diff options
author | Eddy Hautot <eh552t@intl.att.com> | 2018-03-27 16:24:35 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2018-03-27 16:24:35 +0000 |
commit | f672d393226629afe58b660eaec92d487206f519 (patch) | |
tree | 1761a632df95667e36ac50ab9c79ad2e0517896a /src/test | |
parent | 1ab6386b4dd920b39a994b1288673d2e7ee3957b (diff) | |
parent | 540fff37e161d693e8f9168a3ddac1ff4866c33a (diff) |
Merge changes from topic 'bp/input'
* changes:
Add blueprint input
Unit tests improvement
Diffstat (limited to 'src/test')
4 files changed, 297 insertions, 254 deletions
diff --git a/src/test/java/org/onap/clamp/clds/it/sdc/controller/installer/CsarInstallerItCase.java b/src/test/java/org/onap/clamp/clds/it/sdc/controller/installer/CsarInstallerItCase.java index 40dffcd6b..fc5cb040f 100644 --- a/src/test/java/org/onap/clamp/clds/it/sdc/controller/installer/CsarInstallerItCase.java +++ b/src/test/java/org/onap/clamp/clds/it/sdc/controller/installer/CsarInstallerItCase.java @@ -57,8 +57,8 @@ import org.springframework.test.context.junit4.SpringRunner; public class CsarInstallerItCase { private static final String CSAR_ARTIFACT_NAME = "testArtifact.csar"; - private static final String SERVICE_UUID = "serviceUUID"; - private static final String RESOURCE1_UUID = "resource1UUID"; + private static final String INVARIANT_SERVICE_UUID = "4cc5b45a-1f63-4194-8100-cd8e14248c92"; + private static final String INVARIANT_RESOURCE1_UUID = "ba4d4b5d-f861-4155-886b-b1cdba5e0957"; @Autowired private CsarInstaller csarInstaller; @Autowired @@ -84,8 +84,8 @@ public class CsarInstallerItCase { Mockito.when(csarHelper.getServiceMetadata()).thenReturn(data); Mockito.when(csarHandler.getSdcCsarHelper()).thenReturn(csarHelper); Mockito.when(csarHandler.getBlueprintArtifactName()).thenReturn(CSAR_ARTIFACT_NAME); - Mockito.when(csarHandler.getBlueprintInvariantServiceUuid()).thenReturn(SERVICE_UUID); - Mockito.when(csarHandler.getBlueprintInvariantResourceUuid()).thenReturn(RESOURCE1_UUID); + Mockito.when(csarHandler.getBlueprintInvariantServiceUuid()).thenReturn(INVARIANT_SERVICE_UUID); + Mockito.when(csarHandler.getBlueprintInvariantResourceUuid()).thenReturn(INVARIANT_RESOURCE1_UUID); return csarHandler; } 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 a7ab94c57..25daf01f3 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 @@ -28,6 +28,7 @@ import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; import java.io.IOException; +import java.util.Arrays; import org.junit.Before; import org.junit.Test; @@ -84,6 +85,17 @@ public class ModelPropertiesTest { 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())); + assertEquals("value1", prop.getGlobal().getDeployParameters().get("input1").asText()); + assertEquals("value2", prop.getGlobal().getDeployParameters().get("input2").asText()); } @Test @@ -108,6 +120,17 @@ public class ModelPropertiesTest { assertTrue(holmes.isFound()); assertEquals("configPolicy1", holmes.getConfigPolicyName()); assertEquals("blabla", holmes.getCorrelationLogic()); + // 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())); + assertEquals("value1", prop.getGlobal().getDeployParameters().get("input1").asText()); + assertEquals("value2", prop.getGlobal().getDeployParameters().get("input2").asText()); } @Test diff --git a/src/test/resources/example/model-properties/holmes/modelBpmnProperties.json b/src/test/resources/example/model-properties/holmes/modelBpmnProperties.json index 43fecc9ea..6ac97ec85 100644 --- a/src/test/resources/example/model-properties/holmes/modelBpmnProperties.json +++ b/src/test/resources/example/model-properties/holmes/modelBpmnProperties.json @@ -1,109 +1,122 @@ { - "Holmes_0i4n2mm": [ - { - "name": "correlationalLogic", - "value": "blabla" - }, - { - "name": "configPolicyName", - "value": "configPolicy1" - } - ], - "Policy_0honxgv": { - "policy1": [ - { - "name": "pname", - "value": "policy1" - }, - { - "name": "pid", - "value": "0" - }, - { - "name": "timeout", - "value": "345" - }, - { - "policyConfigurations": [ - [ - { - "name": "maxRetries", - "value": [ - "3" - ] - }, - { - "name": "retryTimeLimit", - "value": [ - "180" - ] - }, - { - "name": "_id", - "value": [ - "dGLuNqg" - ] - }, - { - "name": "parentPolicy", - "value": [ - "" - ] - }, - { - "name": "targetResourceId", - "value": [ - "resourceid" - ] - } - ] - ] - } - ] - }, - "global": [ - { - "name": "actionSet", - "value": [ - "vnfRecipe" - ] - }, - { - "name": "vf", - "value": [ - "f5213e3a-9191-4362-93b5-b67f8d770e44" - ] - }, - { - "name": "location", - "value": [ - "SNDGCA64", - "ALPRGAED", - "LSLEILAA", - "MDTWNJC1" - ] - } - ], - "shared": { - "byService": { - "": { - "vf": { - "": "" - }, - "location": { - "": "" - }, - "alarmCondition": { - "": "" - } - } - }, - "byVf": { - "": { - "vfc": { - "": "" - } - } - } - } + "Holmes_0i4n2mm": [ + { + "name": "correlationalLogic", + "value": "blabla" + }, + { + "name": "configPolicyName", + "value": "configPolicy1" + } + ], + "Policy_0honxgv": { + "policy1": [ + { + "name": "pname", + "value": "policy1" + }, + { + "name": "pid", + "value": "0" + }, + { + "name": "timeout", + "value": "345" + }, + { + "policyConfigurations": [ + [ + { + "name": "maxRetries", + "value": [ + "3" + ] + }, + { + "name": "retryTimeLimit", + "value": [ + "180" + ] + }, + { + "name": "_id", + "value": [ + "dGLuNqg" + ] + }, + { + "name": "parentPolicy", + "value": [ + "" + ] + }, + { + "name": "targetResourceId", + "value": [ + "resourceid" + ] + } + ] + ] + } + ] + }, + "global": [ + { + "name": "actionSet", + "value": [ + "vnfRecipe" + ] + }, + { + "name": "service", + "value": [ + "4cc5b45a-1f63-4194-8100-cd8e14248c92" + ] + }, + { + "name": "vf", + "value": [ + "f5213e3a-9191-4362-93b5-b67f8d770e44" + ] + }, + { + "name": "location", + "value": [ + "SNDGCA64", + "ALPRGAED", + "LSLEILAA", + "MDTWNJC1" + ] + }, + { + "name": "deployParameters", + "value": { + "input1": "value1", + "input2": "value2" + } + } + ], + "shared": { + "byService": { + "": { + "vf": { + "": "" + }, + "location": { + "": "" + }, + "alarmCondition": { + "": "" + } + } + }, + "byVf": { + "": { + "vfc": { + "": "" + } + } + } + } } diff --git a/src/test/resources/example/model-properties/tca/modelBpmnProperties.json b/src/test/resources/example/model-properties/tca/modelBpmnProperties.json index 8e2780cda..ce0f317dd 100644 --- a/src/test/resources/example/model-properties/tca/modelBpmnProperties.json +++ b/src/test/resources/example/model-properties/tca/modelBpmnProperties.json @@ -1,145 +1,152 @@ { - "TCA_1jy9to4": { - "group1": [ - { - "name": "tname", - "value": "group1" - }, - { - "name": "tuuid", - "value": "f734f031-10aa-t8fb-330f-04dde2886325" - }, - { - "name": "tcaPolId", - "value": "policy1" - }, - { - "name": "eventName", - "value": "vFirewallBroadcastPackets" - }, - { - "name": "controlLoopSchemaType", - "value": "VNF" - }, - { - "serviceConfigurations": [ - [ - "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedBroadcastPacketsAccumulated", - "LESS_OR_EQUAL", - "123", - "ABATED" - ], - [ - "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedDiscardedPacketsDelta", - "GREATER_OR_EQUAL", - "123", - "ONSET" - ] - ] - } - ] - }, - "Policy_0honxgv": { - "policy1": [ - { - "name": "pname", - "value": "policy1" - }, - { - "name": "pid", - "value": "0" - }, - { - "name": "timeout", - "value": "345" - }, - { - "policyConfigurations": [ - [ - { - "name": "maxRetries", - "value": [ - "3" - ] - }, - { - "name": "retryTimeLimit", - "value": [ - "180" - ] - }, - { - "name": "_id", - "value": [ - "dGLuNqg" - ] - }, - { - "name": "parentPolicy", - "value": [ - "" - ] - }, - { - "name": "targetResourceId", - "value": [ - "resourceid" - ] - } - ] - ] - } - ] - }, - "global": [ - { - "name": "actionSet", - "value": [ - "vnfRecipe" - ] - }, - { - "name": "service", - "value": [ - "4cc5b45a-1f63-4194-8100-cd8e14248c92" - ] - }, - { - "name": "vf", - "value": [ - "023a3f0d-1161-45ff-b4cf-8918a8ccf3ad" - ] - }, - { - "name": "location", - "value": [ - "SNDGCA64", - "ALPRGAED", - "LSLEILAA", - "MDTWNJC1" - ] - } - ], - "shared": { - "byService": { - "": { - "vf": { - "": "" - }, - "location": { - "": "" - }, - "alarmCondition": { - "": "" - } - } - }, - "byVf": { - "": { - "vfc": { - "": "" - } - } - } - } + "TCA_1jy9to4": { + "group1": [ + { + "name": "tname", + "value": "group1" + }, + { + "name": "tuuid", + "value": "f734f031-10aa-t8fb-330f-04dde2886325" + }, + { + "name": "tcaPolId", + "value": "policy1" + }, + { + "name": "eventName", + "value": "vFirewallBroadcastPackets" + }, + { + "name": "controlLoopSchemaType", + "value": "VNF" + }, + { + "serviceConfigurations": [ + [ + "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedBroadcastPacketsAccumulated", + "LESS_OR_EQUAL", + "123", + "ABATED" + ], + [ + "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedDiscardedPacketsDelta", + "GREATER_OR_EQUAL", + "123", + "ONSET" + ] + ] + } + ] + }, + "Policy_0honxgv": { + "policy1": [ + { + "name": "pname", + "value": "policy1" + }, + { + "name": "pid", + "value": "0" + }, + { + "name": "timeout", + "value": "345" + }, + { + "policyConfigurations": [ + [ + { + "name": "maxRetries", + "value": [ + "3" + ] + }, + { + "name": "retryTimeLimit", + "value": [ + "180" + ] + }, + { + "name": "_id", + "value": [ + "dGLuNqg" + ] + }, + { + "name": "parentPolicy", + "value": [ + "" + ] + }, + { + "name": "targetResourceId", + "value": [ + "resourceid" + ] + } + ] + ] + } + ] + }, + "global": [ + { + "name": "actionSet", + "value": [ + "vnfRecipe" + ] + }, + { + "name": "service", + "value": [ + "4cc5b45a-1f63-4194-8100-cd8e14248c92" + ] + }, + { + "name": "vf", + "value": [ + "023a3f0d-1161-45ff-b4cf-8918a8ccf3ad" + ] + }, + { + "name": "location", + "value": [ + "SNDGCA64", + "ALPRGAED", + "LSLEILAA", + "MDTWNJC1" + ] + }, + { + "name": "deployParameters", + "value": { + "input1": "value1", + "input2": "value2" + } + } + ], + "shared": { + "byService": { + "": { + "vf": { + "": "" + }, + "location": { + "": "" + }, + "alarmCondition": { + "": "" + } + } + }, + "byVf": { + "": { + "vfc": { + "": "" + } + } + } + } } |