diff options
Diffstat (limited to 'controlloop/common/eventmanager/src/test/java')
3 files changed, 149 insertions, 149 deletions
diff --git a/controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/eventmanager/ControlLoopEventManagerTest.java b/controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/eventmanager/ControlLoopEventManagerTest.java index 4ff8338a6..700d1abf8 100644 --- a/controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/eventmanager/ControlLoopEventManagerTest.java +++ b/controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/eventmanager/ControlLoopEventManagerTest.java @@ -74,13 +74,13 @@ public class ControlLoopEventManagerTest { { onset = new VirtualControlLoopEvent(); onset.setClosedLoopControlName("ControlLoop-vUSP"); - onset.setRequestID(UUID.randomUUID()); + onset.setRequestId(UUID.randomUUID()); onset.setTarget("VM_NAME"); onset.setClosedLoopAlarmStart(Instant.now()); - onset.setAAI(new HashMap<String, String>()); - onset.getAAI().put("cloud-region.identity-url", "foo"); - onset.getAAI().put("vserver.selflink", "bar"); - onset.getAAI().put("generic-vnf.vnf-id", "83f674e8-7555-44d7-9a39-bdc3770b0491"); + onset.setAai(new HashMap<String, String>()); + onset.getAai().put("cloud-region.identity-url", "foo"); + onset.getAai().put("vserver.selflink", "bar"); + onset.getAai().put("generic-vnf.vnf-id", "83f674e8-7555-44d7-9a39-bdc3770b0491"); onset.setClosedLoopEventStatus(ControlLoopEventStatus.ONSET); } @@ -209,12 +209,12 @@ public class ControlLoopEventManagerTest { public void abatemetCheckEventSyntaxTest() { VirtualControlLoopEvent event = new VirtualControlLoopEvent(); event.setClosedLoopControlName("abatementAAI"); - event.setRequestID(UUID.randomUUID()); + event.setRequestId(UUID.randomUUID()); event.setTarget("generic-vnf.vnf-id"); event.setClosedLoopAlarmStart(Instant.now()); event.setClosedLoopEventStatus(ControlLoopEventStatus.ABATED); ControlLoopEventManager manager = - new ControlLoopEventManager(event.getClosedLoopControlName(), event.getRequestID()); + new ControlLoopEventManager(event.getClosedLoopControlName(), event.getRequestId()); assertNull(manager.getVnfResponse()); assertNull(manager.getVserverResponse()); try { @@ -228,8 +228,8 @@ public class ControlLoopEventManagerTest { assertNull(manager.getVserverResponse()); - event.setAAI(new HashMap<>()); - event.getAAI().put("generic-vnf.vnf-name", "abatementTest"); + event.setAai(new HashMap<>()); + event.getAai().put("generic-vnf.vnf-name", "abatementTest"); try { manager.checkEventSyntax(event); } catch (ControlLoopException e) { @@ -246,15 +246,15 @@ public class ControlLoopEventManagerTest { UUID requestId = UUID.randomUUID(); VirtualControlLoopEvent event = new VirtualControlLoopEvent(); event.setClosedLoopControlName("TwoOnsetTest"); - event.setRequestID(requestId); + event.setRequestId(requestId); event.setTarget("generic-vnf.vnf-id"); event.setClosedLoopAlarmStart(Instant.now()); event.setClosedLoopEventStatus(ControlLoopEventStatus.ONSET); - event.setAAI(new HashMap<>()); - event.getAAI().put("generic-vnf.vnf-name", "onsetOne"); + event.setAai(new HashMap<>()); + event.getAai().put("generic-vnf.vnf-name", "onsetOne"); ControlLoopEventManager manager = - new ControlLoopEventManager(event.getClosedLoopControlName(), event.getRequestID()); + new ControlLoopEventManager(event.getClosedLoopControlName(), event.getRequestId()); VirtualControlLoopNotification notification = manager.activate(event); assertNotNull(notification); @@ -276,12 +276,12 @@ public class ControlLoopEventManagerTest { VirtualControlLoopEvent event2 = new VirtualControlLoopEvent(); event2.setClosedLoopControlName("TwoOnsetTest"); - event2.setRequestID(requestId); + event2.setRequestId(requestId); event2.setTarget("generic-vnf.vnf-id"); event2.setClosedLoopAlarmStart(Instant.now()); event2.setClosedLoopEventStatus(ControlLoopEventStatus.ONSET); - event2.setAAI(new HashMap<>()); - event2.getAAI().put("generic-vnf.vnf-name", "onsetTwo"); + event2.setAai(new HashMap<>()); + event2.getAai().put("generic-vnf.vnf-name", "onsetTwo"); try { @@ -494,15 +494,15 @@ public class ControlLoopEventManagerTest { UUID requestId = UUID.randomUUID(); VirtualControlLoopEvent event = new VirtualControlLoopEvent(); event.setClosedLoopControlName("TwoOnsetTest"); - event.setRequestID(requestId); + event.setRequestId(requestId); event.setTarget("generic-vnf.vnf-id"); event.setClosedLoopAlarmStart(Instant.now()); event.setClosedLoopEventStatus(ControlLoopEventStatus.ONSET); - event.setAAI(new HashMap<>()); - event.getAAI().put("generic-vnf.vnf-name", "onsetOne"); + event.setAai(new HashMap<>()); + event.getAai().put("generic-vnf.vnf-name", "onsetOne"); ControlLoopEventManager manager = - new ControlLoopEventManager(event.getClosedLoopControlName(), event.getRequestID()); + new ControlLoopEventManager(event.getClosedLoopControlName(), event.getRequestId()); manager.setActivated(true); VirtualControlLoopNotification notification = manager.activate(event); assertEquals(ControlLoopNotificationType.REJECTED, notification.getNotification()); @@ -519,15 +519,15 @@ public class ControlLoopEventManagerTest { UUID requestId = UUID.randomUUID(); VirtualControlLoopEvent event = new VirtualControlLoopEvent(); event.setClosedLoopControlName("TwoOnsetTest"); - event.setRequestID(requestId); + event.setRequestId(requestId); event.setTarget("generic-vnf.vnf-id"); event.setClosedLoopAlarmStart(Instant.now()); event.setClosedLoopEventStatus(ControlLoopEventStatus.ONSET); - event.setAAI(new HashMap<>()); - event.getAAI().put("generic-vnf.vnf-name", "onsetOne"); + event.setAai(new HashMap<>()); + event.getAai().put("generic-vnf.vnf-name", "onsetOne"); ControlLoopEventManager manager = - new ControlLoopEventManager(event.getClosedLoopControlName(), event.getRequestID()); + new ControlLoopEventManager(event.getClosedLoopControlName(), event.getRequestId()); // Null YAML should fail VirtualControlLoopNotification notificationNull = manager.activate(null, event); @@ -562,15 +562,15 @@ public class ControlLoopEventManagerTest { UUID requestId = UUID.randomUUID(); VirtualControlLoopEvent event = new VirtualControlLoopEvent(); event.setClosedLoopControlName("TwoOnsetTest"); - event.setRequestID(requestId); + event.setRequestId(requestId); event.setTarget("generic-vnf.vnf-id"); event.setClosedLoopAlarmStart(Instant.now()); event.setClosedLoopEventStatus(ControlLoopEventStatus.ONSET); - event.setAAI(new HashMap<>()); - event.getAAI().put("generic-vnf.vnf-name", "onsetOne"); + event.setAai(new HashMap<>()); + event.getAai().put("generic-vnf.vnf-name", "onsetOne"); ControlLoopEventManager manager = - new ControlLoopEventManager(event.getClosedLoopControlName(), event.getRequestID()); + new ControlLoopEventManager(event.getClosedLoopControlName(), event.getRequestId()); try { manager.isControlLoopFinal(); fail("test should throw an exception here"); @@ -599,7 +599,7 @@ public class ControlLoopEventManagerTest { assertNotNull(clfNotification); assertEquals(ControlLoopNotificationType.FINAL_SUCCESS, clfNotification.getNotification()); - manager = new ControlLoopEventManager(event.getClosedLoopControlName(), event.getRequestID()); + manager = new ControlLoopEventManager(event.getClosedLoopControlName(), event.getRequestId()); notification = manager.activate(yamlString, event); assertNotNull(notification); assertEquals(ControlLoopNotificationType.ACTIVE, notification.getNotification()); @@ -609,7 +609,7 @@ public class ControlLoopEventManagerTest { assertNotNull(clfNotification); assertEquals(ControlLoopNotificationType.FINAL_FAILURE, clfNotification.getNotification()); - manager = new ControlLoopEventManager(event.getClosedLoopControlName(), event.getRequestID()); + manager = new ControlLoopEventManager(event.getClosedLoopControlName(), event.getRequestId()); notification = manager.activate(yamlString, event); assertNotNull(notification); assertEquals(ControlLoopNotificationType.ACTIVE, notification.getNotification()); @@ -633,15 +633,15 @@ public class ControlLoopEventManagerTest { UUID requestId = UUID.randomUUID(); VirtualControlLoopEvent event = new VirtualControlLoopEvent(); event.setClosedLoopControlName("TwoOnsetTest"); - event.setRequestID(requestId); + event.setRequestId(requestId); event.setTarget("generic-vnf.vnf-id"); event.setClosedLoopAlarmStart(Instant.now()); event.setClosedLoopEventStatus(ControlLoopEventStatus.ONSET); - event.setAAI(new HashMap<>()); - event.getAAI().put("generic-vnf.vnf-name", "onsetOne"); + event.setAai(new HashMap<>()); + event.getAai().put("generic-vnf.vnf-name", "onsetOne"); ControlLoopEventManager manager = - new ControlLoopEventManager(event.getClosedLoopControlName(), event.getRequestID()); + new ControlLoopEventManager(event.getClosedLoopControlName(), event.getRequestId()); try { manager.processControlLoop(); fail("test should throw an exception here"); @@ -674,7 +674,7 @@ public class ControlLoopEventManagerTest { assertEquals("Already working an Operation, do not call this method.", e.getMessage()); } - manager = new ControlLoopEventManager(event.getClosedLoopControlName(), event.getRequestID()); + manager = new ControlLoopEventManager(event.getClosedLoopControlName(), event.getRequestId()); notification = manager.activate(yamlString, event); assertNotNull(notification); assertEquals(ControlLoopNotificationType.ACTIVE, notification.getNotification()); @@ -692,7 +692,7 @@ public class ControlLoopEventManagerTest { assertEquals("Control Loop is in FINAL state, do not call this method.", e.getMessage()); } - manager = new ControlLoopEventManager(event.getClosedLoopControlName(), event.getRequestID()); + manager = new ControlLoopEventManager(event.getClosedLoopControlName(), event.getRequestId()); notification = manager.activate(yamlString, event); assertNotNull(notification); assertEquals(ControlLoopNotificationType.ACTIVE, notification.getNotification()); @@ -718,15 +718,15 @@ public class ControlLoopEventManagerTest { UUID requestId = UUID.randomUUID(); VirtualControlLoopEvent event = new VirtualControlLoopEvent(); event.setClosedLoopControlName("TwoOnsetTest"); - event.setRequestID(requestId); + event.setRequestId(requestId); event.setTarget("generic-vnf.vnf-id"); event.setClosedLoopAlarmStart(Instant.now()); event.setClosedLoopEventStatus(ControlLoopEventStatus.ONSET); - event.setAAI(new HashMap<>()); - event.getAAI().put("generic-vnf.vnf-name", "onsetOne"); + event.setAai(new HashMap<>()); + event.getAai().put("generic-vnf.vnf-name", "onsetOne"); ControlLoopEventManager manager = - new ControlLoopEventManager(event.getClosedLoopControlName(), event.getRequestID()); + new ControlLoopEventManager(event.getClosedLoopControlName(), event.getRequestId()); try { manager.finishOperation(null); fail("test should throw an exception here"); @@ -781,7 +781,7 @@ public class ControlLoopEventManagerTest { manager.finishOperation(clom); ControlLoopEventManager otherManager = - new ControlLoopEventManager(event.getClosedLoopControlName(), event.getRequestID()); + new ControlLoopEventManager(event.getClosedLoopControlName(), event.getRequestId()); VirtualControlLoopNotification otherNotification = otherManager.activate(yamlStringStd, event); assertNotNull(otherNotification); assertEquals(ControlLoopNotificationType.ACTIVE, otherNotification.getNotification()); @@ -801,24 +801,24 @@ public class ControlLoopEventManagerTest { UUID requestId = UUID.randomUUID(); VirtualControlLoopEvent onsetEvent = new VirtualControlLoopEvent(); onsetEvent.setClosedLoopControlName("TwoOnsetTest"); - onsetEvent.setRequestID(requestId); + onsetEvent.setRequestId(requestId); onsetEvent.setTarget("generic-vnf.vnf-id"); onsetEvent.setClosedLoopAlarmStart(Instant.now()); onsetEvent.setClosedLoopEventStatus(ControlLoopEventStatus.ONSET); - onsetEvent.setAAI(new HashMap<>()); - onsetEvent.getAAI().put("generic-vnf.vnf-name", "onsetOne"); + onsetEvent.setAai(new HashMap<>()); + onsetEvent.getAai().put("generic-vnf.vnf-name", "onsetOne"); VirtualControlLoopEvent abatedEvent = new VirtualControlLoopEvent(); abatedEvent.setClosedLoopControlName("TwoOnsetTest"); - abatedEvent.setRequestID(requestId); + abatedEvent.setRequestId(requestId); abatedEvent.setTarget("generic-vnf.vnf-id"); abatedEvent.setClosedLoopAlarmStart(Instant.now()); abatedEvent.setClosedLoopEventStatus(ControlLoopEventStatus.ABATED); - abatedEvent.setAAI(new HashMap<>()); - abatedEvent.getAAI().put("generic-vnf.vnf-name", "onsetOne"); + abatedEvent.setAai(new HashMap<>()); + abatedEvent.getAai().put("generic-vnf.vnf-name", "onsetOne"); ControlLoopEventManager manager = - new ControlLoopEventManager(onsetEvent.getClosedLoopControlName(), onsetEvent.getRequestID()); + new ControlLoopEventManager(onsetEvent.getClosedLoopControlName(), onsetEvent.getRequestId()); VirtualControlLoopNotification notification = manager.activate(yamlString, onsetEvent); assertNotNull(notification); assertEquals(ControlLoopNotificationType.ACTIVE, notification.getNotification()); @@ -828,7 +828,7 @@ public class ControlLoopEventManagerTest { assertEquals(NEW_EVENT_STATUS.SUBSEQUENT_ABATEMENT, manager.onNewEvent(abatedEvent)); VirtualControlLoopEvent checkSyntaxEvent = new VirtualControlLoopEvent(); - checkSyntaxEvent.setAAI(null); + checkSyntaxEvent.setAai(null); checkSyntaxEvent.setClosedLoopAlarmEnd(null); checkSyntaxEvent.setClosedLoopAlarmStart(null); checkSyntaxEvent.setClosedLoopControlName(null); @@ -838,7 +838,7 @@ public class ControlLoopEventManagerTest { checkSyntaxEvent.setPolicyName(null); checkSyntaxEvent.setPolicyScope(null); checkSyntaxEvent.setPolicyVersion(null); - checkSyntaxEvent.setRequestID(null); + checkSyntaxEvent.setRequestId(null); checkSyntaxEvent.setTarget(null); checkSyntaxEvent.setTargetType(null); checkSyntaxEvent.setVersion(null); @@ -857,16 +857,16 @@ public class ControlLoopEventManagerTest { checkSyntaxEvent.setClosedLoopControlName("TwoOnsetTest"); assertEquals(NEW_EVENT_STATUS.SYNTAX_ERROR, manager.onNewEvent(checkSyntaxEvent)); - checkSyntaxEvent.setRequestID(null); + checkSyntaxEvent.setRequestId(null); assertEquals(NEW_EVENT_STATUS.SYNTAX_ERROR, manager.onNewEvent(checkSyntaxEvent)); - checkSyntaxEvent.setRequestID(requestId); + checkSyntaxEvent.setRequestId(requestId); assertEquals(NEW_EVENT_STATUS.SYNTAX_ERROR, manager.onNewEvent(checkSyntaxEvent)); - checkSyntaxEvent.setAAI(null); + checkSyntaxEvent.setAai(null); assertEquals(NEW_EVENT_STATUS.SYNTAX_ERROR, manager.onNewEvent(checkSyntaxEvent)); - checkSyntaxEvent.setAAI(new HashMap<>()); + checkSyntaxEvent.setAai(new HashMap<>()); assertEquals(NEW_EVENT_STATUS.SYNTAX_ERROR, manager.onNewEvent(checkSyntaxEvent)); checkSyntaxEvent.setTarget(""); @@ -896,19 +896,19 @@ public class ControlLoopEventManagerTest { checkSyntaxEvent.setTarget("generic-vnf.vnf-name"); assertEquals(NEW_EVENT_STATUS.SYNTAX_ERROR, manager.onNewEvent(checkSyntaxEvent)); - checkSyntaxEvent.setAAI(null); + checkSyntaxEvent.setAai(null); assertEquals(NEW_EVENT_STATUS.SYNTAX_ERROR, manager.onNewEvent(checkSyntaxEvent)); - checkSyntaxEvent.setAAI(new HashMap<>()); + checkSyntaxEvent.setAai(new HashMap<>()); assertEquals(NEW_EVENT_STATUS.SYNTAX_ERROR, manager.onNewEvent(checkSyntaxEvent)); - checkSyntaxEvent.getAAI().put("generic-vnf.vnf-name", "onsetOne"); + checkSyntaxEvent.getAai().put("generic-vnf.vnf-name", "onsetOne"); assertEquals(NEW_EVENT_STATUS.SUBSEQUENT_ABATEMENT, manager.onNewEvent(abatedEvent)); - checkSyntaxEvent.getAAI().put("vserver.vserver-name", "onsetOne"); + checkSyntaxEvent.getAai().put("vserver.vserver-name", "onsetOne"); assertEquals(NEW_EVENT_STATUS.SUBSEQUENT_ABATEMENT, manager.onNewEvent(abatedEvent)); - checkSyntaxEvent.getAAI().put("generic-vnf.vnf-id", "onsetOne"); + checkSyntaxEvent.getAai().put("generic-vnf.vnf-id", "onsetOne"); assertEquals(NEW_EVENT_STATUS.SUBSEQUENT_ABATEMENT, manager.onNewEvent(abatedEvent)); } @@ -920,15 +920,15 @@ public class ControlLoopEventManagerTest { UUID requestId = UUID.randomUUID(); VirtualControlLoopEvent onsetEvent = new VirtualControlLoopEvent(); onsetEvent.setClosedLoopControlName("TwoOnsetTest"); - onsetEvent.setRequestID(requestId); + onsetEvent.setRequestId(requestId); onsetEvent.setTarget("generic-vnf.vnf-id"); onsetEvent.setClosedLoopAlarmStart(Instant.now()); onsetEvent.setClosedLoopEventStatus(ControlLoopEventStatus.ONSET); - onsetEvent.setAAI(new HashMap<>()); - onsetEvent.getAAI().put("generic-vnf.vnf-name", "onsetOne"); + onsetEvent.setAai(new HashMap<>()); + onsetEvent.getAai().put("generic-vnf.vnf-name", "onsetOne"); ControlLoopEventManager manager = - new ControlLoopEventManager(onsetEvent.getClosedLoopControlName(), onsetEvent.getRequestID()); + new ControlLoopEventManager(onsetEvent.getClosedLoopControlName(), onsetEvent.getRequestId()); assertTrue(0 == manager.getControlLoopTimeout(null)); assertTrue(120 == manager.getControlLoopTimeout(120)); @@ -947,15 +947,15 @@ public class ControlLoopEventManagerTest { UUID requestId = UUID.randomUUID(); VirtualControlLoopEvent onsetEvent = new VirtualControlLoopEvent(); onsetEvent.setClosedLoopControlName("TwoOnsetTest"); - onsetEvent.setRequestID(requestId); + onsetEvent.setRequestId(requestId); onsetEvent.setTarget("generic-vnf.vnf-id"); onsetEvent.setClosedLoopAlarmStart(Instant.now()); onsetEvent.setClosedLoopEventStatus(ControlLoopEventStatus.ONSET); - onsetEvent.setAAI(new HashMap<>()); - onsetEvent.getAAI().put("generic-vnf.vnf-name", "onsetOne"); + onsetEvent.setAai(new HashMap<>()); + onsetEvent.getAai().put("generic-vnf.vnf-name", "onsetOne"); ControlLoopEventManager manager = - new ControlLoopEventManager(onsetEvent.getClosedLoopControlName(), onsetEvent.getRequestID()); + new ControlLoopEventManager(onsetEvent.getClosedLoopControlName(), onsetEvent.getRequestId()); manager.queryAai(onsetEvent); VirtualControlLoopNotification notification = manager.activate(yamlString, onsetEvent); @@ -964,53 +964,53 @@ public class ControlLoopEventManagerTest { manager.queryAai(onsetEvent); - onsetEvent.getAAI().put("generic-vnf.is-closed-loop-disabled", "true"); + onsetEvent.getAai().put("generic-vnf.is-closed-loop-disabled", "true"); try { manager.queryAai(onsetEvent); fail("test should throw an exception here"); } catch (Exception e) { assertEquals("is-closed-loop-disabled is set to true on VServer or VNF", e.getMessage()); } - onsetEvent.getAAI().put("vserver.is-closed-loop-disabled", "true"); + onsetEvent.getAai().put("vserver.is-closed-loop-disabled", "true"); try { manager.queryAai(onsetEvent); fail("test should throw an exception here"); } catch (Exception e) { assertEquals("is-closed-loop-disabled is set to true on VServer or VNF", e.getMessage()); } - onsetEvent.getAAI().remove("generic-vnf.is-closed-loop-disabled"); + onsetEvent.getAai().remove("generic-vnf.is-closed-loop-disabled"); try { manager.queryAai(onsetEvent); fail("test should throw an exception here"); } catch (Exception e) { assertEquals("is-closed-loop-disabled is set to true on VServer or VNF", e.getMessage()); } - onsetEvent.getAAI().remove("vserver.is-closed-loop-disabled"); + onsetEvent.getAai().remove("vserver.is-closed-loop-disabled"); manager.queryAai(onsetEvent); - onsetEvent.getAAI().put("generic-vnf.is-closed-loop-disabled", "false"); + onsetEvent.getAai().put("generic-vnf.is-closed-loop-disabled", "false"); manager.queryAai(onsetEvent); - onsetEvent.getAAI().put("vserver.is-closed-loop-disabled", "false"); + onsetEvent.getAai().put("vserver.is-closed-loop-disabled", "false"); manager.queryAai(onsetEvent); - onsetEvent.getAAI().remove("generic-vnf.vnf-id"); - onsetEvent.getAAI().remove("generic-vnf.vnf-name"); - onsetEvent.getAAI().remove("vserver.vserver-name"); + onsetEvent.getAai().remove("generic-vnf.vnf-id"); + onsetEvent.getAai().remove("generic-vnf.vnf-name"); + onsetEvent.getAai().remove("vserver.vserver-name"); manager.queryAai(onsetEvent); - onsetEvent.getAAI().put("vserver.vserver-name", "AVserver"); + onsetEvent.getAai().put("vserver.vserver-name", "AVserver"); manager.queryAai(onsetEvent); - onsetEvent.getAAI().put("generic-vnf.vnf-name", "AVNFName"); + onsetEvent.getAai().put("generic-vnf.vnf-name", "AVNFName"); manager.queryAai(onsetEvent); - onsetEvent.getAAI().put("generic-vnf.vnf-id", "AVNFID"); + onsetEvent.getAai().put("generic-vnf.vnf-id", "AVNFID"); manager.queryAai(onsetEvent); - onsetEvent.getAAI().remove("vserver.vserver-name"); + onsetEvent.getAai().remove("vserver.vserver-name"); manager.queryAai(onsetEvent); - onsetEvent.getAAI().remove("generic-vnf.vnf-name"); + onsetEvent.getAai().remove("generic-vnf.vnf-name"); manager.queryAai(onsetEvent); // Force AAI errors @@ -1024,8 +1024,8 @@ public class ControlLoopEventManagerTest { + "(query by vnf-id)", e.getMessage()); } - onsetEvent.getAAI().remove("generic-vnf.vnf-id"); - onsetEvent.getAAI().put("generic-vnf.vnf-name", "AVNFName"); + onsetEvent.getAai().remove("generic-vnf.vnf-id"); + onsetEvent.getAai().put("generic-vnf.vnf-name", "AVNFName"); try { manager.queryAai(onsetEvent); fail("test should throw an exception here"); @@ -1034,8 +1034,8 @@ public class ControlLoopEventManagerTest { + "(query by vnf-name)", e.getMessage()); } - onsetEvent.getAAI().remove("generic-vnf.vnf-name"); - onsetEvent.getAAI().put("vserver.vserver-name", "AVserver"); + onsetEvent.getAai().remove("generic-vnf.vnf-name"); + onsetEvent.getAai().put("vserver.vserver-name", "AVserver"); try { manager.queryAai(onsetEvent); fail("test should throw an exception here"); diff --git a/controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/eventmanager/ControlLoopOperationManagerTest.java b/controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/eventmanager/ControlLoopOperationManagerTest.java index 8efa3706d..fd4405d61 100644 --- a/controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/eventmanager/ControlLoopOperationManagerTest.java +++ b/controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/eventmanager/ControlLoopOperationManagerTest.java @@ -45,11 +45,11 @@ import org.onap.policy.appc.CommonHeader; import org.onap.policy.appc.Response; import org.onap.policy.appc.ResponseCode; import org.onap.policy.appc.ResponseStatus; -import org.onap.policy.appclcm.LCMCommonHeader; -import org.onap.policy.appclcm.LCMRequest; -import org.onap.policy.appclcm.LCMRequestWrapper; -import org.onap.policy.appclcm.LCMResponse; -import org.onap.policy.appclcm.LCMResponseWrapper; +import org.onap.policy.appclcm.LcmCommonHeader; +import org.onap.policy.appclcm.LcmRequest; +import org.onap.policy.appclcm.LcmRequestWrapper; +import org.onap.policy.appclcm.LcmResponse; +import org.onap.policy.appclcm.LcmResponseWrapper; import org.onap.policy.controlloop.ControlLoopEventStatus; import org.onap.policy.controlloop.ControlLoopException; import org.onap.policy.controlloop.ControlLoopNotificationType; @@ -80,12 +80,12 @@ public class ControlLoopOperationManagerTest { static { onset = new VirtualControlLoopEvent(); - onset.setRequestID(UUID.randomUUID()); + onset.setRequestId(UUID.randomUUID()); onset.setTarget("generic-vnf.vnf-name"); onset.setTargetType(ControlLoopTargetType.VNF); onset.setClosedLoopAlarmStart(Instant.now()); - onset.setAAI(new HashMap<>()); - onset.getAAI().put("generic-vnf.vnf-name", "testTriggerSource"); + onset.setAai(new HashMap<>()); + onset.getAai().put("generic-vnf.vnf-name", "testTriggerSource"); onset.setClosedLoopEventStatus(ControlLoopEventStatus.ONSET); /* Set environment properties */ @@ -127,7 +127,7 @@ public class ControlLoopOperationManagerTest { // create the manager // ControlLoopEventManager eventManager = - new ControlLoopEventManager(onset.getClosedLoopControlName(), onset.getRequestID()); + new ControlLoopEventManager(onset.getClosedLoopControlName(), onset.getRequestId()); VirtualControlLoopNotification notification = eventManager.activate(onset); assertNotNull(notification); @@ -157,17 +157,17 @@ public class ControlLoopOperationManagerTest { Object request = manager.startOperation(onset); logger.debug("{}", manager); assertNotNull(request); - assertTrue(request instanceof LCMRequestWrapper); - LCMRequestWrapper dmaapRequest = (LCMRequestWrapper) request; - LCMRequest appcRequest = dmaapRequest.getBody(); + assertTrue(request instanceof LcmRequestWrapper); + LcmRequestWrapper dmaapRequest = (LcmRequestWrapper) request; + LcmRequest appcRequest = dmaapRequest.getBody(); assertTrue(appcRequest.getCommonHeader().getSubRequestId().contentEquals("1")); assertFalse(manager.isOperationComplete()); assertTrue(manager.isOperationRunning()); // // Accept // - LCMResponseWrapper dmaapResponse = new LCMResponseWrapper(); - LCMResponse appcResponse = new LCMResponse(appcRequest); + LcmResponseWrapper dmaapResponse = new LcmResponseWrapper(); + LcmResponse appcResponse = new LcmResponse(appcRequest); appcResponse.getStatus().setCode(100); appcResponse.getStatus().setMessage("ACCEPT"); dmaapResponse.setBody(appcResponse); @@ -182,7 +182,7 @@ public class ControlLoopOperationManagerTest { // // Now we are going to Fail it // - appcResponse = new LCMResponse(appcRequest); + appcResponse = new LcmResponse(appcRequest); appcResponse.getStatus().setCode(401); appcResponse.getStatus().setMessage("AppC failed for some reason"); dmaapResponse.setBody(appcResponse); @@ -197,8 +197,8 @@ public class ControlLoopOperationManagerTest { request = manager.startOperation(onset); logger.debug("{}", manager); assertNotNull(request); - assertTrue(request instanceof LCMRequestWrapper); - dmaapRequest = (LCMRequestWrapper) request; + assertTrue(request instanceof LcmRequestWrapper); + dmaapRequest = (LcmRequestWrapper) request; appcRequest = dmaapRequest.getBody(); assertTrue(appcRequest.getCommonHeader().getSubRequestId().contentEquals("2")); assertFalse(manager.isOperationComplete()); @@ -206,7 +206,7 @@ public class ControlLoopOperationManagerTest { // // // - appcResponse = new LCMResponse(appcRequest); + appcResponse = new LcmResponse(appcRequest); logger.debug("{}", manager); appcResponse.getStatus().setCode(100); appcResponse.getStatus().setMessage("ACCEPT"); @@ -222,7 +222,7 @@ public class ControlLoopOperationManagerTest { // // Now we are going to Fail it // - appcResponse = new LCMResponse(appcRequest); + appcResponse = new LcmResponse(appcRequest); appcResponse.getStatus().setCode(401); appcResponse.getStatus().setMessage("AppC failed for some reason"); dmaapResponse.setBody(appcResponse); @@ -258,7 +258,7 @@ public class ControlLoopOperationManagerTest { // create the manager // ControlLoopEventManager eventManager = - new ControlLoopEventManager(onset.getClosedLoopControlName(), onset.getRequestID()); + new ControlLoopEventManager(onset.getClosedLoopControlName(), onset.getRequestId()); VirtualControlLoopNotification notification = eventManager.activate(onset); assertNotNull(notification); @@ -288,17 +288,17 @@ public class ControlLoopOperationManagerTest { Object request = manager.startOperation(onset); logger.debug("{}", manager); assertNotNull(request); - assertTrue((request) instanceof LCMRequestWrapper); - LCMRequestWrapper dmaapRequest = (LCMRequestWrapper) request; - LCMRequest appcRequest = dmaapRequest.getBody(); + assertTrue((request) instanceof LcmRequestWrapper); + LcmRequestWrapper dmaapRequest = (LcmRequestWrapper) request; + LcmRequest appcRequest = dmaapRequest.getBody(); assertTrue((appcRequest).getCommonHeader().getSubRequestId().contentEquals("1")); assertFalse(manager.isOperationComplete()); assertTrue(manager.isOperationRunning()); // // Accept // - LCMResponseWrapper dmaapResponse = new LCMResponseWrapper(); - LCMResponse appcResponse = new LCMResponse(appcRequest); + LcmResponseWrapper dmaapResponse = new LcmResponseWrapper(); + LcmResponse appcResponse = new LcmResponse(appcRequest); dmaapResponse.setBody(appcResponse); appcResponse.getStatus().setCode(100); appcResponse.getStatus().setMessage("ACCEPT"); @@ -322,7 +322,7 @@ public class ControlLoopOperationManagerTest { // // Now we are going to Fail the previous request // - appcResponse = new LCMResponse(appcRequest); + appcResponse = new LcmResponse(appcRequest); appcResponse.getStatus().setCode(401); appcResponse.getStatus().setMessage("AppC failed for some reason"); dmaapResponse.setBody(appcResponse); @@ -348,15 +348,15 @@ public class ControlLoopOperationManagerTest { UUID requestId = UUID.randomUUID(); VirtualControlLoopEvent onsetEvent = new VirtualControlLoopEvent(); onsetEvent.setClosedLoopControlName("TwoOnsetTest"); - onsetEvent.setRequestID(requestId); + onsetEvent.setRequestId(requestId); onsetEvent.setTarget("generic-vnf.vnf-id"); onsetEvent.setClosedLoopAlarmStart(Instant.now()); onsetEvent.setClosedLoopEventStatus(ControlLoopEventStatus.ONSET); - onsetEvent.setAAI(new HashMap<>()); - onsetEvent.getAAI().put("generic-vnf.vnf-name", "onsetOne"); + onsetEvent.setAai(new HashMap<>()); + onsetEvent.getAai().put("generic-vnf.vnf-name", "onsetOne"); ControlLoopEventManager manager = - new ControlLoopEventManager(onsetEvent.getClosedLoopControlName(), onsetEvent.getRequestID()); + new ControlLoopEventManager(onsetEvent.getClosedLoopControlName(), onsetEvent.getRequestId()); VirtualControlLoopNotification notification = manager.activate(yamlString, onsetEvent); assertNotNull(notification); assertEquals(ControlLoopNotificationType.ACTIVE, notification.getNotification()); @@ -406,9 +406,9 @@ public class ControlLoopOperationManagerTest { } onsetEvent.setTarget("Oz"); - onsetEvent.getAAI().remove("generic-vnf.vnf-name"); - onsetEvent.getAAI().remove("generic-vnf.vnf-id"); - onsetEvent.getAAI().remove("vserver.vserver-name"); + onsetEvent.getAai().remove("generic-vnf.vnf-name"); + onsetEvent.getAai().remove("generic-vnf.vnf-id"); + onsetEvent.getAai().remove("vserver.vserver-name"); policy.getTarget().setType(TargetType.VNF); try { @@ -419,12 +419,12 @@ public class ControlLoopOperationManagerTest { } onsetEvent.setTarget("vserver.vserver-name"); - onsetEvent.getAAI().put("vserver.vserver-name", "OzVServer"); + onsetEvent.getAai().put("vserver.vserver-name", "OzVServer"); assertEquals("OzVServer", clom.getTarget(policy)); - onsetEvent.getAAI().remove("vserver.vserver-name"); + onsetEvent.getAai().remove("vserver.vserver-name"); onsetEvent.setTarget("generic-vnf.vnf-id"); - onsetEvent.getAAI().put("generic-vnf.vnf-id", "OzVNF"); + onsetEvent.getAai().put("generic-vnf.vnf-id", "OzVNF"); assertEquals("OzVNF", clom.getTarget(policy)); onsetEvent.setTarget("generic-vnf.vnf-name"); @@ -432,7 +432,7 @@ public class ControlLoopOperationManagerTest { manager.onNewEvent(onsetEvent); - onsetEvent.getAAI().remove("generic-vnf.vnf-id"); + onsetEvent.getAai().remove("generic-vnf.vnf-id"); manager.getVnfResponse(); clom.getEventManager().getVnfResponse().setVnfId("generic-vnf.vnf-id"); assertEquals("generic-vnf.vnf-id", clom.getTarget(policy)); @@ -475,15 +475,15 @@ public class ControlLoopOperationManagerTest { UUID requestId = UUID.randomUUID(); VirtualControlLoopEvent onsetEvent = new VirtualControlLoopEvent(); onsetEvent.setClosedLoopControlName("TwoOnsetTest"); - onsetEvent.setRequestID(requestId); + onsetEvent.setRequestId(requestId); onsetEvent.setTarget("generic-vnf.vnf-id"); onsetEvent.setClosedLoopAlarmStart(Instant.now()); onsetEvent.setClosedLoopEventStatus(ControlLoopEventStatus.ONSET); - onsetEvent.setAAI(new HashMap<>()); - onsetEvent.getAAI().put("generic-vnf.vnf-name", "onsetOne"); + onsetEvent.setAai(new HashMap<>()); + onsetEvent.getAai().put("generic-vnf.vnf-name", "onsetOne"); ControlLoopEventManager manager = - new ControlLoopEventManager(onsetEvent.getClosedLoopControlName(), onsetEvent.getRequestID()); + new ControlLoopEventManager(onsetEvent.getClosedLoopControlName(), onsetEvent.getRequestId()); VirtualControlLoopNotification notification = manager.activate(yamlString, onsetEvent); assertNotNull(notification); assertEquals(ControlLoopNotificationType.ACTIVE, notification.getNotification()); @@ -530,15 +530,15 @@ public class ControlLoopOperationManagerTest { UUID requestId = UUID.randomUUID(); VirtualControlLoopEvent onsetEvent = new VirtualControlLoopEvent(); onsetEvent.setClosedLoopControlName("TwoOnsetTest"); - onsetEvent.setRequestID(requestId); + onsetEvent.setRequestId(requestId); onsetEvent.setTarget("generic-vnf.vnf-id"); onsetEvent.setClosedLoopAlarmStart(Instant.now()); onsetEvent.setClosedLoopEventStatus(ControlLoopEventStatus.ONSET); - onsetEvent.setAAI(new HashMap<>()); - onsetEvent.getAAI().put("generic-vnf.vnf-name", "onsetOne"); + onsetEvent.setAai(new HashMap<>()); + onsetEvent.getAai().put("generic-vnf.vnf-name", "onsetOne"); ControlLoopEventManager manager = - new ControlLoopEventManager(onsetEvent.getClosedLoopControlName(), onsetEvent.getRequestID()); + new ControlLoopEventManager(onsetEvent.getClosedLoopControlName(), onsetEvent.getRequestId()); VirtualControlLoopNotification notification = manager.activate(yamlString, onsetEvent); assertNotNull(notification); assertEquals(ControlLoopNotificationType.ACTIVE, notification.getNotification()); @@ -634,15 +634,15 @@ public class ControlLoopOperationManagerTest { UUID requestId = UUID.randomUUID(); VirtualControlLoopEvent onsetEvent = new VirtualControlLoopEvent(); onsetEvent.setClosedLoopControlName("TwoOnsetTest"); - onsetEvent.setRequestID(requestId); + onsetEvent.setRequestId(requestId); onsetEvent.setTarget("generic-vnf.vnf-id"); onsetEvent.setClosedLoopAlarmStart(Instant.now()); onsetEvent.setClosedLoopEventStatus(ControlLoopEventStatus.ONSET); - onsetEvent.setAAI(new HashMap<>()); - onsetEvent.getAAI().put("generic-vnf.vnf-name", "onsetOne"); + onsetEvent.setAai(new HashMap<>()); + onsetEvent.getAai().put("generic-vnf.vnf-name", "onsetOne"); ControlLoopEventManager manager = - new ControlLoopEventManager(onsetEvent.getClosedLoopControlName(), onsetEvent.getRequestID()); + new ControlLoopEventManager(onsetEvent.getClosedLoopControlName(), onsetEvent.getRequestId()); VirtualControlLoopNotification notification = manager.activate(yamlString, onsetEvent); assertNotNull(notification); assertEquals(ControlLoopNotificationType.ACTIVE, notification.getNotification()); @@ -658,7 +658,7 @@ public class ControlLoopOperationManagerTest { appcResponse.setCommonHeader(commonHeader); assertEquals(PolicyResult.FAILURE_EXCEPTION, clom.onResponse(appcResponse)); - commonHeader.setSubRequestID("12345"); + commonHeader.setSubRequestId("12345"); appcResponse.setStatus(null); assertEquals(PolicyResult.FAILURE_EXCEPTION, clom.onResponse(appcResponse)); @@ -684,9 +684,9 @@ public class ControlLoopOperationManagerTest { responseStatus.setCode(ResponseCode.SUCCESS.getValue()); assertEquals(PolicyResult.SUCCESS, clom.onResponse(appcResponse)); - LCMResponseWrapper lrw = new LCMResponseWrapper(); - LCMResponse body = new LCMResponse(); - LCMCommonHeader lcmCh = new LCMCommonHeader(); + LcmResponseWrapper lrw = new LcmResponseWrapper(); + LcmResponse body = new LcmResponse(); + LcmCommonHeader lcmCh = new LcmCommonHeader(); body.setCommonHeader(lcmCh); lrw.setBody(body); @@ -727,15 +727,15 @@ public class ControlLoopOperationManagerTest { UUID requestId = UUID.randomUUID(); VirtualControlLoopEvent onsetEvent = new VirtualControlLoopEvent(); onsetEvent.setClosedLoopControlName("TwoOnsetTest"); - onsetEvent.setRequestID(requestId); + onsetEvent.setRequestId(requestId); onsetEvent.setTarget("generic-vnf.vnf-id"); onsetEvent.setClosedLoopAlarmStart(Instant.now()); onsetEvent.setClosedLoopEventStatus(ControlLoopEventStatus.ONSET); - onsetEvent.setAAI(new HashMap<>()); - onsetEvent.getAAI().put("generic-vnf.vnf-name", "onsetOne"); + onsetEvent.setAai(new HashMap<>()); + onsetEvent.getAai().put("generic-vnf.vnf-name", "onsetOne"); ControlLoopEventManager manager = - new ControlLoopEventManager(onsetEvent.getClosedLoopControlName(), onsetEvent.getRequestID()); + new ControlLoopEventManager(onsetEvent.getClosedLoopControlName(), onsetEvent.getRequestId()); VirtualControlLoopNotification notification = manager.activate(yamlString, onsetEvent); assertNotNull(notification); assertEquals(ControlLoopNotificationType.ACTIVE, notification.getNotification()); diff --git a/controlloop/common/eventmanager/src/test/java/org/onap/policy/drools/DroolsPolicyEngineTest.java b/controlloop/common/eventmanager/src/test/java/org/onap/policy/drools/DroolsPolicyEngineTest.java index 13d5f3679..dcf3e6c95 100644 --- a/controlloop/common/eventmanager/src/test/java/org/onap/policy/drools/DroolsPolicyEngineTest.java +++ b/controlloop/common/eventmanager/src/test/java/org/onap/policy/drools/DroolsPolicyEngineTest.java @@ -26,9 +26,9 @@ import static org.junit.Assert.assertNotNull; import org.junit.Test; import org.onap.policy.appc.CommonHeader; import org.onap.policy.appc.Request; -import org.onap.policy.appclcm.LCMCommonHeader; -import org.onap.policy.appclcm.LCMRequest; -import org.onap.policy.appclcm.LCMRequestWrapper; +import org.onap.policy.appclcm.LcmCommonHeader; +import org.onap.policy.appclcm.LcmRequest; +import org.onap.policy.appclcm.LcmRequestWrapper; import org.onap.policy.controlloop.ControlLoopNotification; import org.onap.policy.controlloop.VirtualControlLoopNotification; import org.onap.policy.drools.impl.PolicyEngineJUnitImpl; @@ -54,12 +54,12 @@ public class DroolsPolicyEngineTest { Request request = new Request(); request.setCommonHeader(new CommonHeader()); - request.getCommonHeader().setSubRequestID("12321"); + request.getCommonHeader().setSubRequestId("12321"); pe.deliver("OmniBus", "TheWizardOfOz", request); - LCMRequestWrapper lcmRw = new LCMRequestWrapper(); - lcmRw.setBody(new LCMRequest()); - lcmRw.getBody().setCommonHeader(new LCMCommonHeader()); + LcmRequestWrapper lcmRw = new LcmRequestWrapper(); + lcmRw.setBody(new LcmRequest()); + lcmRw.getBody().setCommonHeader(new LcmCommonHeader()); lcmRw.getBody().getCommonHeader().setSubRequestId("54321"); pe.deliver("OmniBus", "TheWizardOfOz", lcmRw); } |