de3c8d37b8ea17aee8efda5824c0165ac4ce64b7
[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.apps.uservice.test.adapt.jms;
22
23 import static org.onap.policy.apex.apps.uservice.test.adapt.jms.TestJMS2JMS.HOST;
24 import static org.onap.policy.apex.apps.uservice.test.adapt.jms.TestJMS2JMS.JMS_TOPIC_APEX_IN;
25 import static org.onap.policy.apex.apps.uservice.test.adapt.jms.TestJMS2JMS.JMS_TOPIC_APEX_OUT;
26 import static org.onap.policy.apex.apps.uservice.test.adapt.jms.TestJMS2JMS.PORT;
27 import static org.onap.policy.apex.apps.uservice.test.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  * @author Liam Fallon (liam.fallon@ericsson.com)
47  */
48 public class TestContext implements Context {
49
50     private Properties testProperties;
51
52     public TestContext() {
53         try {
54             testProperties = new Properties();
55
56             final Map<String, Object> params = new HashMap<String, Object>();
57             params.put("host", HOST);
58             params.put("port", PORT);
59             testProperties.put("ConnectionFactory", connectionFactory);
60             testProperties.put(JMS_TOPIC_APEX_IN, new ActiveMQTopic(JMS_TOPIC_APEX_IN));
61             testProperties.put(JMS_TOPIC_APEX_OUT, new ActiveMQTopic(JMS_TOPIC_APEX_OUT));
62         } catch (final Exception e) {
63             e.printStackTrace();
64             throw new ApexRuntimeException("Context initiation failed", e);
65         }
66     }
67
68     @Override
69     public Object lookup(final Name name) throws NamingException {
70         return null;
71     }
72
73     @Override
74     public Object lookup(final String name) throws NamingException {
75         return testProperties.get(name);
76     }
77
78     @Override
79     public void bind(final Name name, final Object obj) throws NamingException {}
80
81     @Override
82     public void bind(final String name, final Object obj) throws NamingException {}
83
84     @Override
85     public void rebind(final Name name, final Object obj) throws NamingException {}
86
87     @Override
88     public void rebind(final String name, final Object obj) throws NamingException {}
89
90     @Override
91     public void unbind(final Name name) throws NamingException {}
92
93     @Override
94     public void unbind(final String name) throws NamingException {}
95
96     @Override
97     public void rename(final Name oldName, final Name newName) throws NamingException {}
98
99     @Override
100     public void rename(final String oldName, final String newName) throws NamingException {}
101
102     @Override
103     public NamingEnumeration<NameClassPair> list(final Name name) throws NamingException {
104         return null;
105     }
106
107     @Override
108     public NamingEnumeration<NameClassPair> list(final String name) throws NamingException {
109         return null;
110     }
111
112     @Override
113     public NamingEnumeration<Binding> listBindings(final Name name) throws NamingException {
114         return null;
115     }
116
117     @Override
118     public NamingEnumeration<Binding> listBindings(final String name) throws NamingException {
119         return null;
120     }
121
122     @Override
123     public void destroySubcontext(final Name name) throws NamingException {}
124
125     @Override
126     public void destroySubcontext(final String name) throws NamingException {}
127
128     @Override
129     public Context createSubcontext(final Name name) throws NamingException {
130         return null;
131     }
132
133     @Override
134     public Context createSubcontext(final String name) throws NamingException {
135         return null;
136     }
137
138     @Override
139     public Object lookupLink(final Name name) throws NamingException {
140         return null;
141     }
142
143     @Override
144     public Object lookupLink(final String name) throws NamingException {
145         return null;
146     }
147
148     @Override
149     public NameParser getNameParser(final Name name) throws NamingException {
150         return null;
151     }
152
153     @Override
154     public NameParser getNameParser(final String name) throws NamingException {
155         return null;
156     }
157
158     @Override
159     public Name composeName(final Name name, final Name prefix) throws NamingException {
160         return null;
161     }
162
163     @Override
164     public String composeName(final String name, final String prefix) throws NamingException {
165         return null;
166     }
167
168     @Override
169     public Object addToEnvironment(final String propName, final Object propVal) throws NamingException {
170         return null;
171     }
172
173     @Override
174     public Object removeFromEnvironment(final String propName) throws NamingException {
175         return null;
176     }
177
178     @Override
179     public Hashtable<?, ?> getEnvironment() throws NamingException {
180         return null;
181     }
182
183     @Override
184     public void close() throws NamingException {}
185
186     @Override
187     public String getNameInNamespace() throws NamingException {
188         return null;
189     }
190
191 }