2e7309633761825b66d4cdd4d04af67b0d547555
[so.git] / asdc-controller / src / test / java / org / openecomp / mso / asdc / util / ASDCNotificationLoggingESTest.java
1 /*
2  * This file was automatically generated by EvoSuite
3  * Mon Mar 13 16:09:00 GMT 2017
4  */
5
6 package org.openecomp.mso.asdc.util;
7
8 import org.junit.Test;
9 import static org.junit.Assert.*;
10 import static org.evosuite.shaded.org.mockito.Mockito.*;
11 import static org.evosuite.runtime.MockitoExtension.*;
12 import static org.evosuite.runtime.EvoAssertions.*;
13 import java.util.Iterator;
14 import java.util.LinkedList;
15 import java.util.List;
16 import java.util.Map;
17 import java.util.function.UnaryOperator;
18 import org.evosuite.runtime.EvoRunner;
19 import org.evosuite.runtime.EvoRunnerParameters;
20 import org.evosuite.runtime.PrivateAccess;
21 import org.evosuite.runtime.ViolatedAssumptionAnswer;
22 import org.junit.runner.RunWith;
23 import org.openecomp.mso.asdc.installer.IVfModuleData;
24 import org.openecomp.mso.asdc.installer.VfModuleMetaData;
25 import org.openecomp.mso.asdc.util.ASDCNotificationLogging;
26 import org.openecomp.sdc.api.notification.IArtifactInfo;
27 import org.openecomp.sdc.api.notification.INotificationData;
28 import org.openecomp.sdc.api.notification.IResourceInstance;
29
30 @RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, useJEE = true)
31 public class ASDCNotificationLoggingESTest extends ASDCNotificationLoggingESTestscaffolding {
32
33     @Test(timeout = 4000)
34     public void test00()  throws Throwable  {
35         LinkedList<IVfModuleData> linkedList0 = new LinkedList<IVfModuleData>();
36         VfModuleMetaData vfModuleMetaData0 = new VfModuleMetaData();
37         vfModuleMetaData0.setAttribute("vfModuleModelInvariantUUID", vfModuleMetaData0);
38         linkedList0.add((IVfModuleData) vfModuleMetaData0);
39         // Undeclared exception!
40         try {
41             ASDCNotificationLogging.dumpVfModuleMetaDataList(linkedList0);
42             fail("Expecting exception: ClassCastException");
43
44         } catch(ClassCastException e) {
45             //
46             // org.openecomp.mso.asdc.installer.VfModuleMetaData cannot be cast to java.lang.String
47             //
48             verifyException("org.openecomp.mso.asdc.installer.VfModuleMetaData", e);
49         }
50     }
51
52     @Test(timeout = 4000)
53     public void test01()  throws Throwable  {
54         List<IArtifactInfo> list0 = (List<IArtifactInfo>) mock(List.class, new ViolatedAssumptionAnswer());
55         doReturn(false).when(list0).isEmpty();
56         doReturn((Iterator) null).when(list0).iterator();
57         doReturn(0).when(list0).size();
58         INotificationData iNotificationData0 = mock(INotificationData.class, new ViolatedAssumptionAnswer());
59         doReturn("rGQA").when(iNotificationData0).getDistributionID();
60         doReturn(list0).when(iNotificationData0).getServiceArtifacts();
61         doReturn("rGQA").when(iNotificationData0).getServiceDescription();
62         doReturn("").when(iNotificationData0).getServiceInvariantUUID();
63         doReturn("").when(iNotificationData0).getServiceName();
64         doReturn("rGQA").when(iNotificationData0).getServiceUUID();
65         doReturn("").when(iNotificationData0).getServiceVersion();
66         // Undeclared exception!
67         try {
68             ASDCNotificationLogging.dumpASDCNotification(iNotificationData0);
69             fail("Expecting exception: NullPointerException");
70
71         } catch(NullPointerException e) {
72             //
73             // no message in exception (getMessage() returned null)
74             //
75             verifyException("org.openecomp.mso.asdc.util.ASDCNotificationLogging", e);
76         }
77     }
78
79     @Test(timeout = 4000)
80     public void test02()  throws Throwable  {
81         LinkedList<IResourceInstance> linkedList0 = new LinkedList<IResourceInstance>();
82         LinkedList<IArtifactInfo> linkedList1 = new LinkedList<IArtifactInfo>();
83         linkedList0.offerFirst((IResourceInstance) null);
84         INotificationData iNotificationData0 = mock(INotificationData.class, new ViolatedAssumptionAnswer());
85         doReturn("").when(iNotificationData0).getDistributionID();
86         doReturn(linkedList0, linkedList0).when(iNotificationData0).getResources();
87         doReturn(linkedList1).when(iNotificationData0).getServiceArtifacts();
88         doReturn("").when(iNotificationData0).getServiceDescription();
89         doReturn("]U5JAkfdX0Cs").when(iNotificationData0).getServiceInvariantUUID();
90         doReturn("jV13a").when(iNotificationData0).getServiceName();
91         doReturn("").when(iNotificationData0).getServiceUUID();
92         doReturn("jV13a").when(iNotificationData0).getServiceVersion();
93         String string0 = ASDCNotificationLogging.dumpASDCNotification(iNotificationData0);
94         assertEquals("ASDC Notification:\nDistributionID:\nServiceName:jV13a\nServiceVersion:jV13a\nServiceUUID:\nServiceInvariantUUID:]U5JAkfdX0Cs\nServiceDescription:\nService Artifacts List:\nNULL\nResource Instances List:\n{\nNULL\n\n}\n\n", string0);
95     }
96
97     @Test(timeout = 4000)
98     public void test03()  throws Throwable  {
99         LinkedList<IResourceInstance> linkedList0 = new LinkedList<IResourceInstance>();
100         LinkedList<IArtifactInfo> linkedList1 = new LinkedList<IArtifactInfo>();
101         IResourceInstance iResourceInstance0 = mock(IResourceInstance.class, new ViolatedAssumptionAnswer());
102         doReturn((List) null).when(iResourceInstance0).getArtifacts();
103         doReturn((String) null).when(iResourceInstance0).getCategory();
104         doReturn((String) null).when(iResourceInstance0).getResourceCustomizationUUID();
105         doReturn((String) null).when(iResourceInstance0).getResourceInstanceName();
106         doReturn((String) null).when(iResourceInstance0).getResourceInvariantUUID();
107         doReturn((String) null).when(iResourceInstance0).getResourceName();
108         doReturn((String) null).when(iResourceInstance0).getResourceType();
109         doReturn((String) null).when(iResourceInstance0).getResourceUUID();
110         doReturn((String) null).when(iResourceInstance0).getResourceVersion();
111         doReturn((String) null).when(iResourceInstance0).getSubcategory();
112         linkedList0.add(iResourceInstance0);
113         INotificationData iNotificationData0 = mock(INotificationData.class, new ViolatedAssumptionAnswer());
114         doReturn("").when(iNotificationData0).getDistributionID();
115         doReturn(linkedList0, linkedList0).when(iNotificationData0).getResources();
116         doReturn(linkedList1).when(iNotificationData0).getServiceArtifacts();
117         doReturn("").when(iNotificationData0).getServiceDescription();
118         doReturn("").when(iNotificationData0).getServiceInvariantUUID();
119         doReturn("36-s.n1@").when(iNotificationData0).getServiceName();
120         doReturn("36-s.n1@").when(iNotificationData0).getServiceUUID();
121         doReturn("").when(iNotificationData0).getServiceVersion();
122         String string0 = ASDCNotificationLogging.dumpASDCNotification(iNotificationData0);
123         assertEquals("ASDC Notification:\nDistributionID:\nServiceName:36-s.n1@\nServiceVersion:\nServiceUUID:36-s.n1@\nServiceInvariantUUID:\nServiceDescription:\nService Artifacts List:\nNULL\nResource Instances List:\n{\nResource Instance Info:\nResourceInstanceName:NULL\nResourceCustomizationUUID:NULL\nResourceInvariantUUID:NULL\nResourceName:NULL\nResourceType:NULL\nResourceUUID:NULL\nResourceVersion:NULL\nCategory:NULL\nSubCategory:NULL\nResource Artifacts List:\nNULL\n\n\n}\n\n", string0);
124     }
125
126     @Test(timeout = 4000)
127     public void test04()  throws Throwable  {
128         INotificationData iNotificationData0 = mock(INotificationData.class, new ViolatedAssumptionAnswer());
129         doReturn((String) null).when(iNotificationData0).getDistributionID();
130         doReturn((List) null).when(iNotificationData0).getResources();
131         doReturn((List) null).when(iNotificationData0).getServiceArtifacts();
132         doReturn((String) null).when(iNotificationData0).getServiceDescription();
133         doReturn((String) null).when(iNotificationData0).getServiceInvariantUUID();
134         doReturn((String) null).when(iNotificationData0).getServiceName();
135         doReturn((String) null).when(iNotificationData0).getServiceUUID();
136         doReturn((String) null).when(iNotificationData0).getServiceVersion();
137         String string0 = ASDCNotificationLogging.dumpASDCNotification(iNotificationData0);
138         assertEquals("ASDC Notification:\nDistributionID:NULL\nServiceName:NULL\nServiceVersion:NULL\nServiceUUID:NULL\nServiceInvariantUUID:NULL\nServiceDescription:NULL\nService Artifacts List:\nNULL\nResource Instances List:\nNULL\n", string0);
139     }
140
141     @Test(timeout = 4000)
142     public void test05()  throws Throwable  {
143         LinkedList<IVfModuleData> linkedList0 = new LinkedList<IVfModuleData>();
144         VfModuleMetaData vfModuleMetaData0 = new VfModuleMetaData();
145         Map<String, String> map0 = vfModuleMetaData0.getProperties();
146         IVfModuleData iVfModuleData0 = mock(IVfModuleData.class, new ViolatedAssumptionAnswer());
147         doReturn((List<String>) null, (List<String>) null).when(iVfModuleData0).getArtifacts();
148         doReturn(map0, map0, (Map<String, String>) null).when(iVfModuleData0).getProperties();
149         doReturn("vfModuleModelUUID", "isBase:").when(iVfModuleData0).getVfModuleModelDescription();
150         doReturn((String) null, "vfModuleModelName").when(iVfModuleData0).getVfModuleModelInvariantUUID();
151         doReturn("", "").when(iVfModuleData0).getVfModuleModelName();
152         doReturn("vfModuleModelUUID", "isBase:").when(iVfModuleData0).getVfModuleModelUUID();
153         doReturn("|:\\KD91", "vfModuleModelName").when(iVfModuleData0).getVfModuleModelVersion();
154         doReturn(false, false).when(iVfModuleData0).isBase();
155         linkedList0.add(iVfModuleData0);
156         String string0 = ASDCNotificationLogging.dumpVfModuleMetaDataList(linkedList0);
157         assertEquals("VfModuleMetaData List:\n{\nVfModuleMetaData:\nVfModuleModelName:\nVfModuleModelVersion:|:\\KD91\nVfModuleModelUUID:vfModuleModelUUID\nVfModuleModelInvariantUUID:NULL\nVfModuleModelDescription:vfModuleModelUUID\nArtifacts UUID List:NULLProperties List:\n}\n\nisBase:false\n\n\n}\n", string0);
158
159         String string1 = ASDCNotificationLogging.dumpVfModuleMetaDataList(linkedList0);
160         assertEquals("VfModuleMetaData List:\n{\nVfModuleMetaData:\nVfModuleModelName:\nVfModuleModelVersion:vfModuleModelName\nVfModuleModelUUID:isBase:\nVfModuleModelInvariantUUID:vfModuleModelName\nVfModuleModelDescription:isBase:\nArtifacts UUID List:NULLNULL\nisBase:false\n\n\n}\n", string1);
161     }
162
163     @Test(timeout = 4000)
164     public void test06()  throws Throwable  {
165         LinkedList<IResourceInstance> linkedList0 = new LinkedList<IResourceInstance>();
166         LinkedList<IVfModuleData> linkedList1 = new LinkedList<IVfModuleData>();
167         IVfModuleData iVfModuleData0 = mock(IVfModuleData.class, new ViolatedAssumptionAnswer());
168         doReturn((List) null, (List) null).when(iVfModuleData0).getArtifacts();
169         doReturn((Map) null, (Map) null).when(iVfModuleData0).getProperties();
170         doReturn((String) null, (String) null).when(iVfModuleData0).getVfModuleModelDescription();
171         doReturn((String) null, (String) null).when(iVfModuleData0).getVfModuleModelInvariantUUID();
172         doReturn((String) null, (String) null).when(iVfModuleData0).getVfModuleModelName();
173         doReturn((String) null, (String) null).when(iVfModuleData0).getVfModuleModelUUID();
174         doReturn((String) null, (String) null).when(iVfModuleData0).getVfModuleModelVersion();
175         doReturn(false, false).when(iVfModuleData0).isBase();
176         linkedList1.add(iVfModuleData0);
177         String string0 = ASDCNotificationLogging.dumpVfModuleMetaDataList(linkedList1);
178         String string1 = ASDCNotificationLogging.dumpVfModuleMetaDataList(linkedList1);
179         assertTrue(string1.equals((Object)string0));
180         assertEquals("VfModuleMetaData List:\n{\nVfModuleMetaData:\nVfModuleModelName:NULL\nVfModuleModelVersion:NULL\nVfModuleModelUUID:NULL\nVfModuleModelInvariantUUID:NULL\nVfModuleModelDescription:NULL\nArtifacts UUID List:NULLNULL\nisBase:false\n\n\n}\n", string1);
181     }
182
183     @Test(timeout = 4000)
184     public void test07()  throws Throwable  {
185         LinkedList<IVfModuleData> linkedList0 = new LinkedList<IVfModuleData>();
186         VfModuleMetaData vfModuleMetaData0 = new VfModuleMetaData();
187         linkedList0.add((IVfModuleData) vfModuleMetaData0);
188         UnaryOperator<IVfModuleData> unaryOperator0 = (UnaryOperator<IVfModuleData>) mock(UnaryOperator.class, new ViolatedAssumptionAnswer());
189         doReturn((Object) null).when(unaryOperator0).apply(any());
190         linkedList0.replaceAll(unaryOperator0);
191         String string0 = ASDCNotificationLogging.dumpVfModuleMetaDataList(linkedList0);
192         assertEquals("VfModuleMetaData List:\n{\nNULL\n\n}\n", string0);
193     }
194
195     @Test(timeout = 4000)
196     public void test08()  throws Throwable  {
197         LinkedList<IVfModuleData> linkedList0 = new LinkedList<IVfModuleData>();
198         VfModuleMetaData vfModuleMetaData0 = new VfModuleMetaData();
199         linkedList0.add((IVfModuleData) vfModuleMetaData0);
200         // Undeclared exception!
201         try {
202             ASDCNotificationLogging.dumpVfModuleMetaDataList(linkedList0);
203             fail("Expecting exception: NullPointerException");
204
205         } catch(NullPointerException e) {
206             //
207             // no message in exception (getMessage() returned null)
208             //
209             verifyException("org.openecomp.mso.asdc.installer.VfModuleMetaData", e);
210         }
211     }
212
213     @Test(timeout = 4000)
214     public void test09()  throws Throwable  {
215         String string0 = ASDCNotificationLogging.dumpVfModuleMetaDataList((List<IVfModuleData>) null);
216         assertNull(string0);
217     }
218
219     @Test(timeout = 4000)
220     public void test10()  throws Throwable  {
221         String string0 = ASDCNotificationLogging.dumpASDCNotification((INotificationData) null);
222         assertEquals("NULL", string0);
223     }
224
225     @Test(timeout = 4000)
226     public void test11()  throws Throwable  {
227         LinkedList<IArtifactInfo> linkedList0 = new LinkedList<IArtifactInfo>();
228         INotificationData iNotificationData0 = mock(INotificationData.class, new ViolatedAssumptionAnswer());
229         doReturn("io7<{~.v|%").when(iNotificationData0).getDistributionID();
230         doReturn((List<IResourceInstance>) null).when(iNotificationData0).getResources();
231         doReturn(linkedList0).when(iNotificationData0).getServiceArtifacts();
232         doReturn("io7<{~.v|%").when(iNotificationData0).getServiceDescription();
233         doReturn("io7<{~.v|%").when(iNotificationData0).getServiceInvariantUUID();
234         doReturn("io7<{~.v|%").when(iNotificationData0).getServiceName();
235         doReturn((String) null).when(iNotificationData0).getServiceUUID();
236         doReturn("io7<{~.v|%").when(iNotificationData0).getServiceVersion();
237         String string0 = ASDCNotificationLogging.dumpASDCNotification(iNotificationData0);
238         assertEquals("ASDC Notification:\nDistributionID:io7<{~.v|%\nServiceName:io7<{~.v|%\nServiceVersion:io7<{~.v|%\nServiceUUID:NULL\nServiceInvariantUUID:io7<{~.v|%\nServiceDescription:io7<{~.v|%\nService Artifacts List:\nNULL\nResource Instances List:\nNULL\n", string0);
239
240         ASDCNotificationLogging.dumpVfModuleMetaDataList((List<IVfModuleData>) null);
241         IArtifactInfo iArtifactInfo0 = mock(IArtifactInfo.class, new ViolatedAssumptionAnswer());
242         doReturn((String) null).when(iArtifactInfo0).getArtifactChecksum();
243         doReturn((String) null).when(iArtifactInfo0).getArtifactDescription();
244         doReturn((String) null).when(iArtifactInfo0).getArtifactName();
245         doReturn((Integer) null).when(iArtifactInfo0).getArtifactTimeout();
246         doReturn((String) null).when(iArtifactInfo0).getArtifactType();
247         doReturn((String) null).when(iArtifactInfo0).getArtifactURL();
248         doReturn((String) null).when(iArtifactInfo0).getArtifactUUID();
249         doReturn((String) null).when(iArtifactInfo0).getArtifactVersion();
250         doReturn((IArtifactInfo) null).when(iArtifactInfo0).getGeneratedArtifact();
251         doReturn((List) null).when(iArtifactInfo0).getRelatedArtifacts();
252         linkedList0.push(iArtifactInfo0);
253         INotificationData iNotificationData1 = mock(INotificationData.class, new ViolatedAssumptionAnswer());
254         doReturn("t2J^4~*i|btm ib&").when(iNotificationData1).getDistributionID();
255         doReturn((List<IResourceInstance>) null).when(iNotificationData1).getResources();
256         doReturn(linkedList0).when(iNotificationData1).getServiceArtifacts();
257         doReturn("N~a W7").when(iNotificationData1).getServiceDescription();
258         doReturn("N~a W7").when(iNotificationData1).getServiceInvariantUUID();
259         doReturn("/&*/=").when(iNotificationData1).getServiceName();
260         doReturn((String) null).when(iNotificationData1).getServiceUUID();
261         doReturn("ASDC Notification:\nDistributionID:io7<{~.v|%\nServiceName:io7<{~.v|%\nServiceVersion:io7<{~.v|%\nServiceUUID:NULL\nServiceInvariantUUID:io7<{~.v|%\nServiceDescription:io7<{~.v|%\nService Artifacts List:\nNULL\nResource Instances List:\nNULL\n").when(iNotificationData1).getServiceVersion();
262         String string1 = ASDCNotificationLogging.dumpASDCNotification(iNotificationData1);
263         assertEquals("ASDC Notification:\nDistributionID:t2J^4~*i|btm ib&\nServiceName:/&*/=\nServiceVersion:ASDC Notification:\nDistributionID:io7<{~.v|%\nServiceName:io7<{~.v|%\nServiceVersion:io7<{~.v|%\nServiceUUID:NULL\nServiceInvariantUUID:io7<{~.v|%\nServiceDescription:io7<{~.v|%\nService Artifacts List:\nNULL\nResource Instances List:\nNULL\n\nServiceUUID:NULL\nServiceInvariantUUID:N~a W7\nServiceDescription:N~a W7\nService Artifacts List:\n{\nService Artifacts Info:\nArtifactName:NULL\nArtifactVersion:NULL\nArtifactType:NULL\nArtifactDescription:NULL\nArtifactTimeout:NULL\nArtifactURL:NULL\nArtifactUUID:NULL\nArtifactChecksum:NULL\nGeneratedArtifact:{NULL\n}\nRelatedArtifacts:NULL\n\n\n}\n\nResource Instances List:\nNULL\n", string1);
264     }
265
266     @Test(timeout = 4000)
267     public void test12()  throws Throwable  {
268         ASDCNotificationLogging aSDCNotificationLogging0 = new ASDCNotificationLogging();
269         Object object0 = PrivateAccess.callMethod((Class<ASDCNotificationLogging>) ASDCNotificationLogging.class, aSDCNotificationLogging0, "dumpASDCResourcesList", (Object) null, (Class<?>) INotificationData.class);
270         assertNull(object0);
271     }
272 }