aboutsummaryrefslogtreecommitdiffstats
path: root/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'src/test')
-rw-r--r--src/test/java/org/onap/clamp/loop/DcaeComponentTest.java2
-rw-r--r--src/test/java/org/onap/clamp/loop/DeployFlowTestItCase.java3
-rw-r--r--src/test/java/org/onap/clamp/loop/deploy/BlueprintInputParametersTest.java25
3 files changed, 22 insertions, 8 deletions
diff --git a/src/test/java/org/onap/clamp/loop/DcaeComponentTest.java b/src/test/java/org/onap/clamp/loop/DcaeComponentTest.java
index fc7e1c90a..b42ba987e 100644
--- a/src/test/java/org/onap/clamp/loop/DcaeComponentTest.java
+++ b/src/test/java/org/onap/clamp/loop/DcaeComponentTest.java
@@ -47,7 +47,7 @@ public class DcaeComponentTest {
private Loop createTestLoop() {
Loop loopTest = new Loop("ControlLoopTest", "<xml></xml>");
loopTest.setGlobalPropertiesJson(
- new Gson().fromJson("{\"dcaeDeployParameters\":" + "{\"policy_id\": \"name\"}}", JsonObject.class));
+ new Gson().fromJson("{\"dcaeDeployParameters\":{\"loop template blueprint\": {\"policy_id\": \"name\"}}}", JsonObject.class));
loopTest.setLastComputedState(LoopState.DESIGN);
loopTest.setDcaeDeploymentId("123456789");
loopTest.setDcaeDeploymentStatusUrl("http4://localhost:8085");
diff --git a/src/test/java/org/onap/clamp/loop/DeployFlowTestItCase.java b/src/test/java/org/onap/clamp/loop/DeployFlowTestItCase.java
index f1d299226..98134e828 100644
--- a/src/test/java/org/onap/clamp/loop/DeployFlowTestItCase.java
+++ b/src/test/java/org/onap/clamp/loop/DeployFlowTestItCase.java
@@ -71,7 +71,8 @@ public class DeployFlowTestItCase {
@Test
@Transactional
public void deployWithSingleBlueprintTest() throws JsonSyntaxException, IOException {
- Loop loopTest = createLoop("ControlLoopTest", "<xml></xml>", "yamlcontent", "{\"testname\":\"testvalue\"}",
+ Loop loopTest = createLoop("ControlLoopTest", "<xml></xml>", "yamlcontent",
+ "{\"dcaeDeployParameters\":{\"loop template blueprint\": {\"policy_id\": \"name\"}}}",
"UUID-blueprint");
LoopTemplate template = new LoopTemplate();
template.setName("templateName");
diff --git a/src/test/java/org/onap/clamp/loop/deploy/BlueprintInputParametersTest.java b/src/test/java/org/onap/clamp/loop/deploy/BlueprintInputParametersTest.java
index ccaa417e4..2b3b48255 100644
--- a/src/test/java/org/onap/clamp/loop/deploy/BlueprintInputParametersTest.java
+++ b/src/test/java/org/onap/clamp/loop/deploy/BlueprintInputParametersTest.java
@@ -27,10 +27,8 @@
package org.onap.clamp.loop.deploy;
import com.google.gson.JsonObject;
-
import java.io.IOException;
import java.util.LinkedHashSet;
-
import org.junit.Assert;
import org.junit.Test;
import org.mockito.Mockito;
@@ -44,9 +42,15 @@ import org.onap.sdc.tosca.parser.exceptions.SdcToscaParserException;
public class BlueprintInputParametersTest {
+ /**
+ * getDeploymentParametersinJsonMultiBlueprintsTest.
+ *
+ * @throws IOException in case of failure
+ * @throws SdcToscaParserException in case of failure
+ */
@Test
public void getDeploymentParametersinJsonMultiBlueprintsTest() throws IOException, SdcToscaParserException {
- Loop loop = Mockito.mock(Loop.class);
+
MicroServicePolicy umService1 = Mockito.mock(MicroServicePolicy.class);
Mockito.when(umService1.getName()).thenReturn("testName1");
@@ -72,10 +76,11 @@ public class BlueprintInputParametersTest {
Mockito.when(loopElement3.getBlueprint()).thenReturn(blueprint3);
Mockito.when(umService3.getLoopElementModel()).thenReturn(loopElement3);
- LinkedHashSet<MicroServicePolicy> umServiceSet = new LinkedHashSet<MicroServicePolicy>();
+ LinkedHashSet<MicroServicePolicy> umServiceSet = new LinkedHashSet<>();
umServiceSet.add(umService1);
umServiceSet.add(umService2);
umServiceSet.add(umService3);
+ Loop loop = Mockito.mock(Loop.class);
Mockito.when(loop.getMicroServicePolicies()).thenReturn(umServiceSet);
LoopTemplate template = Mockito.mock(LoopTemplate.class);
@@ -85,9 +90,16 @@ public class BlueprintInputParametersTest {
JsonObject paramJson = DcaeDeployParameters.getDcaeDeploymentParametersInJson(loop);
Assert.assertEquals(JsonUtils.GSON_JPA_MODEL.toJson(paramJson),
- ResourceFileUtil.getResourceAsString("example/sdc/expected-result/deployment-parameters-multi-blueprints.json"));
+ ResourceFileUtil.getResourceAsString(
+ "example/sdc/expected-result/deployment-parameters-multi-blueprints.json"));
}
+ /**
+ * getDeploymentParametersInJsonSingleBlueprintTest.
+ *
+ * @throws IOException In case of failure
+ * @throws SdcToscaParserException In case of failure
+ */
@Test
public void getDeploymentParametersInJsonSingleBlueprintTest() throws IOException, SdcToscaParserException {
Loop loop = Mockito.mock(Loop.class);
@@ -107,6 +119,7 @@ public class BlueprintInputParametersTest {
JsonObject paramJson = DcaeDeployParameters.getDcaeDeploymentParametersInJson(loop);
Assert.assertEquals(JsonUtils.GSON_JPA_MODEL.toJson(paramJson),
- ResourceFileUtil.getResourceAsString("example/sdc/expected-result/deployment-parameters-single-blueprint.json"));
+ ResourceFileUtil.getResourceAsString(
+ "example/sdc/expected-result/deployment-parameters-single-blueprint.json"));
}
}