summaryrefslogtreecommitdiffstats
path: root/src/test
diff options
context:
space:
mode:
authorsebdet <sebastien.determe@intl.att.com>2019-08-23 07:45:27 -0700
committersebdet <sebastien.determe@intl.att.com>2019-08-23 08:35:15 -0700
commit3142c70fb7530c444c891674fe55c6a9b236dfb3 (patch)
tree807ba054b1fea1af52cdc3bc45b4baa2ea9134a7 /src/test
parent5e2b077e496ca28e9f91fc12cecb872228c81816 (diff)
Fix the log status
Fix the way the code (camel) computes the global loop state + introduce level in component state for that Issue-ID: CLAMP-384 Change-Id: I83a9306eabacfc1f118df6b828e521ee59d19b5f Signed-off-by: sebdet <sebastien.determe@intl.att.com>
Diffstat (limited to 'src/test')
-rw-r--r--src/test/java/org/onap/clamp/loop/LoopToJsonTest.java34
1 files changed, 17 insertions, 17 deletions
diff --git a/src/test/java/org/onap/clamp/loop/LoopToJsonTest.java b/src/test/java/org/onap/clamp/loop/LoopToJsonTest.java
index c9350c610..3010fe50b 100644
--- a/src/test/java/org/onap/clamp/loop/LoopToJsonTest.java
+++ b/src/test/java/org/onap/clamp/loop/LoopToJsonTest.java
@@ -54,7 +54,7 @@ public class LoopToJsonTest {
}
private Loop getLoop(String name, String svgRepresentation, String blueprint, String globalPropertiesJson,
- String dcaeId, String dcaeUrl, String dcaeBlueprintId) {
+ String dcaeId, String dcaeUrl, String dcaeBlueprintId) {
Loop loop = new Loop(name, blueprint, svgRepresentation);
loop.setGlobalPropertiesJson(new Gson().fromJson(globalPropertiesJson, JsonObject.class));
loop.setLastComputedState(LoopState.DESIGN);
@@ -65,9 +65,9 @@ public class LoopToJsonTest {
}
private MicroServicePolicy getMicroServicePolicy(String name, String modelType, String jsonRepresentation,
- String policyTosca, String jsonProperties, boolean shared) {
+ String policyTosca, String jsonProperties, boolean shared) {
MicroServicePolicy microService = new MicroServicePolicy(name, modelType, policyTosca, shared,
- gson.fromJson(jsonRepresentation, JsonObject.class), new HashSet<>());
+ gson.fromJson(jsonRepresentation, JsonObject.class), new HashSet<>());
microService.setProperties(new Gson().fromJson(jsonProperties, JsonObject.class));
return microService;
@@ -82,13 +82,13 @@ public class LoopToJsonTest {
@Test
public void loopGsonTest() throws IOException {
Loop loopTest = getLoop("ControlLoopTest", "<xml></xml>", "yamlcontent", "{\"testname\":\"testvalue\"}",
- "123456789", "https://dcaetest.org", "UUID-blueprint");
+ "123456789", "https://dcaetest.org", "UUID-blueprint");
OperationalPolicy opPolicy = this.getOperationalPolicy(
- ResourceFileUtil.getResourceAsString("tosca/operational-policy-properties.json"), "GuardOpPolicyTest");
+ ResourceFileUtil.getResourceAsString("tosca/operational-policy-properties.json"), "GuardOpPolicyTest");
loopTest.addOperationalPolicy(opPolicy);
MicroServicePolicy microServicePolicy = getMicroServicePolicy("configPolicyTest", "",
- "{\"configtype\":\"json\"}", "tosca_definitions_version: tosca_simple_yaml_1_0_0",
- "{\"param1\":\"value1\"}", true);
+ "{\"configtype\":\"json\"}", "tosca_definitions_version: tosca_simple_yaml_1_0_0",
+ "{\"param1\":\"value1\"}", true);
loopTest.addMicroServicePolicy(microServicePolicy);
LoopLog loopLog = getLoopLog(LogType.INFO, "test message", loopTest);
loopTest.addLog(loopLog);
@@ -99,11 +99,11 @@ public class LoopToJsonTest {
Loop loopTestDeserialized = JsonUtils.GSON_JPA_MODEL.fromJson(jsonSerialized, Loop.class);
assertNotNull(loopTestDeserialized);
assertThat(loopTestDeserialized).isEqualToIgnoringGivenFields(loopTest, "svgRepresentation", "blueprint",
- "components");
+ "components");
assertThat(loopTestDeserialized.getComponent("DCAE").getState())
- .isEqualToComparingFieldByField(loopTest.getComponent("DCAE").getState());
- assertThat(loopTestDeserialized.getComponent("POLICY").getState())
- .isEqualToComparingFieldByField(loopTest.getComponent("POLICY").getState());
+ .isEqualToComparingFieldByField(loopTest.getComponent("DCAE").getState());
+ assertThat(loopTestDeserialized.getComponent("POLICY").getState()).isEqualToComparingOnlyGivenFields(
+ loopTest.getComponent("POLICY").getState(), "stateName", "description");
// svg and blueprint not exposed so wont be deserialized
assertThat(loopTestDeserialized.getBlueprint()).isEqualTo(null);
assertThat(loopTestDeserialized.getSvgRepresentation()).isEqualTo(null);
@@ -112,22 +112,22 @@ public class LoopToJsonTest {
assertThat(loopTestDeserialized.getMicroServicePolicies()).containsExactly(microServicePolicy);
assertThat(loopTestDeserialized.getLoopLogs()).containsExactly(loopLog);
assertThat((LoopLog) loopTestDeserialized.getLoopLogs().toArray()[0]).isEqualToIgnoringGivenFields(loopLog,
- "loop");
+ "loop");
}
@Test
public void createPoliciesPayloadPdpGroupTest() throws IOException {
Loop loopTest = getLoop("ControlLoopTest", "<xml></xml>", "yamlcontent", "{\"testname\":\"testvalue\"}",
- "123456789", "https://dcaetest.org", "UUID-blueprint");
+ "123456789", "https://dcaetest.org", "UUID-blueprint");
OperationalPolicy opPolicy = this.getOperationalPolicy(
- ResourceFileUtil.getResourceAsString("tosca/operational-policy-properties.json"), "GuardOpPolicyTest");
+ ResourceFileUtil.getResourceAsString("tosca/operational-policy-properties.json"), "GuardOpPolicyTest");
loopTest.addOperationalPolicy(opPolicy);
MicroServicePolicy microServicePolicy = getMicroServicePolicy("configPolicyTest", "",
- "{\"configtype\":\"json\"}", "tosca_definitions_version: tosca_simple_yaml_1_0_0",
- "{\"param1\":\"value1\"}", true);
+ "{\"configtype\":\"json\"}", "tosca_definitions_version: tosca_simple_yaml_1_0_0",
+ "{\"param1\":\"value1\"}", true);
loopTest.addMicroServicePolicy(microServicePolicy);
JSONAssert.assertEquals(ResourceFileUtil.getResourceAsString("tosca/pdp-group-policy-payload.json"),
- PolicyComponent.createPoliciesPayloadPdpGroup(loopTest), false);
+ PolicyComponent.createPoliciesPayloadPdpGroup(loopTest), false);
}
}