91025f5c0f7e375d6ac0133acc4fa0a4fe9b6827
[policy/engine.git] / PolicyEngineAPI / src / test / java / org / onap / policy / test / ConfigRequestParametersTest.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.onap.policy.test;
22
23 import java.util.Hashtable;
24 import java.util.Map;
25 import java.util.UUID;
26
27 import org.junit.*;
28 import org.onap.policy.api.ConfigRequestParameters;
29
30 import static org.junit.Assert.*;
31
32 /**
33  * The class <code>ConfigRequestParametersTest</code> contains tests for the class <code>{@link ConfigRequestParameters}</code>.
34  *
35  * @generatedBy CodePro at 6/1/16 1:40 PM
36  * @version $Revision: 1.0 $
37  */
38 public class ConfigRequestParametersTest {
39         /**
40          * Run the ConfigRequestParameters() constructor test.
41          *
42          * @throws Exception
43          *
44          * @generatedBy CodePro at 6/1/16 1:40 PM
45          */
46         @Test
47         public void testConfigRequestParameters_1()
48                 throws Exception {
49
50                 ConfigRequestParameters result = new ConfigRequestParameters();
51
52                 // add additional test code here
53                 assertNotNull(result);
54                 assertEquals(null, result.getPolicyName());
55                 assertEquals(null, result.getConfigName());
56                 assertEquals(null, result.getConfigAttributes());
57                 assertEquals(null, result.getRequestID());
58                 assertEquals(null, result.getOnapName());
59                 assertEquals(Boolean.FALSE, result.getUnique());
60         }
61
62         /**
63          * Run the ConfigRequestParameters(String,String,String,Map<String,String>,Boolean,UUID) constructor test.
64          *
65          * @throws Exception
66          *
67          * @generatedBy CodePro at 6/1/16 1:40 PM
68          */
69         @Test
70         public void testConfigRequestParameters_2()
71                 throws Exception {
72                 String policyName = "";
73                 String onapComponentName = "";
74                 String configName = "";
75                 Map<String, String> configAttributes = new Hashtable<String, String>();
76                 Boolean unique = new Boolean(true);
77                 UUID requestID = UUID.randomUUID();
78
79                 ConfigRequestParameters result = createConfigRequest(policyName, onapComponentName, configName, configAttributes, unique, requestID);
80
81                 // add additional test code here
82                 assertNotNull(result);
83                 assertEquals("", result.getPolicyName());
84                 assertEquals("", result.getConfigName());
85                 assertEquals("", result.getOnapName());
86                 assertEquals(Boolean.TRUE, result.getUnique());
87         }
88
89         /**
90          * Run the Map<String, String> getConfigAttributes() method test.
91          *
92          * @throws Exception
93          *
94          * @generatedBy CodePro at 6/1/16 1:40 PM
95          */
96         @Test
97         public void testGetConfigAttributes_1()
98                 throws Exception {
99                 ConfigRequestParameters fixture = createConfigRequest("", "", "", new Hashtable<String, String>(), new Boolean(true), UUID.randomUUID());
100
101                 Map<String, String> result = fixture.getConfigAttributes();
102
103                 // add additional test code here
104                 assertNotNull(result);
105                 assertEquals(0, result.size());
106         }
107
108         /**
109          * Run the String getConfigName() method test.
110          *
111          * @throws Exception
112          *
113          * @generatedBy CodePro at 6/1/16 1:40 PM
114          */
115         @Test
116         public void testGetConfigName_1()
117                 throws Exception {
118                 ConfigRequestParameters fixture = createConfigRequest("", "", "", new Hashtable<String, String>(), new Boolean(true), UUID.randomUUID());
119
120                 String result = fixture.getConfigName();
121
122                 // add additional test code here
123                 assertEquals("", result);
124         }
125
126         /**
127          * Run the String getOnapName() method test.
128          *
129          * @throws Exception
130          *
131          * @generatedBy CodePro at 6/1/16 1:40 PM
132          */
133         @Test
134         public void testGetOnapName_1()
135                 throws Exception {
136                 ConfigRequestParameters fixture = createConfigRequest("", "", "", new Hashtable<String, String>(), new Boolean(true), UUID.randomUUID());
137
138                 String result = fixture.getOnapName();
139
140                 // add additional test code here
141                 assertEquals("", result);
142         }
143
144         /**
145          * Run the String getPolicyName() method test.
146          *
147          * @throws Exception
148          *
149          * @generatedBy CodePro at 6/1/16 1:40 PM
150          */
151         @Test
152         public void testGetPolicyName_1()
153                 throws Exception {
154                 ConfigRequestParameters fixture = createConfigRequest("", "", "", new Hashtable<String, String>(), new Boolean(true), UUID.randomUUID());
155
156                 String result = fixture.getPolicyName();
157
158                 // add additional test code here
159                 assertEquals("", result);
160         }
161
162         /**
163          * Run the UUID getRequestID() method test.
164          *
165          * @throws Exception
166          *
167          * @generatedBy CodePro at 6/1/16 1:40 PM
168          */
169         @Test
170         public void testGetRequestID_1()
171                 throws Exception {
172                 ConfigRequestParameters fixture = createConfigRequest("", "", "", new Hashtable<String, String>(), new Boolean(true), UUID.fromString("6b5aa070-90bc-46a6-9a59-e1fe526df7ae"));
173
174                 UUID result = fixture.getRequestID();
175
176                 // add additional test code here
177                 assertNotNull(result);
178                 assertEquals("6b5aa070-90bc-46a6-9a59-e1fe526df7ae", result.toString());
179                 assertEquals(4, result.version());
180                 assertEquals(2, result.variant());
181                 assertEquals(-7324574836520519762L, result.getLeastSignificantBits());
182                 assertEquals(7735671715287287462L, result.getMostSignificantBits());
183         }
184
185         /**
186          * Run the Boolean getUnique() method test.
187          *
188          * @throws Exception
189          *
190          * @generatedBy CodePro at 6/1/16 1:40 PM
191          */
192         @Test
193         public void testGetUnique_1()
194                 throws Exception {
195                 ConfigRequestParameters fixture = createConfigRequest("", "", "", new Hashtable<String, String>(), new Boolean(true), UUID.randomUUID());
196
197                 Boolean result = fixture.getUnique();
198
199                 // add additional test code here
200                 assertNotNull(result);
201                 assertEquals("true", result.toString());
202                 assertEquals(true, result.booleanValue());
203         }
204
205         /**
206          * Run the void makeUnique(Boolean) method test.
207          *
208          * @throws Exception
209          *
210          * @generatedBy CodePro at 6/1/16 1:40 PM
211          */
212         @Test
213         public void testMakeUnique_1()
214                 throws Exception {
215                 ConfigRequestParameters fixture = createConfigRequest("", "", "", new Hashtable<String, String>(), new Boolean(true), UUID.randomUUID());
216                 Boolean unique = new Boolean(true);
217
218                 fixture.makeUnique(unique);
219
220                 // add additional test code here
221         }
222
223         /**
224          * Run the void setConfigAttributes(Map<String,String>) method test.
225          *
226          * @throws Exception
227          *
228          * @generatedBy CodePro at 6/1/16 1:40 PM
229          */
230         @Test
231         public void testSetConfigAttributes_1()
232                 throws Exception {
233                 ConfigRequestParameters fixture = createConfigRequest("", "", "", new Hashtable<String, String>(), new Boolean(true), UUID.randomUUID());
234                 Map<String, String> configAttributes = new Hashtable<String, String>();
235
236                 fixture.setConfigAttributes(configAttributes);
237
238                 // add additional test code here
239         }
240
241         /**
242          * Run the void setConfigName(String) method test.
243          *
244          * @throws Exception
245          *
246          * @generatedBy CodePro at 6/1/16 1:40 PM
247          */
248         @Test
249         public void testSetConfigName_1()
250                 throws Exception {
251                 ConfigRequestParameters fixture = createConfigRequest("", "", "", new Hashtable<String, String>(), new Boolean(true), UUID.randomUUID());
252                 String configName = "";
253
254                 fixture.setConfigName(configName);
255
256                 // add additional test code here
257         }
258
259         /**
260          * Run the void setOnapName(String) method test.
261          *
262          * @throws Exception
263          *
264          * @generatedBy CodePro at 6/1/16 1:40 PM
265          */
266         @Test
267         public void testSetOnapName_1()
268                 throws Exception {
269                 ConfigRequestParameters fixture = createConfigRequest("", "", "", new Hashtable<String, String>(), new Boolean(true), UUID.randomUUID());
270                 String onapComponentName = "";
271
272                 fixture.setOnapName(onapComponentName);
273
274                 // add additional test code here
275         }
276
277         /**
278          * Run the void setPolicyName(String) method test.
279          *
280          * @throws Exception
281          *
282          * @generatedBy CodePro at 6/1/16 1:40 PM
283          */
284         @Test
285         public void testSetPolicyName_1()
286                 throws Exception {
287                 ConfigRequestParameters fixture = createConfigRequest("", "", "", new Hashtable<String, String>(), new Boolean(true), UUID.randomUUID());
288                 String policyName = "";
289
290                 fixture.setPolicyName(policyName);
291
292                 // add additional test code here
293         }
294
295         /**
296          * Run the void setRequestID(UUID) method test.
297          *
298          * @throws Exception
299          *
300          * @generatedBy CodePro at 6/1/16 1:40 PM
301          */
302         @Test
303         public void testSetRequestID_1()
304                 throws Exception {
305                 ConfigRequestParameters fixture = createConfigRequest("", "", "", new Hashtable<String, String>(), new Boolean(true), UUID.randomUUID());
306                 UUID requestID = UUID.randomUUID();
307
308                 fixture.setRequestID(requestID);
309
310                 // add additional test code here
311         }
312
313         /**
314          * Perform pre-test initialization.
315          *
316          * @throws Exception
317          *         if the initialization fails for some reason
318          *
319          * @generatedBy CodePro at 6/1/16 1:40 PM
320          */
321         @Before
322         public void setUp()
323                 throws Exception {
324                 // add additional set up code here
325         }
326
327         /**
328          * Perform post-test clean-up.
329          *
330          * @throws Exception
331          *         if the clean-up fails for some reason
332          *
333          * @generatedBy CodePro at 6/1/16 1:40 PM
334          */
335         @After
336         public void tearDown()
337                 throws Exception {
338                 // Add additional tear down code here
339         }
340
341         /**
342          * Launch the test.
343          *
344          * @param args the command line arguments
345          *
346          * @generatedBy CodePro at 6/1/16 1:40 PM
347          */
348         public static void main(String[] args) {
349                 new org.junit.runner.JUnitCore().run(ConfigRequestParametersTest.class);
350         }
351         
352         private ConfigRequestParameters createConfigRequest(String policyName, String onapComponentName, String configName, Map<String,String> configAttributes, Boolean unique, UUID requestID){
353                 ConfigRequestParameters configRequestParameters = new ConfigRequestParameters();
354                 configRequestParameters.setRequestID(requestID);
355                 configRequestParameters.setPolicyName(policyName);
356                 configRequestParameters.setOnapName(onapComponentName);
357                 configRequestParameters.setConfigName(configName);
358                 configRequestParameters.setConfigAttributes(configAttributes);
359                 configRequestParameters.makeUnique(unique);
360                 return configRequestParameters;
361         }
362 }