aboutsummaryrefslogtreecommitdiffstats
path: root/POLICY-SDK-APP/src/test/java/org/onap/policy/controller/CreateDcaeMicroServiceControllerTest.java
diff options
context:
space:
mode:
Diffstat (limited to 'POLICY-SDK-APP/src/test/java/org/onap/policy/controller/CreateDcaeMicroServiceControllerTest.java')
-rw-r--r--POLICY-SDK-APP/src/test/java/org/onap/policy/controller/CreateDcaeMicroServiceControllerTest.java34
1 files changed, 15 insertions, 19 deletions
diff --git a/POLICY-SDK-APP/src/test/java/org/onap/policy/controller/CreateDcaeMicroServiceControllerTest.java b/POLICY-SDK-APP/src/test/java/org/onap/policy/controller/CreateDcaeMicroServiceControllerTest.java
index e4ededa1f..8966f47a9 100644
--- a/POLICY-SDK-APP/src/test/java/org/onap/policy/controller/CreateDcaeMicroServiceControllerTest.java
+++ b/POLICY-SDK-APP/src/test/java/org/onap/policy/controller/CreateDcaeMicroServiceControllerTest.java
@@ -22,7 +22,6 @@
package org.onap.policy.controller;
-
import static org.easymock.EasyMock.createMock;
import static org.easymock.EasyMock.expect;
import static org.easymock.EasyMock.replay;
@@ -70,10 +69,9 @@ import org.springframework.mock.web.MockHttpServletResponse;
/**
* The class <code>CreateDcaeMicroServiceControllerTest</code> contains tests for the class
- * {@link <code>CreateDcaeMicroServiceController</code>}*
*
- * All JUnits are designed to run in the local development environment where they have write privileges and can execute
- * time-sensitive tasks.
+ * <p/>All JUnits are designed to run in the local development environment where they have write privileges
+ * and can execute time-sensitive tasks.
*
*/
@@ -85,11 +83,15 @@ public class CreateDcaeMicroServiceControllerTest {
private String configBodyString = null;
private HttpServletRequest request = null;
+ /**
+ * setUp.
+ *
+ * @throws Exception should not throw one
+ */
@Before
public void setUp() throws Exception {
logger.info("setUp: Entering");
commonClassDao = mock(CommonClassDao.class);
- List<Object> microServiceModelsData = new ArrayList<Object>();
MicroServiceModels testData = new MicroServiceModels();
testData.setVersion("OpenOnap-Junit");
testData.setModelName("modelName");
@@ -101,11 +103,11 @@ public class CreateDcaeMicroServiceControllerTest {
+ "CorrelationWindow=String:defaultValue-null:required-true:MANY-false:description-null,"
+ "EmailNotification=String:defaultValue-null:required-true:MANY-false:description-null,"
+ "CorrelationPriority=string:defaultValue-null:required-true:MANY-false:description-null,");
- testData.setRef_attributes("SymptomTriggerSignature=resource-model-symptomEntity:MANY-true:description-null,"
+ testData.setRefAttributes("SymptomTriggerSignature=resource-model-symptomEntity:MANY-true:description-null,"
+ "triggerSignature=resource-model-entity:MANY-true:description-null,"
+ "SelectServerScope=SELECTSERVERSCOPE:MANY-false,logicalConnector=LOGICALCONNECTOR:MANY-false,"
+ "ParentCorrelationTraversal=PARENTCORRELATIONTRAVERSAL:MANY-false,");
- testData.setSub_attributes(
+ testData.setSubAttributes(
"{\"symptomAlarms\":{\"symptomContains\":\"SYMPTOMCONTAINS:defaultValue-null:required-true:MANY-false:"
+ "description-null\",\"symptomFilterValue\":\"string:defaultValue-null:"
+ "required-true:MANY-false:"
@@ -136,6 +138,7 @@ public class CreateDcaeMicroServiceControllerTest {
testData.setDataOrderInfo("triggerSignature.signaturesAlarm.alarmSignatures.alarmSignature[VnfType, Contains, "
+ "FilterValue]@SymptomTriggerSignature.signaturesSymptom.symptomSignatures."
+ "symptomSignature[symptomVnfType, symptomContains, symptomFilterValue]");
+ List<Object> microServiceModelsData = new ArrayList<Object>();
microServiceModelsData.add(testData);
// mock the getDataById() call
@@ -159,15 +162,8 @@ public class CreateDcaeMicroServiceControllerTest {
+ "\"asdafadf\",\"guard\":\"True\",\"riskType\":\"sfsgs\",\"riskLevel\":\"1\","
+ "\"priority\":\"1\",\"configName\":\"Search\",\"location\":\"Search\","
+ "\"uuid\":\"Search\",\"policyScope\":\"PolicyScope_ssaaa123\"}},"
- + "\"policyJSON\":{\"Correlation Priority\":\"testttt\",\"Correlation Window\":"
- + "\"testttt\",\"Email Notification for failures\":\"sds@l.com\","
- + "\"Select Server Scope\":\"testttt\",\"Parent Correlation Name\":"
- + "\"testttt\",\"Parent Correlation Traversal\":\"testttt\",\"logicalConnector\":"
- + "\"OR\",\"triggerSignature@0.signaturesAlarm.alarmSignatures@0.traversal\":\"testttt\","
- + "\"triggerSignature@0.signaturesAlarm.alarmSignatures@0.alarmSignature@0.VnfType\":"
- + "\" testttt\",\"triggerSignature@0.signaturesAlarm.alarmSignatures@0."
- + "alarmSignature@0.Contains\":\"AND\",\"triggerSignature@0.signaturesAlarm."
- + "alarmSignatures@0.alarmSignature@0.FilterValue\":\"testttt\"}}";
+ + "\"policyJSON\":{\"DCAEProcessingRules@0.processingRules_json\":"
+ + "\"eyJuYW1lIjogIkpvaG4iLCAiYWdlIjogIjI4IiwgImNpdHkiOiAiTmV3IFlvcmsifQ==\"}}";
configBodyString = "{\"service\":\"SniroPolicyEntityTest\",\"policyName\":\"someone\",\"description\":\"test\","
+ "\"templateVersion\":\"1607\",\"version\":\"HD\",\"priority\":\"2\","
@@ -349,11 +345,8 @@ public class CreateDcaeMicroServiceControllerTest {
try {
root = JsonLoader.fromString(jsonString);
restAdapter = mapper.readValue(root.get("policyData").get("policy").toString(), PolicyRestAdapter.class);
- TargetType target = new TargetType();
// create guard attribute
- AnyOfType anyOfType = new AnyOfType();
- AllOfType alltype = new AllOfType();
MatchType matchType = new MatchType();
// set value
AttributeValueType attributeValue1 = new AttributeValueType();
@@ -363,6 +356,7 @@ public class CreateDcaeMicroServiceControllerTest {
AttributeDesignatorType designator = new AttributeDesignatorType();
designator.setAttributeId("guard");
matchType.setAttributeDesignator(designator);
+ AllOfType alltype = new AllOfType();
alltype.getMatch().add(matchType);
// add a dummy MatchType object since while (matchList.size()>1 ...)
@@ -377,8 +371,10 @@ public class CreateDcaeMicroServiceControllerTest {
matchDummy.setAttributeDesignator(designatorDummy);
alltype.getMatch().add(matchDummy);
+ AnyOfType anyOfType = new AnyOfType();
anyOfType.getAllOf().add(alltype);
+ TargetType target = new TargetType();
target.getAnyOf().add(anyOfType);
// create RiskType attribute