a44f84444a8099f855cba60864401cdcbfca1c07
[policy/apex-pdp.git] /
1 /*-
2  * ============LICENSE_START=======================================================
3  *  Copyright (C) 2016-2018 Ericsson. All rights reserved.
4  * ================================================================================
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  *      http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  * SPDX-License-Identifier: Apache-2.0
18  * ============LICENSE_END=========================================================
19  */
20
21 package org.onap.policy.apex.testsuites.integration.uservice.adapt.jms;
22
23 import static org.onap.policy.apex.testsuites.integration.uservice.adapt.jms.TestJms2Jms.HOST;
24 import static org.onap.policy.apex.testsuites.integration.uservice.adapt.jms.TestJms2Jms.JMS_TOPIC_APEX_IN;
25 import static org.onap.policy.apex.testsuites.integration.uservice.adapt.jms.TestJms2Jms.JMS_TOPIC_APEX_OUT;
26 import static org.onap.policy.apex.testsuites.integration.uservice.adapt.jms.TestJms2Jms.PORT;
27 import static org.onap.policy.apex.testsuites.integration.uservice.adapt.jms.TestJms2Jms.connectionFactory;
28
29 import java.util.HashMap;
30 import java.util.Hashtable;
31 import java.util.Map;
32 import java.util.Properties;
33
34 import javax.naming.Binding;
35 import javax.naming.Context;
36 import javax.naming.Name;
37 import javax.naming.NameClassPair;
38 import javax.naming.NameParser;
39 import javax.naming.NamingEnumeration;
40 import javax.naming.NamingException;
41
42 import org.apache.activemq.command.ActiveMQTopic;
43 import org.onap.policy.apex.model.basicmodel.concepts.ApexRuntimeException;
44
45 /**
46  * The Class TestContext.
47  *
48  * @author Liam Fallon (liam.fallon@ericsson.com)
49  */
50 public class TestContext implements Context {
51
52     private Properties testProperties;
53
54     /**
55      * Instantiates a new test context.
56      */
57     public TestContext() {
58         try {
59             testProperties = new Properties();
60
61             final Map<String, Object> params = new HashMap<String, Object>();
62             params.put("host", HOST);
63             params.put("port", PORT);
64             testProperties.put("ConnectionFactory", connectionFactory);
65             testProperties.put(JMS_TOPIC_APEX_IN, new ActiveMQTopic(JMS_TOPIC_APEX_IN));
66             testProperties.put(JMS_TOPIC_APEX_OUT, new ActiveMQTopic(JMS_TOPIC_APEX_OUT));
67         } catch (final Exception e) {
68             e.printStackTrace();
69             throw new ApexRuntimeException("Context initiation failed", e);
70         }
71     }
72
73     /**
74      * {@inheritDoc}.
75      */
76     @Override
77     public Object lookup(final Name name) throws NamingException {
78         return null;
79     }
80
81     /**
82      * {@inheritDoc}.
83      */
84     @Override
85     public Object lookup(final String name) throws NamingException {
86         return testProperties.get(name);
87     }
88
89     /**
90      * {@inheritDoc}.
91      */
92     @Override
93     public void bind(final Name name, final Object obj) throws NamingException {}
94
95     /**
96      * {@inheritDoc}.
97      */
98     @Override
99     public void bind(final String name, final Object obj) throws NamingException {}
100
101     /**
102      * {@inheritDoc}.
103      */
104     @Override
105     public void rebind(final Name name, final Object obj) throws NamingException {}
106
107     /**
108      * {@inheritDoc}.
109      */
110     @Override
111     public void rebind(final String name, final Object obj) throws NamingException {}
112
113     /**
114      * {@inheritDoc}.
115      */
116     @Override
117     public void unbind(final Name name) throws NamingException {}
118
119     /**
120      * {@inheritDoc}.
121      */
122     @Override
123     public void unbind(final String name) throws NamingException {}
124
125     /**
126      * {@inheritDoc}.
127      */
128     @Override
129     public void rename(final Name oldName, final Name newName) throws NamingException {}
130
131     /**
132      * {@inheritDoc}.
133      */
134     @Override
135     public void rename(final String oldName, final String newName) throws NamingException {}
136
137     /**
138      * {@inheritDoc}.
139      */
140     @Override
141     public NamingEnumeration<NameClassPair> list(final Name name) throws NamingException {
142         return null;
143     }
144
145     /**
146      * {@inheritDoc}.
147      */
148     @Override
149     public NamingEnumeration<NameClassPair> list(final String name) throws NamingException {
150         return null;
151     }
152
153     /**
154      * {@inheritDoc}.
155      */
156     @Override
157     public NamingEnumeration<Binding> listBindings(final Name name) throws NamingException {
158         return null;
159     }
160
161     /**
162      * {@inheritDoc}.
163      */
164     @Override
165     public NamingEnumeration<Binding> listBindings(final String name) throws NamingException {
166         return null;
167     }
168
169     /**
170      * {@inheritDoc}.
171      */
172     @Override
173     public void destroySubcontext(final Name name) throws NamingException {}
174
175     /**
176      * {@inheritDoc}.
177      */
178     @Override
179     public void destroySubcontext(final String name) throws NamingException {}
180
181     /**
182      * {@inheritDoc}.
183      */
184     @Override
185     public Context createSubcontext(final Name name) throws NamingException {
186         return null;
187     }
188
189     /**
190      * {@inheritDoc}.
191      */
192     @Override
193     public Context createSubcontext(final String name) throws NamingException {
194         return null;
195     }
196
197     /**
198      * {@inheritDoc}.
199      */
200     @Override
201     public Object lookupLink(final Name name) throws NamingException {
202         return null;
203     }
204
205     /**
206      * {@inheritDoc}.
207      */
208     @Override
209     public Object lookupLink(final String name) throws NamingException {
210         return null;
211     }
212
213     /**
214      * {@inheritDoc}.
215      */
216     @Override
217     public NameParser getNameParser(final Name name) throws NamingException {
218         return null;
219     }
220
221     /**
222      * {@inheritDoc}.
223      */
224     @Override
225     public NameParser getNameParser(final String name) throws NamingException {
226         return null;
227     }
228
229     /**
230      * {@inheritDoc}.
231      */
232     @Override
233     public Name composeName(final Name name, final Name prefix) throws NamingException {
234         return null;
235     }
236
237     /**
238      * {@inheritDoc}.
239      */
240     @Override
241     public String composeName(final String name, final String prefix) throws NamingException {
242         return null;
243     }
244
245     /**
246      * {@inheritDoc}.
247      */
248     @Override
249     public Object addToEnvironment(final String propName, final Object propVal) throws NamingException {
250         return null;
251     }
252
253     /**
254      * {@inheritDoc}.
255      */
256     @Override
257     public Object removeFromEnvironment(final String propName) throws NamingException {
258         return null;
259     }
260
261     /**
262      * {@inheritDoc}.
263      */
264     @Override
265     public Hashtable<?, ?> getEnvironment() throws NamingException {
266         return null;
267     }
268
269     /**
270      * {@inheritDoc}.
271      */
272     @Override
273     public void close() throws NamingException {}
274
275     /**
276      * {@inheritDoc}.
277      */
278     @Override
279     public String getNameInNamespace() throws NamingException {
280         return null;
281     }
282 }