X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=POLICY-SDK-APP%2Fsrc%2Ftest%2Fjava%2Forg%2Fonap%2Fpolicy%2Fcontroller%2FCreateDcaeMicroServiceControllerTest.java;h=8966f47a91ff7ad372c6d3930cf1d137cf283015;hb=39db5ecce3151ad42bc0c5433d14b2a81887a4ef;hp=e4ededa1f0d89bd4e24dda2416e56d3b9908eea3;hpb=418b33f0488a4e80667d7d998620b20ced1f3882;p=policy%2Fengine.git 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 CreateDcaeMicroServiceControllerTest contains tests for the class - * {@link CreateDcaeMicroServiceController}* * - * All JUnits are designed to run in the local development environment where they have write privileges and can execute - * time-sensitive tasks. + *

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 microServiceModelsData = new ArrayList(); 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 microServiceModelsData = new ArrayList(); 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