2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END=========================================================
21 package org.openecomp.policy.std.test;
23 import javax.websocket.Session;
26 import org.mockito.Mockito;
27 import org.openecomp.policy.api.NotificationHandler;
28 import org.openecomp.policy.api.NotificationScheme;
29 import org.openecomp.policy.std.AutoClientEnd;
30 import org.openecomp.policy.std.StdPolicyEngine;
32 import static org.junit.Assert.*;
35 * The class <code>AutoClientEndTest</code> contains tests for the class <code>{@link AutoClientEnd}</code>.
37 * @generatedBy CodePro at 6/1/16 1:40 PM
38 * @version $Revision: 1.0 $
40 public class AutoClientEndTest {
42 * Run the AutoClientEnd() constructor test.
44 * @generatedBy CodePro at 6/1/16 1:40 PM
47 public void testAutoClientEnd_1()
49 AutoClientEnd result = new AutoClientEnd();
50 assertNotNull(result);
51 // add additional test code here
55 * Run the boolean getStatus() method test.
59 * @generatedBy CodePro at 6/1/16 1:40 PM
62 public void testGetStatus_1()
65 boolean result = AutoClientEnd.getStatus();
67 assertNotNull(result);
71 * Run the String getURL() method test.
75 * @generatedBy CodePro at 6/1/16 1:40 PM
78 public void testGetURL_1()
81 String result = AutoClientEnd.getURL();
83 // add additional test code here
84 // An unexpected exception was thrown in user code while executing this test:
85 // java.lang.NoClassDefFoundError: Could not initialize class org.openecomp.policy.std.AutoClientEnd
86 assertNotNull(result);
90 * Run the void onClose(Session) method test.
94 * @generatedBy CodePro at 6/1/16 1:40 PM
97 public void testOnClose()
99 AutoClientEnd fixture = new AutoClientEnd();
100 Session mockSession = Mockito.mock(Session.class);
101 fixture.onClose(mockSession);
103 // add additional test code here
104 // An unexpected exception was thrown in user code while executing this test:
105 // java.lang.NoClassDefFoundError: Could not initialize class org.openecomp.policy.std.AutoClientEnd
110 * Run the void onError(Session,Throwable) method test.
114 * @generatedBy CodePro at 6/1/16 1:40 PM
117 public void testOnError()
119 AutoClientEnd fixture = new AutoClientEnd();
120 Session mockSession = Mockito.mock(Session.class);
121 Throwable e = new Throwable();
123 fixture.onError(mockSession, e);
125 // add additional test code here
126 // An unexpected exception was thrown in user code while executing this test:
127 // java.lang.NoClassDefFoundError: Could not initialize class org.openecomp.policy.std.AutoClientEnd
131 * Run the void onMessage(String,Session) method test.
135 * @generatedBy CodePro at 6/1/16 1:40 PM
138 public void testOnMessage()
140 AutoClientEnd fixture = new AutoClientEnd();
141 Session mockSession = Mockito.mock(Session.class);
143 //Session session = null;
145 fixture.onMessage(message, mockSession);
147 // add additional test code here
148 // An unexpected exception was thrown in user code while executing this test:
149 // java.lang.NoClassDefFoundError: Could not initialize class org.openecomp.policy.std.AutoClientEnd
154 * Run the void onOpen(Session) method test.
158 * @generatedBy CodePro at 6/1/16 1:40 PM
161 public void testOnOpen()
163 AutoClientEnd fixture = new AutoClientEnd();
164 Session mockSession = Mockito.mock(Session.class);
166 fixture.onOpen(mockSession);
168 // add additional test code here
169 // An unexpected exception was thrown in user code while executing this test:
170 // java.lang.NoClassDefFoundError: Could not initialize class org.openecomp.policy.std.AutoClientEnd
174 * Run the void setAuto(NotificationScheme,NotificationHandler) method test.
178 * @generatedBy CodePro at 6/1/16 1:40 PM
181 public void testSetAuto()
183 NotificationScheme scheme = NotificationScheme.AUTO_ALL_NOTIFICATIONS;
184 NotificationHandler handler = null;
186 AutoClientEnd.setAuto(scheme, handler);
188 // add additional test code here
189 // An unexpected exception was thrown in user code while executing this test:
190 // java.lang.ExceptionInInitializerError
191 // at org.apache.log4j.Logger.getLogger(Logger.java:104)
192 // at org.openecomp.policy.std.AutoClientEnd.<clinit>(AutoClientEnd.java:39)
196 * Run the void setScheme(NotificationScheme) method test.
200 * @generatedBy CodePro at 6/1/16 1:40 PM
203 public void testSetScheme()
206 NotificationScheme scheme = NotificationScheme.AUTO_ALL_NOTIFICATIONS;
207 AutoClientEnd.setScheme(scheme);
212 * Run the void start(String) method test.
216 * @generatedBy CodePro at 6/1/16 1:40 PM
219 public void testStart()
221 String url = "http://test.com";
223 AutoClientEnd.start(url);
225 // add additional test code here
226 // An unexpected exception was thrown in user code while executing this test:
227 // java.lang.NoClassDefFoundError: Could not initialize class org.openecomp.policy.std.AutoClientEnd
232 * Run the void start(String) method test.
236 * @generatedBy CodePro at 6/1/16 1:40 PM
239 public void testStart_2()
243 AutoClientEnd.start(url);
245 // add additional test code here
246 // An unexpected exception was thrown in user code while executing this test:
247 // java.lang.NoClassDefFoundError: Could not initialize class org.openecomp.policy.std.AutoClientEnd
251 * Run the void stop() method test.
255 * @generatedBy CodePro at 6/1/16 1:40 PM
258 public void testStop_1()
261 AutoClientEnd.stop();
263 // add additional test code here
264 // An unexpected exception was thrown in user code while executing this test:
265 // java.lang.NoClassDefFoundError: Could not initialize class org.openecomp.policy.std.AutoClientEnd
269 * Perform pre-test initialization.
272 * if the initialization fails for some reason
274 * @generatedBy CodePro at 6/1/16 1:40 PM
279 // add set up code here
280 StdPolicyEngine policyEngine = new StdPolicyEngine("Test/config_pass.properties");
282 NotificationHandler handler = policyEngine.getNotificationHandler();
283 AutoClientEnd.setAuto(NotificationScheme.AUTO_ALL_NOTIFICATIONS, handler);
284 AutoClientEnd.start("http://testurl.com");
289 * Perform post-test clean-up.
292 * if the clean-up fails for some reason
294 * @generatedBy CodePro at 6/1/16 1:40 PM
297 public void tearDown()
299 // Add additional tear down code here
305 * @param args the command line arguments
307 * @generatedBy CodePro at 6/1/16 1:40 PM
309 public static void main(String[] args) {
310 new org.junit.runner.JUnitCore().run(AutoClientEndTest.class);