From: sebdet Date: Thu, 25 Apr 2019 10:24:45 +0000 (+0200) Subject: Rework code for policy type X-Git-Tag: 4.0.0~12 X-Git-Url: https://gerrit.onap.org/r/gitweb?a=commitdiff_plain;h=12700b07bf4850f7de97b69e9b2fcc96e0540b21;hp=7fe3f4b2e79bfe1421bd4d6c33b35d4fd3d18e65;p=clamp.git Rework code for policy type Rework unit tests + test resources and code for policy type renaming Issue-ID: CLAMP-356 Change-Id: Id64c620b42347d6f5535523f33a0a04a54a60fa2 Signed-off-by: sebdet --- diff --git a/src/main/java/org/onap/clamp/clds/sdc/controller/installer/BlueprintParser.java b/src/main/java/org/onap/clamp/clds/sdc/controller/installer/BlueprintParser.java index 5dcffd61..809904f2 100644 --- a/src/main/java/org/onap/clamp/clds/sdc/controller/installer/BlueprintParser.java +++ b/src/main/java/org/onap/clamp/clds/sdc/controller/installer/BlueprintParser.java @@ -89,7 +89,7 @@ public class BlueprintParser { } String msName = theBiggestMicroServiceKey.toLowerCase().contains(HOLMES_PREFIX) ? HOLMES : TCA; return Collections - .singletonList(new MicroService(msName, "onap.policy.monitoring.cdap.tca.hi.lo.app", "", "", "")); + .singletonList(new MicroService(msName, "onap.policies.monitoring.cdap.tca.hi.lo.app", "", "", "")); } String getName(Entry entry) { diff --git a/src/main/java/org/onap/clamp/clds/tosca/ToscaSchemaConstants.java b/src/main/java/org/onap/clamp/clds/tosca/ToscaSchemaConstants.java index f1344723..595b1805 100644 --- a/src/main/java/org/onap/clamp/clds/tosca/ToscaSchemaConstants.java +++ b/src/main/java/org/onap/clamp/clds/tosca/ToscaSchemaConstants.java @@ -58,7 +58,7 @@ public class ToscaSchemaConstants { public static final String PATTERN = "pattern"; // Prefix for policy nodes - public static final String POLICY_NODE = "onap.policy."; + public static final String POLICY_NODE = "onap.policies."; // Prefix for data nodes public static final String POLICY_DATA = "onap.datatypes."; diff --git a/src/test/java/org/onap/clamp/clds/sdc/controller/installer/BlueprintParserTest.java b/src/test/java/org/onap/clamp/clds/sdc/controller/installer/BlueprintParserTest.java index e86fb27d..211bb390 100644 --- a/src/test/java/org/onap/clamp/clds/sdc/controller/installer/BlueprintParserTest.java +++ b/src/test/java/org/onap/clamp/clds/sdc/controller/installer/BlueprintParserTest.java @@ -163,8 +163,8 @@ public class BlueprintParserTest { @Test public void fallBackToOneMicroServiceTCATest() { - MicroService tcaMS = new MicroService(BlueprintParser.TCA, "onap.policy.monitoring.cdap.tca.hi.lo.app", "", "", - ""); + MicroService tcaMS = new MicroService(BlueprintParser.TCA, "onap.policies.monitoring.cdap.tca.hi.lo.app", "", + "", ""); List expected = Collections.singletonList(tcaMS); List actual = new BlueprintParser().fallbackToOneMicroService(microServiceBlueprintOldStyleTCA); @@ -174,7 +174,7 @@ public class BlueprintParserTest { @Test public void fallBackToOneMicroServiceHolmesTest() { - MicroService holmesMS = new MicroService(BlueprintParser.HOLMES, "onap.policy.monitoring.cdap.tca.hi.lo.app", + MicroService holmesMS = new MicroService(BlueprintParser.HOLMES, "onap.policies.monitoring.cdap.tca.hi.lo.app", "", "", ""); List expected = Collections.singletonList(holmesMS); diff --git a/src/test/java/org/onap/clamp/policy/microservice/MicroServicePayloadTest.java b/src/test/java/org/onap/clamp/policy/microservice/MicroServicePayloadTest.java index c511f341..68925a91 100644 --- a/src/test/java/org/onap/clamp/policy/microservice/MicroServicePayloadTest.java +++ b/src/test/java/org/onap/clamp/policy/microservice/MicroServicePayloadTest.java @@ -37,7 +37,7 @@ public class MicroServicePayloadTest { @Test public void testPayloadConstruction() throws IOException { - MicroServicePolicy policy = new MicroServicePolicy("testPolicy", "onap.policy.monitoring.cdap.tca.hi.lo.app", + MicroServicePolicy policy = new MicroServicePolicy("testPolicy", "onap.policies.monitoring.cdap.tca.hi.lo.app", ResourceFileUtil.getResourceAsString("tosca/tosca_example.yaml"), false, new HashSet<>()); policy.setProperties(JsonUtils.GSON.fromJson( ResourceFileUtil.getResourceAsString("tosca/micro-service-policy-properties.json"), JsonObject.class)); diff --git a/src/test/resources/example/sdc/blueprint-dcae/tca.yaml b/src/test/resources/example/sdc/blueprint-dcae/tca.yaml index b2bf8bb9..edaa0be2 100644 --- a/src/test/resources/example/sdc/blueprint-dcae/tca.yaml +++ b/src/test/resources/example/sdc/blueprint-dcae/tca.yaml @@ -17,7 +17,7 @@ node_templates: properties: policy_id: get_input: policy_id - policy_type_id: onap.policy.monitoring.cdap.tca.hi.lo.app + policy_type_id: onap.policies.monitoring.cdap.tca.hi.lo.app cdap_host_host: type: dcae.nodes.StreamingAnalytics.SelectedCDAPInfrastructure properties: diff --git a/src/test/resources/example/sdc/blueprint-dcae/tca_2.yaml b/src/test/resources/example/sdc/blueprint-dcae/tca_2.yaml index fb042575..c834b1b9 100644 --- a/src/test/resources/example/sdc/blueprint-dcae/tca_2.yaml +++ b/src/test/resources/example/sdc/blueprint-dcae/tca_2.yaml @@ -166,5 +166,5 @@ node_templates: properties: policy_id: get_input: policy_id - policy_type_id: onap.policy.monitoring.cdap.tca.hi.lo.app + policy_type_id: onap.policies.monitoring.cdap.tca.hi.lo.app diff --git a/src/test/resources/example/sdc/blueprint-dcae/tca_3.yaml b/src/test/resources/example/sdc/blueprint-dcae/tca_3.yaml index b2bf8bb9..edaa0be2 100644 --- a/src/test/resources/example/sdc/blueprint-dcae/tca_3.yaml +++ b/src/test/resources/example/sdc/blueprint-dcae/tca_3.yaml @@ -17,7 +17,7 @@ node_templates: properties: policy_id: get_input: policy_id - policy_type_id: onap.policy.monitoring.cdap.tca.hi.lo.app + policy_type_id: onap.policies.monitoring.cdap.tca.hi.lo.app cdap_host_host: type: dcae.nodes.StreamingAnalytics.SelectedCDAPInfrastructure properties: diff --git a/src/test/resources/example/sdc/expected-result/policy-data.yaml b/src/test/resources/example/sdc/expected-result/policy-data.yaml index 7f2c4847..2d315311 100644 --- a/src/test/resources/example/sdc/expected-result/policy-data.yaml +++ b/src/test/resources/example/sdc/expected-result/policy-data.yaml @@ -135,7 +135,7 @@ policy_types: tosca.policies.Monitoring: derived_from: tosca.policies.Root description: A base policy type for all policies that governs monitoring provisioning - onap.policy.monitoring.cdap.tca.hi.lo.app: + onap.policies.monitoring.cdap.tca.hi.lo.app: derived_from: tosca.policies.Monitoring version: 1.0.0 properties: diff --git a/src/test/resources/example/sdc/service-Vloadbalancerms-csar.csar b/src/test/resources/example/sdc/service-Vloadbalancerms-csar.csar index b5fe39d3..727ef16b 100755 Binary files a/src/test/resources/example/sdc/service-Vloadbalancerms-csar.csar and b/src/test/resources/example/sdc/service-Vloadbalancerms-csar.csar differ diff --git a/src/test/resources/tosca/micro-service-policy-payload.json b/src/test/resources/tosca/micro-service-policy-payload.json index 01d6d275..2de06b08 100644 --- a/src/test/resources/tosca/micro-service-policy-payload.json +++ b/src/test/resources/tosca/micro-service-policy-payload.json @@ -4,7 +4,7 @@ "policies": [ { "testPolicy": { - "type": "onap.policy.monitoring.cdap.tca.hi.lo.app", + "type": "onap.policies.monitoring.cdap.tca.hi.lo.app", "version": "1.0.0", "metadata": { "policy-id": "testPolicy" diff --git a/src/test/resources/tosca/tosca_example.yaml b/src/test/resources/tosca/tosca_example.yaml index 699cffd7..b0119f88 100644 --- a/src/test/resources/tosca/tosca_example.yaml +++ b/src/test/resources/tosca/tosca_example.yaml @@ -3,7 +3,7 @@ policy_types: onap.policies.Monitoring: derived_from: tosca.policies.Root description: a base policy type for all policies that governs monitoring provisioning - onap.policy.monitoring.cdap.tca.hi.lo.app: + onap.policies.monitoring.cdap.tca.hi.lo.app: derived_from: onap.policies.Monitoring version: 1.0.0 properties: