summaryrefslogtreecommitdiffstats
path: root/asdc-controller/src/test/java/org/openecomp/mso/asdc/installer/VfModuleStructureESTest.java
blob: f3c20c5eb70c1cd1453c1e5b9a6d8699072dc136 (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
/*
 * This file was automatically generated by EvoSuite
 * Fri Nov 25 13:37:00 GMT 2016
 */

package org.openecomp.mso.asdc.installer;

import org.evosuite.runtime.EvoRunner;
import org.evosuite.runtime.EvoRunnerParameters;
import org.evosuite.runtime.ViolatedAssumptionAnswer;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.openecomp.sdc.api.notification.INotificationData;
import org.openecomp.sdc.api.notification.IResourceInstance;
import org.openecomp.sdc.api.notification.IVfModuleMetadata;

import java.util.LinkedList;
import java.util.List;

import static org.evosuite.runtime.EvoAssertions.verifyException;
import static org.evosuite.shaded.org.mockito.Mockito.doReturn;
import static org.evosuite.shaded.org.mockito.Mockito.mock;
import static org.junit.Assert.fail;

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

  @Test(timeout = 4000)
  public void test1()  throws Throwable  {
      INotificationData iNotificationData0 = mock(INotificationData.class, new ViolatedAssumptionAnswer());
      IResourceInstance iResourceInstance0 = mock(IResourceInstance.class, new ViolatedAssumptionAnswer());
      VfResourceStructure vfResourceStructure0 = new VfResourceStructure(iNotificationData0, iResourceInstance0);
      IVfModuleMetadata iVfModuleMetadata0 = mock(IVfModuleMetadata.class, new ViolatedAssumptionAnswer());
      doReturn((List) null).when(iVfModuleMetadata0).getArtifacts();
      VfModuleStructure vfModuleStructure0 = null;
      try {
        vfModuleStructure0 = new VfModuleStructure(vfResourceStructure0, iVfModuleMetadata0);
        fail("Expecting exception: NullPointerException");
      
      } catch(NullPointerException e) {
         //
         // no message in exception (getMessage() returned null)
         //
         verifyException("org.openecomp.mso.asdc.installer.VfModuleStructure", e);
      }
  }

  @Test(timeout = 4000)
  public void test2()  throws Throwable  {
      IVfModuleMetadata iVfModuleMetadata0 = mock(IVfModuleMetadata.class, new ViolatedAssumptionAnswer());
      doReturn((List) null).when(iVfModuleMetadata0).getArtifacts();
      VfModuleStructure vfModuleStructure0 = null;
      try {
        vfModuleStructure0 = new VfModuleStructure((VfResourceStructure) null, iVfModuleMetadata0);
        fail("Expecting exception: NullPointerException");
      
      } catch(NullPointerException e) {
         //
         // no message in exception (getMessage() returned null)
         //
         verifyException("org.openecomp.mso.asdc.installer.VfModuleStructure", e);
      }
  }

  @Test(timeout = 4000)
  public void test3()  throws Throwable  {
      INotificationData iNotificationData0 = mock(INotificationData.class, new ViolatedAssumptionAnswer());
      IResourceInstance iResourceInstance0 = mock(IResourceInstance.class, new ViolatedAssumptionAnswer());
      VfResourceStructure vfResourceStructure0 = new VfResourceStructure(iNotificationData0, iResourceInstance0);
      LinkedList<String> linkedList0 = new LinkedList<String>();
      IVfModuleMetadata iVfModuleMetadata0 = mock(IVfModuleMetadata.class, new ViolatedAssumptionAnswer());
      doReturn(linkedList0).when(iVfModuleMetadata0).getArtifacts();
      linkedList0.add("");
      VfModuleStructure vfModuleStructure0 = null;
      try {
        vfModuleStructure0 = new VfModuleStructure(vfResourceStructure0, iVfModuleMetadata0);
        fail("Expecting exception: Exception");
      
      } catch(Exception e) {
         //
         // Artifact (UUID:) referenced in the VFModule UUID list has not been downloaded, cancelling the Resource deployment
         //
         verifyException("org.openecomp.mso.asdc.installer.VfModuleStructure", e);
      }
  }

  @Test(timeout = 4000)
  public void test4()  throws Throwable  {
      INotificationData iNotificationData0 = mock(INotificationData.class, new ViolatedAssumptionAnswer());
      IResourceInstance iResourceInstance0 = mock(IResourceInstance.class, new ViolatedAssumptionAnswer());
      VfResourceStructure vfResourceStructure0 = new VfResourceStructure(iNotificationData0, iResourceInstance0);
      vfResourceStructure0.setSuccessfulDeployment();
      IVfModuleMetadata iVfModuleMetadata0 = mock(IVfModuleMetadata.class, new ViolatedAssumptionAnswer());
      doReturn((List) null).when(iVfModuleMetadata0).getArtifacts();
      vfResourceStructure0.setSuccessfulDeployment();
      VfModuleStructure vfModuleStructure0 = null;
      try {
        vfModuleStructure0 = new VfModuleStructure(vfResourceStructure0, iVfModuleMetadata0);
        fail("Expecting exception: NullPointerException");
      
      } catch(NullPointerException e) {
         //
         // no message in exception (getMessage() returned null)
         //
         verifyException("org.openecomp.mso.asdc.installer.VfModuleStructure", e);
      }
  }
}