summaryrefslogtreecommitdiffstats
path: root/src/test
diff options
context:
space:
mode:
authorxuegao <xg353y@intl.att.com>2020-03-02 11:37:20 +0100
committerxuegao <xg353y@intl.att.com>2020-03-03 12:09:34 +0100
commit635445a5f262464c88287e5b5ceace4abf9cc4bc (patch)
tree81e772e47ed5deff4ab873e4ee148ac2aed6a373 /src/test
parentae6a9829f0c572cb4789812ea65871132ec861fd (diff)
Update UI to define Pdp Group
Update teh UI, adding the possibilities to define Pdp Group and Pdp Subgroup info. Issue-ID: CLAMP-654 Change-Id: I3660c491d3a4c730a7414f9c6de9e3859f3c3601 Signed-off-by: xuegao <xg353y@intl.att.com>
Diffstat (limited to 'src/test')
-rw-r--r--src/test/java/org/onap/clamp/clds/util/drawing/ClampGraphBuilderTest.java2
-rw-r--r--src/test/java/org/onap/clamp/clds/util/drawing/SvgLoopGeneratorTest.java2
-rw-r--r--src/test/java/org/onap/clamp/loop/DcaeComponentTest.java2
-rw-r--r--src/test/java/org/onap/clamp/loop/DeployFlowTestItCase.java2
-rw-r--r--src/test/java/org/onap/clamp/loop/LoopControllerTestItCase.java2
-rw-r--r--src/test/java/org/onap/clamp/loop/LoopRepositoriesItCase.java4
-rw-r--r--src/test/java/org/onap/clamp/loop/LoopServiceTestItCase.java26
-rw-r--r--src/test/java/org/onap/clamp/loop/LoopToJsonTest.java4
-rw-r--r--src/test/java/org/onap/clamp/loop/PolicyComponentTest.java13
-rw-r--r--src/test/java/org/onap/clamp/policy/microservice/OperationalPolicyPayloadTest.java6
10 files changed, 30 insertions, 33 deletions
diff --git a/src/test/java/org/onap/clamp/clds/util/drawing/ClampGraphBuilderTest.java b/src/test/java/org/onap/clamp/clds/util/drawing/ClampGraphBuilderTest.java
index 2ccecf3e8..184a391d7 100644
--- a/src/test/java/org/onap/clamp/clds/util/drawing/ClampGraphBuilderTest.java
+++ b/src/test/java/org/onap/clamp/clds/util/drawing/ClampGraphBuilderTest.java
@@ -70,7 +70,7 @@ public class ClampGraphBuilderTest {
null);
OperationalPolicy opPolicy = new OperationalPolicy("OperationalPolicy", new Loop(), new JsonObject(),
- new PolicyModel("org.onap.opolicy", null, "1.0.0", "opolicy1"), null);
+ new PolicyModel("org.onap.opolicy", null, "1.0.0", "opolicy1"), null, null, null);
final Set<OperationalPolicy> opPolicies = Set.of(opPolicy);
final Set<MicroServicePolicy> microServices = Set.of(ms1, ms2);
diff --git a/src/test/java/org/onap/clamp/clds/util/drawing/SvgLoopGeneratorTest.java b/src/test/java/org/onap/clamp/clds/util/drawing/SvgLoopGeneratorTest.java
index 7b83a4c35..a320131c4 100644
--- a/src/test/java/org/onap/clamp/clds/util/drawing/SvgLoopGeneratorTest.java
+++ b/src/test/java/org/onap/clamp/clds/util/drawing/SvgLoopGeneratorTest.java
@@ -44,7 +44,7 @@ public class SvgLoopGeneratorTest {
new MicroServicePolicy("ms2", new PolicyModel("org.onap.ms2", "", "1.0.0", "short.ms2"),
false, null);
OperationalPolicy opPolicy = new OperationalPolicy("OperationalPolicy", new Loop(), new JsonObject(),
- new PolicyModel("org.onap.opolicy", null, "1.0.0", "short.OperationalPolicy"), null);
+ new PolicyModel("org.onap.opolicy", null, "1.0.0", "short.OperationalPolicy"), null, null, null);
Loop loop = new Loop();
loop.addMicroServicePolicy(ms1);
loop.addMicroServicePolicy(ms2);
diff --git a/src/test/java/org/onap/clamp/loop/DcaeComponentTest.java b/src/test/java/org/onap/clamp/loop/DcaeComponentTest.java
index 50e2e8d39..fc7e1c90a 100644
--- a/src/test/java/org/onap/clamp/loop/DcaeComponentTest.java
+++ b/src/test/java/org/onap/clamp/loop/DcaeComponentTest.java
@@ -54,7 +54,7 @@ public class DcaeComponentTest {
MicroServicePolicy microServicePolicy = new MicroServicePolicy("configPolicyTest", new PolicyModel("policy1",
"tosca_definitions_version: tosca_simple_yaml_1_0_0","1.0.0"), true,
- new Gson().fromJson("{\"configtype\":\"json\"}", JsonObject.class), null);
+ new Gson().fromJson("{\"configtype\":\"json\"}", JsonObject.class), null, null, null);
microServicePolicy.setConfigurationsJson(new Gson().fromJson("{\"param1\":\"value1\"}", JsonObject.class));
loopTest.addMicroServicePolicy(microServicePolicy);
diff --git a/src/test/java/org/onap/clamp/loop/DeployFlowTestItCase.java b/src/test/java/org/onap/clamp/loop/DeployFlowTestItCase.java
index 3c2ce17ed..f1d299226 100644
--- a/src/test/java/org/onap/clamp/loop/DeployFlowTestItCase.java
+++ b/src/test/java/org/onap/clamp/loop/DeployFlowTestItCase.java
@@ -297,7 +297,7 @@ public class DeployFlowTestItCase {
policyModelsService.saveOrUpdatePolicyModel(policyModel);
MicroServicePolicy microService = new MicroServicePolicy(name, policyModel,
shared,
- gson.fromJson(jsonRepresentation, JsonObject.class), null);
+ gson.fromJson(jsonRepresentation, JsonObject.class), null, null, null);
microService.setConfigurationsJson(new Gson().fromJson(jsonProperties, JsonObject.class));
return microService;
diff --git a/src/test/java/org/onap/clamp/loop/LoopControllerTestItCase.java b/src/test/java/org/onap/clamp/loop/LoopControllerTestItCase.java
index 714cbd592..f017dd899 100644
--- a/src/test/java/org/onap/clamp/loop/LoopControllerTestItCase.java
+++ b/src/test/java/org/onap/clamp/loop/LoopControllerTestItCase.java
@@ -135,7 +135,7 @@ public class LoopControllerTestItCase {
"tosca_definitions_version: tosca_simple_yaml_1_0_0","1.0.0");
policyModelsService.saveOrUpdatePolicyModel(policyModel);
MicroServicePolicy policy = new MicroServicePolicy("policyName", policyModel, false,
- JsonUtils.GSON.fromJson(EXAMPLE_JSON, JsonObject.class), null);
+ JsonUtils.GSON.fromJson(EXAMPLE_JSON, JsonObject.class), null, null, null);
loopController.updateMicroservicePolicy(EXAMPLE_LOOP_NAME, policy);
assertThat(microServicePolicyService.isExisting("policyName")).isTrue();
}
diff --git a/src/test/java/org/onap/clamp/loop/LoopRepositoriesItCase.java b/src/test/java/org/onap/clamp/loop/LoopRepositoriesItCase.java
index acde66d9a..47b4b65c3 100644
--- a/src/test/java/org/onap/clamp/loop/LoopRepositoriesItCase.java
+++ b/src/test/java/org/onap/clamp/loop/LoopRepositoriesItCase.java
@@ -90,7 +90,7 @@ public class LoopRepositoriesItCase {
}
private OperationalPolicy getOperationalPolicy(String configJson, String name, PolicyModel policyModel) {
- return new OperationalPolicy(name, null, new Gson().fromJson(configJson, JsonObject.class), policyModel, null);
+ return new OperationalPolicy(name, null, new Gson().fromJson(configJson, JsonObject.class), policyModel, null, null, null);
}
private LoopElementModel getLoopElementModel(String yaml, String name, String policyType, String createdBy,
@@ -130,7 +130,7 @@ public class LoopRepositoriesItCase {
private MicroServicePolicy getMicroServicePolicy(String name, String jsonRepresentation, String jsonProperties,
boolean shared, PolicyModel policyModel) {
MicroServicePolicy microService = new MicroServicePolicy(name, policyModel, shared,
- gson.fromJson(jsonRepresentation, JsonObject.class), null);
+ gson.fromJson(jsonRepresentation, JsonObject.class), null, null, null);
microService.setConfigurationsJson(new Gson().fromJson(jsonProperties, JsonObject.class));
return microService;
}
diff --git a/src/test/java/org/onap/clamp/loop/LoopServiceTestItCase.java b/src/test/java/org/onap/clamp/loop/LoopServiceTestItCase.java
index 849ca5cfe..5449ada1a 100644
--- a/src/test/java/org/onap/clamp/loop/LoopServiceTestItCase.java
+++ b/src/test/java/org/onap/clamp/loop/LoopServiceTestItCase.java
@@ -101,7 +101,7 @@ public class LoopServiceTestItCase {
// given
saveTestLoopToDb();
OperationalPolicy operationalPolicy = new OperationalPolicy("policyName", null,
- JsonUtils.GSON.fromJson(EXAMPLE_JSON, JsonObject.class), null, null);
+ JsonUtils.GSON.fromJson(EXAMPLE_JSON, JsonObject.class), null, null, null, null);
// when
Loop actualLoop = loopService.updateAndSaveOperationalPolicies(EXAMPLE_LOOP_NAME,
@@ -129,7 +129,7 @@ public class LoopServiceTestItCase {
"tosca_definitions_version: tosca_simple_yaml_1_0_0", "1.0.0", "policyModel1");
policyModelsService.saveOrUpdatePolicyModel(policyModel);
MicroServicePolicy microServicePolicy = new MicroServicePolicy("policyName", policyModel,
- false, JsonUtils.GSON.fromJson(EXAMPLE_JSON, JsonObject.class), null);
+ false, JsonUtils.GSON.fromJson(EXAMPLE_JSON, JsonObject.class), null, null, null);
// when
Loop actualLoop = loopService.updateAndSaveMicroservicePolicies(EXAMPLE_LOOP_NAME,
@@ -159,11 +159,11 @@ public class LoopServiceTestItCase {
"tosca_definitions_version: tosca_simple_yaml_1_0_0", "1.0.0", "secondPolicyName");
policyModelsService.saveOrUpdatePolicyModel(policyModel2);
MicroServicePolicy firstMicroServicePolicy = new MicroServicePolicy("firstPolicyName", policyModel1, false,
- JsonUtils.GSON.fromJson(EXAMPLE_JSON, JsonObject.class), null);
+ JsonUtils.GSON.fromJson(EXAMPLE_JSON, JsonObject.class), null, null, null);
loopService.updateAndSaveMicroservicePolicies(EXAMPLE_LOOP_NAME, Lists.newArrayList(firstMicroServicePolicy));
MicroServicePolicy secondMicroServicePolicy = new MicroServicePolicy("secondPolicyName", policyModel2, false,
- JsonUtils.GSON.fromJson(EXAMPLE_JSON, JsonObject.class), null);
+ JsonUtils.GSON.fromJson(EXAMPLE_JSON, JsonObject.class), null, null, null);
// when
firstMicroServicePolicy
@@ -203,11 +203,11 @@ public class LoopServiceTestItCase {
"tosca_definitions_version: tosca_simple_yaml_1_0_0", "1.0.0", "secondPolicyName");
policyModelsService.saveOrUpdatePolicyModel(policyModel2);
MicroServicePolicy firstMicroServicePolicy = new MicroServicePolicy("firstPolicyName", policyModel1,
- false, JsonUtils.GSON.fromJson(EXAMPLE_JSON, JsonObject.class), null);
+ false, JsonUtils.GSON.fromJson(EXAMPLE_JSON, JsonObject.class), null, null, null);
loopService.updateAndSaveMicroservicePolicies(EXAMPLE_LOOP_NAME, Lists.newArrayList(firstMicroServicePolicy));
MicroServicePolicy secondMicroServicePolicy = new MicroServicePolicy("secondPolicyName", policyModel2,
- false, JsonUtils.GSON.fromJson(EXAMPLE_JSON, JsonObject.class), null);
+ false, JsonUtils.GSON.fromJson(EXAMPLE_JSON, JsonObject.class), null, null, null);
// when
Loop actualLoop = loopService.updateAndSaveMicroservicePolicies(EXAMPLE_LOOP_NAME,
@@ -232,11 +232,11 @@ public class LoopServiceTestItCase {
JsonObject newJsonConfiguration = JsonUtils.GSON.fromJson("{}", JsonObject.class);
OperationalPolicy firstOperationalPolicy = new OperationalPolicy("firstPolicyName", null,
- JsonUtils.GSON.fromJson(EXAMPLE_JSON, JsonObject.class), null, null);
+ JsonUtils.GSON.fromJson(EXAMPLE_JSON, JsonObject.class), null, null, null, null);
loopService.updateAndSaveOperationalPolicies(EXAMPLE_LOOP_NAME, Lists.newArrayList(firstOperationalPolicy));
OperationalPolicy secondOperationalPolicy = new OperationalPolicy("secondPolicyName", null,
- newJsonConfiguration, null, null);
+ newJsonConfiguration, null, null, null, null);
// when
firstOperationalPolicy.setConfigurationsJson(newJsonConfiguration);
@@ -263,11 +263,11 @@ public class LoopServiceTestItCase {
saveTestLoopToDb();
OperationalPolicy firstOperationalPolicy = new OperationalPolicy("firstPolicyName", null,
- JsonUtils.GSON.fromJson(EXAMPLE_JSON, JsonObject.class), null, null);
+ JsonUtils.GSON.fromJson(EXAMPLE_JSON, JsonObject.class), null, null, null, null);
loopService.updateAndSaveOperationalPolicies(EXAMPLE_LOOP_NAME, Lists.newArrayList(firstOperationalPolicy));
OperationalPolicy secondOperationalPolicy = new OperationalPolicy("policyName", null,
- JsonUtils.GSON.fromJson("{}", JsonObject.class), null, null);
+ JsonUtils.GSON.fromJson("{}", JsonObject.class), null, null, "pdpGroup1", "pdpSubgroup1");
// when
Loop actualLoop = loopService.updateAndSaveOperationalPolicies(EXAMPLE_LOOP_NAME,
@@ -319,7 +319,7 @@ public class LoopServiceTestItCase {
loop = loopService.saveOrUpdateLoop(loop);
// Add op policy
OperationalPolicy operationalPolicy = new OperationalPolicy("opPolicy", null,
- JsonUtils.GSON.fromJson(EXAMPLE_JSON, JsonObject.class), null, null);
+ JsonUtils.GSON.fromJson(EXAMPLE_JSON, JsonObject.class), null, null, null, null);
loopService.updateAndSaveOperationalPolicies(EXAMPLE_LOOP_NAME, Lists.newArrayList(operationalPolicy));
PolicyModel policyModel = new PolicyModel("org.policies.microPolicy",
@@ -327,7 +327,7 @@ public class LoopServiceTestItCase {
policyModelsService.saveOrUpdatePolicyModel(policyModel);
// Add Micro service policy
MicroServicePolicy microServicePolicy = new MicroServicePolicy("microPolicy", policyModel,
- false, JsonUtils.GSON.fromJson(EXAMPLE_JSON, JsonObject.class), null);
+ false, JsonUtils.GSON.fromJson(EXAMPLE_JSON, JsonObject.class), null, null, null);
loopService.updateAndSaveMicroservicePolicies(EXAMPLE_LOOP_NAME, Lists.newArrayList(microServicePolicy));
// Verify it's there
@@ -371,7 +371,7 @@ public class LoopServiceTestItCase {
"tosca_definitions_version: tosca_simple_yaml_1_0_0", "1.0.0", "policyName");
policyModelsService.saveOrUpdatePolicyModel(policyModel);
MicroServicePolicy microServicePolicy = new MicroServicePolicy("policyName", policyModel,
- false, JsonUtils.GSON.fromJson(EXAMPLE_JSON, JsonObject.class), null);
+ false, JsonUtils.GSON.fromJson(EXAMPLE_JSON, JsonObject.class), null, null, null);
loopService.updateMicroservicePolicy(EXAMPLE_LOOP_NAME, microServicePolicy);
assertThat(microServicePolicyService.isExisting("policyName")).isTrue();
}
diff --git a/src/test/java/org/onap/clamp/loop/LoopToJsonTest.java b/src/test/java/org/onap/clamp/loop/LoopToJsonTest.java
index 6c6fb0c87..de2ef145a 100644
--- a/src/test/java/org/onap/clamp/loop/LoopToJsonTest.java
+++ b/src/test/java/org/onap/clamp/loop/LoopToJsonTest.java
@@ -52,7 +52,7 @@ public class LoopToJsonTest {
private OperationalPolicy getOperationalPolicy(String configJson, String name) {
return new OperationalPolicy(name, null, gson.fromJson(configJson, JsonObject.class),
- getPolicyModel("org.onap.policy.drools", "yaml", "1.0.0", "Drools", "type1"), null);
+ getPolicyModel("org.onap.policy.drools", "yaml", "1.0.0", "Drools", "type1"), null, null, null);
}
private Loop getLoop(String name, String svgRepresentation, String blueprint, String globalPropertiesJson,
@@ -70,7 +70,7 @@ public class LoopToJsonTest {
String policyTosca, String jsonProperties, boolean shared) {
MicroServicePolicy microService = new MicroServicePolicy(name, new PolicyModel(modelType, policyTosca, "1.0.0"),
shared,
- gson.fromJson(jsonRepresentation, JsonObject.class), null);
+ gson.fromJson(jsonRepresentation, JsonObject.class), null, null, null);
microService.setConfigurationsJson(new Gson().fromJson(jsonProperties, JsonObject.class));
return microService;
}
diff --git a/src/test/java/org/onap/clamp/loop/PolicyComponentTest.java b/src/test/java/org/onap/clamp/loop/PolicyComponentTest.java
index 52e10d2db..370c319b3 100644
--- a/src/test/java/org/onap/clamp/loop/PolicyComponentTest.java
+++ b/src/test/java/org/onap/clamp/loop/PolicyComponentTest.java
@@ -26,7 +26,9 @@ 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;
+import java.util.HashSet;
import org.apache.camel.Exchange;
import org.apache.camel.Message;
import org.junit.Test;
@@ -258,18 +260,12 @@ public class PolicyComponentTest {
PolicyModel policyModel1 = new PolicyModel("onap.policies.monitoring.test", null, "1.0.0");
MicroServicePolicy microServicePolicy = new MicroServicePolicy("configPolicyTest", policyModel1, true,
- new Gson().fromJson("{\"configtype\":\"json\"}", JsonObject.class), null);
- microServicePolicy.setPdpGroup("pdpGroup1");
- microServicePolicy.setPdpSubGroup("pdpSubgroup1");
-
+ new Gson().fromJson("{\"configtype\":\"json\"}", JsonObject.class), null, "pdpGroup1", "pdpSubgroup1");
loopTest.addMicroServicePolicy(microServicePolicy);
PolicyModel policyModel2 = new PolicyModel("onap.policies.controlloop.Operational", null, "1.0.0");
OperationalPolicy opPolicy = new OperationalPolicy("opPolicy", loopTest,
- new Gson().fromJson("{\"configtype\":\"json\"}", JsonObject.class), policyModel2, null);
- opPolicy.setPdpGroup("pdpGroup2");
- opPolicy.setPdpSubGroup("pdpSubgroup2");
-
+ new Gson().fromJson("{\"configtype\":\"json\"}", JsonObject.class), policyModel2, null, "pdpGroup2", "pdpSubgroup2");
loopTest.addOperationalPolicy(opPolicy);
LoopTemplate loopTemplate = new LoopTemplate("test", "yaml", "svg", 1, null);
@@ -278,6 +274,7 @@ public class PolicyComponentTest {
String payload = PolicyComponent.createPoliciesPayloadPdpGroup(loopTest);
String expectedRes = ResourceFileUtil.getResourceAsString("tosca/pdp-group-policy-payload.json");
+
assertThat(payload).isEqualTo(expectedRes);
}
}
diff --git a/src/test/java/org/onap/clamp/policy/microservice/OperationalPolicyPayloadTest.java b/src/test/java/org/onap/clamp/policy/microservice/OperationalPolicyPayloadTest.java
index bdc7e80de..5686bc161 100644
--- a/src/test/java/org/onap/clamp/policy/microservice/OperationalPolicyPayloadTest.java
+++ b/src/test/java/org/onap/clamp/policy/microservice/OperationalPolicyPayloadTest.java
@@ -41,7 +41,7 @@ public class OperationalPolicyPayloadTest {
public void testOperationalPolicyPayloadConstruction() throws IOException {
JsonObject jsonConfig = new GsonBuilder().create().fromJson(
ResourceFileUtil.getResourceAsString("tosca/operational-policy-properties.json"), JsonObject.class);
- OperationalPolicy policy = new OperationalPolicy("testPolicy", null, jsonConfig, null, null);
+ OperationalPolicy policy = new OperationalPolicy("testPolicy", null, jsonConfig, null, null, null, null);
assertThat(policy.createPolicyPayloadYaml())
.isEqualTo(ResourceFileUtil.getResourceAsString("tosca/operational-policy-payload.yaml"));
@@ -63,7 +63,7 @@ public class OperationalPolicyPayloadTest {
JsonObject jsonConfig = new GsonBuilder().create().fromJson(
ResourceFileUtil.getResourceAsString("tosca/operational-policy-no-guard-properties.json"),
JsonObject.class);
- OperationalPolicy policy = new OperationalPolicy("testPolicy", null, jsonConfig, null, null);
+ OperationalPolicy policy = new OperationalPolicy("testPolicy", null, jsonConfig, null, null, null, null);
Map<String, String> guardsMap = policy.createGuardPolicyPayloads();
assertThat(guardsMap).isEmpty();
assertThat(guardsMap.entrySet()).isEmpty();
@@ -73,7 +73,7 @@ public class OperationalPolicyPayloadTest {
public void testGuardPolicyPayloadConstruction() throws IOException {
JsonObject jsonConfig = new GsonBuilder().create().fromJson(
ResourceFileUtil.getResourceAsString("tosca/operational-policy-properties.json"), JsonObject.class);
- OperationalPolicy policy = new OperationalPolicy("testPolicy", null, jsonConfig, null, null);
+ OperationalPolicy policy = new OperationalPolicy("testPolicy", null, jsonConfig, null, null, null, null);
Map<String, String> guardsMap = policy.createGuardPolicyPayloads();