Initial OpenECOMP policy/engine commit
[policy/engine.git] / PolicyEngineAPI / src / test / java / org / openecomp / policy / std / test / AutoClientEndTest.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * PolicyEngineAPI
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
10  * 
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  * 
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=========================================================
19  */
20
21 package org.openecomp.policy.std.test;
22
23 import javax.websocket.Session;
24
25 import org.junit.*;
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;
31
32 import static org.junit.Assert.*;
33
34 /**
35  * The class <code>AutoClientEndTest</code> contains tests for the class <code>{@link AutoClientEnd}</code>.
36  *
37  * @generatedBy CodePro at 6/1/16 1:40 PM
38  * @version $Revision: 1.0 $
39  */
40 public class AutoClientEndTest {
41         /**
42          * Run the AutoClientEnd() constructor test.
43          *
44          * @generatedBy CodePro at 6/1/16 1:40 PM
45          */
46         @Test
47         public void testAutoClientEnd_1()
48                 throws Exception {
49                 AutoClientEnd result = new AutoClientEnd();
50                 assertNotNull(result);
51                 // add additional test code here
52         }
53
54         /**
55          * Run the boolean getStatus() method test.
56          *
57          * @throws Exception
58          *
59          * @generatedBy CodePro at 6/1/16 1:40 PM
60          */
61         @Test
62         public void testGetStatus_1()
63                 throws Exception {
64
65                 boolean result = AutoClientEnd.getStatus();
66
67                 assertNotNull(result);
68         }
69
70         /**
71          * Run the String getURL() method test.
72          *
73          * @throws Exception
74          *
75          * @generatedBy CodePro at 6/1/16 1:40 PM
76          */
77         @Test
78         public void testGetURL_1()
79                 throws Exception {
80
81                 String result = AutoClientEnd.getURL();
82
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);
87         }
88
89         /**
90          * Run the void onClose(Session) method test.
91          *
92          * @throws Exception
93          *
94          * @generatedBy CodePro at 6/1/16 1:40 PM
95          */
96         @Test
97         public void testOnClose()
98                 throws Exception {
99                 AutoClientEnd fixture = new AutoClientEnd();
100                 Session mockSession = Mockito.mock(Session.class);
101                 fixture.onClose(mockSession);
102
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
106         }
107
108
109         /**
110          * Run the void onError(Session,Throwable) method test.
111          *
112          * @throws Exception
113          *
114          * @generatedBy CodePro at 6/1/16 1:40 PM
115          */
116         @Test
117         public void testOnError()
118                 throws Exception {
119                 AutoClientEnd fixture = new AutoClientEnd();
120                 Session mockSession = Mockito.mock(Session.class);
121                 Throwable e = new Throwable();
122
123                 fixture.onError(mockSession, e);
124
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
128         }
129
130         /**
131          * Run the void onMessage(String,Session) method test.
132          *
133          * @throws Exception
134          *
135          * @generatedBy CodePro at 6/1/16 1:40 PM
136          */
137         @Test
138         public void testOnMessage()
139                 throws Exception {
140                 AutoClientEnd fixture = new AutoClientEnd();
141                 Session mockSession = Mockito.mock(Session.class);
142                 String message = "";
143                 //Session session = null;
144
145                 fixture.onMessage(message, mockSession);
146
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
150         }
151
152
153         /**
154          * Run the void onOpen(Session) method test.
155          *
156          * @throws Exception
157          *
158          * @generatedBy CodePro at 6/1/16 1:40 PM
159          */
160         @Test
161         public void testOnOpen()
162                 throws Exception {
163                 AutoClientEnd fixture = new AutoClientEnd();
164                 Session mockSession = Mockito.mock(Session.class);
165
166                 fixture.onOpen(mockSession);
167
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
171         }
172
173         /**
174          * Run the void setAuto(NotificationScheme,NotificationHandler) method test.
175          *
176          * @throws Exception
177          *
178          * @generatedBy CodePro at 6/1/16 1:40 PM
179          */
180         @Test
181         public void testSetAuto()
182                 throws Exception {
183                 NotificationScheme scheme = NotificationScheme.AUTO_ALL_NOTIFICATIONS;
184                 NotificationHandler handler = null;
185
186                 AutoClientEnd.setAuto(scheme, handler);
187
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)
193         }
194
195         /**
196          * Run the void setScheme(NotificationScheme) method test.
197          *
198          * @throws Exception
199          *
200          * @generatedBy CodePro at 6/1/16 1:40 PM
201          */
202         @Test
203         public void testSetScheme()
204                 throws Exception {
205                 
206                 NotificationScheme scheme = NotificationScheme.AUTO_ALL_NOTIFICATIONS;
207                 AutoClientEnd.setScheme(scheme);
208
209         }
210
211         /**
212          * Run the void start(String) method test.
213          *
214          * @throws Exception
215          *
216          * @generatedBy CodePro at 6/1/16 1:40 PM
217          */
218         @Test
219         public void testStart()
220                 throws Exception {
221                 String url = "http://test.com";
222
223                 AutoClientEnd.start(url);
224
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
228         }
229
230
231         /**
232          * Run the void start(String) method test.
233          *
234          * @throws Exception
235          *
236          * @generatedBy CodePro at 6/1/16 1:40 PM
237          */
238         @Test
239         public void testStart_2()
240                 throws Exception {
241                 String url = null;
242
243                 AutoClientEnd.start(url);
244
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
248         }
249
250         /**
251          * Run the void stop() method test.
252          *
253          * @throws Exception
254          *
255          * @generatedBy CodePro at 6/1/16 1:40 PM
256          */
257         @Test
258         public void testStop_1()
259                 throws Exception {
260
261                 AutoClientEnd.stop();
262
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
266         }
267
268         /**
269          * Perform pre-test initialization.
270          *
271          * @throws Exception
272          *         if the initialization fails for some reason
273          *
274          * @generatedBy CodePro at 6/1/16 1:40 PM
275          */
276         @Before
277         public void setUp()
278                 throws Exception {
279                 // add set up code here
280                 StdPolicyEngine policyEngine = new StdPolicyEngine("Test/config_pass.properties");
281                 
282                 NotificationHandler handler = policyEngine.getNotificationHandler();
283                 AutoClientEnd.setAuto(NotificationScheme.AUTO_ALL_NOTIFICATIONS, handler);
284                 AutoClientEnd.start("http://testurl.com");
285                 
286         }
287
288         /**
289          * Perform post-test clean-up.
290          *
291          * @throws Exception
292          *         if the clean-up fails for some reason
293          *
294          * @generatedBy CodePro at 6/1/16 1:40 PM
295          */
296         @After
297         public void tearDown()
298                 throws Exception {
299                 // Add additional tear down code here
300         }
301
302         /**
303          * Launch the test.
304          *
305          * @param args the command line arguments
306          *
307          * @generatedBy CodePro at 6/1/16 1:40 PM
308          */
309         public static void main(String[] args) {
310                 new org.junit.runner.JUnitCore().run(AutoClientEndTest.class);
311         }
312 }