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