aboutsummaryrefslogtreecommitdiffstats
path: root/src/test/java/org
diff options
context:
space:
mode:
authorSébastien Determe <sebastien.determe@intl.att.com>2019-10-17 13:17:35 +0000
committerGerrit Code Review <gerrit@onap.org>2019-10-17 13:17:35 +0000
commite0cebeea79b70f7fb3467166daeb334fd60dcf55 (patch)
tree5f7389fdaa47e1b372b1e9738bfee2ae802ba5c3 /src/test/java/org
parentf7b8730ac36537693ec23f9b341636577330ee48 (diff)
parenta318b9dff3ac360550c203667576a78ab5f0abc3 (diff)
Merge "Improve unit test coverage of LoopService"
Diffstat (limited to 'src/test/java/org')
-rw-r--r--src/test/java/org/onap/clamp/loop/LoopServiceTestItCase.java34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/test/java/org/onap/clamp/loop/LoopServiceTestItCase.java b/src/test/java/org/onap/clamp/loop/LoopServiceTestItCase.java
index 8add1a7b..1fedc9ab 100644
--- a/src/test/java/org/onap/clamp/loop/LoopServiceTestItCase.java
+++ b/src/test/java/org/onap/clamp/loop/LoopServiceTestItCase.java
@@ -319,6 +319,40 @@ public class LoopServiceTestItCase {
assertThat(loopLogService.isExisting(((LoopLog) loop.getLoopLogs().toArray()[0]).getId())).isFalse();
}
+ @Test
+ @Transactional
+ public void testUpdateLoopState() {
+ saveTestLoopToDb();
+ Loop loop = loopService.getLoop(EXAMPLE_LOOP_NAME);
+ loopService.updateLoopState(loop, "SUBMITTED");
+ Loop updatedLoop = loopService.getLoop(EXAMPLE_LOOP_NAME);
+ assertThat(updatedLoop.getLastComputedState()).isEqualTo(LoopState.SUBMITTED);
+ }
+
+ @Test
+ @Transactional
+ public void testUpdateDcaeDeploymentFields() {
+ saveTestLoopToDb();
+ Loop loop = loopService.getLoop(EXAMPLE_LOOP_NAME);
+ loopService.updateDcaeDeploymentFields(loop,"CLAMP_c5ce429a-f570-48c5-a7ea-53bed8f86f85",
+ "https4://deployment-handler.onap:8443");
+ loop = loopService.getLoop(EXAMPLE_LOOP_NAME);
+ assertThat(loop.getDcaeDeploymentId()).isEqualTo("CLAMP_c5ce429a-f570-48c5-a7ea-53bed8f86f85");
+ assertThat(loop.getDcaeDeploymentStatusUrl()).isEqualTo("https4://deployment-handler.onap:8443");
+ }
+
+ @Test
+ @Transactional
+ public void testUpdateMicroservicePolicy() {
+ saveTestLoopToDb();
+ assertThat(microServicePolicyService.isExisting("policyName")).isFalse();
+ MicroServicePolicy microServicePolicy = new MicroServicePolicy("policyName", "",
+ "tosca_definitions_version: tosca_simple_yaml_1_0_0", false,
+ JsonUtils.GSON.fromJson(EXAMPLE_JSON, JsonObject.class), null);
+ loopService.updateMicroservicePolicy(EXAMPLE_LOOP_NAME, microServicePolicy);
+ assertThat(microServicePolicyService.isExisting("policyName")).isTrue();
+ }
+
private Loop createTestLoop(String loopName, String loopBlueprint, String loopSvg) {
return new Loop(loopName, loopBlueprint, loopSvg);
}