diff options
author | xuegao <xg353y@intl.att.com> | 2019-12-06 10:40:49 +0100 |
---|---|---|
committer | xuegao <xg353y@intl.att.com> | 2019-12-09 14:31:19 +0100 |
commit | 69c24994501aead95d5ee9fa172fff659ae34fa4 (patch) | |
tree | 671522a2b1e0a7eb545059d7a75b1a03e9787087 /src/test/java/org | |
parent | 1ebfe6b467e5a6a42c756f225397da76f9e3dfc2 (diff) |
Update service object
Seperate the procedure to install service and loops.
Issue-ID: CLAMP-566
Change-Id: Ied7143ce8849baffda7678e82f4d6c4d9f1443d9
Signed-off-by: xuegao <xg353y@intl.att.com>
Diffstat (limited to 'src/test/java/org')
5 files changed, 13 insertions, 8 deletions
diff --git a/src/test/java/org/onap/clamp/clds/it/sdc/controller/SdcSingleControllerItCase.java b/src/test/java/org/onap/clamp/clds/it/sdc/controller/SdcSingleControllerItCase.java index 695b85166..2cbabbe8c 100644 --- a/src/test/java/org/onap/clamp/clds/it/sdc/controller/SdcSingleControllerItCase.java +++ b/src/test/java/org/onap/clamp/clds/it/sdc/controller/SdcSingleControllerItCase.java @@ -45,7 +45,7 @@ import org.onap.clamp.clds.exception.sdc.controller.SdcControllerException; import org.onap.clamp.clds.sdc.controller.SdcSingleController; import org.onap.clamp.clds.sdc.controller.SdcSingleControllerStatus; import org.onap.clamp.clds.sdc.controller.installer.CsarHandler; -import org.onap.clamp.clds.sdc.controller.installer.CsarInstaller; +import org.onap.clamp.loop.CsarInstaller; import org.onap.sdc.api.notification.IArtifactInfo; import org.onap.sdc.api.notification.INotificationData; import org.onap.sdc.api.notification.IResourceInstance; diff --git a/src/test/java/org/onap/clamp/loop/CsarInstallerItCase.java b/src/test/java/org/onap/clamp/loop/CsarInstallerItCase.java index e3271c7a6..df952aa16 100644 --- a/src/test/java/org/onap/clamp/loop/CsarInstallerItCase.java +++ b/src/test/java/org/onap/clamp/loop/CsarInstallerItCase.java @@ -48,9 +48,9 @@ import org.onap.clamp.clds.exception.sdc.controller.CsarHandlerException; import org.onap.clamp.clds.exception.sdc.controller.SdcArtifactInstallerException; import org.onap.clamp.clds.sdc.controller.installer.BlueprintArtifact; import org.onap.clamp.clds.sdc.controller.installer.CsarHandler; -import org.onap.clamp.clds.sdc.controller.installer.CsarInstaller; import org.onap.clamp.clds.util.JsonUtils; import org.onap.clamp.clds.util.ResourceFileUtil; +import org.onap.clamp.loop.service.ServiceRepository; import org.onap.clamp.policy.microservice.MicroServicePolicy; import org.onap.sdc.api.notification.IArtifactInfo; import org.onap.sdc.api.notification.INotificationData; @@ -83,7 +83,10 @@ public class CsarInstallerItCase { private LoopsRepository loopsRepo; @Autowired - @Qualifier("loopInstaller") + ServiceRepository serviceRepository; + + @Autowired + @Qualifier("csarInstaller") private CsarInstaller csarInstaller; private BlueprintArtifact buildFakeBuildprintArtifact(String instanceName, String invariantResourceUuid, @@ -186,6 +189,8 @@ public class CsarInstallerItCase { String generatedName = RandomStringUtils.randomAlphanumeric(5); CsarHandler csar = buildFakeCsarHandler(generatedName); csarInstaller.installTheCsar(csar); + assertThat(serviceRepository + .existsById("63cac700-ab9a-4115-a74f-7eac85e3fce0")).isTrue(); assertThat(loopsRepo .existsById(Loop.generateLoopName(generatedName, "1.0", RESOURCE_INSTANCE_NAME_RESOURCE1, "tca.yaml"))) .isTrue(); diff --git a/src/test/java/org/onap/clamp/loop/LoopToJsonTest.java b/src/test/java/org/onap/clamp/loop/LoopToJsonTest.java index b68bf48a0..68fe487ef 100644 --- a/src/test/java/org/onap/clamp/loop/LoopToJsonTest.java +++ b/src/test/java/org/onap/clamp/loop/LoopToJsonTest.java @@ -126,7 +126,7 @@ public class LoopToJsonTest { JsonObject jsonModel = new GsonBuilder().create() .fromJson(ResourceFileUtil.getResourceAsString("tosca/model-properties.json"), JsonObject.class); Service service = new Service(jsonModel.get("serviceDetails").getAsJsonObject(), - jsonModel.get("resourceDetails").getAsJsonObject()); + jsonModel.get("resourceDetails").getAsJsonObject(), "1.0"); loopTest2.setModelService(service); String jsonSerialized = JsonUtils.GSON_JPA_MODEL.toJson(loopTest2); diff --git a/src/test/java/org/onap/clamp/loop/ServiceTest.java b/src/test/java/org/onap/clamp/loop/ServiceTest.java index 45de5385e..2b6fab8b6 100644 --- a/src/test/java/org/onap/clamp/loop/ServiceTest.java +++ b/src/test/java/org/onap/clamp/loop/ServiceTest.java @@ -41,12 +41,12 @@ public class ServiceTest { String resourceStr = "{\"CP\": {}}"; Service service1 = new Service(JsonUtils.GSON.fromJson(serviceStr1, JsonObject.class), - JsonUtils.GSON.fromJson(resourceStr, JsonObject.class)); + JsonUtils.GSON.fromJson(resourceStr, JsonObject.class), "1.0"); - Service service2 = new Service(JsonUtils.GSON.fromJson(serviceStr2, JsonObject.class), null); + Service service2 = new Service(JsonUtils.GSON.fromJson(serviceStr2, JsonObject.class), null, "1.0"); Service service3 = new Service(JsonUtils.GSON.fromJson(serviceStr3, JsonObject.class), - JsonUtils.GSON.fromJson(resourceStr, JsonObject.class)); + JsonUtils.GSON.fromJson(resourceStr, JsonObject.class), "1.0"); assertThat(service1.equals(service2)).isEqualTo(true); assertThat(service1.equals(service3)).isEqualTo(false); diff --git a/src/test/java/org/onap/clamp/policy/operational/OperationalPolicyRepresentationBuilderTest.java b/src/test/java/org/onap/clamp/policy/operational/OperationalPolicyRepresentationBuilderTest.java index 673ac323d..12ddbaa71 100644 --- a/src/test/java/org/onap/clamp/policy/operational/OperationalPolicyRepresentationBuilderTest.java +++ b/src/test/java/org/onap/clamp/policy/operational/OperationalPolicyRepresentationBuilderTest.java @@ -42,7 +42,7 @@ public class OperationalPolicyRepresentationBuilderTest { JsonObject jsonModel = new GsonBuilder().create() .fromJson(ResourceFileUtil.getResourceAsString("tosca/model-properties.json"), JsonObject.class); Service service = new Service(jsonModel.get("serviceDetails").getAsJsonObject(), - jsonModel.get("resourceDetails").getAsJsonObject()); + jsonModel.get("resourceDetails").getAsJsonObject(), "1.0"); JsonObject jsonSchema = OperationalPolicyRepresentationBuilder.generateOperationalPolicySchema(service); |