summaryrefslogtreecommitdiffstats
path: root/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'src/test')
-rw-r--r--src/test/java/org/onap/clamp/clds/util/drawing/ClampGraphBuilderTest.java56
-rw-r--r--src/test/java/org/onap/clamp/clds/util/drawing/SvgLoopGeneratorTest.java77
-rw-r--r--src/test/java/org/onap/clamp/loop/DcaeComponentTest.java21
-rw-r--r--src/test/java/org/onap/clamp/loop/DeployFlowTestItCase.java52
-rw-r--r--src/test/java/org/onap/clamp/loop/LoopControllerTestItCase.java14
-rw-r--r--src/test/java/org/onap/clamp/loop/LoopRepositoriesItCase.java40
-rw-r--r--src/test/java/org/onap/clamp/loop/LoopServiceTestItCase.java80
-rw-r--r--src/test/java/org/onap/clamp/loop/LoopToJsonTest.java17
-rw-r--r--src/test/java/org/onap/clamp/policy/downloader/PolicyEngineControllerTestItCase.java14
-rw-r--r--src/test/java/org/onap/clamp/policy/microservice/MicroServicePayloadTest.java8
-rw-r--r--src/test/java/org/onap/clamp/policy/microservice/OperationalPolicyPayloadTest.java8
11 files changed, 276 insertions, 111 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 65eb2696f..63209e9f9 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
@@ -26,12 +26,12 @@
package org.onap.clamp.clds.util.drawing;
+import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
-import java.util.Arrays;
-import java.util.List;
-
+import com.google.gson.JsonObject;
+import java.util.Set;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -39,7 +39,10 @@ import org.mockito.ArgumentCaptor;
import org.mockito.Captor;
import org.mockito.Mock;
import org.mockito.runners.MockitoJUnitRunner;
-import org.onap.clamp.clds.sdc.controller.installer.BlueprintMicroService;
+import org.onap.clamp.loop.Loop;
+import org.onap.clamp.loop.template.PolicyModel;
+import org.onap.clamp.policy.microservice.MicroServicePolicy;
+import org.onap.clamp.policy.operational.OperationalPolicy;
@RunWith(MockitoJUnitRunner.class)
public class ClampGraphBuilderTest {
@@ -50,47 +53,52 @@ public class ClampGraphBuilderTest {
private ArgumentCaptor<String> collectorCaptor;
@Captor
- private ArgumentCaptor<List<BlueprintMicroService>> microServicesCaptor;
+ private ArgumentCaptor<Set<MicroServicePolicy>> microServicesCaptor;
@Captor
- private ArgumentCaptor<String> policyCaptor;
+ private ArgumentCaptor<Set<OperationalPolicy>> policyCaptor;
+ /**
+ * Do a quick test of the graphBuilder chain.
+ */
@Test
public void clampGraphBuilderCompleteChainTest() {
String collector = "VES";
- BlueprintMicroService ms1 = new BlueprintMicroService("ms1", "", "", "1.0.0");
- BlueprintMicroService ms2 = new BlueprintMicroService("ms2", "", "", "1.0.0");
+ MicroServicePolicy ms1 = new MicroServicePolicy("ms1", new PolicyModel("org.onap.ms1", "", "1.0.0"), false,
+ null);
+ MicroServicePolicy ms2 = new MicroServicePolicy("ms2", new PolicyModel("org.onap.ms2", "", "1.0.0"), false,
+ null);
- String policy = "OperationalPolicy";
- final List<BlueprintMicroService> microServices = Arrays.asList(ms1, ms2);
+ OperationalPolicy opPolicy = new OperationalPolicy("OperationalPolicy", new Loop(), new JsonObject(),
+ new PolicyModel("org.onap.opolicy", null, "1.0.0", "opolicy1"));
+ final Set<OperationalPolicy> opPolicies = Set.of(opPolicy);
+ final Set<MicroServicePolicy> microServices = Set.of(ms1, ms2);
ClampGraphBuilder clampGraphBuilder = new ClampGraphBuilder(mockPainter);
- clampGraphBuilder.collector(collector).addMicroService(ms1).addMicroService(ms2).policy(policy).build();
+ clampGraphBuilder.collector(collector).addMicroService(ms1).addMicroService(ms2).addPolicy(opPolicy).build();
verify(mockPainter, times(1)).doPaint(collectorCaptor.capture(), microServicesCaptor.capture(),
policyCaptor.capture());
Assert.assertEquals(collector, collectorCaptor.getValue());
Assert.assertEquals(microServices, microServicesCaptor.getValue());
- Assert.assertEquals(policy, policyCaptor.getValue());
+ Assert.assertEquals(opPolicies, policyCaptor.getValue());
}
- @Test(expected = InvalidStateException.class)
+ /**
+ * Do a quick test of the graphBuilder chain when no policy is given.
+ */
+ @Test
public void clampGraphBuilderNoPolicyGivenTest() {
String collector = "VES";
- BlueprintMicroService ms1 = new BlueprintMicroService("ms1", "", "", "1.0.0");
- BlueprintMicroService ms2 = new BlueprintMicroService("ms2", "", "", "1.0.0");
+ MicroServicePolicy ms1 =
+ new MicroServicePolicy("ms1", new PolicyModel("org.onap.ms1", "", "1.0.0"), false, null);
+ MicroServicePolicy ms2 =
+ new MicroServicePolicy("ms2", new PolicyModel("org.onap.ms2", "", "1.0.0"), false, null);
ClampGraphBuilder clampGraphBuilder = new ClampGraphBuilder(mockPainter);
- clampGraphBuilder.collector(collector).addMicroService(ms1).addMicroService(ms2).build();
- }
+ assertThat(clampGraphBuilder.collector(collector).addMicroService(ms1).addMicroService(ms2).build())
+ .isNotNull();
- @Test(expected = InvalidStateException.class)
- public void clampGraphBuilderNoMicroServiceGivenTest() {
- String collector = "VES";
- String policy = "OperationalPolicy";
-
- ClampGraphBuilder clampGraphBuilder = new ClampGraphBuilder(mockPainter);
- clampGraphBuilder.collector(collector).policy(policy).build();
}
}
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
new file mode 100644
index 000000000..aad11adb2
--- /dev/null
+++ b/src/test/java/org/onap/clamp/clds/util/drawing/SvgLoopGeneratorTest.java
@@ -0,0 +1,77 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP CLAMP
+ * ================================================================================
+ * Copyright (C) 2019 AT&T Intellectual Property. All rights
+ * reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END============================================
+ * ===================================================================
+ *
+ */
+
+package org.onap.clamp.clds.util.drawing;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+import com.google.gson.JsonObject;
+import java.io.IOException;
+import java.util.HashSet;
+import javax.xml.parsers.ParserConfigurationException;
+import org.junit.Test;
+import org.onap.clamp.loop.Loop;
+import org.onap.clamp.loop.template.PolicyModel;
+import org.onap.clamp.policy.microservice.MicroServicePolicy;
+import org.onap.clamp.policy.operational.OperationalPolicy;
+import org.xml.sax.SAXException;
+
+public class SvgLoopGeneratorTest {
+ private Loop getLoop() {
+ MicroServicePolicy ms1 =
+ new MicroServicePolicy("ms1", new PolicyModel("org.onap.ms1", "", "1.0.0", "short.ms1"),
+ false,
+ new HashSet<Loop>());
+ MicroServicePolicy ms2 =
+ new MicroServicePolicy("ms2", new PolicyModel("org.onap.ms2", "", "1.0.0", "short.ms2"),
+ false, new HashSet<Loop>());
+ OperationalPolicy opPolicy = new OperationalPolicy("OperationalPolicy", new Loop(), new JsonObject(),
+ new PolicyModel("org.onap.opolicy", null, "1.0.0", "short.OperationalPolicy"));
+ Loop loop = new Loop();
+ loop.addMicroServicePolicy(ms1);
+ loop.addMicroServicePolicy(ms2);
+ loop.addOperationalPolicy(opPolicy);
+ return loop;
+ }
+
+ /**
+ * Test a Svg rendering with all objects.
+ *
+ * @throws IOException In case of isssues
+ * @throws ParserConfigurationException In case of isssues
+ * @throws SAXException In case of isssues
+ */
+ @Test
+ public void getAsSvgTest() throws IOException, ParserConfigurationException, SAXException {
+ String xml = SvgLoopGenerator.getSvgImage(getLoop());
+ assertThat(xml).contains("data-element-id=\"VES\"");
+ assertThat(xml).contains(">VES<");
+ assertThat(xml).contains("data-element-id=\"ms1\"");
+ assertThat(xml).contains("data-element-id=\"ms2\"");
+ assertThat(xml).contains(">short.ms1<");
+ assertThat(xml).contains(">short.ms2<");
+ assertThat(xml).contains("data-element-id=\"OperationalPolicy\"");
+ assertThat(xml).contains(">short.OperationalPolicy<");
+
+ }
+}
diff --git a/src/test/java/org/onap/clamp/loop/DcaeComponentTest.java b/src/test/java/org/onap/clamp/loop/DcaeComponentTest.java
index fa9cc063a..57e99a3da 100644
--- a/src/test/java/org/onap/clamp/loop/DcaeComponentTest.java
+++ b/src/test/java/org/onap/clamp/loop/DcaeComponentTest.java
@@ -27,11 +27,9 @@ 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 java.util.List;
-
import org.apache.camel.Exchange;
import org.apache.camel.Message;
import org.json.simple.parser.ParseException;
@@ -42,6 +40,7 @@ import org.onap.clamp.clds.model.dcae.DcaeOperationStatusResponse;
import org.onap.clamp.loop.components.external.DcaeComponent;
import org.onap.clamp.loop.components.external.ExternalComponentState;
import org.onap.clamp.loop.template.LoopTemplate;
+import org.onap.clamp.loop.template.PolicyModel;
import org.onap.clamp.policy.microservice.MicroServicePolicy;
public class DcaeComponentTest {
@@ -54,8 +53,8 @@ public class DcaeComponentTest {
loopTest.setDcaeDeploymentId("123456789");
loopTest.setDcaeDeploymentStatusUrl("http4://localhost:8085");
- MicroServicePolicy microServicePolicy = new MicroServicePolicy("configPolicyTest", "",
- "tosca_definitions_version: tosca_simple_yaml_1_0_0", true,
+ 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), new HashSet<>());
microServicePolicy.setConfigurationsJson(new Gson().fromJson("{\"param1\":\"value1\"}", JsonObject.class));
@@ -67,6 +66,10 @@ public class DcaeComponentTest {
return loopTest;
}
+ /**
+ * Test the DcaeReponse roughly.
+ * @throws IOException In case of issues
+ */
@Test
public void convertDcaeResponseTest() throws IOException {
String dcaeFakeResponse = "{'requestId':'testId','operationType':'install','status':'state',"
@@ -99,6 +102,11 @@ public class DcaeComponentTest {
assertThat(unDeploymentPayload).isEqualTo(expectedPayload);
}
+ /**
+ * Test the computeState method of the DcaeComponent roughly.
+ *
+ * @throws IOException In case of issues
+ */
@Test
public void computeStateTest() throws IOException {
Exchange exchange = Mockito.mock(Exchange.class);
@@ -157,6 +165,11 @@ public class DcaeComponentTest {
assertThat(state9.getStateName()).isEqualTo("IN_ERROR");
}
+ /**
+ * Test the Converter to DcaeInventoryResponse method.
+ * @throws IOException In case of failure
+ * @throws ParseException In case of failure
+ */
@Test
public void convertToDcaeInventoryResponseTest() throws IOException, ParseException {
String dcaeFakeResponse = "{\n" + " \"links\": {\n" + " \"previousLink\": {\n"
diff --git a/src/test/java/org/onap/clamp/loop/DeployFlowTestItCase.java b/src/test/java/org/onap/clamp/loop/DeployFlowTestItCase.java
index c85d5a57c..4fd78d18a 100644
--- a/src/test/java/org/onap/clamp/loop/DeployFlowTestItCase.java
+++ b/src/test/java/org/onap/clamp/loop/DeployFlowTestItCase.java
@@ -28,13 +28,10 @@ import static org.assertj.core.api.Assertions.assertThat;
import com.google.gson.Gson;
import com.google.gson.JsonObject;
import com.google.gson.JsonSyntaxException;
-
import java.io.IOException;
import java.util.HashSet;
import java.util.Set;
-
import javax.transaction.Transactional;
-
import org.apache.camel.CamelContext;
import org.apache.camel.Exchange;
import org.apache.camel.builder.ExchangeBuilder;
@@ -42,6 +39,8 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.onap.clamp.clds.Application;
import org.onap.clamp.loop.template.LoopTemplate;
+import org.onap.clamp.loop.template.PolicyModel;
+import org.onap.clamp.loop.template.PolicyModelsService;
import org.onap.clamp.policy.microservice.MicroServicePolicy;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
@@ -56,11 +55,20 @@ public class DeployFlowTestItCase {
CamelContext camelContext;
@Autowired
+ PolicyModelsService policyModelsService;
+
+ @Autowired
LoopService loopService;
@Autowired
LoopsRepository loopsRepository;
+ /**
+ * This method tests a deployment a single blueprint.
+ *
+ * @throws JsonSyntaxException In case of issues
+ * @throws IOException In case of issues
+ */
@Test
@Transactional
public void deployWithSingleBlueprintTest() throws JsonSyntaxException, IOException {
@@ -85,6 +93,12 @@ public class DeployFlowTestItCase {
assertThat(loopAfterTest.getDcaeDeploymentId()).isNotNull();
}
+ /**
+ * This method tests the deployment of multiple separated blueprints.
+ *
+ * @throws JsonSyntaxException In case of issues
+ * @throws IOException In case of issues
+ */
@Test
@Transactional
public void deployWithMultipleBlueprintTest() throws JsonSyntaxException, IOException {
@@ -117,6 +131,12 @@ public class DeployFlowTestItCase {
assertThat(loopAfterTest.getDcaeDeploymentId()).isNull();
}
+ /**
+ * This method tests the undeployment of a single blueprint.
+ *
+ * @throws JsonSyntaxException In case of issues
+ * @throws IOException In case of issues
+ */
@Test
@Transactional
public void undeployWithSingleBlueprintTest() throws JsonSyntaxException, IOException {
@@ -142,6 +162,12 @@ public class DeployFlowTestItCase {
assertThat(loopAfterTest.getDcaeDeploymentStatusUrl().contains("/uninstall")).isTrue();
}
+ /**
+ * This method tests the undeployment of multiple separated blueprints.
+ *
+ * @throws JsonSyntaxException In case of issues
+ * @throws IOException In case of issues
+ */
@Test
@Transactional
public void undeployWithMultipleBlueprintTest() throws JsonSyntaxException, IOException {
@@ -175,7 +201,12 @@ public class DeployFlowTestItCase {
assertThat(loopAfterTest.getDcaeDeploymentId()).isNull();
}
-
+ /**
+ * This method tests the DCAE get status for a single blueprint.
+ *
+ * @throws JsonSyntaxException In case of issues
+ * @throws IOException In case of issues
+ */
@Test
@Transactional
public void getStatusWithSingleBlueprintTest() throws JsonSyntaxException, IOException {
@@ -206,6 +237,12 @@ public class DeployFlowTestItCase {
assertThat(loopAfterTest.getComponent("POLICY")).isNotNull();
}
+ /**
+ * This method tests the dcae get status for multiple blueprints.
+ *
+ * @throws JsonSyntaxException In case of issues
+ * @throws IOException In case of issues
+ */
@Test
@Transactional
public void getStatusWithMultipleBlueprintTest() throws JsonSyntaxException, IOException {
@@ -256,8 +293,13 @@ public class DeployFlowTestItCase {
private MicroServicePolicy getMicroServicePolicy(String name, String modelType, String jsonRepresentation,
String policyTosca, String jsonProperties, boolean shared) {
- MicroServicePolicy microService = new MicroServicePolicy(name, modelType, policyTosca, shared,
+
+ PolicyModel policyModel = new PolicyModel(modelType, policyTosca,"1.0.0");
+ policyModelsService.saveOrUpdatePolicyModel(policyModel);
+ MicroServicePolicy microService = new MicroServicePolicy(name, policyModel,
+ shared,
gson.fromJson(jsonRepresentation, JsonObject.class), new HashSet<>());
+
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 f1e5c0927..714cbd592 100644
--- a/src/test/java/org/onap/clamp/loop/LoopControllerTestItCase.java
+++ b/src/test/java/org/onap/clamp/loop/LoopControllerTestItCase.java
@@ -30,16 +30,15 @@ import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
-
import java.util.Set;
-
import javax.transaction.Transactional;
-
import org.junit.Test;
import org.junit.runner.RunWith;
import org.onap.clamp.clds.Application;
import org.onap.clamp.clds.util.JsonUtils;
import org.onap.clamp.loop.template.LoopTemplate;
+import org.onap.clamp.loop.template.PolicyModel;
+import org.onap.clamp.loop.template.PolicyModelsService;
import org.onap.clamp.policy.microservice.MicroServicePolicy;
import org.onap.clamp.policy.microservice.MicroServicePolicyService;
import org.onap.clamp.policy.operational.OperationalPolicy;
@@ -64,6 +63,9 @@ public class LoopControllerTestItCase {
MicroServicePolicyService microServicePolicyService;
@Autowired
+ PolicyModelsService policyModelsService;
+
+ @Autowired
LoopController loopController;
private void saveTestLoopToDb() {
@@ -129,8 +131,10 @@ public class LoopControllerTestItCase {
@Transactional
public void testUpdateMicroservicePolicy() {
saveTestLoopToDb();
- MicroServicePolicy policy = new MicroServicePolicy("policyName", "",
- "tosca_definitions_version: tosca_simple_yaml_1_0_0", false,
+ PolicyModel policyModel = new PolicyModel("",
+ "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);
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 62b25605e..e6c477b44 100644
--- a/src/test/java/org/onap/clamp/loop/LoopRepositoriesItCase.java
+++ b/src/test/java/org/onap/clamp/loop/LoopRepositoriesItCase.java
@@ -30,10 +30,8 @@ import static org.assertj.core.api.Assertions.assertThat;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.JsonObject;
-
import java.time.Instant;
import java.util.HashSet;
-
import org.junit.Test;
import org.junit.runner.RunWith;
import org.onap.clamp.clds.Application;
@@ -92,32 +90,33 @@ public class LoopRepositoriesItCase {
return new Service(serviceDetails, resourceDetails);
}
- private OperationalPolicy getOperationalPolicy(String configJson, String name) {
- return new OperationalPolicy(name, null, new Gson().fromJson(configJson, JsonObject.class));
+ private OperationalPolicy getOperationalPolicy(String configJson, String name, PolicyModel policyModel) {
+ return new OperationalPolicy(name, null, new Gson().fromJson(configJson, JsonObject.class), policyModel);
}
private LoopElementModel getLoopElementModel(String yaml, String name, String policyType, String createdBy,
- PolicyModel policyModel) {
+ PolicyModel policyModel) {
LoopElementModel model = new LoopElementModel(name, policyType, yaml);
model.addPolicyModel(policyModel);
return model;
}
- private PolicyModel getPolicyModel(String policyType, String policyModelTosca, String version, String policyAcronym,
- String policyVariant, String createdBy) {
+ private PolicyModel getPolicyModel(String policyType, String policyModelTosca, String version,
+ String policyAcronym) {
return new PolicyModel(policyType, policyModelTosca, version, policyAcronym);
}
private LoopTemplate getLoopTemplate(String name, String blueprint, String svgRepresentation, String createdBy,
- Integer maxInstancesAllowed) {
+ Integer maxInstancesAllowed) {
LoopTemplate template = new LoopTemplate(name, blueprint, svgRepresentation, maxInstancesAllowed, null);
template.addLoopElementModel(getLoopElementModel("yaml", "microService1", "org.onap.policy.drools", createdBy,
- getPolicyModel("org.onap.policy.drools", "yaml", "1.0.0", "Drools", "type1", createdBy)));
+ getPolicyModel("org.onap.policy.drools", "yaml", "1.0.0", "Drools")));
+ loopTemplateRepository.save(template);
return template;
}
private Loop getLoop(String name, String svgRepresentation, String blueprint, String globalPropertiesJson,
- String dcaeId, String dcaeUrl, String dcaeBlueprintId) {
+ String dcaeId, String dcaeUrl, String dcaeBlueprintId) {
Loop loop = new Loop();
loop.setName(name);
loop.setSvgRepresentation(svgRepresentation);
@@ -129,9 +128,9 @@ public class LoopRepositoriesItCase {
return loop;
}
- private MicroServicePolicy getMicroServicePolicy(String name, String modelType, String jsonRepresentation,
- String policyTosca, String jsonProperties, boolean shared) {
- MicroServicePolicy microService = new MicroServicePolicy(name, modelType, policyTosca, shared,
+ 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), new HashSet<>());
microService.setConfigurationsJson(new Gson().fromJson(jsonProperties, JsonObject.class));
return microService;
@@ -141,17 +140,20 @@ public class LoopRepositoriesItCase {
return new LoopLog(message, type, "CLAMP", loop);
}
+ /**
+ * This method does a crud test and save a loop template and a loop object in db.
+ */
@Test
@Transactional
public void crudTest() {
// Setup
Loop loopTest = getLoop("ControlLoopTest", "<xml></xml>", "yamlcontent", "{\"testname\":\"testvalue\"}",
"123456789", "https://dcaetest.org", "UUID-blueprint");
- OperationalPolicy opPolicy = this.getOperationalPolicy("{\"type\":\"GUARD\"}", "GuardOpPolicyTest");
+ OperationalPolicy opPolicy = this.getOperationalPolicy("{\"type\":\"GUARD\"}", "GuardOpPolicyTest",
+ getPolicyModel("org.onap.policy.drools", "yaml", "1.0.0", "Drools"));
loopTest.addOperationalPolicy(opPolicy);
- MicroServicePolicy microServicePolicy = getMicroServicePolicy("configPolicyTest", "",
- "{\"configtype\":\"json\"}", "tosca_definitions_version: tosca_simple_yaml_1_0_0",
- "{\"param1\":\"value1\"}", true);
+ MicroServicePolicy microServicePolicy = getMicroServicePolicy("configPolicyTest", "{\"configtype\":\"json\"}",
+ "{\"param1\":\"value1\"}", true, getPolicyModel("org.onap.policy.drools", "yaml", "1.0.0", "Drools"));
loopTest.addMicroServicePolicy(microServicePolicy);
LoopLog loopLog = getLoopLog(LogType.INFO, "test message", loopTest);
loopTest.addLog(loopLog);
@@ -182,7 +184,7 @@ public class LoopRepositoriesItCase {
assertThat(servicesRepository.existsById(loopInDb.getModelService().getServiceUuid())).isEqualTo(true);
assertThat(microServiceModelsRepository.existsById(
loopInDb.getLoopTemplate().getLoopElementModelsUsed().first().getLoopElementModel().getName()))
- .isEqualTo(true);
+ .isEqualTo(true);
assertThat(policyModelsRepository.existsById(new PolicyModelId(
loopInDb.getLoopTemplate().getLoopElementModelsUsed().first().getLoopElementModel().getPolicyModels()
.first().getPolicyModelType(),
@@ -238,7 +240,7 @@ public class LoopRepositoriesItCase {
assertThat(servicesRepository.existsById(loopInDb.getModelService().getServiceUuid())).isEqualTo(true);
assertThat(microServiceModelsRepository.existsById(
loopInDb.getLoopTemplate().getLoopElementModelsUsed().first().getLoopElementModel().getName()))
- .isEqualTo(true);
+ .isEqualTo(true);
assertThat(policyModelsRepository.existsById(new PolicyModelId(
loopInDb.getLoopTemplate().getLoopElementModelsUsed().first().getLoopElementModel().getPolicyModels()
diff --git a/src/test/java/org/onap/clamp/loop/LoopServiceTestItCase.java b/src/test/java/org/onap/clamp/loop/LoopServiceTestItCase.java
index 8089bf1a8..152648712 100644
--- a/src/test/java/org/onap/clamp/loop/LoopServiceTestItCase.java
+++ b/src/test/java/org/onap/clamp/loop/LoopServiceTestItCase.java
@@ -26,12 +26,9 @@ package org.onap.clamp.loop;
import static org.assertj.core.api.Assertions.assertThat;
import com.google.gson.JsonObject;
-
import java.util.Set;
import java.util.stream.Collectors;
-
import javax.transaction.Transactional;
-
import org.assertj.core.util.Lists;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -41,6 +38,8 @@ import org.onap.clamp.loop.log.LogType;
import org.onap.clamp.loop.log.LoopLog;
import org.onap.clamp.loop.log.LoopLogService;
import org.onap.clamp.loop.template.LoopTemplate;
+import org.onap.clamp.loop.template.PolicyModel;
+import org.onap.clamp.loop.template.PolicyModelsService;
import org.onap.clamp.policy.microservice.MicroServicePolicy;
import org.onap.clamp.policy.microservice.MicroServicePolicyService;
import org.onap.clamp.policy.operational.OperationalPolicy;
@@ -71,6 +70,9 @@ public class LoopServiceTestItCase {
@Autowired
LoopLogService loopLogService;
+ @Autowired
+ PolicyModelsService policyModelsService;
+
@Test
@Transactional
public void shouldCreateEmptyLoop() {
@@ -99,7 +101,7 @@ public class LoopServiceTestItCase {
// given
saveTestLoopToDb();
OperationalPolicy operationalPolicy = new OperationalPolicy("policyName", null,
- JsonUtils.GSON.fromJson(EXAMPLE_JSON, JsonObject.class));
+ JsonUtils.GSON.fromJson(EXAMPLE_JSON, JsonObject.class), null);
// when
Loop actualLoop = loopService.updateAndSaveOperationalPolicies(EXAMPLE_LOOP_NAME,
@@ -123,9 +125,11 @@ public class LoopServiceTestItCase {
public void shouldAddMicroservicePolicyToLoop() {
// given
saveTestLoopToDb();
- MicroServicePolicy microServicePolicy = new MicroServicePolicy("policyName", "",
- "tosca_definitions_version: tosca_simple_yaml_1_0_0", false,
- JsonUtils.GSON.fromJson(EXAMPLE_JSON, JsonObject.class), null);
+ PolicyModel policyModel = new PolicyModel("org.policies.policyModel1",
+ "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);
// when
Loop actualLoop = loopService.updateAndSaveMicroservicePolicies(EXAMPLE_LOOP_NAME,
@@ -147,13 +151,18 @@ public class LoopServiceTestItCase {
public void shouldCreateNewMicroservicePolicyAndUpdateJsonRepresentationOfOldOne() {
// given
saveTestLoopToDb();
-
- MicroServicePolicy firstMicroServicePolicy = new MicroServicePolicy("firstPolicyName", "", "", false,
+ PolicyModel policyModel1 = new PolicyModel("org.policies.firstPolicyName",
+ "tosca_definitions_version: tosca_simple_yaml_1_0_0", "1.0.0", "firstPolicyName");
+ policyModelsService.saveOrUpdatePolicyModel(policyModel1);
+ PolicyModel policyModel2 = new PolicyModel("org.policies.secondPolicyName",
+ "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);
+
loopService.updateAndSaveMicroservicePolicies(EXAMPLE_LOOP_NAME, Lists.newArrayList(firstMicroServicePolicy));
- MicroServicePolicy secondMicroServicePolicy = new MicroServicePolicy("secondPolicyName", "",
- "tosca_definitions_version: tosca_simple_yaml_1_0_0", true,
- JsonUtils.GSON.fromJson("{}", JsonObject.class), null);
+ MicroServicePolicy secondMicroServicePolicy = new MicroServicePolicy("secondPolicyName", policyModel2, false,
+ JsonUtils.GSON.fromJson(EXAMPLE_JSON, JsonObject.class), null);
// when
firstMicroServicePolicy
@@ -170,13 +179,12 @@ public class LoopServiceTestItCase {
assertThat(savedPolicies).contains(secondMicroServicePolicy);
assertThat(savedPolicies).usingElementComparatorIgnoringFields("usedByLoops", "createdDate", "updatedDate",
"createdBy", "updatedBy").containsExactlyInAnyOrder(firstMicroServicePolicy, secondMicroServicePolicy);
-
}
private void saveTestLoopToDb() {
Loop testLoop = createTestLoop(EXAMPLE_LOOP_NAME, "blueprint", "representation");
testLoop.setGlobalPropertiesJson(JsonUtils.GSON.fromJson(EXAMPLE_JSON, JsonObject.class));
- LoopTemplate template = new LoopTemplate();
+ LoopTemplate template = new LoopTemplate();
template.setName("testTemplate");
testLoop.setLoopTemplate(template);
loopService.saveOrUpdateLoop(testLoop);
@@ -187,14 +195,18 @@ public class LoopServiceTestItCase {
public void shouldRemoveOldMicroservicePolicyIfNotInUpdatedList() {
// given
saveTestLoopToDb();
-
- MicroServicePolicy firstMicroServicePolicy = new MicroServicePolicy("firstPolicyName", "",
- "\"tosca_definitions_version: tosca_simple_yaml_1_0_0\"", false,
- JsonUtils.GSON.fromJson(EXAMPLE_JSON, JsonObject.class), null);
+ PolicyModel policyModel1 = new PolicyModel("org.policies.firstPolicyName",
+ "tosca_definitions_version: tosca_simple_yaml_1_0_0", "1.0.0", "firstPolicyName");
+ policyModelsService.saveOrUpdatePolicyModel(policyModel1);
+ PolicyModel policyModel2 = new PolicyModel("org.policies.secondPolicyName",
+ "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);
loopService.updateAndSaveMicroservicePolicies(EXAMPLE_LOOP_NAME, Lists.newArrayList(firstMicroServicePolicy));
- MicroServicePolicy secondMicroServicePolicy = new MicroServicePolicy("policyName", "", "secondPolicyTosca",
- true, JsonUtils.GSON.fromJson("{}", JsonObject.class), null);
+ MicroServicePolicy secondMicroServicePolicy = new MicroServicePolicy("secondPolicyName", policyModel2,
+ false, JsonUtils.GSON.fromJson(EXAMPLE_JSON, JsonObject.class), null);
// when
Loop actualLoop = loopService.updateAndSaveMicroservicePolicies(EXAMPLE_LOOP_NAME,
@@ -219,11 +231,11 @@ public class LoopServiceTestItCase {
JsonObject newJsonConfiguration = JsonUtils.GSON.fromJson("{}", JsonObject.class);
OperationalPolicy firstOperationalPolicy = new OperationalPolicy("firstPolicyName", null,
- JsonUtils.GSON.fromJson(EXAMPLE_JSON, JsonObject.class));
+ JsonUtils.GSON.fromJson(EXAMPLE_JSON, JsonObject.class), null);
loopService.updateAndSaveOperationalPolicies(EXAMPLE_LOOP_NAME, Lists.newArrayList(firstOperationalPolicy));
OperationalPolicy secondOperationalPolicy = new OperationalPolicy("secondPolicyName", null,
- newJsonConfiguration);
+ newJsonConfiguration, null);
// when
firstOperationalPolicy.setConfigurationsJson(newJsonConfiguration);
@@ -250,11 +262,11 @@ public class LoopServiceTestItCase {
saveTestLoopToDb();
OperationalPolicy firstOperationalPolicy = new OperationalPolicy("firstPolicyName", null,
- JsonUtils.GSON.fromJson(EXAMPLE_JSON, JsonObject.class));
+ JsonUtils.GSON.fromJson(EXAMPLE_JSON, JsonObject.class), null);
loopService.updateAndSaveOperationalPolicies(EXAMPLE_LOOP_NAME, Lists.newArrayList(firstOperationalPolicy));
OperationalPolicy secondOperationalPolicy = new OperationalPolicy("policyName", null,
- JsonUtils.GSON.fromJson("{}", JsonObject.class));
+ JsonUtils.GSON.fromJson("{}", JsonObject.class), null);
// when
Loop actualLoop = loopService.updateAndSaveOperationalPolicies(EXAMPLE_LOOP_NAME,
@@ -300,19 +312,21 @@ public class LoopServiceTestItCase {
// Add log
Loop loop = loopsRepository.findById(EXAMPLE_LOOP_NAME).orElse(null);
loop.addLog(new LoopLog("test", LogType.INFO, "CLAMP", loop));
- LoopTemplate template = new LoopTemplate();
+ LoopTemplate template = new LoopTemplate();
template.setName("testTemplate");
loop.setLoopTemplate(template);
loop = loopService.saveOrUpdateLoop(loop);
// Add op policy
OperationalPolicy operationalPolicy = new OperationalPolicy("opPolicy", null,
- JsonUtils.GSON.fromJson(EXAMPLE_JSON, JsonObject.class));
+ JsonUtils.GSON.fromJson(EXAMPLE_JSON, JsonObject.class), null);
loopService.updateAndSaveOperationalPolicies(EXAMPLE_LOOP_NAME, Lists.newArrayList(operationalPolicy));
+ PolicyModel policyModel = new PolicyModel("org.policies.microPolicy",
+ "tosca_definitions_version: tosca_simple_yaml_1_0_0", "1.0.0", "microPolicy");
+ policyModelsService.saveOrUpdatePolicyModel(policyModel);
// Add Micro service policy
- MicroServicePolicy microServicePolicy = new MicroServicePolicy("microPolicy", "",
- "tosca_definitions_version: tosca_simple_yaml_1_0_0", false,
- JsonUtils.GSON.fromJson(EXAMPLE_JSON, JsonObject.class), null);
+ MicroServicePolicy microServicePolicy = new MicroServicePolicy("microPolicy", policyModel,
+ false, JsonUtils.GSON.fromJson(EXAMPLE_JSON, JsonObject.class), null);
loopService.updateAndSaveMicroservicePolicies(EXAMPLE_LOOP_NAME, Lists.newArrayList(microServicePolicy));
// Verify it's there
@@ -352,9 +366,11 @@ public class LoopServiceTestItCase {
public void testUpdateMicroservicePolicy() {
saveTestLoopToDb();
assertThat(microServicePolicyService.isExisting("policyName")).isFalse();
- MicroServicePolicy microServicePolicy = new MicroServicePolicy("policyName", "",
- "tosca_definitions_version: tosca_simple_yaml_1_0_0", false,
- JsonUtils.GSON.fromJson(EXAMPLE_JSON, JsonObject.class), null);
+ PolicyModel policyModel = new PolicyModel("org.policies.policyName",
+ "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);
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 ae4b2564e..a2a4536ff 100644
--- a/src/test/java/org/onap/clamp/loop/LoopToJsonTest.java
+++ b/src/test/java/org/onap/clamp/loop/LoopToJsonTest.java
@@ -32,11 +32,9 @@ import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.JsonObject;
import com.google.gson.JsonSyntaxException;
-
import java.io.IOException;
import java.util.HashSet;
import java.util.Random;
-
import org.junit.Test;
import org.onap.clamp.clds.util.JsonUtils;
import org.onap.clamp.clds.util.ResourceFileUtil;
@@ -56,11 +54,13 @@ public class LoopToJsonTest {
private Gson gson = new Gson();
private OperationalPolicy getOperationalPolicy(String configJson, String name) {
- return new OperationalPolicy(name, null, gson.fromJson(configJson, JsonObject.class));
+ return new OperationalPolicy(name, null, gson.fromJson(configJson, JsonObject.class),
+ getPolicyModel("org.onap.policy.drools", "yaml", "1.0.0", "Drools", "type1"));
}
private Loop getLoop(String name, String svgRepresentation, String blueprint, String globalPropertiesJson,
- String dcaeId, String dcaeUrl, String dcaeBlueprintId) throws JsonSyntaxException, IOException {
+ String dcaeId, String dcaeUrl, String dcaeBlueprintId)
+ throws JsonSyntaxException, IOException {
Loop loop = new Loop(name, svgRepresentation);
loop.setGlobalPropertiesJson(new Gson().fromJson(globalPropertiesJson, JsonObject.class));
loop.setLastComputedState(LoopState.DESIGN);
@@ -70,8 +70,9 @@ public class LoopToJsonTest {
}
private MicroServicePolicy getMicroServicePolicy(String name, String modelType, String jsonRepresentation,
- String policyTosca, String jsonProperties, boolean shared) {
- MicroServicePolicy microService = new MicroServicePolicy(name, modelType, policyTosca, shared,
+ String policyTosca, String jsonProperties, boolean shared) {
+ MicroServicePolicy microService = new MicroServicePolicy(name, new PolicyModel(modelType, policyTosca, "1.0.0"),
+ shared,
gson.fromJson(jsonRepresentation, JsonObject.class), new HashSet<>());
microService.setConfigurationsJson(new Gson().fromJson(jsonProperties, JsonObject.class));
return microService;
@@ -87,12 +88,12 @@ public class LoopToJsonTest {
}
private PolicyModel getPolicyModel(String policyType, String policyModelTosca, String version, String policyAcronym,
- String policyVariant) {
+ String policyVariant) {
return new PolicyModel(policyType, policyModelTosca, version, policyAcronym);
}
private LoopTemplate getLoopTemplate(String name, String blueprint, String svgRepresentation,
- Integer maxInstancesAllowed) {
+ Integer maxInstancesAllowed) {
LoopTemplate template = new LoopTemplate(name, blueprint, svgRepresentation, maxInstancesAllowed, null);
template.addLoopElementModel(getLoopElementModel("yaml", "microService1",
getPolicyModel("org.onap.policy.drools", "yaml", "1.0.0", "Drools", "type1")));
diff --git a/src/test/java/org/onap/clamp/policy/downloader/PolicyEngineControllerTestItCase.java b/src/test/java/org/onap/clamp/policy/downloader/PolicyEngineControllerTestItCase.java
index 7762111b0..b42e15367 100644
--- a/src/test/java/org/onap/clamp/policy/downloader/PolicyEngineControllerTestItCase.java
+++ b/src/test/java/org/onap/clamp/policy/downloader/PolicyEngineControllerTestItCase.java
@@ -25,13 +25,10 @@ package org.onap.clamp.policy.downloader;
import static org.assertj.core.api.Assertions.assertThat;
import com.google.gson.JsonSyntaxException;
-
import java.io.IOException;
import java.time.Instant;
import java.util.List;
-
import javax.transaction.Transactional;
-
import org.junit.Test;
import org.junit.runner.RunWith;
import org.onap.clamp.clds.Application;
@@ -53,12 +50,19 @@ public class PolicyEngineControllerTestItCase {
@Autowired
PolicyModelsRepository policyModelsRepository;
+ /**
+ * This method tests a fake synchronization with the emulator.
+ *
+ * @throws JsonSyntaxException In case of issues
+ * @throws IOException In case of issues
+ * @throws InterruptedException In case of issues
+ */
@Test
@Transactional
public void synchronizeAllPoliciesTest() throws JsonSyntaxException, IOException, InterruptedException {
policyController.synchronizeAllPolicies();
Instant firstExecution = policyController.getLastInstantExecuted();
- assertThat (firstExecution).isNotNull();
+ assertThat(firstExecution).isNotNull();
List<PolicyModel> policyModelsList = policyModelsRepository.findAll();
assertThat(policyModelsList.size()).isGreaterThanOrEqualTo(8);
assertThat(policyModelsList).contains(new PolicyModel("onap.policies.Monitoring", null, "1.0.0"));
@@ -67,7 +71,7 @@ public class PolicyEngineControllerTestItCase {
// Re-do it to check that there is no issue with duplicate key
policyController.synchronizeAllPolicies();
Instant secondExecution = policyController.getLastInstantExecuted();
- assertThat (secondExecution).isNotNull();
+ assertThat(secondExecution).isNotNull();
assertThat(firstExecution).isBefore(secondExecution);
}
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 1556ac6d3..3911494f4 100644
--- a/src/test/java/org/onap/clamp/policy/microservice/MicroServicePayloadTest.java
+++ b/src/test/java/org/onap/clamp/policy/microservice/MicroServicePayloadTest.java
@@ -24,21 +24,21 @@
package org.onap.clamp.policy.microservice;
import com.google.gson.JsonObject;
-
import java.io.IOException;
import java.util.HashSet;
-
import org.junit.Test;
import org.onap.clamp.clds.util.JsonUtils;
import org.onap.clamp.clds.util.ResourceFileUtil;
+import org.onap.clamp.loop.template.PolicyModel;
import org.skyscreamer.jsonassert.JSONAssert;
public class MicroServicePayloadTest {
@Test
public void testPayloadConstruction() throws IOException {
- MicroServicePolicy policy = new MicroServicePolicy("testPolicy", "onap.policies.monitoring.cdap.tca.hi.lo.app",
- ResourceFileUtil.getResourceAsString("tosca/tosca_example.yaml"), false, new HashSet<>());
+ MicroServicePolicy policy = new MicroServicePolicy("testPolicy", new PolicyModel(
+ "onap.policies.monitoring.cdap.tca.hi.lo.app",
+ ResourceFileUtil.getResourceAsString("tosca/tosca_example.yaml"),"1.0.0"), false, new HashSet<>());
policy.setConfigurationsJson(JsonUtils.GSON.fromJson(
ResourceFileUtil.getResourceAsString("tosca/micro-service-policy-properties.json"), JsonObject.class));
JSONAssert.assertEquals(ResourceFileUtil.getResourceAsString("tosca/micro-service-policy-payload.json"),
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 728b61cc9..f42bbc1c0 100644
--- a/src/test/java/org/onap/clamp/policy/microservice/OperationalPolicyPayloadTest.java
+++ b/src/test/java/org/onap/clamp/policy/microservice/OperationalPolicyPayloadTest.java
@@ -27,10 +27,8 @@ import static org.assertj.core.api.Assertions.assertThat;
import com.google.gson.GsonBuilder;
import com.google.gson.JsonObject;
-
import java.io.IOException;
import java.util.Map;
-
import org.junit.Test;
import org.onap.clamp.clds.util.ResourceFileUtil;
import org.onap.clamp.policy.operational.LegacyOperationalPolicy;
@@ -43,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);
+ OperationalPolicy policy = new OperationalPolicy("testPolicy", null, jsonConfig, null);
assertThat(policy.createPolicyPayloadYaml())
.isEqualTo(ResourceFileUtil.getResourceAsString("tosca/operational-policy-payload.yaml"));
@@ -65,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);
+ OperationalPolicy policy = new OperationalPolicy("testPolicy", null, jsonConfig, null);
Map<String, String> guardsMap = policy.createGuardPolicyPayloads();
assertThat(guardsMap).isEmpty();
assertThat(guardsMap.entrySet()).isEmpty();
@@ -75,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);
+ OperationalPolicy policy = new OperationalPolicy("testPolicy", null, jsonConfig, null);
Map<String, String> guardsMap = policy.createGuardPolicyPayloads();