diff options
author | Xue Gao <xg353y@intl.att.com> | 2020-04-15 08:04:08 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2020-04-15 08:04:08 +0000 |
commit | db5bbd3947a76eb5ab5a17de263b06100d4ce42b (patch) | |
tree | 8517876ed6a5066218c111b7f04fcd5318a754b5 /src/test | |
parent | 10266c923850e842e14c602d772ce2ebbc77fe89 (diff) | |
parent | 3854d7c1008aa947e4b532bbef9d9efc738f6928 (diff) |
Merge "Fix legacy policy submit issues"
Diffstat (limited to 'src/test')
-rw-r--r-- | src/test/java/org/onap/clamp/loop/PolicyComponentTest.java | 17 | ||||
-rw-r--r-- | src/test/resources/tosca/pdp-group-policy-payload.json | 8 |
2 files changed, 20 insertions, 5 deletions
diff --git a/src/test/java/org/onap/clamp/loop/PolicyComponentTest.java b/src/test/java/org/onap/clamp/loop/PolicyComponentTest.java index 432de6065..6449a8966 100644 --- a/src/test/java/org/onap/clamp/loop/PolicyComponentTest.java +++ b/src/test/java/org/onap/clamp/loop/PolicyComponentTest.java @@ -24,7 +24,6 @@ package org.onap.clamp.loop; import static org.assertj.core.api.Assertions.assertThat; - import com.google.gson.Gson; import com.google.gson.JsonObject; import java.io.IOException; @@ -32,6 +31,7 @@ import org.apache.camel.Exchange; import org.apache.camel.Message; import org.junit.Test; import org.mockito.Mockito; +import org.onap.clamp.clds.config.LegacyOperationalPolicyController; import org.onap.clamp.clds.util.ResourceFileUtil; import org.onap.clamp.loop.components.external.ExternalComponentState; import org.onap.clamp.loop.components.external.PolicyComponent; @@ -267,7 +267,8 @@ public class PolicyComponentTest { new Gson().fromJson("{\"configtype\":\"json\"}", JsonObject.class), null, "pdpGroup2", "pdpSubgroup1"); loopTest.addMicroServicePolicy(microServicePolicy2); - PolicyModel policyModel2 = new PolicyModel("onap.policies.controlloop.Operational", null, "1.0.0"); + PolicyModel policyModel2 = new PolicyModel(LegacyOperationalPolicyController.OPERATIONAL_POLICY_LEGACY, null, + "1.0.0"); OperationalPolicy opPolicy = new OperationalPolicy("opPolicy", new Gson().fromJson("{\"configtype\":\"json\"}", JsonObject.class), new Gson().fromJson("{\"jsonschema\":\"schema\"}", JsonObject.class), policyModel2, null, @@ -275,16 +276,22 @@ public class PolicyComponentTest { "pdpSubgroup2"); loopTest.addOperationalPolicy(opPolicy); + OperationalPolicy opLegacyPolicy = + new OperationalPolicy("opLegacyPolicy", new Gson().fromJson( + "{\"guard_policies\":[{\"policy-id\":\"guard1\"}]}", JsonObject.class), + new Gson().fromJson("{\"jsonschema\":\"schema\"}", JsonObject.class), policyModel2, null, + "pdpGroup2", + "pdpSubgroup2"); + + loopTest.addOperationalPolicy(opLegacyPolicy); LoopTemplate loopTemplate = new LoopTemplate("test", "yaml", "svg", 1, null); loopTemplate.setDcaeBlueprintId("UUID-blueprint"); loopTest.setLoopTemplate(loopTemplate); - String payload = PolicyComponent.createPoliciesPayloadPdpGroup(loopTest); + String payload = PolicyComponent.createPoliciesPayloadPdpGroup(loopTest, "POST"); String expectedRes = ResourceFileUtil.getResourceAsString("tosca/pdp-group-policy-payload.json"); assertThat(payload).isEqualTo(expectedRes); - - assertThat(PolicyComponent.listPolicyNamesPdpGroup(loopTest)).containsExactlyInAnyOrder("opPolicy","configPolicyTest","configPolicyTest2"); } } diff --git a/src/test/resources/tosca/pdp-group-policy-payload.json b/src/test/resources/tosca/pdp-group-policy-payload.json index c81440e73..dce740fcd 100644 --- a/src/test/resources/tosca/pdp-group-policy-payload.json +++ b/src/test/resources/tosca/pdp-group-policy-payload.json @@ -23,6 +23,14 @@ "action": "POST", "policies": [ { + "name": "opLegacyPolicy", + "version": "1.0.0" + }, + { + "name": "guard1", + "version": "1.0.0" + }, + { "name": "opPolicy", "version": "1.0.0" } |