b8ea0c7fea23b0beff391863f12aa3f7968cff84
[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     /* (non-Javadoc)
74      * @see javax.naming.Context#lookup(javax.naming.Name)
75      */
76     @Override
77     public Object lookup(final Name name) throws NamingException {
78         return null;
79     }
80
81     /* (non-Javadoc)
82      * @see javax.naming.Context#lookup(java.lang.String)
83      */
84     @Override
85     public Object lookup(final String name) throws NamingException {
86         return testProperties.get(name);
87     }
88
89     /* (non-Javadoc)
90      * @see javax.naming.Context#bind(javax.naming.Name, java.lang.Object)
91      */
92     @Override
93     public void bind(final Name name, final Object obj) throws NamingException {}
94
95     /* (non-Javadoc)
96      * @see javax.naming.Context#bind(java.lang.String, java.lang.Object)
97      */
98     @Override
99     public void bind(final String name, final Object obj) throws NamingException {}
100
101     /* (non-Javadoc)
102      * @see javax.naming.Context#rebind(javax.naming.Name, java.lang.Object)
103      */
104     @Override
105     public void rebind(final Name name, final Object obj) throws NamingException {}
106
107     /* (non-Javadoc)
108      * @see javax.naming.Context#rebind(java.lang.String, java.lang.Object)
109      */
110     @Override
111     public void rebind(final String name, final Object obj) throws NamingException {}
112
113     /* (non-Javadoc)
114      * @see javax.naming.Context#unbind(javax.naming.Name)
115      */
116     @Override
117     public void unbind(final Name name) throws NamingException {}
118
119     /* (non-Javadoc)
120      * @see javax.naming.Context#unbind(java.lang.String)
121      */
122     @Override
123     public void unbind(final String name) throws NamingException {}
124
125     /* (non-Javadoc)
126      * @see javax.naming.Context#rename(javax.naming.Name, javax.naming.Name)
127      */
128     @Override
129     public void rename(final Name oldName, final Name newName) throws NamingException {}
130
131     /* (non-Javadoc)
132      * @see javax.naming.Context#rename(java.lang.String, java.lang.String)
133      */
134     @Override
135     public void rename(final String oldName, final String newName) throws NamingException {}
136
137     /* (non-Javadoc)
138      * @see javax.naming.Context#list(javax.naming.Name)
139      */
140     @Override
141     public NamingEnumeration<NameClassPair> list(final Name name) throws NamingException {
142         return null;
143     }
144
145     /* (non-Javadoc)
146      * @see javax.naming.Context#list(java.lang.String)
147      */
148     @Override
149     public NamingEnumeration<NameClassPair> list(final String name) throws NamingException {
150         return null;
151     }
152
153     /* (non-Javadoc)
154      * @see javax.naming.Context#listBindings(javax.naming.Name)
155      */
156     @Override
157     public NamingEnumeration<Binding> listBindings(final Name name) throws NamingException {
158         return null;
159     }
160
161     /* (non-Javadoc)
162      * @see javax.naming.Context#listBindings(java.lang.String)
163      */
164     @Override
165     public NamingEnumeration<Binding> listBindings(final String name) throws NamingException {
166         return null;
167     }
168
169     /* (non-Javadoc)
170      * @see javax.naming.Context#destroySubcontext(javax.naming.Name)
171      */
172     @Override
173     public void destroySubcontext(final Name name) throws NamingException {}
174
175     /* (non-Javadoc)
176      * @see javax.naming.Context#destroySubcontext(java.lang.String)
177      */
178     @Override
179     public void destroySubcontext(final String name) throws NamingException {}
180
181     /* (non-Javadoc)
182      * @see javax.naming.Context#createSubcontext(javax.naming.Name)
183      */
184     @Override
185     public Context createSubcontext(final Name name) throws NamingException {
186         return null;
187     }
188
189     /* (non-Javadoc)
190      * @see javax.naming.Context#createSubcontext(java.lang.String)
191      */
192     @Override
193     public Context createSubcontext(final String name) throws NamingException {
194         return null;
195     }
196
197     /* (non-Javadoc)
198      * @see javax.naming.Context#lookupLink(javax.naming.Name)
199      */
200     @Override
201     public Object lookupLink(final Name name) throws NamingException {
202         return null;
203     }
204
205     /* (non-Javadoc)
206      * @see javax.naming.Context#lookupLink(java.lang.String)
207      */
208     @Override
209     public Object lookupLink(final String name) throws NamingException {
210         return null;
211     }
212
213     /* (non-Javadoc)
214      * @see javax.naming.Context#getNameParser(javax.naming.Name)
215      */
216     @Override
217     public NameParser getNameParser(final Name name) throws NamingException {
218         return null;
219     }
220
221     /* (non-Javadoc)
222      * @see javax.naming.Context#getNameParser(java.lang.String)
223      */
224     @Override
225     public NameParser getNameParser(final String name) throws NamingException {
226         return null;
227     }
228
229     /* (non-Javadoc)
230      * @see javax.naming.Context#composeName(javax.naming.Name, javax.naming.Name)
231      */
232     @Override
233     public Name composeName(final Name name, final Name prefix) throws NamingException {
234         return null;
235     }
236
237     /* (non-Javadoc)
238      * @see javax.naming.Context#composeName(java.lang.String, java.lang.String)
239      */
240     @Override
241     public String composeName(final String name, final String prefix) throws NamingException {
242         return null;
243     }
244
245     /* (non-Javadoc)
246      * @see javax.naming.Context#addToEnvironment(java.lang.String, java.lang.Object)
247      */
248     @Override
249     public Object addToEnvironment(final String propName, final Object propVal) throws NamingException {
250         return null;
251     }
252
253     /* (non-Javadoc)
254      * @see javax.naming.Context#removeFromEnvironment(java.lang.String)
255      */
256     @Override
257     public Object removeFromEnvironment(final String propName) throws NamingException {
258         return null;
259     }
260
261     /* (non-Javadoc)
262      * @see javax.naming.Context#getEnvironment()
263      */
264     @Override
265     public Hashtable<?, ?> getEnvironment() throws NamingException {
266         return null;
267     }
268
269     /* (non-Javadoc)
270      * @see javax.naming.Context#close()
271      */
272     @Override
273     public void close() throws NamingException {}
274
275     /* (non-Javadoc)
276      * @see javax.naming.Context#getNameInNamespace()
277      */
278     @Override
279     public String getNameInNamespace() throws NamingException {
280         return null;
281     }
282 }