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