b547cc4820aab52aa7961a3a80132e31723b5039
[policy/apex-pdp.git] / testsuites / integration / integration-uservice-test / src / test / java / org / onap / policy / apex / testsuites / integration / uservice / adapt / jms / TestContext.java
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         // Not used here
95     }
96
97     /**
98      * {@inheritDoc}.
99      */
100     @Override
101     public void bind(final String name, final Object obj) throws NamingException {
102         // Not used here
103     }
104
105     /**
106      * {@inheritDoc}.
107      */
108     @Override
109     public void rebind(final Name name, final Object obj) throws NamingException {
110         // Not used here
111     }
112
113     /**
114      * {@inheritDoc}.
115      */
116     @Override
117     public void rebind(final String name, final Object obj) throws NamingException {
118         // Not used here
119     }
120
121     /**
122      * {@inheritDoc}.
123      */
124     @Override
125     public void unbind(final Name name) throws NamingException {
126         // Not used here
127     }
128
129     /**
130      * {@inheritDoc}.
131      */
132     @Override
133     public void unbind(final String name) throws NamingException {
134         // Not used here
135     }
136
137     /**
138      * {@inheritDoc}.
139      */
140     @Override
141     public void rename(final Name oldName, final Name newName) throws NamingException {
142         // Not used here
143     }
144
145     /**
146      * {@inheritDoc}.
147      */
148     @Override
149     public void rename(final String oldName, final String newName) throws NamingException {
150         // Not used here
151     }
152
153     /**
154      * {@inheritDoc}.
155      */
156     @Override
157     public NamingEnumeration<NameClassPair> list(final Name name) throws NamingException {
158         return null;
159     }
160
161     /**
162      * {@inheritDoc}.
163      */
164     @Override
165     public NamingEnumeration<NameClassPair> list(final String name) throws NamingException {
166         return null;
167     }
168
169     /**
170      * {@inheritDoc}.
171      */
172     @Override
173     public NamingEnumeration<Binding> listBindings(final Name name) throws NamingException {
174         return null;
175     }
176
177     /**
178      * {@inheritDoc}.
179      */
180     @Override
181     public NamingEnumeration<Binding> listBindings(final String name) throws NamingException {
182         return null;
183     }
184
185     /**
186      * {@inheritDoc}.
187      */
188     @Override
189     public void destroySubcontext(final Name name) throws NamingException {
190         // Not used here
191     }
192
193     /**
194      * {@inheritDoc}.
195      */
196     @Override
197     public void destroySubcontext(final String name) throws NamingException {
198         // Not used here
199     }
200
201     /**
202      * {@inheritDoc}.
203      */
204     @Override
205     public Context createSubcontext(final Name name) throws NamingException {
206         return null;
207     }
208
209     /**
210      * {@inheritDoc}.
211      */
212     @Override
213     public Context createSubcontext(final String name) throws NamingException {
214         return null;
215     }
216
217     /**
218      * {@inheritDoc}.
219      */
220     @Override
221     public Object lookupLink(final Name name) throws NamingException {
222         return null;
223     }
224
225     /**
226      * {@inheritDoc}.
227      */
228     @Override
229     public Object lookupLink(final String name) throws NamingException {
230         return null;
231     }
232
233     /**
234      * {@inheritDoc}.
235      */
236     @Override
237     public NameParser getNameParser(final Name name) throws NamingException {
238         return null;
239     }
240
241     /**
242      * {@inheritDoc}.
243      */
244     @Override
245     public NameParser getNameParser(final String name) throws NamingException {
246         return null;
247     }
248
249     /**
250      * {@inheritDoc}.
251      */
252     @Override
253     public Name composeName(final Name name, final Name prefix) throws NamingException {
254         return null;
255     }
256
257     /**
258      * {@inheritDoc}.
259      */
260     @Override
261     public String composeName(final String name, final String prefix) throws NamingException {
262         return null;
263     }
264
265     /**
266      * {@inheritDoc}.
267      */
268     @Override
269     public Object addToEnvironment(final String propName, final Object propVal) throws NamingException {
270         return null;
271     }
272
273     /**
274      * {@inheritDoc}.
275      */
276     @Override
277     public Object removeFromEnvironment(final String propName) throws NamingException {
278         return null;
279     }
280
281     /**
282      * {@inheritDoc}.
283      */
284     @Override
285     public Hashtable<?, ?> getEnvironment() throws NamingException {
286         return null;
287     }
288
289     /**
290      * {@inheritDoc}.
291      */
292     @Override
293     public void close() throws NamingException {
294         // Not used here
295     }
296
297     /**
298      * {@inheritDoc}.
299      */
300     @Override
301     public String getNameInNamespace() throws NamingException {
302         return null;
303     }
304 }