summaryrefslogtreecommitdiffstats
path: root/src/test/java/org
diff options
context:
space:
mode:
authorDeterme, Sebastien (sd378r) <sd378r@intl.att.com>2018-04-12 14:54:26 +0200
committerDeterme, Sebastien (sd378r) <sd378r@intl.att.com>2018-04-12 14:54:26 +0200
commit0c8c6ff37abb1080fec59ee2558689c312a953a1 (patch)
tree3de12a16556a4d69b4948a4b9d0573553a28f230 /src/test/java/org
parent9f4759c7d09b8ba1b1ef73c904ae8699182e32b5 (diff)
Refactor code Sdc-controller
Rework the Sdc-controller and mainly blueprintArtifact so that the resource attached is fully available in this class Issue-ID: CLAMP-151 Change-Id: I77210cfa90a04df505566ff7e5f093c768cbbda9 Signed-off-by: Determe, Sebastien (sd378r) <sd378r@intl.att.com>
Diffstat (limited to 'src/test/java/org')
-rw-r--r--src/test/java/org/onap/clamp/clds/it/sdc/controller/installer/CsarInstallerItCase.java9
-rw-r--r--src/test/java/org/onap/clamp/clds/sdc/controller/installer/CsarHandlerTest.java8
2 files changed, 10 insertions, 7 deletions
diff --git a/src/test/java/org/onap/clamp/clds/it/sdc/controller/installer/CsarInstallerItCase.java b/src/test/java/org/onap/clamp/clds/it/sdc/controller/installer/CsarInstallerItCase.java
index b741f7c75..9009d372f 100644
--- a/src/test/java/org/onap/clamp/clds/it/sdc/controller/installer/CsarInstallerItCase.java
+++ b/src/test/java/org/onap/clamp/clds/it/sdc/controller/installer/CsarInstallerItCase.java
@@ -67,6 +67,7 @@ public class CsarInstallerItCase {
private static final String CSAR_ARTIFACT_NAME = "testArtifact.csar";
private static final String INVARIANT_SERVICE_UUID = "4cc5b45a-1f63-4194-8100-cd8e14248c92";
private static final String INVARIANT_RESOURCE1_UUID = "07e266fc-49ab-4cd7-8378-ca4676f1b9ec";
+ private static final String INSTANCE_NAME_RESOURCE1 = "ResourceInstanceName";
@Autowired
private CsarInstaller csarInstaller;
@Autowired
@@ -77,6 +78,7 @@ public class CsarInstallerItCase {
throws SdcArtifactInstallerException, SdcToscaParserException, CsarHandlerException, IOException {
CsarHandler csarHandler = Mockito.mock(CsarHandler.class);
BlueprintArtifact blueprintArtifact = Mockito.mock(BlueprintArtifact.class);
+ Mockito.when(blueprintArtifact.getResourceAttached()).thenReturn(Mockito.mock(IResourceInstance.class));
Map<String, BlueprintArtifact> blueprintMap = new HashMap<>();
blueprintMap.put("resourceid", blueprintArtifact);
Mockito.when(csarHandler.getMapOfBlueprints()).thenReturn(blueprintMap);
@@ -93,8 +95,9 @@ public class CsarInstallerItCase {
// Create fake resource in notification
List<IResourceInstance> listResources = new ArrayList<>();
IResourceInstance resource = Mockito.mock(IResourceInstance.class);
- Mockito.when(resource.getResourceInstanceName()).thenReturn("mm-e 0");
- Mockito.when(resource.getResourceInvariantUUID()).thenReturn("mme0-invariantUuid");
+ Mockito.when(resource.getResourceInstanceName()).thenReturn(INSTANCE_NAME_RESOURCE1);
+ Mockito.when(resource.getResourceInvariantUUID()).thenReturn(INVARIANT_RESOURCE1_UUID);
+ listResources.add(resource);
Mockito.when(notificationData.getResources()).thenReturn(listResources);
// Create fake blueprint artifact
BlueprintArtifact blueprintArtifact = Mockito.mock(BlueprintArtifact.class);
@@ -102,7 +105,7 @@ public class CsarInstallerItCase {
.thenReturn(ResourceFileUtil.getResourceAsString("example/sdc/blueprint-dcae/tca.yaml"));
Mockito.when(blueprintArtifact.getBlueprintArtifactName()).thenReturn(CSAR_ARTIFACT_NAME);
Mockito.when(blueprintArtifact.getBlueprintInvariantServiceUuid()).thenReturn(INVARIANT_SERVICE_UUID);
- Mockito.when(blueprintArtifact.getBlueprintInvariantResourceUuid()).thenReturn(INVARIANT_RESOURCE1_UUID);
+ Mockito.when(blueprintArtifact.getResourceAttached()).thenReturn(resource);
Map<String, BlueprintArtifact> blueprintMap = new HashMap<>();
blueprintMap.put("resourceid", blueprintArtifact);
// Build fake csarhandler
diff --git a/src/test/java/org/onap/clamp/clds/sdc/controller/installer/CsarHandlerTest.java b/src/test/java/org/onap/clamp/clds/sdc/controller/installer/CsarHandlerTest.java
index b02e8bab4..397a6a6f3 100644
--- a/src/test/java/org/onap/clamp/clds/sdc/controller/installer/CsarHandlerTest.java
+++ b/src/test/java/org/onap/clamp/clds/sdc/controller/installer/CsarHandlerTest.java
@@ -132,8 +132,8 @@ public class CsarHandlerTest {
// Test additional properties from Sdc notif
assertEquals(BLUEPRINT1_NAME,
csar.getMapOfBlueprints().get(RESOURCE1_INSTANCE_NAME).getBlueprintArtifactName());
- assertEquals(RESOURCE1_UUID,
- csar.getMapOfBlueprints().get(RESOURCE1_INSTANCE_NAME).getBlueprintInvariantResourceUuid());
+ assertEquals(RESOURCE1_UUID, csar.getMapOfBlueprints().get(RESOURCE1_INSTANCE_NAME).getResourceAttached()
+ .getResourceInvariantUUID());
assertEquals(SERVICE_UUID,
csar.getMapOfBlueprints().get(RESOURCE1_INSTANCE_NAME).getBlueprintInvariantServiceUuid());
// Do some cleanup
@@ -158,8 +158,8 @@ public class CsarHandlerTest {
// Test additional properties from Sdc notif
assertEquals(BLUEPRINT1_NAME,
csar.getMapOfBlueprints().get(RESOURCE1_INSTANCE_NAME).getBlueprintArtifactName());
- assertEquals(RESOURCE1_UUID,
- csar.getMapOfBlueprints().get(RESOURCE1_INSTANCE_NAME).getBlueprintInvariantResourceUuid());
+ assertEquals(RESOURCE1_UUID, csar.getMapOfBlueprints().get(RESOURCE1_INSTANCE_NAME).getResourceAttached()
+ .getResourceInvariantUUID());
assertEquals(SERVICE_UUID,
csar.getMapOfBlueprints().get(RESOURCE1_INSTANCE_NAME).getBlueprintInvariantServiceUuid());
Path path = Paths.get(SDC_FOLDER + "/test-controller/" + CSAR_ARTIFACT_NAME);