aboutsummaryrefslogtreecommitdiffstats
path: root/src/test
diff options
context:
space:
mode:
authorsebdet <sd378r@intl.att.com>2018-09-03 15:12:31 +0200
committersebdet <sd378r@intl.att.com>2018-09-03 16:30:11 +0200
commitd1ff5b9dcfce8c3a69b80832ad2cbe4dbaf1d9cc (patch)
tree8b24c46669da289ea6d20b8541fda523fa766321 /src/test
parent6651e17eab83a2231e1502f8083689f0ddc4751b (diff)
Update policy libraries
Update policy libraries + small reworking of the op policy code Issue-ID: CLAMP-215 Change-Id: I5dad2b9eaf4f6855d2c69f4533b3aae95d155d25 Signed-off-by: sebdet <sd378r@intl.att.com>
Diffstat (limited to 'src/test')
-rw-r--r--src/test/java/org/onap/clamp/clds/client/req/policy/OperationalPolicyAttributesConstructorTest.java128
-rw-r--r--src/test/java/org/onap/clamp/clds/client/req/policy/OperationalPolicyYamlFormatterTest.java35
-rw-r--r--src/test/java/org/onap/clamp/clds/it/OperationPolicyReqItCase.java13
-rw-r--r--src/test/java/org/onap/clamp/clds/it/PolicyClientItCase.java16
-rw-r--r--src/test/java/org/onap/clamp/clds/model/prop/ModelPropertiesTest.java38
5 files changed, 98 insertions, 132 deletions
diff --git a/src/test/java/org/onap/clamp/clds/client/req/policy/OperationalPolicyAttributesConstructorTest.java b/src/test/java/org/onap/clamp/clds/client/req/policy/OperationalPolicyAttributesConstructorTest.java
index c257ec3fd..a6a209a1e 100644
--- a/src/test/java/org/onap/clamp/clds/client/req/policy/OperationalPolicyAttributesConstructorTest.java
+++ b/src/test/java/org/onap/clamp/clds/client/req/policy/OperationalPolicyAttributesConstructorTest.java
@@ -26,6 +26,11 @@ package org.onap.clamp.clds.client.req.policy;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.common.collect.ImmutableMap;
+
+import java.io.IOException;
+import java.net.URLDecoder;
+import java.util.Map;
+
import org.assertj.core.api.Assertions;
import org.junit.Before;
import org.junit.Test;
@@ -43,121 +48,98 @@ import org.onap.policy.controlloop.policy.TargetType;
import org.onap.policy.controlloop.policy.builder.BuilderException;
import org.yaml.snakeyaml.Yaml;
-import java.io.IOException;
-import java.net.URLDecoder;
-import java.util.Map;
-
public class OperationalPolicyAttributesConstructorTest {
private static final String CONTROL_NAME = "ClosedLoop-d4629aee-970f-11e8-86c9-02552dda865e";
private ModelProperties modelProperties;
private PolicyChain policyChain;
- private OperationalPolicyYamlFormatter operationalPolicyYamlFormatter = new OperationalPolicyYamlFormatter();
- private OperationalPolicyAttributesConstructor operationalPolicyAttributesConstructor =
- new OperationalPolicyAttributesConstructor(operationalPolicyYamlFormatter);
-
@Before
public void setUp() throws Exception {
String modelProp = ResourceFileUtil
- .getResourceAsString("example/model-properties/policy/modelBpmnProperties.json");
- modelProperties = new ModelProperties("CLAMPDemoVFW_v1_0_3af8daec-6f10-4027-a3540",
- CONTROL_NAME, "PUT", false, "{}", modelProp);
+ .getResourceAsString("example/model-properties/policy/modelBpmnProperties.json");
+ modelProperties = new ModelProperties("CLAMPDemoVFW_v1_0_3af8daec-6f10-4027-a3540", CONTROL_NAME, "PUT", false,
+ "{}", modelProp);
policyChain = readPolicyChainFromResources();
}
-
@Test
public void shouldFormatRequestAttributes() throws IOException, BuilderException {
// given
ClampProperties mockClampProperties = createMockClampProperties(ImmutableMap.<String, String>builder()
- .put("op.templateName", "ClosedLoopControlName")
- .put("op.notificationTopic", "POLICY-CL-MGT")
- .put("op.controller", "amsterdam")
- .put("op.recipeTopic", "APPC")
- .build());
-
- //when
- Map<AttributeType, Map<String, String>> requestAttributes
- = operationalPolicyAttributesConstructor.formatAttributes(mockClampProperties, modelProperties,
- "789875c1-e788-432f-9a76-eac8ed889734", policyChain);
- //then
+ .put("op.templateName", "ClosedLoopControlName").put("op.notificationTopic", "POLICY-CL-MGT")
+ .put("op.controller", "amsterdam").put("op.recipeTopic", "APPC").build());
+
+ // when
+ Map<AttributeType, Map<String, String>> requestAttributes = OperationalPolicyAttributesConstructor
+ .formatAttributes(mockClampProperties, modelProperties, "789875c1-e788-432f-9a76-eac8ed889734",
+ policyChain);
+ // then
Assertions.assertThat(requestAttributes).containsKeys(AttributeType.MATCHING, AttributeType.RULE);
Assertions.assertThat(requestAttributes.get(AttributeType.MATCHING))
- .contains(Assertions.entry(OperationalPolicyAttributesConstructor.CONTROLLER, "amsterdam"));
+ .contains(Assertions.entry(OperationalPolicyAttributesConstructor.CONTROLLER, "amsterdam"));
Map<String, String> ruleParameters = requestAttributes.get(AttributeType.RULE);
Assertions.assertThat(ruleParameters).containsExactly(
- Assertions.entry(OperationalPolicyAttributesConstructor.MAX_RETRIES, "3"),
- Assertions.entry(OperationalPolicyAttributesConstructor.TEMPLATE_NAME, "ClosedLoopControlName"),
- Assertions.entry(OperationalPolicyAttributesConstructor.NOTIFICATION_TOPIC, "POLICY-CL-MGT"),
- Assertions.entry(OperationalPolicyAttributesConstructor.RECIPE_TOPIC, "APPC"),
- Assertions.entry(OperationalPolicyAttributesConstructor.RECIPE, "healthCheck"),
- Assertions.entry(OperationalPolicyAttributesConstructor.RESOURCE_ID,
- "cdb69724-57d5-4a22-b96c-4c345150fd0e"),
- Assertions.entry(OperationalPolicyAttributesConstructor.RETRY_TIME_LIMIT, "180"),
- Assertions.entry(OperationalPolicyAttributesConstructor.CLOSED_LOOP_CONTROL_NAME, CONTROL_NAME + "_1")
- );
+ Assertions.entry(OperationalPolicyAttributesConstructor.MAX_RETRIES, "3"),
+ Assertions.entry(OperationalPolicyAttributesConstructor.TEMPLATE_NAME, "ClosedLoopControlName"),
+ Assertions.entry(OperationalPolicyAttributesConstructor.NOTIFICATION_TOPIC, "POLICY-CL-MGT"),
+ Assertions.entry(OperationalPolicyAttributesConstructor.RECIPE_TOPIC, "APPC"),
+ Assertions.entry(OperationalPolicyAttributesConstructor.RECIPE, "healthCheck"),
+ Assertions.entry(OperationalPolicyAttributesConstructor.RESOURCE_ID,
+ "cdb69724-57d5-4a22-b96c-4c345150fd0e"),
+ Assertions.entry(OperationalPolicyAttributesConstructor.RETRY_TIME_LIMIT, "180"),
+ Assertions.entry(OperationalPolicyAttributesConstructor.CLOSED_LOOP_CONTROL_NAME, CONTROL_NAME + "_1"));
}
@Test
public void shouldFormatRequestAttributesWithProperControlLoopYaml() throws IOException, BuilderException {
- //given
- ClampProperties mockClampProperties = createMockClampProperties(ImmutableMap.<String, String>builder()
- .put("op.templateName", "ClosedLoopControlName")
- .put("op.operationTopic", "APPP-CL")
- .put("op.notificationTopic", "POLICY-CL-MGT")
- .put("op.controller", "amsterdam")
- .put("op.recipeTopic", "APPC")
- .build());
+ // given
+ ClampProperties mockClampProperties = createMockClampProperties(
+ ImmutableMap.<String, String>builder().put("op.templateName", "ClosedLoopControlName")
+ .put("op.operationTopic", "APPP-CL").put("op.notificationTopic", "POLICY-CL-MGT")
+ .put("op.controller", "amsterdam").put("op.recipeTopic", "APPC").build());
Policy expectedPolicy = new Policy("6f76ad0b-ea9d-4a92-8d7d-6a6367ce2c77", "healthCheck Policy",
- "healthCheck Policy - the trigger (no parent) policy - created by CLDS", "APPC",
- null, new Target(TargetType.VM, "cdb69724-57d5-4a22-b96c-4c345150fd0e"),
- "healthCheck", 3, 180);
-
- //when
- Map<AttributeType, Map<String, String>> requestAttributes = operationalPolicyAttributesConstructor
- .formatAttributes(mockClampProperties, modelProperties,
- "789875c1-e788-432f-9a76-eac8ed889734", policyChain);
-
- //then
- Assertions.assertThat(requestAttributes)
- .containsKeys(AttributeType.MATCHING, AttributeType.RULE);
- Assertions.assertThat(requestAttributes
- .get(AttributeType.MATCHING))
- .contains(Assertions.entry("controller", "amsterdam"));
+ "healthCheck Policy - the trigger (no parent) policy - created by CLDS", "APPC", null,
+ new Target(TargetType.VM, "cdb69724-57d5-4a22-b96c-4c345150fd0e"), "healthCheck", 3, 180);
+
+ // when
+ Map<AttributeType, Map<String, String>> requestAttributes = OperationalPolicyAttributesConstructor
+ .formatAttributes(mockClampProperties, modelProperties, "789875c1-e788-432f-9a76-eac8ed889734",
+ policyChain);
+
+ // then
+ Assertions.assertThat(requestAttributes).containsKeys(AttributeType.MATCHING, AttributeType.RULE);
+ Assertions.assertThat(requestAttributes.get(AttributeType.MATCHING))
+ .contains(Assertions.entry("controller", "amsterdam"));
Map<String, String> ruleParameters = requestAttributes.get(AttributeType.RULE);
Assertions.assertThat(ruleParameters).contains(
- Assertions.entry(OperationalPolicyAttributesConstructor.OPERATION_TOPIC, "APPP-CL"),
- Assertions.entry(OperationalPolicyAttributesConstructor.TEMPLATE_NAME, "ClosedLoopControlName"),
- Assertions.entry(OperationalPolicyAttributesConstructor.NOTIFICATION_TOPIC, "POLICY-CL-MGT"),
- Assertions.entry(OperationalPolicyAttributesConstructor.CLOSED_LOOP_CONTROL_NAME, CONTROL_NAME + "_1")
- );
-
- String controlLoopYaml = URLDecoder.decode(
- ruleParameters.get(OperationalPolicyAttributesConstructor.CONTROL_LOOP_YAML), "UTF-8");
+ Assertions.entry(OperationalPolicyAttributesConstructor.OPERATION_TOPIC, "APPP-CL"),
+ Assertions.entry(OperationalPolicyAttributesConstructor.TEMPLATE_NAME, "ClosedLoopControlName"),
+ Assertions.entry(OperationalPolicyAttributesConstructor.NOTIFICATION_TOPIC, "POLICY-CL-MGT"),
+ Assertions.entry(OperationalPolicyAttributesConstructor.CLOSED_LOOP_CONTROL_NAME, CONTROL_NAME + "_1"));
+
+ String controlLoopYaml = URLDecoder
+ .decode(ruleParameters.get(OperationalPolicyAttributesConstructor.CONTROL_LOOP_YAML), "UTF-8");
ControlLoopPolicy controlLoopPolicy = new Yaml().load(controlLoopYaml);
Assertions.assertThat(controlLoopPolicy.getControlLoop().getControlLoopName()).isEqualTo(CONTROL_NAME);
- Assertions.assertThat(controlLoopPolicy.getPolicies())
- .usingElementComparatorIgnoringFields("id")
- .containsExactly(expectedPolicy);
+ Assertions.assertThat(controlLoopPolicy.getPolicies()).usingElementComparatorIgnoringFields("id")
+ .containsExactly(expectedPolicy);
}
-
private ClampProperties createMockClampProperties(ImmutableMap<String, String> propertiesMap) {
ClampProperties props = Mockito.mock(ClampProperties.class);
- propertiesMap.forEach((property, value) ->
- Mockito.when(props.getStringValue(Matchers.matches(property), Matchers.any())).thenReturn(value)
- );
+ propertiesMap.forEach((property, value) -> Mockito
+ .when(props.getStringValue(Matchers.matches(property), Matchers.any())).thenReturn(value));
return props;
}
private PolicyChain readPolicyChainFromResources() throws IOException {
String policyChainText = ResourceFileUtil
- .getResourceAsString("example/operational-policy/json-policy-chain.json");
+ .getResourceAsString("example/operational-policy/json-policy-chain.json");
JsonNode policyChainNode = new ObjectMapper().readTree(policyChainText);
return new PolicyChain(policyChainNode);
}
diff --git a/src/test/java/org/onap/clamp/clds/client/req/policy/OperationalPolicyYamlFormatterTest.java b/src/test/java/org/onap/clamp/clds/client/req/policy/OperationalPolicyYamlFormatterTest.java
index 046d7394d..662beb2b4 100644
--- a/src/test/java/org/onap/clamp/clds/client/req/policy/OperationalPolicyYamlFormatterTest.java
+++ b/src/test/java/org/onap/clamp/clds/client/req/policy/OperationalPolicyYamlFormatterTest.java
@@ -35,37 +35,30 @@ import org.onap.policy.sdc.ResourceType;
public class OperationalPolicyYamlFormatterTest {
- private OperationalPolicyYamlFormatter policyYamlFormatter = new OperationalPolicyYamlFormatter();
-
@Test
- public void shouldConvertGivenStringsToResourceObjects()
- throws SecurityException,
- IllegalArgumentException {
+ public void shouldConvertGivenStringsToResourceObjects() throws SecurityException, IllegalArgumentException {
- //given
+ // given
List<String> stringList = Arrays.asList("test1", "test2", "test3", "test4");
- //when
- Resource[] resources = policyYamlFormatter.convertToResources(stringList, ResourceType.VF);
+ // when
+ Resource[] resources = OperationalPolicyYamlFormatter.convertToResources(stringList, ResourceType.VF);
- //then
- Assertions.assertThat(resources).extracting(Resource::getResourceName)
- .containsExactly("test1", "test2", "test3", "test4");
+ // then
+ Assertions.assertThat(resources).extracting(Resource::getResourceName).containsExactly("test1", "test2",
+ "test3", "test4");
}
@Test
- public void shouldConvertGivenStringsToPolicyResults()
- throws SecurityException,
- IllegalArgumentException {
- //given
+ public void shouldConvertGivenStringsToPolicyResults() throws SecurityException, IllegalArgumentException {
+ // given
List<String> stringList = Arrays.asList("FAILURE", "SUCCESS", "FAILURE_GUARD", "FAILURE_TIMEOUT");
- //when
- PolicyResult[] policyResults = policyYamlFormatter.convertToPolicyResults(stringList);
+ // when
+ PolicyResult[] policyResults = OperationalPolicyYamlFormatter.convertToPolicyResults(stringList);
- //then
- Assertions.assertThat(policyResults)
- .containsExactly(PolicyResult.FAILURE, PolicyResult.SUCCESS,
- PolicyResult.FAILURE_GUARD, PolicyResult.FAILURE_TIMEOUT);
+ // then
+ Assertions.assertThat(policyResults).containsExactly(PolicyResult.FAILURE, PolicyResult.SUCCESS,
+ PolicyResult.FAILURE_GUARD, PolicyResult.FAILURE_TIMEOUT);
}
} \ No newline at end of file
diff --git a/src/test/java/org/onap/clamp/clds/it/OperationPolicyReqItCase.java b/src/test/java/org/onap/clamp/clds/it/OperationPolicyReqItCase.java
index ad58ea1e4..344641a72 100644
--- a/src/test/java/org/onap/clamp/clds/it/OperationPolicyReqItCase.java
+++ b/src/test/java/org/onap/clamp/clds/it/OperationPolicyReqItCase.java
@@ -19,7 +19,7 @@
* ============LICENSE_END============================================
* Modifications copyright (c) 2018 Nokia
* ===================================================================
- *
+ *
*/
package org.onap.clamp.clds.it;
@@ -56,21 +56,18 @@ public class OperationPolicyReqItCase {
@Autowired
private ClampProperties refProp;
- @Autowired
- private OperationalPolicyAttributesConstructor operationalPolicyAttributesConstructor;
-
@Test
public void formatAttributesTest() throws IOException, BuilderException {
String modelBpmnProp = ResourceFileUtil
- .getResourceAsString("example/model-properties/policy/modelBpmnProperties.json");
+ .getResourceAsString("example/model-properties/policy/modelBpmnProperties.json");
String modelBpmn = ResourceFileUtil.getResourceAsString("example/model-properties/policy/modelBpmn.json");
ModelProperties modelProperties = new ModelProperties("testModel", "controlNameTest", CldsEvent.ACTION_SUBMIT,
- true, modelBpmn, modelBpmnProp);
+ true, modelBpmn, modelBpmnProp);
List<Map<AttributeType, Map<String, String>>> attributes = new ArrayList<>();
if (modelProperties.getType(Policy.class).isFound()) {
for (PolicyChain policyChain : modelProperties.getType(Policy.class).getPolicyChains()) {
- attributes.add(operationalPolicyAttributesConstructor.formatAttributes(refProp, modelProperties,
- modelProperties.getType(Policy.class).getId(), policyChain));
+ attributes.add(OperationalPolicyAttributesConstructor.formatAttributes(refProp, modelProperties,
+ modelProperties.getType(Policy.class).getId(), policyChain));
}
}
assertFalse(attributes.isEmpty());
diff --git a/src/test/java/org/onap/clamp/clds/it/PolicyClientItCase.java b/src/test/java/org/onap/clamp/clds/it/PolicyClientItCase.java
index 2400d4ab6..59fad9a69 100644
--- a/src/test/java/org/onap/clamp/clds/it/PolicyClientItCase.java
+++ b/src/test/java/org/onap/clamp/clds/it/PolicyClientItCase.java
@@ -19,7 +19,7 @@
* ============LICENSE_END============================================
* Modifications copyright (c) 2018 Nokia
* ===================================================================
- *
+ *
*/
package org.onap.clamp.clds.it;
@@ -66,8 +66,6 @@ public class PolicyClientItCase {
private ClampProperties refProp;
@Autowired
private PolicyClient policyClient;
- @Autowired
- private OperationalPolicyAttributesConstructor operationalPolicyAttributesConstructor;
String modelProp;
String modelBpmnProp;
@@ -91,8 +89,8 @@ public class PolicyClientItCase {
if (policy.isFound()) {
for (PolicyChain policyChain : policy.getPolicyChains()) {
String operationalPolicyRequestUuid = UUID.randomUUID().toString();
- Map<AttributeType, Map<String, String>> attributes = operationalPolicyAttributesConstructor
- .formatAttributes(refProp, prop, policy.getId(), policyChain);
+ Map<AttributeType, Map<String, String>> attributes = OperationalPolicyAttributesConstructor
+ .formatAttributes(refProp, prop, policy.getId(), policyChain);
policyClient.sendBrmsPolicy(attributes, prop, operationalPolicyRequestUuid);
}
}
@@ -166,14 +164,14 @@ public class PolicyClientItCase {
assertNotNull(policyConfiguration.getNotificationUebServers());
assertEquals(8, policyConfiguration.getProperties().size());
assertTrue(((String) policyConfiguration.getProperties().get(PolicyConfiguration.PDP_URL1))
- .contains("/pdp/ , testpdp, alpha123"));
+ .contains("/pdp/ , testpdp, alpha123"));
assertTrue(((String) policyConfiguration.getProperties().get(PolicyConfiguration.PDP_URL2))
- .contains("/pdp/ , testpdp, alpha123"));
+ .contains("/pdp/ , testpdp, alpha123"));
assertTrue(((String) policyConfiguration.getProperties().get(PolicyConfiguration.PAP_URL))
- .contains("/pap/ , testpap, alpha123"));
+ .contains("/pap/ , testpap, alpha123"));
assertEquals("websocket", policyConfiguration.getProperties().get(PolicyConfiguration.NOTIFICATION_TYPE));
assertEquals("localhost",
- policyConfiguration.getProperties().get(PolicyConfiguration.NOTIFICATION_UEB_SERVERS));
+ policyConfiguration.getProperties().get(PolicyConfiguration.NOTIFICATION_UEB_SERVERS));
assertEquals("python", policyConfiguration.getProperties().get(PolicyConfiguration.CLIENT_ID));
assertEquals("dGVzdA==", policyConfiguration.getProperties().get(PolicyConfiguration.CLIENT_KEY));
assertEquals("DEVL", policyConfiguration.getProperties().get(PolicyConfiguration.ENVIRONMENT));
diff --git a/src/test/java/org/onap/clamp/clds/model/prop/ModelPropertiesTest.java b/src/test/java/org/onap/clamp/clds/model/prop/ModelPropertiesTest.java
index 751d70404..295ccc59f 100644
--- a/src/test/java/org/onap/clamp/clds/model/prop/ModelPropertiesTest.java
+++ b/src/test/java/org/onap/clamp/clds/model/prop/ModelPropertiesTest.java
@@ -18,7 +18,7 @@
* limitations under the License.
* ============LICENSE_END============================================
* ===================================================================
- *
+ *
*/
package org.onap.clamp.clds.model.prop;
@@ -52,10 +52,10 @@ public class ModelPropertiesTest {
@Test
public void testTcaModelDecoding() throws IOException {
String modelBpmnProp = ResourceFileUtil
- .getResourceAsString("example/model-properties/tca/modelBpmnProperties.json");
+ .getResourceAsString("example/model-properties/tca/modelBpmnProperties.json");
String modelBpmn = ResourceFileUtil.getResourceAsString("example/model-properties/tca/modelBpmn.json");
ModelProperties prop = new ModelProperties("example-model-name", "example-control-name", null, true, modelBpmn,
- modelBpmnProp);
+ modelBpmnProp);
Policy policy = prop.getType(Policy.class);
assertTrue(policy.isFound());
assertEquals(1, policy.getPolicyChains().size());
@@ -76,23 +76,21 @@ public class ModelPropertiesTest {
assertEquals(2, tca.getTcaItem().getTcaThresholds().size());
assertEquals("ABATED", tca.getTcaItem().getTcaThresholds().get(0).getClosedLoopEventStatus());
assertEquals("$.event.measurementsForVfScalingFields.additionalMeasurements[*].arrayOfFields[0].value",
- tca.getTcaItem().getTcaThresholds().get(0).getFieldPath());
+ tca.getTcaItem().getTcaThresholds().get(0).getFieldPath());
assertEquals("LESS_OR_EQUAL", tca.getTcaItem().getTcaThresholds().get(0).getOperator());
assertEquals(Integer.valueOf(123), tca.getTcaItem().getTcaThresholds().get(0).getThreshold());
assertEquals("ONSET", tca.getTcaItem().getTcaThresholds().get(1).getClosedLoopEventStatus());
assertEquals("$.event.measurementsForVfScalingFields.additionalMeasurements[*].arrayOfFields[0].value",
- tca.getTcaItem().getTcaThresholds().get(1).getFieldPath());
+ tca.getTcaItem().getTcaThresholds().get(1).getFieldPath());
assertEquals("GREATER_OR_EQUAL", tca.getTcaItem().getTcaThresholds().get(1).getOperator());
assertEquals(Integer.valueOf(123), tca.getTcaItem().getTcaThresholds().get(1).getThreshold());
// Test global prop
assertEquals("vnfRecipe", prop.getGlobal().getActionSet());
assertEquals("4cc5b45a-1f63-4194-8100-cd8e14248c92", prop.getGlobal().getService());
- assertTrue(Arrays.equals(new String[] {
- "023a3f0d-1161-45ff-b4cf-8918a8ccf3ad"
- }, prop.getGlobal().getResourceVf().toArray()));
- assertTrue(Arrays.equals(new String[] {
- "SNDGCA64", "ALPRGAED", "LSLEILAA", "MDTWNJC1"
- }, prop.getGlobal().getLocation().toArray()));
+ assertTrue(Arrays.equals(new String[] { "023a3f0d-1161-45ff-b4cf-8918a8ccf3ad" },
+ prop.getGlobal().getResourceVf().toArray()));
+ assertTrue(Arrays.equals(new String[] { "SNDGCA64", "ALPRGAED", "LSLEILAA", "MDTWNJC1" },
+ prop.getGlobal().getLocation().toArray()));
assertEquals("value1", prop.getGlobal().getDeployParameters().get("input1").asText());
assertEquals("value2", prop.getGlobal().getDeployParameters().get("input2").asText());
}
@@ -100,10 +98,10 @@ public class ModelPropertiesTest {
@Test
public void testHolmesModelDecoding() throws IOException {
String modelBpmnProp = ResourceFileUtil
- .getResourceAsString("example/model-properties/holmes/modelBpmnProperties.json");
+ .getResourceAsString("example/model-properties/holmes/modelBpmnProperties.json");
String modelBpmn = ResourceFileUtil.getResourceAsString("example/model-properties/holmes/modelBpmn.json");
ModelProperties prop = new ModelProperties("example-model-name", "example-control-name", null, true, modelBpmn,
- modelBpmnProp);
+ modelBpmnProp);
Policy policy = prop.getType(Policy.class);
assertTrue(policy.isFound());
assertEquals(1, policy.getPolicyChains().size());
@@ -122,12 +120,10 @@ public class ModelPropertiesTest {
// Test global prop
assertEquals("vnfRecipe", prop.getGlobal().getActionSet());
assertEquals("4cc5b45a-1f63-4194-8100-cd8e14248c92", prop.getGlobal().getService());
- assertTrue(Arrays.equals(new String[] {
- "f5213e3a-9191-4362-93b5-b67f8d770e44"
- }, prop.getGlobal().getResourceVf().toArray()));
- assertTrue(Arrays.equals(new String[] {
- "SNDGCA64", "ALPRGAED", "LSLEILAA", "MDTWNJC1"
- }, prop.getGlobal().getLocation().toArray()));
+ assertTrue(Arrays.equals(new String[] { "f5213e3a-9191-4362-93b5-b67f8d770e44" },
+ prop.getGlobal().getResourceVf().toArray()));
+ assertTrue(Arrays.equals(new String[] { "SNDGCA64", "ALPRGAED", "LSLEILAA", "MDTWNJC1" },
+ prop.getGlobal().getLocation().toArray()));
assertEquals("value1", prop.getGlobal().getDeployParameters().get("input1").asText());
assertEquals("value2", prop.getGlobal().getDeployParameters().get("input2").asText());
}
@@ -135,8 +131,8 @@ public class ModelPropertiesTest {
@Test
public void testGetVf() throws IOException {
CldsModel cldsModel = new CldsModel();
- cldsModel.setPropText(
- ResourceFileUtil.getResourceAsString("example/model-properties/tca/modelBpmnProperties.json"));
+ cldsModel
+ .setPropText(ResourceFileUtil.getResourceAsString("example/model-properties/tca/modelBpmnProperties.json"));
assertEquals("023a3f0d-1161-45ff-b4cf-8918a8ccf3ad", ModelProperties.getVf(cldsModel));
}
} \ No newline at end of file