aboutsummaryrefslogtreecommitdiffstats
path: root/asdc-controller/src/test/java/org/openecomp/mso/asdc/util/ASDCNotificationLoggingESTest.java
blob: 2e7309633761825b66d4cdd4d04af67b0d547555 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
/*
 * This file was automatically generated by EvoSuite
 * Mon Mar 13 16:09:00 GMT 2017
 */

package org.openecomp.mso.asdc.util;

import org.junit.Test;
import static org.junit.Assert.*;
import static org.evosuite.shaded.org.mockito.Mockito.*;
import static org.evosuite.runtime.MockitoExtension.*;
import static org.evosuite.runtime.EvoAssertions.*;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.function.UnaryOperator;
import org.evosuite.runtime.EvoRunner;
import org.evosuite.runtime.EvoRunnerParameters;
import org.evosuite.runtime.PrivateAccess;
import org.evosuite.runtime.ViolatedAssumptionAnswer;
import org.junit.runner.RunWith;
import org.openecomp.mso.asdc.installer.IVfModuleData;
import org.openecomp.mso.asdc.installer.VfModuleMetaData;
import org.openecomp.mso.asdc.util.ASDCNotificationLogging;
import org.openecomp.sdc.api.notification.IArtifactInfo;
import org.openecomp.sdc.api.notification.INotificationData;
import org.openecomp.sdc.api.notification.IResourceInstance;

@RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, useJEE = true)
public class ASDCNotificationLoggingESTest extends ASDCNotificationLoggingESTestscaffolding {

    @Test(timeout = 4000)
    public void test00()  throws Throwable  {
        LinkedList<IVfModuleData> linkedList0 = new LinkedList<IVfModuleData>();
        VfModuleMetaData vfModuleMetaData0 = new VfModuleMetaData();
        vfModuleMetaData0.setAttribute("vfModuleModelInvariantUUID", vfModuleMetaData0);
        linkedList0.add((IVfModuleData) vfModuleMetaData0);
        // Undeclared exception!
        try {
            ASDCNotificationLogging.dumpVfModuleMetaDataList(linkedList0);
            fail("Expecting exception: ClassCastException");

        } catch(ClassCastException e) {
            //
            // org.openecomp.mso.asdc.installer.VfModuleMetaData cannot be cast to java.lang.String
            //
            verifyException("org.openecomp.mso.asdc.installer.VfModuleMetaData", e);
        }
    }

    @Test(timeout = 4000)
    public void test01()  throws Throwable  {
        List<IArtifactInfo> list0 = (List<IArtifactInfo>) mock(List.class, new ViolatedAssumptionAnswer());
        doReturn(false).when(list0).isEmpty();
        doReturn((Iterator) null).when(list0).iterator();
        doReturn(0).when(list0).size();
        INotificationData iNotificationData0 = mock(INotificationData.class, new ViolatedAssumptionAnswer());
        doReturn("rGQA").when(iNotificationData0).getDistributionID();
        doReturn(list0).when(iNotificationData0).getServiceArtifacts();
        doReturn("rGQA").when(iNotificationData0).getServiceDescription();
        doReturn("").when(iNotificationData0).getServiceInvariantUUID();
        doReturn("").when(iNotificationData0).getServiceName();
        doReturn("rGQA").when(iNotificationData0).getServiceUUID();
        doReturn("").when(iNotificationData0).getServiceVersion();
        // Undeclared exception!
        try {
            ASDCNotificationLogging.dumpASDCNotification(iNotificationData0);
            fail("Expecting exception: NullPointerException");

        } catch(NullPointerException e) {
            //
            // no message in exception (getMessage() returned null)
            //
            verifyException("org.openecomp.mso.asdc.util.ASDCNotificationLogging", e);
        }
    }

    @Test(timeout = 4000)
    public void test02()  throws Throwable  {
        LinkedList<IResourceInstance> linkedList0 = new LinkedList<IResourceInstance>();
        LinkedList<IArtifactInfo> linkedList1 = new LinkedList<IArtifactInfo>();
        linkedList0.offerFirst((IResourceInstance) null);
        INotificationData iNotificationData0 = mock(INotificationData.class, new ViolatedAssumptionAnswer());
        doReturn("").when(iNotificationData0).getDistributionID();
        doReturn(linkedList0, linkedList0).when(iNotificationData0).getResources();
        doReturn(linkedList1).when(iNotificationData0).getServiceArtifacts();
        doReturn("").when(iNotificationData0).getServiceDescription();
        doReturn("]U5JAkfdX0Cs").when(iNotificationData0).getServiceInvariantUUID();
        doReturn("jV13a").when(iNotificationData0).getServiceName();
        doReturn("").when(iNotificationData0).getServiceUUID();
        doReturn("jV13a").when(iNotificationData0).getServiceVersion();
        String string0 = ASDCNotificationLogging.dumpASDCNotification(iNotificationData0);
        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);
    }

    @Test(timeout = 4000)
    public void test03()  throws Throwable  {
        LinkedList<IResourceInstance> linkedList0 = new LinkedList<IResourceInstance>();
        LinkedList<IArtifactInfo> linkedList1 = new LinkedList<IArtifactInfo>();
        IResourceInstance iResourceInstance0 = mock(IResourceInstance.class, new ViolatedAssumptionAnswer());
        doReturn((List) null).when(iResourceInstance0).getArtifacts();
        doReturn((String) null).when(iResourceInstance0).getCategory();
        doReturn((String) null).when(iResourceInstance0).getResourceCustomizationUUID();
        doReturn((String) null).when(iResourceInstance0).getResourceInstanceName();
        doReturn((String) null).when(iResourceInstance0).getResourceInvariantUUID();
        doReturn((String) null).when(iResourceInstance0).getResourceName();
        doReturn((String) null).when(iResourceInstance0).getResourceType();
        doReturn((String) null).when(iResourceInstance0).getResourceUUID();
        doReturn((String) null).when(iResourceInstance0).getResourceVersion();
        doReturn((String) null).when(iResourceInstance0).getSubcategory();
        linkedList0.add(iResourceInstance0);
        INotificationData iNotificationData0 = mock(INotificationData.class, new ViolatedAssumptionAnswer());
        doReturn("").when(iNotificationData0).getDistributionID();
        doReturn(linkedList0, linkedList0).when(iNotificationData0).getResources();
        doReturn(linkedList1).when(iNotificationData0).getServiceArtifacts();
        doReturn("").when(iNotificationData0).getServiceDescription();
        doReturn("").when(iNotificationData0).getServiceInvariantUUID();
        doReturn("36-s.n1@").when(iNotificationData0).getServiceName();
        doReturn("36-s.n1@").when(iNotificationData0).getServiceUUID();
        doReturn("").when(iNotificationData0).getServiceVersion();
        String string0 = ASDCNotificationLogging.dumpASDCNotification(iNotificationData0);
        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);
    }

    @Test(timeout = 4000)
    public void test04()  throws Throwable  {
        INotificationData iNotificationData0 = mock(INotificationData.class, new ViolatedAssumptionAnswer());
        doReturn((String) null).when(iNotificationData0).getDistributionID();
        doReturn((List) null).when(iNotificationData0).getResources();
        doReturn((List) null).when(iNotificationData0).getServiceArtifacts();
        doReturn((String) null).when(iNotificationData0).getServiceDescription();
        doReturn((String) null).when(iNotificationData0).getServiceInvariantUUID();
        doReturn((String) null).when(iNotificationData0).getServiceName();
        doReturn((String) null).when(iNotificationData0).getServiceUUID();
        doReturn((String) null).when(iNotificationData0).getServiceVersion();
        String string0 = ASDCNotificationLogging.dumpASDCNotification(iNotificationData0);
        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);
    }

    @Test(timeout = 4000)
    public void test05()  throws Throwable  {
        LinkedList<IVfModuleData> linkedList0 = new LinkedList<IVfModuleData>();
        VfModuleMetaData vfModuleMetaData0 = new VfModuleMetaData();
        Map<String, String> map0 = vfModuleMetaData0.getProperties();
        IVfModuleData iVfModuleData0 = mock(IVfModuleData.class, new ViolatedAssumptionAnswer());
        doReturn((List<String>) null, (List<String>) null).when(iVfModuleData0).getArtifacts();
        doReturn(map0, map0, (Map<String, String>) null).when(iVfModuleData0).getProperties();
        doReturn("vfModuleModelUUID", "isBase:").when(iVfModuleData0).getVfModuleModelDescription();
        doReturn((String) null, "vfModuleModelName").when(iVfModuleData0).getVfModuleModelInvariantUUID();
        doReturn("", "").when(iVfModuleData0).getVfModuleModelName();
        doReturn("vfModuleModelUUID", "isBase:").when(iVfModuleData0).getVfModuleModelUUID();
        doReturn("|:\\KD91", "vfModuleModelName").when(iVfModuleData0).getVfModuleModelVersion();
        doReturn(false, false).when(iVfModuleData0).isBase();
        linkedList0.add(iVfModuleData0);
        String string0 = ASDCNotificationLogging.dumpVfModuleMetaDataList(linkedList0);
        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);

        String string1 = ASDCNotificationLogging.dumpVfModuleMetaDataList(linkedList0);
        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);
    }

    @Test(timeout = 4000)
    public void test06()  throws Throwable  {
        LinkedList<IResourceInstance> linkedList0 = new LinkedList<IResourceInstance>();
        LinkedList<IVfModuleData> linkedList1 = new LinkedList<IVfModuleData>();
        IVfModuleData iVfModuleData0 = mock(IVfModuleData.class, new ViolatedAssumptionAnswer());
        doReturn((List) null, (List) null).when(iVfModuleData0).getArtifacts();
        doReturn((Map) null, (Map) null).when(iVfModuleData0).getProperties();
        doReturn((String) null, (String) null).when(iVfModuleData0).getVfModuleModelDescription();
        doReturn((String) null, (String) null).when(iVfModuleData0).getVfModuleModelInvariantUUID();
        doReturn((String) null, (String) null).when(iVfModuleData0).getVfModuleModelName();
        doReturn((String) null, (String) null).when(iVfModuleData0).getVfModuleModelUUID();
        doReturn((String) null, (String) null).when(iVfModuleData0).getVfModuleModelVersion();
        doReturn(false, false).when(iVfModuleData0).isBase();
        linkedList1.add(iVfModuleData0);
        String string0 = ASDCNotificationLogging.dumpVfModuleMetaDataList(linkedList1);
        String string1 = ASDCNotificationLogging.dumpVfModuleMetaDataList(linkedList1);
        assertTrue(string1.equals((Object)string0));
        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);
    }

    @Test(timeout = 4000)
    public void test07()  throws Throwable  {
        LinkedList<IVfModuleData> linkedList0 = new LinkedList<IVfModuleData>();
        VfModuleMetaData vfModuleMetaData0 = new VfModuleMetaData();
        linkedList0.add((IVfModuleData) vfModuleMetaData0);
        UnaryOperator<IVfModuleData> unaryOperator0 = (UnaryOperator<IVfModuleData>) mock(UnaryOperator.class, new ViolatedAssumptionAnswer());
        doReturn((Object) null).when(unaryOperator0).apply(any());
        linkedList0.replaceAll(unaryOperator0);
        String string0 = ASDCNotificationLogging.dumpVfModuleMetaDataList(linkedList0);
        assertEquals("VfModuleMetaData List:\n{\nNULL\n\n}\n", string0);
    }

    @Test(timeout = 4000)
    public void test08()  throws Throwable  {
        LinkedList<IVfModuleData> linkedList0 = new LinkedList<IVfModuleData>();
        VfModuleMetaData vfModuleMetaData0 = new VfModuleMetaData();
        linkedList0.add((IVfModuleData) vfModuleMetaData0);
        // Undeclared exception!
        try {
            ASDCNotificationLogging.dumpVfModuleMetaDataList(linkedList0);
            fail("Expecting exception: NullPointerException");

        } catch(NullPointerException e) {
            //
            // no message in exception (getMessage() returned null)
            //
            verifyException("org.openecomp.mso.asdc.installer.VfModuleMetaData", e);
        }
    }

    @Test(timeout = 4000)
    public void test09()  throws Throwable  {
        String string0 = ASDCNotificationLogging.dumpVfModuleMetaDataList((List<IVfModuleData>) null);
        assertNull(string0);
    }

    @Test(timeout = 4000)
    public void test10()  throws Throwable  {
        String string0 = ASDCNotificationLogging.dumpASDCNotification((INotificationData) null);
        assertEquals("NULL", string0);
    }

    @Test(timeout = 4000)
    public void test11()  throws Throwable  {
        LinkedList<IArtifactInfo> linkedList0 = new LinkedList<IArtifactInfo>();
        INotificationData iNotificationData0 = mock(INotificationData.class, new ViolatedAssumptionAnswer());
        doReturn("io7<{~.v|%").when(iNotificationData0).getDistributionID();
        doReturn((List<IResourceInstance>) null).when(iNotificationData0).getResources();
        doReturn(linkedList0).when(iNotificationData0).getServiceArtifacts();
        doReturn("io7<{~.v|%").when(iNotificationData0).getServiceDescription();
        doReturn("io7<{~.v|%").when(iNotificationData0).getServiceInvariantUUID();
        doReturn("io7<{~.v|%").when(iNotificationData0).getServiceName();
        doReturn((String) null).when(iNotificationData0).getServiceUUID();
        doReturn("io7<{~.v|%").when(iNotificationData0).getServiceVersion();
        String string0 = ASDCNotificationLogging.dumpASDCNotification(iNotificationData0);
        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);

        ASDCNotificationLogging.dumpVfModuleMetaDataList((List<IVfModuleData>) null);
        IArtifactInfo iArtifactInfo0 = mock(IArtifactInfo.class, new ViolatedAssumptionAnswer());
        doReturn((String) null).when(iArtifactInfo0).getArtifactChecksum();
        doReturn((String) null).when(iArtifactInfo0).getArtifactDescription();
        doReturn((String) null).when(iArtifactInfo0).getArtifactName();
        doReturn((Integer) null).when(iArtifactInfo0).getArtifactTimeout();
        doReturn((String) null).when(iArtifactInfo0).getArtifactType();
        doReturn((String) null).when(iArtifactInfo0).getArtifactURL();
        doReturn((String) null).when(iArtifactInfo0).getArtifactUUID();
        doReturn((String) null).when(iArtifactInfo0).getArtifactVersion();
        doReturn((IArtifactInfo) null).when(iArtifactInfo0).getGeneratedArtifact();
        doReturn((List) null).when(iArtifactInfo0).getRelatedArtifacts();
        linkedList0.push(iArtifactInfo0);
        INotificationData iNotificationData1 = mock(INotificationData.class, new ViolatedAssumptionAnswer());
        doReturn("t2J^4~*i|btm ib&").when(iNotificationData1).getDistributionID();
        doReturn((List<IResourceInstance>) null).when(iNotificationData1).getResources();
        doReturn(linkedList0).when(iNotificationData1).getServiceArtifacts();
        doReturn("N~a W7").when(iNotificationData1).getServiceDescription();
        doReturn("N~a W7").when(iNotificationData1).getServiceInvariantUUID();
        doReturn("/&*/=").when(iNotificationData1).getServiceName();
        doReturn((String) null).when(iNotificationData1).getServiceUUID();
        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();
        String string1 = ASDCNotificationLogging.dumpASDCNotification(iNotificationData1);
        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);
    }

    @Test(timeout = 4000)
    public void test12()  throws Throwable  {
        ASDCNotificationLogging aSDCNotificationLogging0 = new ASDCNotificationLogging();
        Object object0 = PrivateAccess.callMethod((Class<ASDCNotificationLogging>) ASDCNotificationLogging.class, aSDCNotificationLogging0, "dumpASDCResourcesList", (Object) null, (Class<?>) INotificationData.class);
        assertNull(object0);
    }
}