Reformat PolicyEngineAPI test cases
[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  * Modifications Copyright (C) 2019 Samsung
8  * ================================================================================
9  * Licensed under the Apache License, Version 2.0 (the "License");
10  * you may not use this file except in compliance with the License.
11  * You may obtain a copy of the License at
12  *
13  *      http://www.apache.org/licenses/LICENSE-2.0
14  *
15  * Unless required by applicable law or agreed to in writing, software
16  * distributed under the License is distributed on an "AS IS" BASIS,
17  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18  * See the License for the specific language governing permissions and
19  * limitations under the License.
20  * ============LICENSE_END=========================================================
21  */
22
23 package org.onap.policy.test;
24
25 import java.util.Hashtable;
26 import java.util.Map;
27 import java.util.UUID;
28 import org.junit.*;
29 import org.onap.policy.api.ConfigRequestParameters;
30 import static org.junit.Assert.*;
31
32 /**
33  * The class <code>ConfigRequestParametersTest</code> contains tests for the class
34  * <code>{@link ConfigRequestParameters}</code>.
35  *
36  * @generatedBy CodePro at 6/1/16 1:40 PM
37  * @version $Revision: 1.0 $
38  */
39 public class ConfigRequestParametersTest {
40     /**
41      * Run the ConfigRequestParameters() constructor test.
42      *
43      * @throws Exception
44      *
45      * @generatedBy CodePro at 6/1/16 1:40 PM
46      */
47     @Test
48     public void testConfigRequestParameters_1() 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)
64      * constructor test.
65      *
66      * @throws Exception
67      *
68      * @generatedBy CodePro at 6/1/16 1:40 PM
69      */
70     @Test
71     public void testConfigRequestParameters_2() 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,
80                 configName, configAttributes, unique, requestID);
81
82         // add additional test code here
83         assertNotNull(result);
84         assertEquals("", result.getPolicyName());
85         assertEquals("", result.getConfigName());
86         assertEquals("", result.getOnapName());
87         assertEquals(Boolean.TRUE, result.getUnique());
88     }
89
90     /**
91      * Run the Map<String, String> getConfigAttributes() method test.
92      *
93      * @throws Exception
94      *
95      * @generatedBy CodePro at 6/1/16 1:40 PM
96      */
97     @Test
98     public void testGetConfigAttributes_1() throws Exception {
99         ConfigRequestParameters fixture = createConfigRequest("", "", "",
100                 new Hashtable<String, String>(), new Boolean(true), UUID.randomUUID());
101
102         Map<String, String> result = fixture.getConfigAttributes();
103
104         // add additional test code here
105         assertNotNull(result);
106         assertEquals(0, result.size());
107     }
108
109     /**
110      * Run the String getConfigName() method test.
111      *
112      * @throws Exception
113      *
114      * @generatedBy CodePro at 6/1/16 1:40 PM
115      */
116     @Test
117     public void testGetConfigName_1() throws Exception {
118         ConfigRequestParameters fixture = createConfigRequest("", "", "",
119                 new Hashtable<String, String>(), new Boolean(true), UUID.randomUUID());
120
121         String result = fixture.getConfigName();
122
123         // add additional test code here
124         assertEquals("", result);
125     }
126
127     /**
128      * Run the String getOnapName() method test.
129      *
130      * @throws Exception
131      *
132      * @generatedBy CodePro at 6/1/16 1:40 PM
133      */
134     @Test
135     public void testGetOnapName_1() throws Exception {
136         ConfigRequestParameters fixture = createConfigRequest("", "", "",
137                 new Hashtable<String, String>(), new Boolean(true), UUID.randomUUID());
138
139         String result = fixture.getOnapName();
140
141         // add additional test code here
142         assertEquals("", result);
143     }
144
145     /**
146      * Run the String getPolicyName() method test.
147      *
148      * @throws Exception
149      *
150      * @generatedBy CodePro at 6/1/16 1:40 PM
151      */
152     @Test
153     public void testGetPolicyName_1() throws Exception {
154         ConfigRequestParameters fixture = createConfigRequest("", "", "",
155                 new Hashtable<String, String>(), new Boolean(true), UUID.randomUUID());
156
157         String result = fixture.getPolicyName();
158
159         // add additional test code here
160         assertEquals("", result);
161     }
162
163     /**
164      * Run the UUID getRequestID() method test.
165      *
166      * @throws Exception
167      *
168      * @generatedBy CodePro at 6/1/16 1:40 PM
169      */
170     @Test
171     public void testGetRequestID_1() throws Exception {
172         ConfigRequestParameters fixture =
173                 createConfigRequest("", "", "", new Hashtable<String, String>(), new Boolean(true),
174                         UUID.fromString("6b5aa070-90bc-46a6-9a59-e1fe526df7ae"));
175
176         UUID result = fixture.getRequestID();
177
178         // add additional test code here
179         assertNotNull(result);
180         assertEquals("6b5aa070-90bc-46a6-9a59-e1fe526df7ae", result.toString());
181         assertEquals(4, result.version());
182         assertEquals(2, result.variant());
183         assertEquals(-7324574836520519762L, result.getLeastSignificantBits());
184         assertEquals(7735671715287287462L, result.getMostSignificantBits());
185     }
186
187     /**
188      * Run the Boolean getUnique() method test.
189      *
190      * @throws Exception
191      *
192      * @generatedBy CodePro at 6/1/16 1:40 PM
193      */
194     @Test
195     public void testGetUnique_1() throws Exception {
196         ConfigRequestParameters fixture = createConfigRequest("", "", "",
197                 new Hashtable<String, String>(), new Boolean(true), UUID.randomUUID());
198
199         Boolean result = fixture.getUnique();
200
201         // add additional test code here
202         assertNotNull(result);
203         assertEquals("true", result.toString());
204         assertEquals(true, result.booleanValue());
205     }
206
207     /**
208      * Run the void makeUnique(Boolean) method test.
209      *
210      * @throws Exception
211      *
212      * @generatedBy CodePro at 6/1/16 1:40 PM
213      */
214     @Test
215     public void testMakeUnique_1() throws Exception {
216         ConfigRequestParameters fixture = createConfigRequest("", "", "",
217                 new Hashtable<String, String>(), new Boolean(true), UUID.randomUUID());
218         Boolean unique = new Boolean(true);
219
220         fixture.makeUnique(unique);
221
222         // add additional test code here
223     }
224
225     /**
226      * Run the void setConfigAttributes(Map<String,String>) method test.
227      *
228      * @throws Exception
229      *
230      * @generatedBy CodePro at 6/1/16 1:40 PM
231      */
232     @Test
233     public void testSetConfigAttributes_1() throws Exception {
234         ConfigRequestParameters fixture = createConfigRequest("", "", "",
235                 new Hashtable<String, String>(), new Boolean(true), UUID.randomUUID());
236         Map<String, String> configAttributes = new Hashtable<String, String>();
237
238         fixture.setConfigAttributes(configAttributes);
239
240         // add additional test code here
241     }
242
243     /**
244      * Run the void setConfigName(String) method test.
245      *
246      * @throws Exception
247      *
248      * @generatedBy CodePro at 6/1/16 1:40 PM
249      */
250     @Test
251     public void testSetConfigName_1() throws Exception {
252         ConfigRequestParameters fixture = createConfigRequest("", "", "",
253                 new Hashtable<String, String>(), new Boolean(true), UUID.randomUUID());
254         String configName = "";
255
256         fixture.setConfigName(configName);
257
258         // add additional test code here
259     }
260
261     /**
262      * Run the void setOnapName(String) method test.
263      *
264      * @throws Exception
265      *
266      * @generatedBy CodePro at 6/1/16 1:40 PM
267      */
268     @Test
269     public void testSetOnapName_1() throws Exception {
270         ConfigRequestParameters fixture = createConfigRequest("", "", "",
271                 new Hashtable<String, String>(), new Boolean(true), UUID.randomUUID());
272         String onapComponentName = "";
273
274         fixture.setOnapName(onapComponentName);
275
276         // add additional test code here
277     }
278
279     /**
280      * Run the void setPolicyName(String) method test.
281      *
282      * @throws Exception
283      *
284      * @generatedBy CodePro at 6/1/16 1:40 PM
285      */
286     @Test
287     public void testSetPolicyName_1() throws Exception {
288         ConfigRequestParameters fixture = createConfigRequest("", "", "",
289                 new Hashtable<String, String>(), new Boolean(true), UUID.randomUUID());
290         String policyName = "";
291
292         fixture.setPolicyName(policyName);
293
294         // add additional test code here
295     }
296
297     /**
298      * Run the void setRequestID(UUID) method test.
299      *
300      * @throws Exception
301      *
302      * @generatedBy CodePro at 6/1/16 1:40 PM
303      */
304     @Test
305     public void testSetRequestID_1() throws Exception {
306         ConfigRequestParameters fixture = createConfigRequest("", "", "",
307                 new Hashtable<String, String>(), new Boolean(true), UUID.randomUUID());
308         UUID requestID = UUID.randomUUID();
309
310         fixture.setRequestID(requestID);
311
312         // add additional test code here
313     }
314
315     /**
316      * Perform pre-test initialization.
317      *
318      * @throws Exception if the initialization fails for some reason
319      *
320      * @generatedBy CodePro at 6/1/16 1:40 PM
321      */
322     @Before
323     public void setUp() throws Exception {
324         // add additional set up code here
325     }
326
327     /**
328      * Perform post-test clean-up.
329      *
330      * @throws Exception if the clean-up fails for some reason
331      *
332      * @generatedBy CodePro at 6/1/16 1:40 PM
333      */
334     @After
335     public void tearDown() throws Exception {
336         // Add additional tear down code here
337     }
338
339     /**
340      * Launch the test.
341      *
342      * @param args the command line arguments
343      *
344      * @generatedBy CodePro at 6/1/16 1:40 PM
345      */
346     public static void main(String[] args) {
347         new org.junit.runner.JUnitCore().run(ConfigRequestParametersTest.class);
348     }
349
350     private ConfigRequestParameters createConfigRequest(String policyName, String onapComponentName,
351             String configName, Map<String, String> configAttributes, Boolean unique,
352             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 }