From 4b3d5ae4a7ae81dc337c81abc282d1e2fa7213c5 Mon Sep 17 00:00:00 2001 From: Jim Hahn Date: Fri, 11 Jan 2019 11:46:55 -0500 Subject: Remove model-impl/so checkstyle suppressions Renamed classes from "SOxxx" to "SoXxx". Also renamed a few method names to make them camelcase, too. Updated drl files with above changes. Change-Id: I06aa303a20911733f870947c55e01f3a2dc66fa3 Issue-ID: POLICY-1143 Signed-off-by: Jim Hahn --- .../actor/so/SoActorServiceProvider.java | 72 ++-- .../actor/so/SoActorServiceProviderTest.java | 15 +- .../eventmanager/ControlLoopOperationManager.java | 8 +- .../ControlLoopOperationManagerTest.java | 16 +- .../model-impl/so/checkstyle-suppressions.xml | 30 -- controlloop/common/model-impl/so/pom.xml | 3 +- .../org/onap/policy/so/SOAsyncRequestStatus.java | 125 ------- .../org/onap/policy/so/SOCloudConfiguration.java | 57 ---- .../org/onap/policy/so/SOInstanceReferences.java | 57 ---- .../main/java/org/onap/policy/so/SOManager.java | 371 --------------------- .../main/java/org/onap/policy/so/SOModelInfo.java | 112 ------- .../onap/policy/so/SOPolicyExceptionHolder.java | 57 ---- .../java/org/onap/policy/so/SORelatedInstance.java | 70 ---- .../policy/so/SORelatedInstanceListElement.java | 46 --- .../main/java/org/onap/policy/so/SORequest.java | 123 ------- .../java/org/onap/policy/so/SORequestDetails.java | 215 ------------ .../java/org/onap/policy/so/SORequestError.java | 57 ---- .../java/org/onap/policy/so/SORequestInfo.java | 145 -------- .../org/onap/policy/so/SORequestParameters.java | 71 ---- .../org/onap/policy/so/SORequestReferences.java | 53 --- .../java/org/onap/policy/so/SORequestStatus.java | 79 ----- .../main/java/org/onap/policy/so/SOResponse.java | 78 ----- .../java/org/onap/policy/so/SOResponseWrapper.java | 102 ------ .../onap/policy/so/SOServiceExceptionHolder.java | 66 ---- .../java/org/onap/policy/so/SOSubscriberInfo.java | 68 ---- .../org/onap/policy/so/SoAsyncRequestStatus.java | 125 +++++++ .../org/onap/policy/so/SoCloudConfiguration.java | 57 ++++ .../org/onap/policy/so/SoInstanceReferences.java | 57 ++++ .../main/java/org/onap/policy/so/SoManager.java | 371 +++++++++++++++++++++ .../main/java/org/onap/policy/so/SoModelInfo.java | 112 +++++++ .../onap/policy/so/SoPolicyExceptionHolder.java | 57 ++++ .../java/org/onap/policy/so/SoRelatedInstance.java | 70 ++++ .../policy/so/SoRelatedInstanceListElement.java | 46 +++ .../main/java/org/onap/policy/so/SoRequest.java | 123 +++++++ .../java/org/onap/policy/so/SoRequestDetails.java | 215 ++++++++++++ .../java/org/onap/policy/so/SoRequestError.java | 57 ++++ .../java/org/onap/policy/so/SoRequestInfo.java | 145 ++++++++ .../org/onap/policy/so/SoRequestParameters.java | 71 ++++ .../org/onap/policy/so/SoRequestReferences.java | 53 +++ .../java/org/onap/policy/so/SoRequestStatus.java | 79 +++++ .../main/java/org/onap/policy/so/SoResponse.java | 78 +++++ .../java/org/onap/policy/so/SoResponseWrapper.java | 102 ++++++ .../onap/policy/so/SoServiceExceptionHolder.java | 66 ++++ .../java/org/onap/policy/so/SoSubscriberInfo.java | 68 ++++ .../src/test/java/org/onap/policy/so/DemoTest.java | 82 ++--- .../onap/policy/so/SoAsyncRequestStatusTest.java | 9 +- .../onap/policy/so/SoCloudConfigurationTest.java | 5 +- .../java/org/onap/policy/so/SoDummyServerTest.java | 28 +- .../onap/policy/so/SoInstanceReferencesTest.java | 5 +- .../java/org/onap/policy/so/SoManagerTest.java | 101 +++--- .../java/org/onap/policy/so/SoModelInfoTest.java | 5 +- .../policy/so/SoPolicyExceptionHolderTest.java | 6 +- .../so/SoRelatedInstanceListElementTest.java | 7 +- .../org/onap/policy/so/SoRelatedInstanceTest.java | 8 +- .../org/onap/policy/so/SoRequestDetailsTest.java | 32 +- .../org/onap/policy/so/SoRequestErrorTest.java | 9 +- .../java/org/onap/policy/so/SoRequestInfoTest.java | 5 +- .../onap/policy/so/SoRequestParametersTest.java | 5 +- .../onap/policy/so/SoRequestReferencesTest.java | 5 +- .../org/onap/policy/so/SoRequestStatusTest.java | 5 +- .../java/org/onap/policy/so/SoRequestTest.java | 7 +- .../java/org/onap/policy/so/SoResponseTest.java | 11 +- .../org/onap/policy/so/SoResponseWrapperTest.java | 44 +-- .../policy/so/SoServiceExceptionHolderTest.java | 5 +- .../org/onap/policy/so/SoSubscriberInfoTest.java | 5 +- .../onap/policy/simulators/SoSimulatorJaxRs.java | 18 +- .../onap/policy/simulators/SoSimulatorTest.java | 48 +-- .../main/resources/__closedLoopControlName__.drl | 18 +- .../main/resources/__closedLoopControlName__.drl | 18 +- .../main/resources/__closedLoopControlName__.drl | 18 +- .../policy/template/demo/VdnsControlLoopTest.java | 6 +- 71 files changed, 2260 insertions(+), 2303 deletions(-) delete mode 100644 controlloop/common/model-impl/so/checkstyle-suppressions.xml delete mode 100644 controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOAsyncRequestStatus.java delete mode 100644 controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOCloudConfiguration.java delete mode 100644 controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOInstanceReferences.java delete mode 100644 controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOManager.java delete mode 100644 controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOModelInfo.java delete mode 100644 controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOPolicyExceptionHolder.java delete mode 100644 controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SORelatedInstance.java delete mode 100644 controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SORelatedInstanceListElement.java delete mode 100644 controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SORequest.java delete mode 100644 controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SORequestDetails.java delete mode 100644 controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SORequestError.java delete mode 100644 controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SORequestInfo.java delete mode 100644 controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SORequestParameters.java delete mode 100644 controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SORequestReferences.java delete mode 100644 controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SORequestStatus.java delete mode 100644 controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOResponse.java delete mode 100644 controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOResponseWrapper.java delete mode 100644 controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOServiceExceptionHolder.java delete mode 100644 controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOSubscriberInfo.java create mode 100644 controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SoAsyncRequestStatus.java create mode 100644 controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SoCloudConfiguration.java create mode 100644 controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SoInstanceReferences.java create mode 100644 controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SoManager.java create mode 100644 controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SoModelInfo.java create mode 100644 controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SoPolicyExceptionHolder.java create mode 100644 controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SoRelatedInstance.java create mode 100644 controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SoRelatedInstanceListElement.java create mode 100644 controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SoRequest.java create mode 100644 controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SoRequestDetails.java create mode 100644 controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SoRequestError.java create mode 100644 controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SoRequestInfo.java create mode 100644 controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SoRequestParameters.java create mode 100644 controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SoRequestReferences.java create mode 100644 controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SoRequestStatus.java create mode 100644 controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SoResponse.java create mode 100644 controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SoResponseWrapper.java create mode 100644 controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SoServiceExceptionHolder.java create mode 100644 controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SoSubscriberInfo.java (limited to 'controlloop') diff --git a/controlloop/common/actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/SoActorServiceProvider.java b/controlloop/common/actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/SoActorServiceProvider.java index 8edddbb40..dcda995ad 100644 --- a/controlloop/common/actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/SoActorServiceProvider.java +++ b/controlloop/common/actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/SoActorServiceProvider.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * SOActorServiceProvider * ================================================================================ - * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017-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. @@ -35,16 +35,16 @@ import org.onap.policy.controlloop.ControlLoopOperation; import org.onap.policy.controlloop.VirtualControlLoopEvent; import org.onap.policy.controlloop.actorserviceprovider.spi.Actor; import org.onap.policy.controlloop.policy.Policy; -import org.onap.policy.so.SOCloudConfiguration; -import org.onap.policy.so.SOManager; -import org.onap.policy.so.SOModelInfo; -import org.onap.policy.so.SORelatedInstance; -import org.onap.policy.so.SORelatedInstanceListElement; -import org.onap.policy.so.SORequest; -import org.onap.policy.so.SORequestDetails; -import org.onap.policy.so.SORequestInfo; -import org.onap.policy.so.SORequestParameters; +import org.onap.policy.so.SoCloudConfiguration; +import org.onap.policy.so.SoManager; +import org.onap.policy.so.SoModelInfo; import org.onap.policy.so.SoOperationType; +import org.onap.policy.so.SoRelatedInstance; +import org.onap.policy.so.SoRelatedInstanceListElement; +import org.onap.policy.so.SoRequest; +import org.onap.policy.so.SoRequestDetails; +import org.onap.policy.so.SoRequestInfo; +import org.onap.policy.so.SoRequestParameters; import org.onap.policy.so.util.Serialization; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -120,7 +120,7 @@ public class SoActorServiceProvider implements Actor { * @param aaiResponseWrapper wrapper for AAI vserver named-query response * @return a SO request conforming to the lcm API using the DMAAP wrapper */ - public SORequest constructRequest(VirtualControlLoopEvent onset, ControlLoopOperation operation, Policy policy, + public SoRequest constructRequest(VirtualControlLoopEvent onset, ControlLoopOperation operation, Policy policy, AaiNqResponseWrapper aaiResponseWrapper) { if (!SO_ACTOR.equals(policy.getActor()) || !recipes().contains(policy.getRecipe())) { return null; @@ -194,18 +194,18 @@ public class SoActorServiceProvider implements Actor { * @param vfModuleItem vf module item from A&AI named-query response * @return SO create vf-module request */ - private SORequest constructCreateRequest(AaiNqResponseWrapper aaiResponseWrapper, Policy policy, + private SoRequest constructCreateRequest(AaiNqResponseWrapper aaiResponseWrapper, Policy policy, AaiNqInventoryResponseItem tenantItem, AaiNqInventoryResponseItem vnfItem, AaiNqInventoryResponseItem vnfServiceItem, AaiNqInventoryResponseItem vfModuleItem) { - SORequest request = new SORequest(); + SoRequest request = new SoRequest(); request.setOperationType(SoOperationType.SCALE_OUT); // // // Do NOT send So the requestId, they do not support this field // - request.setRequestDetails(new SORequestDetails()); - request.getRequestDetails().setRequestParameters(new SORequestParameters()); + request.setRequestDetails(new SoRequestDetails()); + request.getRequestDetails().setRequestParameters(new SoRequestParameters()); request.getRequestDetails().getRequestParameters().setUserParams(null); // cloudConfiguration @@ -220,15 +220,15 @@ public class SoActorServiceProvider implements Actor { request.getRequestDetails().getRequestInfo().setInstanceName(vfModuleName); // relatedInstanceList - SORelatedInstanceListElement relatedInstanceListElement1 = new SORelatedInstanceListElement(); - SORelatedInstanceListElement relatedInstanceListElement2 = new SORelatedInstanceListElement(); - relatedInstanceListElement1.setRelatedInstance(new SORelatedInstance()); - relatedInstanceListElement2.setRelatedInstance(new SORelatedInstance()); + SoRelatedInstanceListElement relatedInstanceListElement1 = new SoRelatedInstanceListElement(); + SoRelatedInstanceListElement relatedInstanceListElement2 = new SoRelatedInstanceListElement(); + relatedInstanceListElement1.setRelatedInstance(new SoRelatedInstance()); + relatedInstanceListElement2.setRelatedInstance(new SoRelatedInstance()); // Service Item relatedInstanceListElement1.getRelatedInstance() .setInstanceId(vnfServiceItem.getServiceInstance().getServiceInstanceId()); - relatedInstanceListElement1.getRelatedInstance().setModelInfo(new SOModelInfo()); + relatedInstanceListElement1.getRelatedInstance().setModelInfo(new SoModelInfo()); relatedInstanceListElement1.getRelatedInstance().getModelInfo().setModelType("service"); relatedInstanceListElement1.getRelatedInstance().getModelInfo() .setModelInvariantId(vnfServiceItem.getServiceInstance().getModelInvariantId()); @@ -246,7 +246,7 @@ public class SoActorServiceProvider implements Actor { // VNF Item relatedInstanceListElement2.getRelatedInstance().setInstanceId(vnfItem.getGenericVnf().getVnfId()); - relatedInstanceListElement2.getRelatedInstance().setModelInfo(new SOModelInfo()); + relatedInstanceListElement2.getRelatedInstance().setModelInfo(new SoModelInfo()); relatedInstanceListElement2.getRelatedInstance().getModelInfo().setModelType("vnf"); relatedInstanceListElement2.getRelatedInstance().getModelInfo() .setModelInvariantId(vnfItem.getGenericVnf().getModelInvariantId()); @@ -295,11 +295,11 @@ public class SoActorServiceProvider implements Actor { * @param vfModuleItem vf module item from A&AI named-query response * @return SO delete vf-module request */ - private SORequest constructDeleteRequest(AaiNqInventoryResponseItem tenantItem, AaiNqInventoryResponseItem + private SoRequest constructDeleteRequest(AaiNqInventoryResponseItem tenantItem, AaiNqInventoryResponseItem vnfItem, AaiNqInventoryResponseItem vnfServiceItem, AaiNqInventoryResponseItem vfModuleItem) { - SORequest request = new SORequest(); + SoRequest request = new SoRequest(); request.setOperationType(SoOperationType.DELETE_VF_MODULE); - request.setRequestDetails(new SORequestDetails()); + request.setRequestDetails(new SoRequestDetails()); request.getRequestDetails().setRelatedInstanceList(null); request.getRequestDetails().setConfigurationParameters(null); @@ -324,8 +324,8 @@ public class SoActorServiceProvider implements Actor { * * @return SO request information */ - private SORequestInfo constructRequestInfo() { - SORequestInfo soRequestInfo = new SORequestInfo(); + private SoRequestInfo constructRequestInfo() { + SoRequestInfo soRequestInfo = new SoRequestInfo(); soRequestInfo.setSource("POLICY"); soRequestInfo.setSuppressRollback(false); soRequestInfo.setRequestorId("policy"); @@ -338,8 +338,8 @@ public class SoActorServiceProvider implements Actor { * @param vfModuleItem vf module item from A&AI named-query response * @return SO Model info for the vfModule */ - private SOModelInfo constructVfModuleModelInfo(AaiNqInventoryResponseItem vfModuleItem) { - SOModelInfo soModelInfo = new SOModelInfo(); + private SoModelInfo constructVfModuleModelInfo(AaiNqInventoryResponseItem vfModuleItem) { + SoModelInfo soModelInfo = new SoModelInfo(); soModelInfo.setModelType("vfModule"); soModelInfo.setModelInvariantId(vfModuleItem.getVfModule().getModelInvariantId()); soModelInfo.setModelCustomizationId(vfModuleItem.getVfModule().getModelCustomizationId()); @@ -360,8 +360,8 @@ public class SoActorServiceProvider implements Actor { * @param tenantItem tenant item from A&AI named-query response * @return SO cloud configuration */ - private SOCloudConfiguration constructCloudConfiguration(AaiNqInventoryResponseItem tenantItem) { - SOCloudConfiguration cloudConfiguration = new SOCloudConfiguration(); + private SoCloudConfiguration constructCloudConfiguration(AaiNqInventoryResponseItem tenantItem) { + SoCloudConfiguration cloudConfiguration = new SoCloudConfiguration(); cloudConfiguration.setTenantId(tenantItem.getTenant().getTenantId()); cloudConfiguration.setLcpCloudRegionId(tenantItem.getItems().getInventoryResponseItems().get(0) .getCloudRegion().getCloudRegionId()); @@ -377,9 +377,9 @@ public class SoActorServiceProvider implements Actor { * @param request the request */ public static void sendRequest(String requestId, WorkingMemory wm, Object request) { - SOManager soManager = new SOManager(); - soManager.asyncSORestCall(requestId, wm, lastServiceItemServiceInstanceId, lastVNFItemVnfId, - lastVfModuleItemVfModuleInstanceId, (SORequest) request); + SoManager soManager = new SoManager(); + soManager.asyncSoRestCall(requestId, wm, lastServiceItemServiceInstanceId, lastVNFItemVnfId, + lastVfModuleItemVfModuleInstanceId, (SoRequest) request); } /** @@ -402,7 +402,7 @@ public class SoActorServiceProvider implements Actor { * @param policy the policy * @param request request into which to stick the request parameters */ - private void buildRequestParameters(Policy policy, SORequestDetails request) { + private void buildRequestParameters(Policy policy, SoRequestDetails request) { // assume null until proven otherwise request.setRequestParameters(null); @@ -415,7 +415,7 @@ public class SoActorServiceProvider implements Actor { return; } - request.setRequestParameters(Serialization.gsonPretty.fromJson(json, SORequestParameters.class)); + request.setRequestParameters(Serialization.gsonPretty.fromJson(json, SoRequestParameters.class)); } /** @@ -424,7 +424,7 @@ public class SoActorServiceProvider implements Actor { * @param policy the policy * @param request request into which to stick the configuration parameters */ - private void buildConfigurationParameters(Policy policy, SORequestDetails request) { + private void buildConfigurationParameters(Policy policy, SoRequestDetails request) { // assume null until proven otherwise request.setConfigurationParameters(null); diff --git a/controlloop/common/actors/actor.so/src/test/java/org/onap/policy/controlloop/actor/so/SoActorServiceProviderTest.java b/controlloop/common/actors/actor.so/src/test/java/org/onap/policy/controlloop/actor/so/SoActorServiceProviderTest.java index 90a4c2868..272e45ae1 100644 --- a/controlloop/common/actors/actor.so/src/test/java/org/onap/policy/controlloop/actor/so/SoActorServiceProviderTest.java +++ b/controlloop/common/actors/actor.so/src/test/java/org/onap/policy/controlloop/actor/so/SoActorServiceProviderTest.java @@ -1,9 +1,10 @@ -/*- +/* * ============LICENSE_START======================================================= * TestSOActorServiceProvider * ================================================================================ * Copyright (C) 2018 Ericsson. All rights reserved. - * Modifications Copyright (C) 2018 AT&T. All rights reserved. + * ================================================================================ + * Modifications Copyright (C) 2018-2019 AT&T. 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. @@ -40,9 +41,9 @@ import org.onap.policy.aai.AaiNqResponseWrapper; import org.onap.policy.controlloop.ControlLoopOperation; import org.onap.policy.controlloop.VirtualControlLoopEvent; import org.onap.policy.controlloop.policy.Policy; -import org.onap.policy.so.SORequest; -import org.onap.policy.so.SORequestParameters; import org.onap.policy.so.SoOperationType; +import org.onap.policy.so.SoRequest; +import org.onap.policy.so.SoRequestParameters; import org.onap.policy.so.util.Serialization; public class SoActorServiceProviderTest { @@ -71,7 +72,7 @@ public class SoActorServiceProviderTest { policy.setRecipe(VF_MODULE_CREATE); // empty policy payload - SORequest request = new SoActorServiceProvider().constructRequest(onset, operation, policy, aaiNqResp); + SoRequest request = new SoActorServiceProvider().constructRequest(onset, operation, policy, aaiNqResp); assertNotNull(request); assertEquals("my_module_3", request.getRequestDetails().getRequestInfo().getInstanceName()); @@ -115,7 +116,7 @@ public class SoActorServiceProviderTest { loadAaiResponse(onset, "aai/AaiNqResponse-NoNonBase.json"))); policy.setRecipe(VF_MODULE_DELETE); - SORequest deleteRequest = new SoActorServiceProvider().constructRequest(onset, operation, policy, aaiNqResp); + SoRequest deleteRequest = new SoActorServiceProvider().constructRequest(onset, operation, policy, aaiNqResp); assertNotNull(deleteRequest); assertEquals(SoOperationType.DELETE_VF_MODULE, deleteRequest.getOperationType()); @@ -182,7 +183,7 @@ public class SoActorServiceProviderTest { * @return request parameters, encoded as JSON */ private String makeReqParams() { - SORequestParameters params = new SORequestParameters(); + SoRequestParameters params = new SoRequestParameters(); params.setUsePreload(true); diff --git a/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopOperationManager.java b/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopOperationManager.java index 36db9fe53..2ea1c48f4 100644 --- a/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopOperationManager.java +++ b/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopOperationManager.java @@ -53,7 +53,7 @@ import org.onap.policy.drools.system.PolicyEngine; import org.onap.policy.guard.Util; import org.onap.policy.sdnc.SdncResponse; import org.onap.policy.sdnr.PciResponseWrapper; -import org.onap.policy.so.SOResponseWrapper; +import org.onap.policy.so.SoResponseWrapper; import org.onap.policy.vfc.VfcResponse; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -346,11 +346,11 @@ public class ControlLoopOperationManager implements Serializable { // Cast SDNR response and handle it // return onResponse((PciResponseWrapper) response); - } else if (response instanceof SOResponseWrapper) { + } else if (response instanceof SoResponseWrapper) { // // Cast SO response and handle it // - return onResponse((SOResponseWrapper) response); + return onResponse((SoResponseWrapper) response); } else if (response instanceof VfcResponse) { // // Cast VFC response and handle it @@ -531,7 +531,7 @@ public class ControlLoopOperationManager implements Serializable { * @param msoResponse the SO response * @return The result of the response handling */ - private PolicyResult onResponse(SOResponseWrapper msoResponse) { + private PolicyResult onResponse(SoResponseWrapper msoResponse) { switch (msoResponse.getSoResponse().getHttpResponseCode()) { case 200: case 202: 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 f761d69b7..0189e17bf 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 @@ -71,8 +71,8 @@ import org.onap.policy.controlloop.policy.Target; import org.onap.policy.controlloop.policy.TargetType; import org.onap.policy.controlloop.processor.ControlLoopProcessor; import org.onap.policy.drools.system.PolicyEngine; -import org.onap.policy.so.SOResponse; -import org.onap.policy.so.SOResponseWrapper; +import org.onap.policy.so.SoResponse; +import org.onap.policy.so.SoResponseWrapper; import org.onap.policy.vfc.VfcResponse; import org.onap.policy.vfc.VfcResponseDescriptor; import org.slf4j.Logger; @@ -741,8 +741,8 @@ public class ControlLoopOperationManagerTest { lcmCh.setSubRequestId("12345"); assertEquals(PolicyResult.FAILURE_EXCEPTION, clom.onResponse(lrw)); - SOResponse soResponse = new SOResponse(); - SOResponseWrapper soRw = new SOResponseWrapper(soResponse, null); + SoResponse soResponse = new SoResponse(); + SoResponseWrapper soRw = new SoResponseWrapper(soResponse, null); soResponse.setHttpResponseCode(200); assertEquals(PolicyResult.SUCCESS, clom.onResponse(soRw)); @@ -791,8 +791,8 @@ public class ControlLoopOperationManagerTest { clom.startOperation(onsetEvent); - SOResponse soResponse = new SOResponse(); - final SOResponseWrapper soRw = new SOResponseWrapper(soResponse, null); + SoResponse soResponse = new SoResponse(); + final SoResponseWrapper soRw = new SoResponseWrapper(soResponse, null); PolicyEngine.manager.setEnvironmentProperty("guard.disabled", "false"); PolicyEngine.manager.setEnvironmentProperty(org.onap.policy.guard.Util.ONAP_KEY_URL, @@ -881,8 +881,8 @@ public class ControlLoopOperationManagerTest { assertNotNull(clom); assertTrue(clom.isOperationRunning()); - SOResponse soResponse = new SOResponse(); - final SOResponseWrapper soRw = new SOResponseWrapper(soResponse, null); + SoResponse soResponse = new SoResponse(); + final SoResponseWrapper soRw = new SoResponseWrapper(soResponse, null); PolicyEngine.manager.setEnvironmentProperty("guard.disabled", "false"); PolicyEngine.manager.setEnvironmentProperty(org.onap.policy.guard.Util.ONAP_KEY_URL, diff --git a/controlloop/common/model-impl/so/checkstyle-suppressions.xml b/controlloop/common/model-impl/so/checkstyle-suppressions.xml deleted file mode 100644 index 01bb15f8a..000000000 --- a/controlloop/common/model-impl/so/checkstyle-suppressions.xml +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - diff --git a/controlloop/common/model-impl/so/pom.xml b/controlloop/common/model-impl/so/pom.xml index 0b57f069d..7ddaf2e79 100644 --- a/controlloop/common/model-impl/so/pom.xml +++ b/controlloop/common/model-impl/so/pom.xml @@ -2,7 +2,7 @@ ============LICENSE_START======================================================= Drools PDP Application Models ================================================================================ - Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. + Copyright (C) 2017-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. @@ -93,7 +93,6 @@ true - ${project.basedir}/checkstyle-suppressions.xml true true warning diff --git a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOAsyncRequestStatus.java b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOAsyncRequestStatus.java deleted file mode 100644 index 5bb03de06..000000000 --- a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOAsyncRequestStatus.java +++ /dev/null @@ -1,125 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * so - * ================================================================================ - * Copyright (C) 2017-2018 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.policy.so; - -import com.google.gson.annotations.SerializedName; - -import java.io.Serializable; -import java.time.LocalDateTime; - -public class SOAsyncRequestStatus implements Serializable { - - private static final long serialVersionUID = -3283942659786236032L; - - @SerializedName("correlator") - private String correlator; - - @SerializedName("requestId") - private String requestId; - - @SerializedName("instanceReferences") - private SOInstanceReferences instanceReferences; - - @SerializedName("startTime") - private LocalDateTime startTime; - - @SerializedName("finishTime") - private LocalDateTime finishTime; - - @SerializedName("requestScope") - private String requestScope; - - @SerializedName("requestType") - private String requestType; - - @SerializedName("requestStatus") - private SORequestStatus requestStatus; - - public SOAsyncRequestStatus() { - // required by author - } - - public String getCorrelator() { - return correlator; - } - - - public LocalDateTime getFinishTime() { - return finishTime; - } - - public SOInstanceReferences getInstanceReferences() { - return instanceReferences; - } - - public String getRequestId() { - return requestId; - } - - public String getRequestScope() { - return requestScope; - } - - public SORequestStatus getRequestStatus() { - return requestStatus; - } - - public String getRequestType() { - return requestType; - } - - public LocalDateTime getStartTime() { - return startTime; - } - - public void setCorrelator(String correlator) { - this.correlator = correlator; - } - - public void setFinishTime(LocalDateTime finishTime) { - this.finishTime = finishTime; - } - - public void setInstanceReferences(SOInstanceReferences instanceReferences) { - this.instanceReferences = instanceReferences; - } - - public void setRequestId(String requestId) { - this.requestId = requestId; - } - - public void setRequestScope(String requestScope) { - this.requestScope = requestScope; - } - - public void setRequestStatus(SORequestStatus requestStatus) { - this.requestStatus = requestStatus; - } - - public void setRequestType(String requestType) { - this.requestType = requestType; - } - - public void setStartTime(LocalDateTime startTime) { - this.startTime = startTime; - } - -} diff --git a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOCloudConfiguration.java b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOCloudConfiguration.java deleted file mode 100644 index b52fe2b7c..000000000 --- a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOCloudConfiguration.java +++ /dev/null @@ -1,57 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * so - * ================================================================================ - * Copyright (C) 2017-2018 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.policy.so; - -import com.google.gson.annotations.SerializedName; - -import java.io.Serializable; - -public class SOCloudConfiguration implements Serializable { - - private static final long serialVersionUID = -3283942659786236032L; - - @SerializedName("lcpCloudRegionId") - private String lcpCloudRegionId; - - @SerializedName("tenantId") - private String tenantId; - - public SOCloudConfiguration() { - //required by author - } - - public String getLcpCloudRegionId() { - return lcpCloudRegionId; - } - - public String getTenantId() { - return tenantId; - } - - public void setLcpCloudRegionId(String lcpCloudRegionId) { - this.lcpCloudRegionId = lcpCloudRegionId; - } - - public void setTenantId(String tenantId) { - this.tenantId = tenantId; - } - -} diff --git a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOInstanceReferences.java b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOInstanceReferences.java deleted file mode 100644 index 645e7f711..000000000 --- a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOInstanceReferences.java +++ /dev/null @@ -1,57 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * so - * ================================================================================ - * Copyright (C) 2017-2018 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.policy.so; - -import com.google.gson.annotations.SerializedName; - -import java.io.Serializable; - -public class SOInstanceReferences implements Serializable { - - private static final long serialVersionUID = -3283942659786236032L; - - @SerializedName("requestId") - private String requestId; - - @SerializedName("instanceId") - private String instanceId; - - public SOInstanceReferences() { - //requried by author - } - - public String getInstanceId() { - return instanceId; - } - - public String getRequestId() { - return requestId; - } - - public void setInstanceId(String instanceId) { - this.instanceId = instanceId; - } - - public void setRequestId(String requestId) { - this.requestId = requestId; - } - -} diff --git a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOManager.java b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOManager.java deleted file mode 100644 index 6557be45e..000000000 --- a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOManager.java +++ /dev/null @@ -1,371 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * so - * ================================================================================ - * Copyright (C) 2017-2018 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.policy.so; - -import com.google.gson.GsonBuilder; -import com.google.gson.JsonSyntaxException; -import java.util.HashMap; -import java.util.Map; -import java.util.concurrent.Callable; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; -import java.util.concurrent.Future; -import org.drools.core.WorkingMemory; -import org.onap.policy.drools.system.PolicyEngine; -import org.onap.policy.rest.RESTManager; -import org.onap.policy.rest.RESTManager.Pair; -import org.onap.policy.so.util.Serialization; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - - -/** - * This class handles the interface towards SO (Service Orchestrator) for the ONAP Policy - * Framework. The SO API is defined at this link: - * http://onap.readthedocs.io/en/latest/submodules/so.git/docs/SO_R1_Interface.html#get-orchestration-request - * - */ -public final class SOManager { - private static final Logger logger = LoggerFactory.getLogger(SOManager.class); - private static final Logger netLogger = - LoggerFactory.getLogger(org.onap.policy.common.endpoints.event.comm.Topic.NETWORK_LOGGER); - private static ExecutorService executors = Executors.newCachedThreadPool(); - - private static final int SO_RESPONSE_ERROR = 999; - private static final String MEDIA_TYPE = "application/json"; - private static final String LINE_SEPARATOR = System.lineSeparator(); - - // REST get timeout value in milliseconds - private static final int GET_REQUESTS_BEFORE_TIMEOUT = 20; - private static final long GET_REQUEST_WAIT_INTERVAL = 20000; - - // The REST manager used for processing REST calls for this VFC manager - private RESTManager restManager; - - private long restGetTimeout = GET_REQUEST_WAIT_INTERVAL; - - /** - * Default constructor. - */ - public SOManager() { - restManager = new RESTManager(); - } - - /** - * Create a service instance in SO. - * - * @param url the SO URL - * @param urlBase the base URL - * @param username user name on SO - * @param password password on SO - * @param request the request to issue to SO - * @return the SO Response object - */ - public SOResponse createModuleInstance(final String url, final String urlBase, final String username, - final String password, final SORequest request) { - // Issue the HTTP POST request to SO to create the service instance - String requestJson = Serialization.gsonPretty.toJson(request); - netLogger.info("[OUT|{}|{}|{}|{}|{}|{}|]{}{}", "SO", url, username, password, createSimpleHeaders(), MEDIA_TYPE, - LINE_SEPARATOR, requestJson); - Pair httpResponse = - restManager.post(url, username, password, createSimpleHeaders(), MEDIA_TYPE, requestJson); - - // Process the response from SO - SOResponse response = waitForSoOperationCompletion(urlBase, username, password, url, httpResponse); - if (SO_RESPONSE_ERROR != response.getHttpResponseCode()) { - return response; - } else { - return null; - } - } - - /** - * Works just like SOManager#asyncSORestCall(String, WorkingMemory, String, String, String, SORequest) - * except the vfModuleInstanceId is always null. - * - */ - public Future asyncSORestCall(final String requestId, final WorkingMemory wm, - final String serviceInstanceId, final String vnfInstanceId, - final SORequest request) { - return asyncSORestCall(requestId, wm, serviceInstanceId, vnfInstanceId, null, request); - } - - /** - * This method makes an asynchronous Rest call to MSO and inserts the response into - * Drools working memory. - * - * @param requestId the request id - * @param wm the Drools working memory - * @param serviceInstanceId service instance id to construct the request url - * @param vnfInstanceId vnf instance id to construct the request url - * @param vfModuleInstanceId vfModule instance id to construct the request url (required in case of delete vf - * module) - * @param request the SO request - * @return a concurrent Future for the thread that handles the request - */ - public Future asyncSORestCall(final String requestId, - final WorkingMemory wm, - final String serviceInstanceId, - final String vnfInstanceId, - final String vfModuleInstanceId, final SORequest request) { - return executors.submit(new AsyncSoRestCallThread(requestId, wm, serviceInstanceId, vnfInstanceId, - vfModuleInstanceId, request)); - } - - /** - * This class handles an asynchronous request to SO as a thread. - */ - private class AsyncSoRestCallThread implements Callable { - final String requestId; - final WorkingMemory wm; - final String serviceInstanceId; - final String vnfInstanceId; - final String vfModuleInstanceId; - final SORequest request; - - /** - * Constructor, sets the context of the request. - * - * @param requestID The request ID - * @param wm reference to the Drools working memory - * @param serviceInstanceId the service instance in SO to use - * @param vnfInstanceId the VNF instance that is the subject of the request - * @param vfModuleInstanceId the vf module instance id (not null in case of delete vf module request) - * @param request the request itself - */ - private AsyncSoRestCallThread(final String requestId, - final WorkingMemory wm, final String serviceInstanceId, - final String vnfInstanceId, final String vfModuleInstanceId, - final SORequest request) { - this.requestId = requestId; - this.wm = wm; - this.serviceInstanceId = serviceInstanceId; - this.vnfInstanceId = vnfInstanceId; - this.vfModuleInstanceId = vfModuleInstanceId; - this.request = request; - } - - /** - * Process the asynchronous SO request. - */ - @Override - public SOResponse call() { - String urlBase = PolicyEngine.manager.getEnvironmentProperty("so.url"); - String username = PolicyEngine.manager.getEnvironmentProperty("so.username"); - String password = PolicyEngine.manager.getEnvironmentProperty("so.password"); - - // Create a JSON representation of the request - String soJson = new GsonBuilder().disableHtmlEscaping().setPrettyPrinting().create().toJson(request); - String url = null; - Pair httpResponse = null; - - if (request.getOperationType() != null && request.getOperationType() - .equals(SoOperationType.SCALE_OUT)) { - url = urlBase + "/serviceInstantiation/v7/serviceInstances/" + serviceInstanceId + "/vnfs/" - + vnfInstanceId + "/vfModules/scaleOut"; - netLogger.info("[OUT|{}|{}|]{}{}", "SO", url, LINE_SEPARATOR, soJson); - httpResponse = restManager.post(url, username, password, createSimpleHeaders(), MEDIA_TYPE, soJson); - } else if (request.getOperationType() != null && request.getOperationType() - .equals(SoOperationType.DELETE_VF_MODULE)) { - url = urlBase + "/serviceInstances/v7/" + serviceInstanceId + "/vnfs/" + vnfInstanceId - + "/vfModules/" + vfModuleInstanceId; - netLogger.info("[OUT|{}|{}|]{}{}", "SO", url, LINE_SEPARATOR, soJson); - httpResponse = restManager.delete(url, username, password, createSimpleHeaders(), MEDIA_TYPE, soJson); - } else { - return null; - } - - // Process the response from SO - SOResponse response = waitForSoOperationCompletion(urlBase, username, password, url, httpResponse); - - // Return the response to Drools in its working memory - SOResponseWrapper soWrapper = new SOResponseWrapper(response, requestId); - wm.insert(soWrapper); - - return response; - } - } - - /** - * Wait for the SO operation we have ordered to complete. - * - * @param urlBaseSO The base URL for SO - * @param username user name on SO - * @param password password on SO - * @param initialRequestURL The URL of the initial HTTP request - * @param initialHTTPResponse The initial HTTP message returned from SO - * @return The parsed final response of SO to the request - */ - private SOResponse waitForSoOperationCompletion(final String urlBaseSO, final String username, - final String password, final String initialRequestURL, - final Pair initialHTTPResponse) { - // Process the initial response from SO, the response to a post - SOResponse response = processSoResponse(initialRequestURL, initialHTTPResponse); - if (SO_RESPONSE_ERROR == response.getHttpResponseCode()) { - return response; - } - - // The SO URL to use to get the status of orchestration requests - String urlGet = urlBaseSO + "/orchestrationRequests/v5/" + response.getRequestReferences().getRequestId(); - - // The HTTP status code of the latest response - Pair latestHttpResponse = initialHTTPResponse; - - // Wait for the response from SO - for (int attemptsLeft = GET_REQUESTS_BEFORE_TIMEOUT; attemptsLeft >= 0; attemptsLeft--) { - // The SO request may have completed even on the first request so we check the - // response - // here before - // issuing any other requests - if (isRequestStateFinished(latestHttpResponse, response)) { - return response; - } - - // Wait for the defined interval before issuing a get - try { - Thread.sleep(restGetTimeout); - } catch (InterruptedException e) { - logger.error("Interrupted exception: ", e); - Thread.currentThread().interrupt(); - response.setHttpResponseCode(SO_RESPONSE_ERROR); - return response; - } - - // Issue a GET to find the current status of our request - netLogger.info("[OUT|{}|{}|{}|{}|{}|{}|]{}", "SO", urlGet, username, password, createSimpleHeaders(), - MEDIA_TYPE, LINE_SEPARATOR); - Pair httpResponse = restManager.get(urlGet, username, password, createSimpleHeaders()); - - // Get our response - response = processSoResponse(urlGet, httpResponse); - if (SO_RESPONSE_ERROR == response.getHttpResponseCode()) { - return response; - } - - // Our latest HTTP response code - latestHttpResponse = httpResponse; - } - - // We have timed out on the SO request - response.setHttpResponseCode(SO_RESPONSE_ERROR); - return response; - } - - /** - * Parse the response message from SO into a SOResponse object. - * - * @param requestURL The URL of the HTTP request - * @param httpResponse The HTTP message returned from SO - * @return The parsed response - */ - private SOResponse processSoResponse(final String requestUrl, final Pair httpResponse) { - SOResponse response = new SOResponse(); - - // A null httpDetails indicates a HTTP problem, a valid response from SO must be - // either 200 - // or 202 - if (!httpResultIsNullFree(httpResponse) || (httpResponse.first != 200 && httpResponse.first != 202)) { - logger.error("Invalid HTTP response received from SO"); - response.setHttpResponseCode(SO_RESPONSE_ERROR); - return response; - } - - // Parse the JSON of the response into our POJO - try { - response = Serialization.gsonPretty.fromJson(httpResponse.second, SOResponse.class); - } catch (JsonSyntaxException e) { - logger.error("Failed to deserialize HTTP response into SOResponse: ", e); - response.setHttpResponseCode(SO_RESPONSE_ERROR); - return response; - } - - // Set the HTTP response code of the response if needed - if (response.getHttpResponseCode() == 0) { - response.setHttpResponseCode(httpResponse.first); - } - - netLogger.info("[IN|{}|{}|]{}{}", "SO", requestUrl, LINE_SEPARATOR, httpResponse.second); - - if (logger.isDebugEnabled()) { - logger.debug("***** Response to SO Request to URL {}:", requestUrl); - logger.debug(httpResponse.second); - } - - return response; - } - - /** - * Method to allow tuning of REST get timeout. - * - * @param restGetTimeout the timeout value - */ - protected void setRestGetTimeout(final long restGetTimeout) { - this.restGetTimeout = restGetTimeout; - } - - /** - * Check that the request state of a response is defined. - * - * @param response The response to check - * @return true if the request for the response is defined - */ - private boolean isRequestStateDefined(final SOResponse response) { - return response != null && response.getRequest() != null && response.getRequest().getRequestStatus() != null - && response.getRequest().getRequestStatus().getRequestState() != null; - } - - /** - * Check that the request state of a response is finished. - * - * @param latestHttpDetails the HTTP details of the response - * @param response The response to check - * @return true if the request for the response is finished - */ - private boolean isRequestStateFinished(final Pair latestHttpDetails, final SOResponse response) { - if (latestHttpDetails != null && 200 == latestHttpDetails.first && isRequestStateDefined(response)) { - String requestState = response.getRequest().getRequestStatus().getRequestState(); - return "COMPLETE".equalsIgnoreCase(requestState) || "FAILED".equalsIgnoreCase(requestState); - } else { - return false; - } - } - - /** - * Check that a HTTP operation result has no nulls. - * - * @param httpOperationResult the result to check - * @return true if no nulls are found - */ - private boolean httpResultIsNullFree(Pair httpOperationResult) { - return httpOperationResult != null && httpOperationResult.first != null && httpOperationResult.second != null; - } - - /** - * Create simple HTTP headers for unauthenticated requests to SO. - * - * @return the HTTP headers - */ - private Map createSimpleHeaders() { - Map headers = new HashMap<>(); - headers.put("Accept", MEDIA_TYPE); - return headers; - } -} diff --git a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOModelInfo.java b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOModelInfo.java deleted file mode 100644 index 15cbd23d0..000000000 --- a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOModelInfo.java +++ /dev/null @@ -1,112 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * so - * ================================================================================ - * Copyright (C) 2017-2018 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.policy.so; - -import com.google.gson.annotations.SerializedName; - -import java.io.Serializable; - -public class SOModelInfo implements Serializable { - - private static final long serialVersionUID = -3283942659786236032L; - - @SerializedName("modelType") - private String modelType; - - @SerializedName("modelInvariantId") - private String modelInvariantId; - - @SerializedName("modelVersionId") - private String modelVersionId; - - @SerializedName("modelName") - private String modelName; - - @SerializedName("modelVersion") - private String modelVersion; - - @SerializedName("modelCustomizationName") - private String modelCustomizationName; - - @SerializedName("modelCustomizationId") - private String modelCustomizationId; - - public SOModelInfo() { - //required by author - } - - public String getModelCustomizationId() { - return modelCustomizationId; - } - - public String getModelCustomizationName() { - return modelCustomizationName; - } - - public String getModelInvariantId() { - return modelInvariantId; - } - - public String getModelName() { - return modelName; - } - - public String getModelType() { - return modelType; - } - - public String getModelVersion() { - return modelVersion; - } - - public String getModelVersionId() { - return modelVersionId; - } - - public void setModelCustomizationId(String modelCustomizationId) { - this.modelCustomizationId = modelCustomizationId; - } - - public void setModelCustomizationName(String modelCustomizationName) { - this.modelCustomizationName = modelCustomizationName; - } - - public void setModelInvariantId(String modelInvariantId) { - this.modelInvariantId = modelInvariantId; - } - - public void setModelName(String modelName) { - this.modelName = modelName; - } - - public void setModelType(String modelType) { - this.modelType = modelType; - } - - public void setModelVersion(String modelVersion) { - this.modelVersion = modelVersion; - } - - public void setModelVersionId(String modelVersionId) { - this.modelVersionId = modelVersionId; - } - -} diff --git a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOPolicyExceptionHolder.java b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOPolicyExceptionHolder.java deleted file mode 100644 index 4c4fed1f2..000000000 --- a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOPolicyExceptionHolder.java +++ /dev/null @@ -1,57 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * so - * ================================================================================ - * Copyright (C) 2017-2018 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.policy.so; - -import com.google.gson.annotations.SerializedName; - -import java.io.Serializable; - -public class SOPolicyExceptionHolder implements Serializable { - - private static final long serialVersionUID = -3283942659786236032L; - - @SerializedName("messageId") - private String messageId; - - @SerializedName("text") - private String text; - - public SOPolicyExceptionHolder() { - //required by author - } - - public String getMessageId() { - return messageId; - } - - public String getText() { - return text; - } - - public void setMessageId(String messageId) { - this.messageId = messageId; - } - - public void setText(String text) { - this.text = text; - } - -} diff --git a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SORelatedInstance.java b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SORelatedInstance.java deleted file mode 100644 index 90fe339ee..000000000 --- a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SORelatedInstance.java +++ /dev/null @@ -1,70 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * so - * ================================================================================ - * Copyright (C) 2017-2018 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.policy.so; - -import com.google.gson.annotations.SerializedName; - -import java.io.Serializable; - -public class SORelatedInstance implements Serializable { - - private static final long serialVersionUID = -3283942659786236032L; - - @SerializedName("instanceId") - private String instanceId; - - @SerializedName("instanceName") - private String instanceName; - - @SerializedName("modelInfo") - private SOModelInfo modelInfo; - - public SORelatedInstance() { - //required by author - } - - public String getInstanceId() { - return instanceId; - } - - - public String getInstanceName() { - return instanceName; - } - - public SOModelInfo getModelInfo() { - return modelInfo; - } - - public void setInstanceId(String instanceId) { - this.instanceId = instanceId; - } - - public void setInstanceName(String instanceName) { - this.instanceName = instanceName; - } - - - public void setModelInfo(SOModelInfo modelInfo) { - this.modelInfo = modelInfo; - } - -} diff --git a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SORelatedInstanceListElement.java b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SORelatedInstanceListElement.java deleted file mode 100644 index 4d3d27346..000000000 --- a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SORelatedInstanceListElement.java +++ /dev/null @@ -1,46 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * so - * ================================================================================ - * Copyright (C) 2017-2018 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.policy.so; - -import com.google.gson.annotations.SerializedName; - -import java.io.Serializable; - -public class SORelatedInstanceListElement implements Serializable { - - private static final long serialVersionUID = -3283942659786236032L; - - @SerializedName("relatedInstance") - private SORelatedInstance relatedInstance; - - public SORelatedInstanceListElement() { - //required by author - } - - public SORelatedInstance getRelatedInstance() { - return relatedInstance; - } - - public void setRelatedInstance(SORelatedInstance relatedInstance) { - this.relatedInstance = relatedInstance; - } - -} diff --git a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SORequest.java b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SORequest.java deleted file mode 100644 index 8bcbacf73..000000000 --- a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SORequest.java +++ /dev/null @@ -1,123 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * so - * ================================================================================ - * Copyright (C) 2017-2018 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.policy.so; - -import com.google.gson.annotations.SerializedName; - -import java.io.Serializable; -import java.time.LocalDateTime; -import java.util.UUID; - -public class SORequest implements Serializable { - - private static final long serialVersionUID = -3283942659786236032L; - - @SerializedName("requestId") - private UUID requestId; - - @SerializedName("startTime") - private String startTime; - - @SerializedName("finishTime") - private LocalDateTime finishTime; - - @SerializedName("requestScope") - private String requestScope; - - @SerializedName("requestType") - private String requestType; - - @SerializedName("requestDetails") - private SORequestDetails requestDetails; - - @SerializedName("requestStatus") - private SORequestStatus requestStatus; - - private transient SoOperationType operationType; - - public SORequest() { - // required by author - } - - public LocalDateTime getFinishTime() { - return finishTime; - } - - public SORequestDetails getRequestDetails() { - return requestDetails; - } - - public UUID getRequestId() { - return requestId; - } - - public String getRequestScope() { - return requestScope; - } - - public SORequestStatus getRequestStatus() { - return requestStatus; - } - - public String getRequestType() { - return requestType; - } - - public String getStartTime() { - return startTime; - } - - public void setFinishTime(LocalDateTime finishTime) { - this.finishTime = finishTime; - } - - public void setRequestDetails(SORequestDetails requestDetails) { - this.requestDetails = requestDetails; - } - - public void setRequestId(UUID requestId) { - this.requestId = requestId; - } - - public void setRequestScope(String requestScope) { - this.requestScope = requestScope; - } - - public void setRequestStatus(SORequestStatus requestStatus) { - this.requestStatus = requestStatus; - } - - public void setRequestType(String requestType) { - this.requestType = requestType; - } - - public void setStartTime(String startTime) { - this.startTime = startTime; - } - - public SoOperationType getOperationType() { - return operationType; - } - - public void setOperationType(SoOperationType operationType) { - this.operationType = operationType; - } -} diff --git a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SORequestDetails.java b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SORequestDetails.java deleted file mode 100644 index 465895117..000000000 --- a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SORequestDetails.java +++ /dev/null @@ -1,215 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * so - * ================================================================================ - * Copyright (C) 2017-2018 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.policy.so; - -import com.google.gson.annotations.SerializedName; - -import java.io.Serializable; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; - -public class SORequestDetails implements Serializable { - - private static final long serialVersionUID = -3283942659786236032L; - - @SerializedName("modelInfo") - private SOModelInfo modelInfo; - - @SerializedName("cloudConfiguration") - private SOCloudConfiguration cloudConfiguration; - - @SerializedName("requestInfo") - private SORequestInfo requestInfo; - - @SerializedName("subscriberInfo") - private SOSubscriberInfo subscriberInfo; - - @SerializedName("relatedInstanceList") - private List relatedInstanceList = new LinkedList<>(); - - @SerializedName("requestParameters") - private SORequestParameters requestParameters; - - @SerializedName("configurationParameters") - private List> configurationParameters = new LinkedList<>(); - - public SORequestDetails() { - - } - - /** - * Constructor. - * - * @param soRequestDetails copy object - */ - public SORequestDetails(SORequestDetails soRequestDetails) { - this.modelInfo = soRequestDetails.modelInfo; - this.cloudConfiguration = soRequestDetails.cloudConfiguration; - this.requestInfo = soRequestDetails.requestInfo; - this.relatedInstanceList = soRequestDetails.relatedInstanceList; - this.requestParameters = soRequestDetails.requestParameters; - this.subscriberInfo = soRequestDetails.subscriberInfo; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - SORequestDetails other = (SORequestDetails) obj; - if (cloudConfiguration == null) { - if (other.cloudConfiguration != null) { - return false; - } - } else if (!cloudConfiguration.equals(other.cloudConfiguration)) { - return false; - } - if (configurationParameters == null) { - if (other.configurationParameters != null) { - return false; - } - } else if (!configurationParameters.equals(other.configurationParameters)) { - return false; - } - if (modelInfo == null) { - if (other.modelInfo != null) { - return false; - } - } else if (!modelInfo.equals(other.modelInfo)) { - return false; - } - if (relatedInstanceList == null) { - if (other.relatedInstanceList != null) { - return false; - } - } else if (!relatedInstanceList.equals(other.relatedInstanceList)) { - return false; - } - if (requestInfo == null) { - if (other.requestInfo != null) { - return false; - } - } else if (!requestInfo.equals(other.requestInfo)) { - return false; - } - if (requestParameters == null) { - if (other.requestParameters != null) { - return false; - } - } else if (!requestParameters.equals(other.requestParameters)) { - return false; - } - if (subscriberInfo == null) { - if (other.subscriberInfo != null) { - return false; - } - } else if (!subscriberInfo.equals(other.subscriberInfo)) { - return false; - } - return true; - } - - public SOCloudConfiguration getCloudConfiguration() { - return cloudConfiguration; - } - - public SOModelInfo getModelInfo() { - return modelInfo; - } - - public List getRelatedInstanceList() { - return relatedInstanceList; - } - - public SORequestInfo getRequestInfo() { - return requestInfo; - } - - public SORequestParameters getRequestParameters() { - return requestParameters; - } - - public List> getConfigurationParameters() { - return configurationParameters; - } - - public SOSubscriberInfo getSubscriberInfo() { - return subscriberInfo; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((cloudConfiguration == null) ? 0 : cloudConfiguration.hashCode()); - result = prime * result + ((configurationParameters == null) ? 0 : configurationParameters.hashCode()); - result = prime * result + ((modelInfo == null) ? 0 : modelInfo.hashCode()); - result = prime * result + ((relatedInstanceList == null) ? 0 : relatedInstanceList.hashCode()); - result = prime * result + ((requestInfo == null) ? 0 : requestInfo.hashCode()); - result = prime * result + ((requestParameters == null) ? 0 : requestParameters.hashCode()); - result = prime * result + ((subscriberInfo == null) ? 0 : subscriberInfo.hashCode()); - return result; - } - - public void setCloudConfiguration(SOCloudConfiguration cloudConfiguration) { - this.cloudConfiguration = cloudConfiguration; - } - - public void setModelInfo(SOModelInfo modelInfo) { - this.modelInfo = modelInfo; - } - - public void setRequestInfo(SORequestInfo requestInfo) { - this.requestInfo = requestInfo; - } - - public void setRequestParameters(SORequestParameters requestParameters) { - this.requestParameters = requestParameters; - } - - public void setConfigurationParameters(List> configurationParameters) { - this.configurationParameters = configurationParameters; - } - - public void setSubscriberInfo(SOSubscriberInfo subscriberInfo) { - this.subscriberInfo = subscriberInfo; - } - - public void setRelatedInstanceList(List relatedInstanceList) { - this.relatedInstanceList = relatedInstanceList; - } - - @Override - public String toString() { - return "SORequestDetails [modelInfo=" + modelInfo + ", cloudConfiguration=" + cloudConfiguration - + ", requestInfo=" + requestInfo + ", subscriberInfo=" + subscriberInfo - + ", relatedInstanceList=" + relatedInstanceList + ", requestParameters=" + requestParameters - + ", configurationParameters=" + configurationParameters + "]"; - } - -} diff --git a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SORequestError.java b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SORequestError.java deleted file mode 100644 index 7594ef95c..000000000 --- a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SORequestError.java +++ /dev/null @@ -1,57 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * so - * ================================================================================ - * Copyright (C) 2017-2018 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.policy.so; - -import com.google.gson.annotations.SerializedName; - -import java.io.Serializable; - -public class SORequestError implements Serializable { - - private static final long serialVersionUID = -3283942659786236032L; - - @SerializedName("policyException") - private SOPolicyExceptionHolder policyException; - - @SerializedName("serviceException") - private SOServiceExceptionHolder serviceException; - - public SORequestError() { - // required by author - } - - public SOPolicyExceptionHolder getPolicyException() { - return policyException; - } - - public SOServiceExceptionHolder getServiceException() { - return serviceException; - } - - public void setPolicyException(SOPolicyExceptionHolder policyException) { - this.policyException = policyException; - } - - public void setServiceException(SOServiceExceptionHolder serviceException) { - this.serviceException = serviceException; - } - -} diff --git a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SORequestInfo.java b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SORequestInfo.java deleted file mode 100644 index c30e50c17..000000000 --- a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SORequestInfo.java +++ /dev/null @@ -1,145 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * so - * ================================================================================ - * Copyright (C) 2017-2018 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.policy.so; - -import com.google.gson.annotations.SerializedName; - -import java.io.Serializable; - -public class SORequestInfo implements Serializable { - - private static final long serialVersionUID = -3283942659786236032L; - - @SerializedName("instanceName") - private String instanceName; - - @SerializedName("source") - private String source; - - @SerializedName("productFamilyId") - private String productFamilyId; - - @SerializedName("suppressRollback") - private boolean suppressRollback; - - @SerializedName("billingAccountNumber") - private String billingAccountNumber; - - @SerializedName("callbackUrl") - private String callbackUrl; - - @SerializedName("correlator") - private String correlator; - - @SerializedName("orderNumber") - private String orderNumber; - - @SerializedName("orderVersion") - private Integer orderVersion; - - @SerializedName("requestorId") - private String requestorId; - - public SORequestInfo() { - // required by author - } - - public String getBillingAccountNumber() { - return billingAccountNumber; - } - - public String getCallbackUrl() { - return callbackUrl; - } - - public String getCorrelator() { - return correlator; - } - - public String getInstanceName() { - return instanceName; - } - - public String getOrderNumber() { - return orderNumber; - } - - public Integer getOrderVersion() { - return orderVersion; - } - - public String getProductFamilyId() { - return productFamilyId; - } - - public String getRequestorId() { - return requestorId; - } - - public String getSource() { - return source; - } - - public boolean isSuppressRollback() { - return suppressRollback; - } - - public void setBillingAccountNumber(String billingAccountNumber) { - this.billingAccountNumber = billingAccountNumber; - } - - public void setCallbackUrl(String callbackUrl) { - this.callbackUrl = callbackUrl; - } - - public void setCorrelator(String correlator) { - this.correlator = correlator; - } - - public void setInstanceName(String instanceName) { - this.instanceName = instanceName; - } - - public void setOrderNumber(String orderNumber) { - this.orderNumber = orderNumber; - } - - public void setOrderVersion(Integer orderVersion) { - this.orderVersion = orderVersion; - } - - public void setProductFamilyId(String productFamilyId) { - this.productFamilyId = productFamilyId; - } - - public void setRequestorId(String requestorId) { - this.requestorId = requestorId; - } - - public void setSource(String source) { - this.source = source; - } - - public void setSuppressRollback(boolean suppressRollback) { - this.suppressRollback = suppressRollback; - } - -} diff --git a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SORequestParameters.java b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SORequestParameters.java deleted file mode 100644 index 69faded76..000000000 --- a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SORequestParameters.java +++ /dev/null @@ -1,71 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * so - * ================================================================================ - * Copyright (C) 2017-2018 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.policy.so; - -import com.google.gson.annotations.SerializedName; - -import java.io.Serializable; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; - -public class SORequestParameters implements Serializable { - - private static final long serialVersionUID = -3283942659786236033L; - - @SerializedName("subscriptionServiceType") - private String subscriptionServiceType; - - @SerializedName("usePreload") - private boolean usePreload; - - @SerializedName("userParams") - private List> userParams = new LinkedList<>(); - - public SORequestParameters() { - // required by author - } - - public String getSubscriptionServiceType() { - return subscriptionServiceType; - } - - public boolean isUsePreload() { - return usePreload; - } - - public List> getUserParams() { - return userParams; - } - - public void setSubscriptionServiceType(String subscriptionServiceType) { - this.subscriptionServiceType = subscriptionServiceType; - } - - public void setUsePreload(boolean usePreload) { - this.usePreload = usePreload; - } - - public void setUserParams(List> userParams) { - this.userParams = userParams; - } - -} diff --git a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SORequestReferences.java b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SORequestReferences.java deleted file mode 100644 index 71b1cccfe..000000000 --- a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SORequestReferences.java +++ /dev/null @@ -1,53 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * so - * ================================================================================ - * Copyright (C) 2017-2018 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.policy.so; - -import com.google.gson.annotations.SerializedName; - -import java.io.Serializable; - -public class SORequestReferences implements Serializable { - - private static final long serialVersionUID = -3283942659786236032L; - - @SerializedName("instanceId") - private String instanceId; - - @SerializedName("requestId") - private String requestId; - - public String getInstanceId() { - return instanceId; - } - - public String getRequestId() { - return requestId; - } - - public void setInstanceId(String instanceId) { - this.instanceId = instanceId; - } - - public void setRequestId(String requestId) { - this.requestId = requestId; - } - -} diff --git a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SORequestStatus.java b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SORequestStatus.java deleted file mode 100644 index 79406574d..000000000 --- a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SORequestStatus.java +++ /dev/null @@ -1,79 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * so - * ================================================================================ - * Copyright (C) 2017-2018 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.policy.so; - -import com.google.gson.annotations.SerializedName; - -import java.io.Serializable; - -public class SORequestStatus implements Serializable { - - private static final long serialVersionUID = -3283942659786236032L; - - @SerializedName("percentProgress") - private int percentProgress; - - @SerializedName("requestState") - private String requestState; - - @SerializedName("timestamp") - private String timestamp; - - @SerializedName("wasRolledBack") - private boolean wasRolledBack; - - public SORequestStatus() { - //required by author - } - - public int getPercentProgress() { - return percentProgress; - } - - public String getRequestState() { - return requestState; - } - - public String getTimestamp() { - return timestamp; - } - - public boolean isWasRolledBack() { - return wasRolledBack; - } - - public void setPercentProgress(int percentProgress) { - this.percentProgress = percentProgress; - } - - public void setRequestState(String requestState) { - this.requestState = requestState; - } - - public void setTimestamp(String timestamp) { - this.timestamp = timestamp; - } - - public void setWasRolledBack(boolean wasRolledBack) { - this.wasRolledBack = wasRolledBack; - } - -} diff --git a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOResponse.java b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOResponse.java deleted file mode 100644 index e9350838a..000000000 --- a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOResponse.java +++ /dev/null @@ -1,78 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * so - * ================================================================================ - * Copyright (C) 2017-2018 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.policy.so; - -import com.google.gson.annotations.SerializedName; - -import java.io.Serializable; - -public class SOResponse implements Serializable { - - private static final long serialVersionUID = -3283942659786236032L; - - @SerializedName("requestReferences") - private SORequestReferences requestReferences; - - @SerializedName("requestError") - private SORequestError requestError; - - @SerializedName("request") - private SORequest request; - - private int httpResponseCode; - - public SOResponse() { - // required by author - } - - public int getHttpResponseCode() { - return httpResponseCode; - } - - public SORequest getRequest() { - return request; - } - - public SORequestError getRequestError() { - return requestError; - } - - public SORequestReferences getRequestReferences() { - return requestReferences; - } - - public void setHttpResponseCode(int httpResponseCode) { - this.httpResponseCode = httpResponseCode; - } - - public void setRequest(SORequest request) { - this.request = request; - } - - public void setRequestError(SORequestError requestError) { - this.requestError = requestError; - } - - public void setRequestReferences(SORequestReferences requestReferences) { - this.requestReferences = requestReferences; - } - -} diff --git a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOResponseWrapper.java b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOResponseWrapper.java deleted file mode 100644 index dcf640d83..000000000 --- a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOResponseWrapper.java +++ /dev/null @@ -1,102 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * so - * ================================================================================ - * Copyright (C) 2017-2018 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.policy.so; - -import com.google.gson.annotations.SerializedName; - -import java.io.Serializable; - -public class SOResponseWrapper implements Serializable { - - private static final long serialVersionUID = 7673023687132889069L; - - @SerializedName("SoResponse") - private SOResponse soResponse; - - private transient String requestID; - - public SOResponseWrapper(SOResponse response, String reqID) { - this.soResponse = response; - this.requestID = reqID; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - SOResponseWrapper other = (SOResponseWrapper) obj; - if (soResponse == null) { - if (other.soResponse != null) { - return false; - } - } - else if (!soResponse.equals(other.soResponse)) { - return false; - } - if (requestID == null) { - if (other.requestID != null) { - return false; - } - } - else if (!requestID.equals(other.requestID)) { - return false; - } - return true; - } - - public String getRequestID() { - return requestID; - } - - public SOResponse getSoResponse() { - return soResponse; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = super.hashCode(); - result = prime * result + ((soResponse == null) ? 0 : soResponse.hashCode()); - result = prime * result + ((requestID == null) ? 0 : requestID.hashCode()); - return result; - } - - public void setRequestID(String requestId) { - this.requestID = requestId; - } - - public void setSoResponse(SOResponse response) { - soResponse = response; - } - - @Override - public String toString() { - return "SOResponseWrapper [SOResponse=" + soResponse + ", RequestID=" + requestID + "]"; - } - -} diff --git a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOServiceExceptionHolder.java b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOServiceExceptionHolder.java deleted file mode 100644 index 65ba446e3..000000000 --- a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOServiceExceptionHolder.java +++ /dev/null @@ -1,66 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * so - * ================================================================================ - * Copyright (C) 2017-2018 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.policy.so; - -import com.google.gson.annotations.SerializedName; - -import java.io.Serializable; -import java.util.LinkedList; -import java.util.List; - -public class SOServiceExceptionHolder implements Serializable { - - private static final long serialVersionUID = -3283942659786236032L; - - @SerializedName("messageId") - private String messageId; - - @SerializedName("text") - private String text; - - @SerializedName("variables") - private List variables = new LinkedList<>(); - - public SOServiceExceptionHolder() { - // required by author - } - - public String getMessageId() { - return messageId; - } - - public String getText() { - return text; - } - - public List getVariables() { - return variables; - } - - public void setMessageId(String messageId) { - this.messageId = messageId; - } - - public void setText(String text) { - this.text = text; - } - -} diff --git a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOSubscriberInfo.java b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOSubscriberInfo.java deleted file mode 100644 index f7a4982a1..000000000 --- a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOSubscriberInfo.java +++ /dev/null @@ -1,68 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * so - * ================================================================================ - * Copyright (C) 2017-2018 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.policy.so; - -import com.google.gson.annotations.SerializedName; - -import java.io.Serializable; - -public class SOSubscriberInfo implements Serializable { - - private static final long serialVersionUID = -3283942659786236032L; - - @SerializedName("globalSubscriberId") - private String globalSubscriberId; - - @SerializedName("subscriberCommonSiteId") - private String subscriberCommonSiteId; - - @SerializedName("subscriberName") - private String subscriberName; - - public SOSubscriberInfo() { - //required by author - } - - public String getGlobalSubscriberId() { - return globalSubscriberId; - } - - public String getSubscriberCommonSiteId() { - return subscriberCommonSiteId; - } - - public String getSubscriberName() { - return subscriberName; - } - - public void setGlobalSubscriberId(String globalSubscriberId) { - this.globalSubscriberId = globalSubscriberId; - } - - public void setSubscriberCommonSiteId(String subscriberCommonSiteId) { - this.subscriberCommonSiteId = subscriberCommonSiteId; - } - - public void setSubscriberName(String subscriberName) { - this.subscriberName = subscriberName; - } - -} diff --git a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SoAsyncRequestStatus.java b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SoAsyncRequestStatus.java new file mode 100644 index 000000000..a596b1b07 --- /dev/null +++ b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SoAsyncRequestStatus.java @@ -0,0 +1,125 @@ +/*- + * ============LICENSE_START======================================================= + * so + * ================================================================================ + * Copyright (C) 2017-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.policy.so; + +import com.google.gson.annotations.SerializedName; + +import java.io.Serializable; +import java.time.LocalDateTime; + +public class SoAsyncRequestStatus implements Serializable { + + private static final long serialVersionUID = -3283942659786236032L; + + @SerializedName("correlator") + private String correlator; + + @SerializedName("requestId") + private String requestId; + + @SerializedName("instanceReferences") + private SoInstanceReferences instanceReferences; + + @SerializedName("startTime") + private LocalDateTime startTime; + + @SerializedName("finishTime") + private LocalDateTime finishTime; + + @SerializedName("requestScope") + private String requestScope; + + @SerializedName("requestType") + private String requestType; + + @SerializedName("requestStatus") + private SoRequestStatus requestStatus; + + public SoAsyncRequestStatus() { + // required by author + } + + public String getCorrelator() { + return correlator; + } + + + public LocalDateTime getFinishTime() { + return finishTime; + } + + public SoInstanceReferences getInstanceReferences() { + return instanceReferences; + } + + public String getRequestId() { + return requestId; + } + + public String getRequestScope() { + return requestScope; + } + + public SoRequestStatus getRequestStatus() { + return requestStatus; + } + + public String getRequestType() { + return requestType; + } + + public LocalDateTime getStartTime() { + return startTime; + } + + public void setCorrelator(String correlator) { + this.correlator = correlator; + } + + public void setFinishTime(LocalDateTime finishTime) { + this.finishTime = finishTime; + } + + public void setInstanceReferences(SoInstanceReferences instanceReferences) { + this.instanceReferences = instanceReferences; + } + + public void setRequestId(String requestId) { + this.requestId = requestId; + } + + public void setRequestScope(String requestScope) { + this.requestScope = requestScope; + } + + public void setRequestStatus(SoRequestStatus requestStatus) { + this.requestStatus = requestStatus; + } + + public void setRequestType(String requestType) { + this.requestType = requestType; + } + + public void setStartTime(LocalDateTime startTime) { + this.startTime = startTime; + } + +} diff --git a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SoCloudConfiguration.java b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SoCloudConfiguration.java new file mode 100644 index 000000000..48a2489ab --- /dev/null +++ b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SoCloudConfiguration.java @@ -0,0 +1,57 @@ +/*- + * ============LICENSE_START======================================================= + * so + * ================================================================================ + * Copyright (C) 2017-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.policy.so; + +import com.google.gson.annotations.SerializedName; + +import java.io.Serializable; + +public class SoCloudConfiguration implements Serializable { + + private static final long serialVersionUID = -3283942659786236032L; + + @SerializedName("lcpCloudRegionId") + private String lcpCloudRegionId; + + @SerializedName("tenantId") + private String tenantId; + + public SoCloudConfiguration() { + //required by author + } + + public String getLcpCloudRegionId() { + return lcpCloudRegionId; + } + + public String getTenantId() { + return tenantId; + } + + public void setLcpCloudRegionId(String lcpCloudRegionId) { + this.lcpCloudRegionId = lcpCloudRegionId; + } + + public void setTenantId(String tenantId) { + this.tenantId = tenantId; + } + +} diff --git a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SoInstanceReferences.java b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SoInstanceReferences.java new file mode 100644 index 000000000..f4065e613 --- /dev/null +++ b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SoInstanceReferences.java @@ -0,0 +1,57 @@ +/*- + * ============LICENSE_START======================================================= + * so + * ================================================================================ + * Copyright (C) 2017-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.policy.so; + +import com.google.gson.annotations.SerializedName; + +import java.io.Serializable; + +public class SoInstanceReferences implements Serializable { + + private static final long serialVersionUID = -3283942659786236032L; + + @SerializedName("requestId") + private String requestId; + + @SerializedName("instanceId") + private String instanceId; + + public SoInstanceReferences() { + //requried by author + } + + public String getInstanceId() { + return instanceId; + } + + public String getRequestId() { + return requestId; + } + + public void setInstanceId(String instanceId) { + this.instanceId = instanceId; + } + + public void setRequestId(String requestId) { + this.requestId = requestId; + } + +} diff --git a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SoManager.java b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SoManager.java new file mode 100644 index 000000000..632c48933 --- /dev/null +++ b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SoManager.java @@ -0,0 +1,371 @@ +/*- + * ============LICENSE_START======================================================= + * so + * ================================================================================ + * Copyright (C) 2017-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.policy.so; + +import com.google.gson.GsonBuilder; +import com.google.gson.JsonSyntaxException; +import java.util.HashMap; +import java.util.Map; +import java.util.concurrent.Callable; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.Future; +import org.drools.core.WorkingMemory; +import org.onap.policy.drools.system.PolicyEngine; +import org.onap.policy.rest.RESTManager; +import org.onap.policy.rest.RESTManager.Pair; +import org.onap.policy.so.util.Serialization; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + + +/** + * This class handles the interface towards SO (Service Orchestrator) for the ONAP Policy + * Framework. The SO API is defined at this link: + * http://onap.readthedocs.io/en/latest/submodules/so.git/docs/SO_R1_Interface.html#get-orchestration-request + * + */ +public final class SoManager { + private static final Logger logger = LoggerFactory.getLogger(SoManager.class); + private static final Logger netLogger = + LoggerFactory.getLogger(org.onap.policy.common.endpoints.event.comm.Topic.NETWORK_LOGGER); + private static ExecutorService executors = Executors.newCachedThreadPool(); + + private static final int SO_RESPONSE_ERROR = 999; + private static final String MEDIA_TYPE = "application/json"; + private static final String LINE_SEPARATOR = System.lineSeparator(); + + // REST get timeout value in milliseconds + private static final int GET_REQUESTS_BEFORE_TIMEOUT = 20; + private static final long GET_REQUEST_WAIT_INTERVAL = 20000; + + // The REST manager used for processing REST calls for this VFC manager + private RESTManager restManager; + + private long restGetTimeout = GET_REQUEST_WAIT_INTERVAL; + + /** + * Default constructor. + */ + public SoManager() { + restManager = new RESTManager(); + } + + /** + * Create a service instance in SO. + * + * @param url the SO URL + * @param urlBase the base URL + * @param username user name on SO + * @param password password on SO + * @param request the request to issue to SO + * @return the SO Response object + */ + public SoResponse createModuleInstance(final String url, final String urlBase, final String username, + final String password, final SoRequest request) { + // Issue the HTTP POST request to SO to create the service instance + String requestJson = Serialization.gsonPretty.toJson(request); + netLogger.info("[OUT|{}|{}|{}|{}|{}|{}|]{}{}", "SO", url, username, password, createSimpleHeaders(), MEDIA_TYPE, + LINE_SEPARATOR, requestJson); + Pair httpResponse = + restManager.post(url, username, password, createSimpleHeaders(), MEDIA_TYPE, requestJson); + + // Process the response from SO + SoResponse response = waitForSoOperationCompletion(urlBase, username, password, url, httpResponse); + if (SO_RESPONSE_ERROR != response.getHttpResponseCode()) { + return response; + } else { + return null; + } + } + + /** + * Works just like SOManager#asyncSORestCall(String, WorkingMemory, String, String, String, SORequest) + * except the vfModuleInstanceId is always null. + * + */ + public Future asyncSoRestCall(final String requestId, final WorkingMemory wm, + final String serviceInstanceId, final String vnfInstanceId, + final SoRequest request) { + return asyncSoRestCall(requestId, wm, serviceInstanceId, vnfInstanceId, null, request); + } + + /** + * This method makes an asynchronous Rest call to MSO and inserts the response into + * Drools working memory. + * + * @param requestId the request id + * @param wm the Drools working memory + * @param serviceInstanceId service instance id to construct the request url + * @param vnfInstanceId vnf instance id to construct the request url + * @param vfModuleInstanceId vfModule instance id to construct the request url (required in case of delete vf + * module) + * @param request the SO request + * @return a concurrent Future for the thread that handles the request + */ + public Future asyncSoRestCall(final String requestId, + final WorkingMemory wm, + final String serviceInstanceId, + final String vnfInstanceId, + final String vfModuleInstanceId, final SoRequest request) { + return executors.submit(new AsyncSoRestCallThread(requestId, wm, serviceInstanceId, vnfInstanceId, + vfModuleInstanceId, request)); + } + + /** + * This class handles an asynchronous request to SO as a thread. + */ + private class AsyncSoRestCallThread implements Callable { + final String requestId; + final WorkingMemory wm; + final String serviceInstanceId; + final String vnfInstanceId; + final String vfModuleInstanceId; + final SoRequest request; + + /** + * Constructor, sets the context of the request. + * + * @param requestID The request ID + * @param wm reference to the Drools working memory + * @param serviceInstanceId the service instance in SO to use + * @param vnfInstanceId the VNF instance that is the subject of the request + * @param vfModuleInstanceId the vf module instance id (not null in case of delete vf module request) + * @param request the request itself + */ + private AsyncSoRestCallThread(final String requestId, + final WorkingMemory wm, final String serviceInstanceId, + final String vnfInstanceId, final String vfModuleInstanceId, + final SoRequest request) { + this.requestId = requestId; + this.wm = wm; + this.serviceInstanceId = serviceInstanceId; + this.vnfInstanceId = vnfInstanceId; + this.vfModuleInstanceId = vfModuleInstanceId; + this.request = request; + } + + /** + * Process the asynchronous SO request. + */ + @Override + public SoResponse call() { + String urlBase = PolicyEngine.manager.getEnvironmentProperty("so.url"); + String username = PolicyEngine.manager.getEnvironmentProperty("so.username"); + String password = PolicyEngine.manager.getEnvironmentProperty("so.password"); + + // Create a JSON representation of the request + String soJson = new GsonBuilder().disableHtmlEscaping().setPrettyPrinting().create().toJson(request); + String url = null; + Pair httpResponse = null; + + if (request.getOperationType() != null && request.getOperationType() + .equals(SoOperationType.SCALE_OUT)) { + url = urlBase + "/serviceInstantiation/v7/serviceInstances/" + serviceInstanceId + "/vnfs/" + + vnfInstanceId + "/vfModules/scaleOut"; + netLogger.info("[OUT|{}|{}|]{}{}", "SO", url, LINE_SEPARATOR, soJson); + httpResponse = restManager.post(url, username, password, createSimpleHeaders(), MEDIA_TYPE, soJson); + } else if (request.getOperationType() != null && request.getOperationType() + .equals(SoOperationType.DELETE_VF_MODULE)) { + url = urlBase + "/serviceInstances/v7/" + serviceInstanceId + "/vnfs/" + vnfInstanceId + + "/vfModules/" + vfModuleInstanceId; + netLogger.info("[OUT|{}|{}|]{}{}", "SO", url, LINE_SEPARATOR, soJson); + httpResponse = restManager.delete(url, username, password, createSimpleHeaders(), MEDIA_TYPE, soJson); + } else { + return null; + } + + // Process the response from SO + SoResponse response = waitForSoOperationCompletion(urlBase, username, password, url, httpResponse); + + // Return the response to Drools in its working memory + SoResponseWrapper soWrapper = new SoResponseWrapper(response, requestId); + wm.insert(soWrapper); + + return response; + } + } + + /** + * Wait for the SO operation we have ordered to complete. + * + * @param urlBaseSo The base URL for SO + * @param username user name on SO + * @param password password on SO + * @param initialRequestUrl The URL of the initial HTTP request + * @param initialHttpResponse The initial HTTP message returned from SO + * @return The parsed final response of SO to the request + */ + private SoResponse waitForSoOperationCompletion(final String urlBaseSo, final String username, + final String password, final String initialRequestUrl, + final Pair initialHttpResponse) { + // Process the initial response from SO, the response to a post + SoResponse response = processSoResponse(initialRequestUrl, initialHttpResponse); + if (SO_RESPONSE_ERROR == response.getHttpResponseCode()) { + return response; + } + + // The SO URL to use to get the status of orchestration requests + String urlGet = urlBaseSo + "/orchestrationRequests/v5/" + response.getRequestReferences().getRequestId(); + + // The HTTP status code of the latest response + Pair latestHttpResponse = initialHttpResponse; + + // Wait for the response from SO + for (int attemptsLeft = GET_REQUESTS_BEFORE_TIMEOUT; attemptsLeft >= 0; attemptsLeft--) { + // The SO request may have completed even on the first request so we check the + // response + // here before + // issuing any other requests + if (isRequestStateFinished(latestHttpResponse, response)) { + return response; + } + + // Wait for the defined interval before issuing a get + try { + Thread.sleep(restGetTimeout); + } catch (InterruptedException e) { + logger.error("Interrupted exception: ", e); + Thread.currentThread().interrupt(); + response.setHttpResponseCode(SO_RESPONSE_ERROR); + return response; + } + + // Issue a GET to find the current status of our request + netLogger.info("[OUT|{}|{}|{}|{}|{}|{}|]{}", "SO", urlGet, username, password, createSimpleHeaders(), + MEDIA_TYPE, LINE_SEPARATOR); + Pair httpResponse = restManager.get(urlGet, username, password, createSimpleHeaders()); + + // Get our response + response = processSoResponse(urlGet, httpResponse); + if (SO_RESPONSE_ERROR == response.getHttpResponseCode()) { + return response; + } + + // Our latest HTTP response code + latestHttpResponse = httpResponse; + } + + // We have timed out on the SO request + response.setHttpResponseCode(SO_RESPONSE_ERROR); + return response; + } + + /** + * Parse the response message from SO into a SOResponse object. + * + * @param requestURL The URL of the HTTP request + * @param httpResponse The HTTP message returned from SO + * @return The parsed response + */ + private SoResponse processSoResponse(final String requestUrl, final Pair httpResponse) { + SoResponse response = new SoResponse(); + + // A null httpDetails indicates a HTTP problem, a valid response from SO must be + // either 200 + // or 202 + if (!httpResultIsNullFree(httpResponse) || (httpResponse.first != 200 && httpResponse.first != 202)) { + logger.error("Invalid HTTP response received from SO"); + response.setHttpResponseCode(SO_RESPONSE_ERROR); + return response; + } + + // Parse the JSON of the response into our POJO + try { + response = Serialization.gsonPretty.fromJson(httpResponse.second, SoResponse.class); + } catch (JsonSyntaxException e) { + logger.error("Failed to deserialize HTTP response into SOResponse: ", e); + response.setHttpResponseCode(SO_RESPONSE_ERROR); + return response; + } + + // Set the HTTP response code of the response if needed + if (response.getHttpResponseCode() == 0) { + response.setHttpResponseCode(httpResponse.first); + } + + netLogger.info("[IN|{}|{}|]{}{}", "SO", requestUrl, LINE_SEPARATOR, httpResponse.second); + + if (logger.isDebugEnabled()) { + logger.debug("***** Response to SO Request to URL {}:", requestUrl); + logger.debug(httpResponse.second); + } + + return response; + } + + /** + * Method to allow tuning of REST get timeout. + * + * @param restGetTimeout the timeout value + */ + protected void setRestGetTimeout(final long restGetTimeout) { + this.restGetTimeout = restGetTimeout; + } + + /** + * Check that the request state of a response is defined. + * + * @param response The response to check + * @return true if the request for the response is defined + */ + private boolean isRequestStateDefined(final SoResponse response) { + return response != null && response.getRequest() != null && response.getRequest().getRequestStatus() != null + && response.getRequest().getRequestStatus().getRequestState() != null; + } + + /** + * Check that the request state of a response is finished. + * + * @param latestHttpDetails the HTTP details of the response + * @param response The response to check + * @return true if the request for the response is finished + */ + private boolean isRequestStateFinished(final Pair latestHttpDetails, final SoResponse response) { + if (latestHttpDetails != null && 200 == latestHttpDetails.first && isRequestStateDefined(response)) { + String requestState = response.getRequest().getRequestStatus().getRequestState(); + return "COMPLETE".equalsIgnoreCase(requestState) || "FAILED".equalsIgnoreCase(requestState); + } else { + return false; + } + } + + /** + * Check that a HTTP operation result has no nulls. + * + * @param httpOperationResult the result to check + * @return true if no nulls are found + */ + private boolean httpResultIsNullFree(Pair httpOperationResult) { + return httpOperationResult != null && httpOperationResult.first != null && httpOperationResult.second != null; + } + + /** + * Create simple HTTP headers for unauthenticated requests to SO. + * + * @return the HTTP headers + */ + private Map createSimpleHeaders() { + Map headers = new HashMap<>(); + headers.put("Accept", MEDIA_TYPE); + return headers; + } +} diff --git a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SoModelInfo.java b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SoModelInfo.java new file mode 100644 index 000000000..8ab13201c --- /dev/null +++ b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SoModelInfo.java @@ -0,0 +1,112 @@ +/*- + * ============LICENSE_START======================================================= + * so + * ================================================================================ + * Copyright (C) 2017-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.policy.so; + +import com.google.gson.annotations.SerializedName; + +import java.io.Serializable; + +public class SoModelInfo implements Serializable { + + private static final long serialVersionUID = -3283942659786236032L; + + @SerializedName("modelType") + private String modelType; + + @SerializedName("modelInvariantId") + private String modelInvariantId; + + @SerializedName("modelVersionId") + private String modelVersionId; + + @SerializedName("modelName") + private String modelName; + + @SerializedName("modelVersion") + private String modelVersion; + + @SerializedName("modelCustomizationName") + private String modelCustomizationName; + + @SerializedName("modelCustomizationId") + private String modelCustomizationId; + + public SoModelInfo() { + //required by author + } + + public String getModelCustomizationId() { + return modelCustomizationId; + } + + public String getModelCustomizationName() { + return modelCustomizationName; + } + + public String getModelInvariantId() { + return modelInvariantId; + } + + public String getModelName() { + return modelName; + } + + public String getModelType() { + return modelType; + } + + public String getModelVersion() { + return modelVersion; + } + + public String getModelVersionId() { + return modelVersionId; + } + + public void setModelCustomizationId(String modelCustomizationId) { + this.modelCustomizationId = modelCustomizationId; + } + + public void setModelCustomizationName(String modelCustomizationName) { + this.modelCustomizationName = modelCustomizationName; + } + + public void setModelInvariantId(String modelInvariantId) { + this.modelInvariantId = modelInvariantId; + } + + public void setModelName(String modelName) { + this.modelName = modelName; + } + + public void setModelType(String modelType) { + this.modelType = modelType; + } + + public void setModelVersion(String modelVersion) { + this.modelVersion = modelVersion; + } + + public void setModelVersionId(String modelVersionId) { + this.modelVersionId = modelVersionId; + } + +} diff --git a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SoPolicyExceptionHolder.java b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SoPolicyExceptionHolder.java new file mode 100644 index 000000000..0553eac76 --- /dev/null +++ b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SoPolicyExceptionHolder.java @@ -0,0 +1,57 @@ +/*- + * ============LICENSE_START======================================================= + * so + * ================================================================================ + * Copyright (C) 2017-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.policy.so; + +import com.google.gson.annotations.SerializedName; + +import java.io.Serializable; + +public class SoPolicyExceptionHolder implements Serializable { + + private static final long serialVersionUID = -3283942659786236032L; + + @SerializedName("messageId") + private String messageId; + + @SerializedName("text") + private String text; + + public SoPolicyExceptionHolder() { + //required by author + } + + public String getMessageId() { + return messageId; + } + + public String getText() { + return text; + } + + public void setMessageId(String messageId) { + this.messageId = messageId; + } + + public void setText(String text) { + this.text = text; + } + +} diff --git a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SoRelatedInstance.java b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SoRelatedInstance.java new file mode 100644 index 000000000..f4e329643 --- /dev/null +++ b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SoRelatedInstance.java @@ -0,0 +1,70 @@ +/*- + * ============LICENSE_START======================================================= + * so + * ================================================================================ + * Copyright (C) 2017-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.policy.so; + +import com.google.gson.annotations.SerializedName; + +import java.io.Serializable; + +public class SoRelatedInstance implements Serializable { + + private static final long serialVersionUID = -3283942659786236032L; + + @SerializedName("instanceId") + private String instanceId; + + @SerializedName("instanceName") + private String instanceName; + + @SerializedName("modelInfo") + private SoModelInfo modelInfo; + + public SoRelatedInstance() { + //required by author + } + + public String getInstanceId() { + return instanceId; + } + + + public String getInstanceName() { + return instanceName; + } + + public SoModelInfo getModelInfo() { + return modelInfo; + } + + public void setInstanceId(String instanceId) { + this.instanceId = instanceId; + } + + public void setInstanceName(String instanceName) { + this.instanceName = instanceName; + } + + + public void setModelInfo(SoModelInfo modelInfo) { + this.modelInfo = modelInfo; + } + +} diff --git a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SoRelatedInstanceListElement.java b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SoRelatedInstanceListElement.java new file mode 100644 index 000000000..d4bf98680 --- /dev/null +++ b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SoRelatedInstanceListElement.java @@ -0,0 +1,46 @@ +/*- + * ============LICENSE_START======================================================= + * so + * ================================================================================ + * Copyright (C) 2017-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.policy.so; + +import com.google.gson.annotations.SerializedName; + +import java.io.Serializable; + +public class SoRelatedInstanceListElement implements Serializable { + + private static final long serialVersionUID = -3283942659786236032L; + + @SerializedName("relatedInstance") + private SoRelatedInstance relatedInstance; + + public SoRelatedInstanceListElement() { + //required by author + } + + public SoRelatedInstance getRelatedInstance() { + return relatedInstance; + } + + public void setRelatedInstance(SoRelatedInstance relatedInstance) { + this.relatedInstance = relatedInstance; + } + +} diff --git a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SoRequest.java b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SoRequest.java new file mode 100644 index 000000000..255c5b79e --- /dev/null +++ b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SoRequest.java @@ -0,0 +1,123 @@ +/*- + * ============LICENSE_START======================================================= + * so + * ================================================================================ + * Copyright (C) 2017-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.policy.so; + +import com.google.gson.annotations.SerializedName; + +import java.io.Serializable; +import java.time.LocalDateTime; +import java.util.UUID; + +public class SoRequest implements Serializable { + + private static final long serialVersionUID = -3283942659786236032L; + + @SerializedName("requestId") + private UUID requestId; + + @SerializedName("startTime") + private String startTime; + + @SerializedName("finishTime") + private LocalDateTime finishTime; + + @SerializedName("requestScope") + private String requestScope; + + @SerializedName("requestType") + private String requestType; + + @SerializedName("requestDetails") + private SoRequestDetails requestDetails; + + @SerializedName("requestStatus") + private SoRequestStatus requestStatus; + + private transient SoOperationType operationType; + + public SoRequest() { + // required by author + } + + public LocalDateTime getFinishTime() { + return finishTime; + } + + public SoRequestDetails getRequestDetails() { + return requestDetails; + } + + public UUID getRequestId() { + return requestId; + } + + public String getRequestScope() { + return requestScope; + } + + public SoRequestStatus getRequestStatus() { + return requestStatus; + } + + public String getRequestType() { + return requestType; + } + + public String getStartTime() { + return startTime; + } + + public void setFinishTime(LocalDateTime finishTime) { + this.finishTime = finishTime; + } + + public void setRequestDetails(SoRequestDetails requestDetails) { + this.requestDetails = requestDetails; + } + + public void setRequestId(UUID requestId) { + this.requestId = requestId; + } + + public void setRequestScope(String requestScope) { + this.requestScope = requestScope; + } + + public void setRequestStatus(SoRequestStatus requestStatus) { + this.requestStatus = requestStatus; + } + + public void setRequestType(String requestType) { + this.requestType = requestType; + } + + public void setStartTime(String startTime) { + this.startTime = startTime; + } + + public SoOperationType getOperationType() { + return operationType; + } + + public void setOperationType(SoOperationType operationType) { + this.operationType = operationType; + } +} diff --git a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SoRequestDetails.java b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SoRequestDetails.java new file mode 100644 index 000000000..0ea1a272d --- /dev/null +++ b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SoRequestDetails.java @@ -0,0 +1,215 @@ +/*- + * ============LICENSE_START======================================================= + * so + * ================================================================================ + * Copyright (C) 2017-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.policy.so; + +import com.google.gson.annotations.SerializedName; + +import java.io.Serializable; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; + +public class SoRequestDetails implements Serializable { + + private static final long serialVersionUID = -3283942659786236032L; + + @SerializedName("modelInfo") + private SoModelInfo modelInfo; + + @SerializedName("cloudConfiguration") + private SoCloudConfiguration cloudConfiguration; + + @SerializedName("requestInfo") + private SoRequestInfo requestInfo; + + @SerializedName("subscriberInfo") + private SoSubscriberInfo subscriberInfo; + + @SerializedName("relatedInstanceList") + private List relatedInstanceList = new LinkedList<>(); + + @SerializedName("requestParameters") + private SoRequestParameters requestParameters; + + @SerializedName("configurationParameters") + private List> configurationParameters = new LinkedList<>(); + + public SoRequestDetails() { + + } + + /** + * Constructor. + * + * @param soRequestDetails copy object + */ + public SoRequestDetails(SoRequestDetails soRequestDetails) { + this.modelInfo = soRequestDetails.modelInfo; + this.cloudConfiguration = soRequestDetails.cloudConfiguration; + this.requestInfo = soRequestDetails.requestInfo; + this.relatedInstanceList = soRequestDetails.relatedInstanceList; + this.requestParameters = soRequestDetails.requestParameters; + this.subscriberInfo = soRequestDetails.subscriberInfo; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + SoRequestDetails other = (SoRequestDetails) obj; + if (cloudConfiguration == null) { + if (other.cloudConfiguration != null) { + return false; + } + } else if (!cloudConfiguration.equals(other.cloudConfiguration)) { + return false; + } + if (configurationParameters == null) { + if (other.configurationParameters != null) { + return false; + } + } else if (!configurationParameters.equals(other.configurationParameters)) { + return false; + } + if (modelInfo == null) { + if (other.modelInfo != null) { + return false; + } + } else if (!modelInfo.equals(other.modelInfo)) { + return false; + } + if (relatedInstanceList == null) { + if (other.relatedInstanceList != null) { + return false; + } + } else if (!relatedInstanceList.equals(other.relatedInstanceList)) { + return false; + } + if (requestInfo == null) { + if (other.requestInfo != null) { + return false; + } + } else if (!requestInfo.equals(other.requestInfo)) { + return false; + } + if (requestParameters == null) { + if (other.requestParameters != null) { + return false; + } + } else if (!requestParameters.equals(other.requestParameters)) { + return false; + } + if (subscriberInfo == null) { + if (other.subscriberInfo != null) { + return false; + } + } else if (!subscriberInfo.equals(other.subscriberInfo)) { + return false; + } + return true; + } + + public SoCloudConfiguration getCloudConfiguration() { + return cloudConfiguration; + } + + public SoModelInfo getModelInfo() { + return modelInfo; + } + + public List getRelatedInstanceList() { + return relatedInstanceList; + } + + public SoRequestInfo getRequestInfo() { + return requestInfo; + } + + public SoRequestParameters getRequestParameters() { + return requestParameters; + } + + public List> getConfigurationParameters() { + return configurationParameters; + } + + public SoSubscriberInfo getSubscriberInfo() { + return subscriberInfo; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((cloudConfiguration == null) ? 0 : cloudConfiguration.hashCode()); + result = prime * result + ((configurationParameters == null) ? 0 : configurationParameters.hashCode()); + result = prime * result + ((modelInfo == null) ? 0 : modelInfo.hashCode()); + result = prime * result + ((relatedInstanceList == null) ? 0 : relatedInstanceList.hashCode()); + result = prime * result + ((requestInfo == null) ? 0 : requestInfo.hashCode()); + result = prime * result + ((requestParameters == null) ? 0 : requestParameters.hashCode()); + result = prime * result + ((subscriberInfo == null) ? 0 : subscriberInfo.hashCode()); + return result; + } + + public void setCloudConfiguration(SoCloudConfiguration cloudConfiguration) { + this.cloudConfiguration = cloudConfiguration; + } + + public void setModelInfo(SoModelInfo modelInfo) { + this.modelInfo = modelInfo; + } + + public void setRequestInfo(SoRequestInfo requestInfo) { + this.requestInfo = requestInfo; + } + + public void setRequestParameters(SoRequestParameters requestParameters) { + this.requestParameters = requestParameters; + } + + public void setConfigurationParameters(List> configurationParameters) { + this.configurationParameters = configurationParameters; + } + + public void setSubscriberInfo(SoSubscriberInfo subscriberInfo) { + this.subscriberInfo = subscriberInfo; + } + + public void setRelatedInstanceList(List relatedInstanceList) { + this.relatedInstanceList = relatedInstanceList; + } + + @Override + public String toString() { + return "SORequestDetails [modelInfo=" + modelInfo + ", cloudConfiguration=" + cloudConfiguration + + ", requestInfo=" + requestInfo + ", subscriberInfo=" + subscriberInfo + + ", relatedInstanceList=" + relatedInstanceList + ", requestParameters=" + requestParameters + + ", configurationParameters=" + configurationParameters + "]"; + } + +} diff --git a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SoRequestError.java b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SoRequestError.java new file mode 100644 index 000000000..1214a6c8c --- /dev/null +++ b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SoRequestError.java @@ -0,0 +1,57 @@ +/*- + * ============LICENSE_START======================================================= + * so + * ================================================================================ + * Copyright (C) 2017-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.policy.so; + +import com.google.gson.annotations.SerializedName; + +import java.io.Serializable; + +public class SoRequestError implements Serializable { + + private static final long serialVersionUID = -3283942659786236032L; + + @SerializedName("policyException") + private SoPolicyExceptionHolder policyException; + + @SerializedName("serviceException") + private SoServiceExceptionHolder serviceException; + + public SoRequestError() { + // required by author + } + + public SoPolicyExceptionHolder getPolicyException() { + return policyException; + } + + public SoServiceExceptionHolder getServiceException() { + return serviceException; + } + + public void setPolicyException(SoPolicyExceptionHolder policyException) { + this.policyException = policyException; + } + + public void setServiceException(SoServiceExceptionHolder serviceException) { + this.serviceException = serviceException; + } + +} diff --git a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SoRequestInfo.java b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SoRequestInfo.java new file mode 100644 index 000000000..ae0b57bc2 --- /dev/null +++ b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SoRequestInfo.java @@ -0,0 +1,145 @@ +/*- + * ============LICENSE_START======================================================= + * so + * ================================================================================ + * Copyright (C) 2017-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.policy.so; + +import com.google.gson.annotations.SerializedName; + +import java.io.Serializable; + +public class SoRequestInfo implements Serializable { + + private static final long serialVersionUID = -3283942659786236032L; + + @SerializedName("instanceName") + private String instanceName; + + @SerializedName("source") + private String source; + + @SerializedName("productFamilyId") + private String productFamilyId; + + @SerializedName("suppressRollback") + private boolean suppressRollback; + + @SerializedName("billingAccountNumber") + private String billingAccountNumber; + + @SerializedName("callbackUrl") + private String callbackUrl; + + @SerializedName("correlator") + private String correlator; + + @SerializedName("orderNumber") + private String orderNumber; + + @SerializedName("orderVersion") + private Integer orderVersion; + + @SerializedName("requestorId") + private String requestorId; + + public SoRequestInfo() { + // required by author + } + + public String getBillingAccountNumber() { + return billingAccountNumber; + } + + public String getCallbackUrl() { + return callbackUrl; + } + + public String getCorrelator() { + return correlator; + } + + public String getInstanceName() { + return instanceName; + } + + public String getOrderNumber() { + return orderNumber; + } + + public Integer getOrderVersion() { + return orderVersion; + } + + public String getProductFamilyId() { + return productFamilyId; + } + + public String getRequestorId() { + return requestorId; + } + + public String getSource() { + return source; + } + + public boolean isSuppressRollback() { + return suppressRollback; + } + + public void setBillingAccountNumber(String billingAccountNumber) { + this.billingAccountNumber = billingAccountNumber; + } + + public void setCallbackUrl(String callbackUrl) { + this.callbackUrl = callbackUrl; + } + + public void setCorrelator(String correlator) { + this.correlator = correlator; + } + + public void setInstanceName(String instanceName) { + this.instanceName = instanceName; + } + + public void setOrderNumber(String orderNumber) { + this.orderNumber = orderNumber; + } + + public void setOrderVersion(Integer orderVersion) { + this.orderVersion = orderVersion; + } + + public void setProductFamilyId(String productFamilyId) { + this.productFamilyId = productFamilyId; + } + + public void setRequestorId(String requestorId) { + this.requestorId = requestorId; + } + + public void setSource(String source) { + this.source = source; + } + + public void setSuppressRollback(boolean suppressRollback) { + this.suppressRollback = suppressRollback; + } + +} diff --git a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SoRequestParameters.java b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SoRequestParameters.java new file mode 100644 index 000000000..bc545455b --- /dev/null +++ b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SoRequestParameters.java @@ -0,0 +1,71 @@ +/*- + * ============LICENSE_START======================================================= + * so + * ================================================================================ + * Copyright (C) 2017-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.policy.so; + +import com.google.gson.annotations.SerializedName; + +import java.io.Serializable; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; + +public class SoRequestParameters implements Serializable { + + private static final long serialVersionUID = -3283942659786236033L; + + @SerializedName("subscriptionServiceType") + private String subscriptionServiceType; + + @SerializedName("usePreload") + private boolean usePreload; + + @SerializedName("userParams") + private List> userParams = new LinkedList<>(); + + public SoRequestParameters() { + // required by author + } + + public String getSubscriptionServiceType() { + return subscriptionServiceType; + } + + public boolean isUsePreload() { + return usePreload; + } + + public List> getUserParams() { + return userParams; + } + + public void setSubscriptionServiceType(String subscriptionServiceType) { + this.subscriptionServiceType = subscriptionServiceType; + } + + public void setUsePreload(boolean usePreload) { + this.usePreload = usePreload; + } + + public void setUserParams(List> userParams) { + this.userParams = userParams; + } + +} diff --git a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SoRequestReferences.java b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SoRequestReferences.java new file mode 100644 index 000000000..8006142ed --- /dev/null +++ b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SoRequestReferences.java @@ -0,0 +1,53 @@ +/*- + * ============LICENSE_START======================================================= + * so + * ================================================================================ + * Copyright (C) 2017-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.policy.so; + +import com.google.gson.annotations.SerializedName; + +import java.io.Serializable; + +public class SoRequestReferences implements Serializable { + + private static final long serialVersionUID = -3283942659786236032L; + + @SerializedName("instanceId") + private String instanceId; + + @SerializedName("requestId") + private String requestId; + + public String getInstanceId() { + return instanceId; + } + + public String getRequestId() { + return requestId; + } + + public void setInstanceId(String instanceId) { + this.instanceId = instanceId; + } + + public void setRequestId(String requestId) { + this.requestId = requestId; + } + +} diff --git a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SoRequestStatus.java b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SoRequestStatus.java new file mode 100644 index 000000000..2d2e5bf24 --- /dev/null +++ b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SoRequestStatus.java @@ -0,0 +1,79 @@ +/*- + * ============LICENSE_START======================================================= + * so + * ================================================================================ + * Copyright (C) 2017-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.policy.so; + +import com.google.gson.annotations.SerializedName; + +import java.io.Serializable; + +public class SoRequestStatus implements Serializable { + + private static final long serialVersionUID = -3283942659786236032L; + + @SerializedName("percentProgress") + private int percentProgress; + + @SerializedName("requestState") + private String requestState; + + @SerializedName("timestamp") + private String timestamp; + + @SerializedName("wasRolledBack") + private boolean wasRolledBack; + + public SoRequestStatus() { + //required by author + } + + public int getPercentProgress() { + return percentProgress; + } + + public String getRequestState() { + return requestState; + } + + public String getTimestamp() { + return timestamp; + } + + public boolean isWasRolledBack() { + return wasRolledBack; + } + + public void setPercentProgress(int percentProgress) { + this.percentProgress = percentProgress; + } + + public void setRequestState(String requestState) { + this.requestState = requestState; + } + + public void setTimestamp(String timestamp) { + this.timestamp = timestamp; + } + + public void setWasRolledBack(boolean wasRolledBack) { + this.wasRolledBack = wasRolledBack; + } + +} diff --git a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SoResponse.java b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SoResponse.java new file mode 100644 index 000000000..08b01c9f8 --- /dev/null +++ b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SoResponse.java @@ -0,0 +1,78 @@ +/*- + * ============LICENSE_START======================================================= + * so + * ================================================================================ + * Copyright (C) 2017-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.policy.so; + +import com.google.gson.annotations.SerializedName; + +import java.io.Serializable; + +public class SoResponse implements Serializable { + + private static final long serialVersionUID = -3283942659786236032L; + + @SerializedName("requestReferences") + private SoRequestReferences requestReferences; + + @SerializedName("requestError") + private SoRequestError requestError; + + @SerializedName("request") + private SoRequest request; + + private int httpResponseCode; + + public SoResponse() { + // required by author + } + + public int getHttpResponseCode() { + return httpResponseCode; + } + + public SoRequest getRequest() { + return request; + } + + public SoRequestError getRequestError() { + return requestError; + } + + public SoRequestReferences getRequestReferences() { + return requestReferences; + } + + public void setHttpResponseCode(int httpResponseCode) { + this.httpResponseCode = httpResponseCode; + } + + public void setRequest(SoRequest request) { + this.request = request; + } + + public void setRequestError(SoRequestError requestError) { + this.requestError = requestError; + } + + public void setRequestReferences(SoRequestReferences requestReferences) { + this.requestReferences = requestReferences; + } + +} diff --git a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SoResponseWrapper.java b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SoResponseWrapper.java new file mode 100644 index 000000000..4a53ee232 --- /dev/null +++ b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SoResponseWrapper.java @@ -0,0 +1,102 @@ +/*- + * ============LICENSE_START======================================================= + * so + * ================================================================================ + * Copyright (C) 2017-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.policy.so; + +import com.google.gson.annotations.SerializedName; + +import java.io.Serializable; + +public class SoResponseWrapper implements Serializable { + + private static final long serialVersionUID = 7673023687132889069L; + + @SerializedName("SoResponse") + private SoResponse soResponse; + + private transient String requestId; + + public SoResponseWrapper(SoResponse response, String reqId) { + this.soResponse = response; + this.requestId = reqId; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + SoResponseWrapper other = (SoResponseWrapper) obj; + if (soResponse == null) { + if (other.soResponse != null) { + return false; + } + } + else if (!soResponse.equals(other.soResponse)) { + return false; + } + if (requestId == null) { + if (other.requestId != null) { + return false; + } + } + else if (!requestId.equals(other.requestId)) { + return false; + } + return true; + } + + public String getRequestId() { + return requestId; + } + + public SoResponse getSoResponse() { + return soResponse; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = super.hashCode(); + result = prime * result + ((soResponse == null) ? 0 : soResponse.hashCode()); + result = prime * result + ((requestId == null) ? 0 : requestId.hashCode()); + return result; + } + + public void setRequestId(String requestId) { + this.requestId = requestId; + } + + public void setSoResponse(SoResponse response) { + soResponse = response; + } + + @Override + public String toString() { + return "SOResponseWrapper [SOResponse=" + soResponse + ", RequestID=" + requestId + "]"; + } + +} diff --git a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SoServiceExceptionHolder.java b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SoServiceExceptionHolder.java new file mode 100644 index 000000000..5dd87e539 --- /dev/null +++ b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SoServiceExceptionHolder.java @@ -0,0 +1,66 @@ +/*- + * ============LICENSE_START======================================================= + * so + * ================================================================================ + * Copyright (C) 2017-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.policy.so; + +import com.google.gson.annotations.SerializedName; + +import java.io.Serializable; +import java.util.LinkedList; +import java.util.List; + +public class SoServiceExceptionHolder implements Serializable { + + private static final long serialVersionUID = -3283942659786236032L; + + @SerializedName("messageId") + private String messageId; + + @SerializedName("text") + private String text; + + @SerializedName("variables") + private List variables = new LinkedList<>(); + + public SoServiceExceptionHolder() { + // required by author + } + + public String getMessageId() { + return messageId; + } + + public String getText() { + return text; + } + + public List getVariables() { + return variables; + } + + public void setMessageId(String messageId) { + this.messageId = messageId; + } + + public void setText(String text) { + this.text = text; + } + +} diff --git a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SoSubscriberInfo.java b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SoSubscriberInfo.java new file mode 100644 index 000000000..208cff23d --- /dev/null +++ b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SoSubscriberInfo.java @@ -0,0 +1,68 @@ +/*- + * ============LICENSE_START======================================================= + * so + * ================================================================================ + * Copyright (C) 2017-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.policy.so; + +import com.google.gson.annotations.SerializedName; + +import java.io.Serializable; + +public class SoSubscriberInfo implements Serializable { + + private static final long serialVersionUID = -3283942659786236032L; + + @SerializedName("globalSubscriberId") + private String globalSubscriberId; + + @SerializedName("subscriberCommonSiteId") + private String subscriberCommonSiteId; + + @SerializedName("subscriberName") + private String subscriberName; + + public SoSubscriberInfo() { + //required by author + } + + public String getGlobalSubscriberId() { + return globalSubscriberId; + } + + public String getSubscriberCommonSiteId() { + return subscriberCommonSiteId; + } + + public String getSubscriberName() { + return subscriberName; + } + + public void setGlobalSubscriberId(String globalSubscriberId) { + this.globalSubscriberId = globalSubscriberId; + } + + public void setSubscriberCommonSiteId(String subscriberCommonSiteId) { + this.subscriberCommonSiteId = subscriberCommonSiteId; + } + + public void setSubscriberName(String subscriberName) { + this.subscriberName = subscriberName; + } + +} diff --git a/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/DemoTest.java b/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/DemoTest.java index 43cce61e1..2db347846 100644 --- a/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/DemoTest.java +++ b/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/DemoTest.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * mso * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017, 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. @@ -24,14 +24,14 @@ import java.util.HashMap; import java.util.Map; import org.junit.Test; -import org.onap.policy.so.SOCloudConfiguration; -import org.onap.policy.so.SOModelInfo; -import org.onap.policy.so.SORelatedInstance; -import org.onap.policy.so.SORelatedInstanceListElement; -import org.onap.policy.so.SORequest; -import org.onap.policy.so.SORequestDetails; -import org.onap.policy.so.SORequestInfo; -import org.onap.policy.so.SORequestParameters; +import org.onap.policy.so.SoCloudConfiguration; +import org.onap.policy.so.SoModelInfo; +import org.onap.policy.so.SoRelatedInstance; +import org.onap.policy.so.SoRelatedInstanceListElement; +import org.onap.policy.so.SoRequest; +import org.onap.policy.so.SoRequestDetails; +import org.onap.policy.so.SoRequestInfo; +import org.onap.policy.so.SoRequestParameters; import org.onap.policy.so.util.Serialization; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -42,12 +42,12 @@ public class DemoTest { @Test public void test() { - SORequest request = new SORequest(); - request.setRequestDetails(new SORequestDetails()); - request.getRequestDetails().setModelInfo(new SOModelInfo()); - request.getRequestDetails().setCloudConfiguration(new SOCloudConfiguration()); - request.getRequestDetails().setRequestInfo(new SORequestInfo()); - request.getRequestDetails().setRequestParameters(new SORequestParameters()); + SoRequest request = new SoRequest(); + request.setRequestDetails(new SoRequestDetails()); + request.getRequestDetails().setModelInfo(new SoModelInfo()); + request.getRequestDetails().setCloudConfiguration(new SoCloudConfiguration()); + request.getRequestDetails().setRequestInfo(new SoRequestInfo()); + request.getRequestDetails().setRequestParameters(new SoRequestParameters()); request.getRequestDetails().getModelInfo().setModelType("vfModule"); request.getRequestDetails().getModelInfo().setModelInvariantId("ff5256d2-5a33-55df-13ab-12abad84e7ff"); @@ -62,25 +62,25 @@ public class DemoTest { request.getRequestDetails().getRequestInfo().setSource("VID"); request.getRequestDetails().getRequestInfo().setSuppressRollback(true); - SORelatedInstanceListElement relatedInstanceListElement1 = - new SORelatedInstanceListElement(); - SORelatedInstanceListElement relatedInstanceListElement2 = - new SORelatedInstanceListElement(); - SORelatedInstanceListElement relatedInstanceListElement3 = - new SORelatedInstanceListElement(); - relatedInstanceListElement1.setRelatedInstance(new SORelatedInstance()); - relatedInstanceListElement2.setRelatedInstance(new SORelatedInstance()); - relatedInstanceListElement3.setRelatedInstance(new SORelatedInstance()); + SoRelatedInstanceListElement relatedInstanceListElement1 = + new SoRelatedInstanceListElement(); + SoRelatedInstanceListElement relatedInstanceListElement2 = + new SoRelatedInstanceListElement(); + SoRelatedInstanceListElement relatedInstanceListElement3 = + new SoRelatedInstanceListElement(); + relatedInstanceListElement1.setRelatedInstance(new SoRelatedInstance()); + relatedInstanceListElement2.setRelatedInstance(new SoRelatedInstance()); + relatedInstanceListElement3.setRelatedInstance(new SoRelatedInstance()); relatedInstanceListElement1.getRelatedInstance().setInstanceId( "17ef4658-bd1f-4ef0-9ca0-ea76e2bf122c"); relatedInstanceListElement1.getRelatedInstance().setInstanceName( "SOTESTVOL103a-vSAMP12_base_module-0_vol"); - relatedInstanceListElement1.getRelatedInstance().setModelInfo(new SOModelInfo()); + relatedInstanceListElement1.getRelatedInstance().setModelInfo(new SoModelInfo()); relatedInstanceListElement1.getRelatedInstance().getModelInfo().setModelType("volumeGroup"); relatedInstanceListElement2.getRelatedInstance().setInstanceId("serviceInstanceId"); - relatedInstanceListElement2.getRelatedInstance().setModelInfo(new SOModelInfo()); + relatedInstanceListElement2.getRelatedInstance().setModelInfo(new SoModelInfo()); relatedInstanceListElement2.getRelatedInstance().getModelInfo().setModelType("service"); relatedInstanceListElement2.getRelatedInstance().getModelInfo().setModelInvariantId( "ff3514e3-5a33-55df-13ab-12abad84e7ff"); @@ -91,7 +91,7 @@ public class DemoTest { relatedInstanceListElement2.getRelatedInstance().getModelInfo().setModelVersion("1.0"); relatedInstanceListElement3.getRelatedInstance().setInstanceId("vnfInstanceId"); - relatedInstanceListElement3.getRelatedInstance().setModelInfo(new SOModelInfo()); + relatedInstanceListElement3.getRelatedInstance().setModelInfo(new SoModelInfo()); relatedInstanceListElement3.getRelatedInstance().getModelInfo().setModelType("vnf"); relatedInstanceListElement3.getRelatedInstance().getModelInfo().setModelInvariantId( "ff5256d1-5a33-55df-13ab-12abad84e7ff"); @@ -123,13 +123,13 @@ public class DemoTest { logger.debug("** HACK **"); - SORequest request = new SORequest(); + SoRequest request = new SoRequest(); - request.setRequestDetails(new SORequestDetails()); - request.getRequestDetails().setModelInfo(new SOModelInfo()); - request.getRequestDetails().setCloudConfiguration(new SOCloudConfiguration()); - request.getRequestDetails().setRequestInfo(new SORequestInfo()); - request.getRequestDetails().setRequestParameters(new SORequestParameters()); + request.setRequestDetails(new SoRequestDetails()); + request.getRequestDetails().setModelInfo(new SoModelInfo()); + request.getRequestDetails().setCloudConfiguration(new SoCloudConfiguration()); + request.getRequestDetails().setRequestInfo(new SoRequestInfo()); + request.getRequestDetails().setRequestParameters(new SoRequestParameters()); request.getRequestDetails().getRequestParameters().setUserParams(null); request.getRequestDetails().getModelInfo().setModelType("vfModule"); @@ -146,16 +146,16 @@ public class DemoTest { request.getRequestDetails().getRequestInfo().setSource("POLICY"); request.getRequestDetails().getRequestInfo().setSuppressRollback(false); - SORelatedInstanceListElement relatedInstanceListElement1 = - new SORelatedInstanceListElement(); - SORelatedInstanceListElement relatedInstanceListElement2 = - new SORelatedInstanceListElement(); - relatedInstanceListElement1.setRelatedInstance(new SORelatedInstance()); - relatedInstanceListElement2.setRelatedInstance(new SORelatedInstance()); + SoRelatedInstanceListElement relatedInstanceListElement1 = + new SoRelatedInstanceListElement(); + SoRelatedInstanceListElement relatedInstanceListElement2 = + new SoRelatedInstanceListElement(); + relatedInstanceListElement1.setRelatedInstance(new SoRelatedInstance()); + relatedInstanceListElement2.setRelatedInstance(new SoRelatedInstance()); String serviceInstanceId = "98af39ce-6408-466b-921f-c2c7a8f59ed6"; relatedInstanceListElement1.getRelatedInstance().setInstanceId(serviceInstanceId); - relatedInstanceListElement1.getRelatedInstance().setModelInfo(new SOModelInfo()); + relatedInstanceListElement1.getRelatedInstance().setModelInfo(new SoModelInfo()); relatedInstanceListElement1.getRelatedInstance().getModelInfo().setModelType("service"); relatedInstanceListElement1.getRelatedInstance().getModelInfo().setModelInvariantId( "24329a0c-1d57-4210-b1af-a65df64e9d59"); @@ -166,7 +166,7 @@ public class DemoTest { String vnfInstanceId = "8eb411b8-a936-412f-b01f-9a9a435c0e93"; relatedInstanceListElement2.getRelatedInstance().setInstanceId(vnfInstanceId); - relatedInstanceListElement2.getRelatedInstance().setModelInfo(new SOModelInfo()); + relatedInstanceListElement2.getRelatedInstance().setModelInfo(new SoModelInfo()); relatedInstanceListElement2.getRelatedInstance().getModelInfo().setModelType("vnf"); relatedInstanceListElement2.getRelatedInstance().getModelInfo().setModelInvariantId( "09fd971e-db5f-475d-997c-cf6704b6b8fe"); diff --git a/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/SoAsyncRequestStatusTest.java b/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/SoAsyncRequestStatusTest.java index d6fd0ad25..64467b299 100755 --- a/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/SoAsyncRequestStatusTest.java +++ b/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/SoAsyncRequestStatusTest.java @@ -3,6 +3,7 @@ * so * ================================================================================ * + * Modifications 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. @@ -31,7 +32,7 @@ public class SoAsyncRequestStatusTest { @Test public void testConstructor() { - SOAsyncRequestStatus obj = new SOAsyncRequestStatus(); + SoAsyncRequestStatus obj = new SoAsyncRequestStatus(); assertTrue(obj.getCorrelator() == null); assertTrue(obj.getFinishTime() == null); @@ -44,7 +45,7 @@ public class SoAsyncRequestStatusTest { @Test public void testSetGet() { - SOAsyncRequestStatus obj = new SOAsyncRequestStatus(); + SoAsyncRequestStatus obj = new SoAsyncRequestStatus(); obj.setCorrelator("correlator"); assertEquals("correlator", obj.getCorrelator()); @@ -53,7 +54,7 @@ public class SoAsyncRequestStatusTest { obj.setFinishTime(finishTime); assertEquals(finishTime, obj.getFinishTime()); - SOInstanceReferences instanceReferences = new SOInstanceReferences(); + SoInstanceReferences instanceReferences = new SoInstanceReferences(); obj.setInstanceReferences(instanceReferences); assertEquals(instanceReferences, obj.getInstanceReferences()); @@ -63,7 +64,7 @@ public class SoAsyncRequestStatusTest { obj.setRequestScope("requestScope"); assertEquals("requestScope", obj.getRequestScope()); - SORequestStatus requestStatus = new SORequestStatus(); + SoRequestStatus requestStatus = new SoRequestStatus(); obj.setRequestStatus(requestStatus); assertEquals(requestStatus, obj.getRequestStatus()); diff --git a/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/SoCloudConfigurationTest.java b/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/SoCloudConfigurationTest.java index 8b52ae9a2..0b6521be1 100755 --- a/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/SoCloudConfigurationTest.java +++ b/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/SoCloudConfigurationTest.java @@ -3,6 +3,7 @@ * so * ================================================================================ * + * Modifications 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. @@ -29,7 +30,7 @@ public class SoCloudConfigurationTest { @Test public void testConstructor() { - SOCloudConfiguration obj = new SOCloudConfiguration(); + SoCloudConfiguration obj = new SoCloudConfiguration(); assertTrue(obj.getLcpCloudRegionId() == null); assertTrue(obj.getTenantId() == null); @@ -37,7 +38,7 @@ public class SoCloudConfigurationTest { @Test public void testSetGet() { - SOCloudConfiguration obj = new SOCloudConfiguration(); + SoCloudConfiguration obj = new SoCloudConfiguration(); obj.setLcpCloudRegionId("lcpCloudRegionId"); assertEquals("lcpCloudRegionId", obj.getLcpCloudRegionId()); diff --git a/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/SoDummyServerTest.java b/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/SoDummyServerTest.java index 17f92bcb9..5c302474a 100644 --- a/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/SoDummyServerTest.java +++ b/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/SoDummyServerTest.java @@ -4,7 +4,7 @@ * ================================================================================ * Copyright (C) 2018 Ericsson. All rights reserved. * ================================================================================ - * Modifications Copyright (C) 2018 AT&T. All rights reserved. + * Modifications Copyright (C) 2018-2019 AT&T. 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. @@ -41,7 +41,7 @@ public class SoDummyServerTest { private static int getMessagesReceived = 0; private static int deleteMessagesReceived = 0; - private static Map ongoingRequestMap = new ConcurrentHashMap<>(); + private static Map ongoingRequestMap = new ConcurrentHashMap<>(); /** * Stats method. @@ -110,12 +110,12 @@ public class SoDummyServerTest { @Path("/orchestrationRequests/v5/{nsInstanceId}") public Response soRequestStatus(@PathParam("nsInstanceId") final String nsInstanceId) { - SOResponse response = ongoingRequestMap.get(nsInstanceId); + SoResponse response = ongoingRequestMap.get(nsInstanceId); int iterationsLeft = Integer.valueOf(response.getRequest().getRequestScope()); if (--iterationsLeft > 0) { response.getRequest().setRequestScope(new Integer(iterationsLeft).toString()); - String responseString = new Gson().toJson(response, SOResponse.class); + String responseString = new Gson().toJson(response, SoResponse.class); return Response.status(response.getHttpResponseCode()).entity(responseString).build(); } @@ -128,7 +128,7 @@ public class SoDummyServerTest { response.getRequest().getRequestStatus().setRequestState("COMPLETE"); response.getRequest().setRequestScope("0"); response.setHttpResponseCode(200); - String responseString = new Gson().toJson(response, SOResponse.class); + String responseString = new Gson().toJson(response, SoResponse.class); return Response.status(response.getHttpResponseCode()).entity(responseString).build(); } @@ -157,9 +157,9 @@ public class SoDummyServerTest { return Response.status(400).build(); } - SORequest request = null; + SoRequest request = null; try { - request = new Gson().fromJson(jsonString, SORequest.class); + request = new Gson().fromJson(jsonString, SoRequest.class); } catch (Exception e) { return Response.status(400).build(); } @@ -179,15 +179,15 @@ public class SoDummyServerTest { + ",\"DELETE\": " + deleteMessagesReceived + "}").build(); } - SOResponse response = new SOResponse(); + SoResponse response = new SoResponse(); response.setRequest(request); - response.setRequestReferences(new SORequestReferences()); + response.setRequestReferences(new SoRequestReferences()); response.getRequestReferences().setRequestId(request.getRequestId().toString()); if ("ReturnCompleted".equals(request.getRequestType())) { response.getRequest().getRequestStatus().setRequestState("COMPLETE"); response.setHttpResponseCode(200); - String responseString = new Gson().toJson(response, SOResponse.class); + String responseString = new Gson().toJson(response, SoResponse.class); return Response.status(response.getHttpResponseCode()) .entity(responseString) .build(); @@ -196,7 +196,7 @@ public class SoDummyServerTest { if ("ReturnFailed".equals(request.getRequestType())) { response.getRequest().getRequestStatus().setRequestState("FAILED"); response.setHttpResponseCode(200); - String responseString = new Gson().toJson(response, SOResponse.class); + String responseString = new Gson().toJson(response, SoResponse.class); return Response.status(response.getHttpResponseCode()) .entity(responseString) .build(); @@ -207,7 +207,7 @@ public class SoDummyServerTest { response.getRequest().getRequestStatus().setRequestState("ONGOING"); response.setHttpResponseCode(202); - String responseString = new Gson().toJson(response, SOResponse.class); + String responseString = new Gson().toJson(response, SoResponse.class); return Response.status(response.getHttpResponseCode()) .entity(responseString) .build(); @@ -218,7 +218,7 @@ public class SoDummyServerTest { response.getRequest().getRequestStatus().setRequestState("ONGOING"); response.setHttpResponseCode(200); - String responseString = new Gson().toJson(response, SOResponse.class); + String responseString = new Gson().toJson(response, SoResponse.class); return Response.status(response.getHttpResponseCode()) .entity(responseString) .build(); @@ -229,7 +229,7 @@ public class SoDummyServerTest { response.getRequest().getRequestStatus().setRequestState("ONGOING"); response.setHttpResponseCode(200); - String responseString = new Gson().toJson(response, SOResponse.class); + String responseString = new Gson().toJson(response, SoResponse.class); return Response.status(response.getHttpResponseCode()) .entity(responseString) .build(); diff --git a/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/SoInstanceReferencesTest.java b/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/SoInstanceReferencesTest.java index 39e37f0cb..13d7dd83b 100755 --- a/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/SoInstanceReferencesTest.java +++ b/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/SoInstanceReferencesTest.java @@ -3,6 +3,7 @@ * so * ================================================================================ * + * Modifications 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. @@ -29,7 +30,7 @@ public class SoInstanceReferencesTest { @Test public void testConstructor() { - SOInstanceReferences obj = new SOInstanceReferences(); + SoInstanceReferences obj = new SoInstanceReferences(); assertTrue(obj.getInstanceId() == null); assertTrue(obj.getRequestId() == null); @@ -37,7 +38,7 @@ public class SoInstanceReferencesTest { @Test public void testSetGet() { - SOInstanceReferences obj = new SOInstanceReferences(); + SoInstanceReferences obj = new SoInstanceReferences(); obj.setInstanceId("instanceId"); assertEquals("instanceId", obj.getInstanceId()); diff --git a/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/SoManagerTest.java b/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/SoManagerTest.java index c090513f6..e2482569d 100644 --- a/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/SoManagerTest.java +++ b/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/SoManagerTest.java @@ -3,7 +3,8 @@ * TestSOManager * ================================================================================ * Copyright (C) 2018 Ericsson. All rights reserved. - * Modifications Copyright (C) 2018 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Modifications Copyright (C) 2018-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. @@ -83,11 +84,11 @@ public class SoManagerTest { @Test public void testServiceInstantiation() throws IOException { - SOManager manager = new SOManager(); + SoManager manager = new SoManager(); assertNotNull(manager); manager.setRestGetTimeout(100); - SOResponse response = manager.createModuleInstance("http:/localhost:99999999", BASE_SO_URI, "sean", + SoResponse response = manager.createModuleInstance("http:/localhost:99999999", BASE_SO_URI, "sean", "citizen", null); assertNull(response); @@ -96,15 +97,15 @@ public class SoManagerTest { assertNull(response); response = manager.createModuleInstance(BASE_SO_URI + "/serviceInstantiation/v7", BASE_SO_URI, "sean", - "citizen", new SORequest()); + "citizen", new SoRequest()); assertNull(response); - SORequest request = new SORequest(); + SoRequest request = new SoRequest(); request.setRequestId(UUID.randomUUID()); request.setRequestScope("Test"); request.setRequestType("ReturnBadJson"); request.setStartTime("2018-03-23 16:31"); - request.setRequestStatus(new SORequestStatus()); + request.setRequestStatus(new SoRequestStatus()); request.getRequestStatus().setRequestState("ONGOING"); response = manager.createModuleInstance(BASE_SO_URI + "/serviceInstantiation/v7", BASE_SO_URI, "sean", @@ -158,7 +159,7 @@ public class SoManagerTest { @Test public void testVfModuleCreation() throws IOException { - SOManager manager = new SOManager(); + SoManager manager = new SoManager(); assertNotNull(manager); manager.setRestGetTimeout(100); @@ -167,41 +168,41 @@ public class SoManagerTest { WorkingMemory wm = new DummyWorkingMemory(); - SORequest soRequest = new SORequest(); + SoRequest soRequest = new SoRequest(); soRequest.setOperationType(SoOperationType.SCALE_OUT); PolicyEngine.manager.setEnvironmentProperty("so.url", "http:/localhost:99999999"); - Future asyncRestCallFuture = manager.asyncSORestCall(UUID.randomUUID().toString(), wm, + Future asyncRestCallFuture = manager.asyncSoRestCall(UUID.randomUUID().toString(), wm, UUID.randomUUID().toString(), UUID.randomUUID().toString(), soRequest); try { - SOResponse response = asyncRestCallFuture.get(); + SoResponse response = asyncRestCallFuture.get(); assertEquals(999, response.getHttpResponseCode()); } catch (Exception e) { fail("test should not throw an exception"); } PolicyEngine.manager.setEnvironmentProperty("so.url", BASE_SO_URI); - asyncRestCallFuture = manager.asyncSORestCall(UUID.randomUUID().toString(), wm, UUID.randomUUID().toString(), + asyncRestCallFuture = manager.asyncSoRestCall(UUID.randomUUID().toString(), wm, UUID.randomUUID().toString(), UUID.randomUUID().toString(), soRequest); try { - SOResponse response = asyncRestCallFuture.get(); + SoResponse response = asyncRestCallFuture.get(); assertEquals(999, response.getHttpResponseCode()); } catch (Exception e) { fail("test should not throw an exception"); } - SORequest request = new SORequest(); + SoRequest request = new SoRequest(); request.setRequestId(UUID.randomUUID()); request.setRequestScope("Test"); request.setRequestType("ReturnBadJson"); request.setStartTime("2018-03-23 16:31"); - request.setRequestStatus(new SORequestStatus()); + request.setRequestStatus(new SoRequestStatus()); request.getRequestStatus().setRequestState("ONGOING"); request.setOperationType(SoOperationType.SCALE_OUT); - asyncRestCallFuture = manager.asyncSORestCall(UUID.randomUUID().toString(), wm, UUID.randomUUID().toString(), + asyncRestCallFuture = manager.asyncSoRestCall(UUID.randomUUID().toString(), wm, UUID.randomUUID().toString(), UUID.randomUUID().toString(), request); try { - SOResponse response = asyncRestCallFuture.get(); + SoResponse response = asyncRestCallFuture.get(); assertEquals(999, response.getHttpResponseCode()); } catch (Exception e) { fail("test should not throw an exception"); @@ -209,20 +210,20 @@ public class SoManagerTest { request.setRequestType("ReturnCompleted"); - asyncRestCallFuture = manager.asyncSORestCall(UUID.randomUUID().toString(), wm, UUID.randomUUID().toString(), + asyncRestCallFuture = manager.asyncSoRestCall(UUID.randomUUID().toString(), wm, UUID.randomUUID().toString(), UUID.randomUUID().toString(), request); try { - SOResponse response = asyncRestCallFuture.get(); + SoResponse response = asyncRestCallFuture.get(); assertEquals("COMPLETE", response.getRequest().getRequestStatus().getRequestState()); } catch (Exception e) { fail("test should not throw an exception"); } request.setRequestType("ReturnFailed"); - asyncRestCallFuture = manager.asyncSORestCall(UUID.randomUUID().toString(), wm, UUID.randomUUID().toString(), + asyncRestCallFuture = manager.asyncSoRestCall(UUID.randomUUID().toString(), wm, UUID.randomUUID().toString(), UUID.randomUUID().toString(), request); try { - SOResponse response = asyncRestCallFuture.get(); + SoResponse response = asyncRestCallFuture.get(); assertEquals("FAILED", response.getRequest().getRequestStatus().getRequestState()); } catch (Exception e) { fail("test should not throw an exception"); @@ -232,10 +233,10 @@ public class SoManagerTest { request.setRequestType("ReturnOnging200"); request.setRequestScope(new Integer(10).toString()); - asyncRestCallFuture = manager.asyncSORestCall(UUID.randomUUID().toString(), wm, UUID.randomUUID().toString(), + asyncRestCallFuture = manager.asyncSoRestCall(UUID.randomUUID().toString(), wm, UUID.randomUUID().toString(), UUID.randomUUID().toString(), request); try { - SOResponse response = asyncRestCallFuture.get(); + SoResponse response = asyncRestCallFuture.get(); assertNotNull(response.getRequest()); assertEquals("COMPLETE", response.getRequest().getRequestStatus().getRequestState()); } catch (Exception e) { @@ -244,10 +245,10 @@ public class SoManagerTest { request.setRequestType("ReturnOnging202"); request.setRequestScope(new Integer(20).toString()); - asyncRestCallFuture = manager.asyncSORestCall(UUID.randomUUID().toString(), wm, UUID.randomUUID().toString(), + asyncRestCallFuture = manager.asyncSoRestCall(UUID.randomUUID().toString(), wm, UUID.randomUUID().toString(), UUID.randomUUID().toString(), request); try { - SOResponse response = asyncRestCallFuture.get(); + SoResponse response = asyncRestCallFuture.get(); assertNotNull(response.getRequest()); assertEquals("COMPLETE", response.getRequest().getRequestStatus().getRequestState()); } catch (Exception e) { @@ -257,10 +258,10 @@ public class SoManagerTest { // Test timeout after 20 attempts for a response request.setRequestType("ReturnOnging202"); request.setRequestScope(new Integer(21).toString()); - asyncRestCallFuture = manager.asyncSORestCall(UUID.randomUUID().toString(), wm, UUID.randomUUID().toString(), + asyncRestCallFuture = manager.asyncSoRestCall(UUID.randomUUID().toString(), wm, UUID.randomUUID().toString(), UUID.randomUUID().toString(), request); try { - SOResponse response = asyncRestCallFuture.get(); + SoResponse response = asyncRestCallFuture.get(); assertEquals(999, response.getHttpResponseCode()); } catch (Exception e) { fail("test should not throw an exception"); @@ -269,10 +270,10 @@ public class SoManagerTest { // Test bad response after 3 attempts for a response request.setRequestType("ReturnBadAfterWait"); request.setRequestScope(new Integer(3).toString()); - asyncRestCallFuture = manager.asyncSORestCall(UUID.randomUUID().toString(), wm, UUID.randomUUID().toString(), + asyncRestCallFuture = manager.asyncSoRestCall(UUID.randomUUID().toString(), wm, UUID.randomUUID().toString(), UUID.randomUUID().toString(), request); try { - SOResponse response = asyncRestCallFuture.get(); + SoResponse response = asyncRestCallFuture.get(); assertEquals(999, response.getHttpResponseCode()); } catch (Exception e) { fail("test should not throw an exception"); @@ -281,7 +282,7 @@ public class SoManagerTest { @Test public void testVfModuleDeletion() { - SOManager manager = new SOManager(); + SoManager manager = new SoManager(); assertNotNull(manager); manager.setRestGetTimeout(100); @@ -290,41 +291,41 @@ public class SoManagerTest { WorkingMemory wm = new DummyWorkingMemory(); - SORequest soRequest = new SORequest(); + SoRequest soRequest = new SoRequest(); soRequest.setOperationType(SoOperationType.DELETE_VF_MODULE); PolicyEngine.manager.setEnvironmentProperty("so.url", "http:/localhost:99999999"); - Future asyncRestCallFuture = manager.asyncSORestCall(UUID.randomUUID().toString(), wm, + Future asyncRestCallFuture = manager.asyncSoRestCall(UUID.randomUUID().toString(), wm, UUID.randomUUID().toString(), UUID.randomUUID().toString(), UUID.randomUUID().toString(), soRequest); try { - SOResponse response = asyncRestCallFuture.get(); + SoResponse response = asyncRestCallFuture.get(); assertEquals(999, response.getHttpResponseCode()); } catch (Exception e) { fail("test should not throw an exception"); } PolicyEngine.manager.setEnvironmentProperty("so.url", BASE_SO_URI); - asyncRestCallFuture = manager.asyncSORestCall(UUID.randomUUID().toString(), wm, UUID.randomUUID().toString(), + asyncRestCallFuture = manager.asyncSoRestCall(UUID.randomUUID().toString(), wm, UUID.randomUUID().toString(), UUID.randomUUID().toString(), UUID.randomUUID().toString(), soRequest); try { - SOResponse response = asyncRestCallFuture.get(); + SoResponse response = asyncRestCallFuture.get(); assertEquals(999, response.getHttpResponseCode()); } catch (Exception e) { fail("test should not throw an exception"); } - SORequest request = new SORequest(); + SoRequest request = new SoRequest(); request.setRequestId(UUID.randomUUID()); request.setRequestScope("Test"); request.setRequestType("ReturnBadJson"); request.setStartTime("2018-03-23 16:31"); - request.setRequestStatus(new SORequestStatus()); + request.setRequestStatus(new SoRequestStatus()); request.getRequestStatus().setRequestState("ONGOING"); request.setOperationType(SoOperationType.DELETE_VF_MODULE); - asyncRestCallFuture = manager.asyncSORestCall(UUID.randomUUID().toString(), wm, UUID.randomUUID().toString(), + asyncRestCallFuture = manager.asyncSoRestCall(UUID.randomUUID().toString(), wm, UUID.randomUUID().toString(), UUID.randomUUID().toString(), UUID.randomUUID().toString(), request); try { - SOResponse response = asyncRestCallFuture.get(); + SoResponse response = asyncRestCallFuture.get(); assertEquals(999, response.getHttpResponseCode()); } catch (Exception e) { fail("test should not throw an exception"); @@ -332,20 +333,20 @@ public class SoManagerTest { request.setRequestType("ReturnCompleted"); - asyncRestCallFuture = manager.asyncSORestCall(UUID.randomUUID().toString(), wm, UUID.randomUUID().toString(), + asyncRestCallFuture = manager.asyncSoRestCall(UUID.randomUUID().toString(), wm, UUID.randomUUID().toString(), UUID.randomUUID().toString(), UUID.randomUUID().toString(), request); try { - SOResponse response = asyncRestCallFuture.get(); + SoResponse response = asyncRestCallFuture.get(); assertEquals("COMPLETE", response.getRequest().getRequestStatus().getRequestState()); } catch (Exception e) { fail("test should not throw an exception"); } request.setRequestType("ReturnFailed"); - asyncRestCallFuture = manager.asyncSORestCall(UUID.randomUUID().toString(), wm, UUID.randomUUID().toString(), + asyncRestCallFuture = manager.asyncSoRestCall(UUID.randomUUID().toString(), wm, UUID.randomUUID().toString(), UUID.randomUUID().toString(), UUID.randomUUID().toString(), request); try { - SOResponse response = asyncRestCallFuture.get(); + SoResponse response = asyncRestCallFuture.get(); assertEquals("FAILED", response.getRequest().getRequestStatus().getRequestState()); } catch (Exception e) { fail("test should not throw an exception"); @@ -355,10 +356,10 @@ public class SoManagerTest { request.setRequestType("ReturnOnging200"); request.setRequestScope(new Integer(10).toString()); - asyncRestCallFuture = manager.asyncSORestCall(UUID.randomUUID().toString(), wm, UUID.randomUUID().toString(), + asyncRestCallFuture = manager.asyncSoRestCall(UUID.randomUUID().toString(), wm, UUID.randomUUID().toString(), UUID.randomUUID().toString(), UUID.randomUUID().toString(), request); try { - SOResponse response = asyncRestCallFuture.get(); + SoResponse response = asyncRestCallFuture.get(); assertNotNull(response.getRequest()); assertEquals("COMPLETE", response.getRequest().getRequestStatus().getRequestState()); } catch (Exception e) { @@ -367,10 +368,10 @@ public class SoManagerTest { request.setRequestType("ReturnOnging202"); request.setRequestScope(new Integer(20).toString()); - asyncRestCallFuture = manager.asyncSORestCall(UUID.randomUUID().toString(), wm, UUID.randomUUID().toString(), + asyncRestCallFuture = manager.asyncSoRestCall(UUID.randomUUID().toString(), wm, UUID.randomUUID().toString(), UUID.randomUUID().toString(), UUID.randomUUID().toString(), request); try { - SOResponse response = asyncRestCallFuture.get(); + SoResponse response = asyncRestCallFuture.get(); assertNotNull(response.getRequest()); assertEquals("COMPLETE", response.getRequest().getRequestStatus().getRequestState()); } catch (Exception e) { @@ -380,10 +381,10 @@ public class SoManagerTest { // Test timeout after 20 attempts for a response request.setRequestType("ReturnOnging202"); request.setRequestScope(new Integer(21).toString()); - asyncRestCallFuture = manager.asyncSORestCall(UUID.randomUUID().toString(), wm, UUID.randomUUID().toString(), + asyncRestCallFuture = manager.asyncSoRestCall(UUID.randomUUID().toString(), wm, UUID.randomUUID().toString(), UUID.randomUUID().toString(), UUID.randomUUID().toString(), request); try { - SOResponse response = asyncRestCallFuture.get(); + SoResponse response = asyncRestCallFuture.get(); assertEquals(999, response.getHttpResponseCode()); } catch (Exception e) { fail("test should not throw an exception"); @@ -392,10 +393,10 @@ public class SoManagerTest { // Test bad response after 3 attempts for a response request.setRequestType("ReturnBadAfterWait"); request.setRequestScope(new Integer(3).toString()); - asyncRestCallFuture = manager.asyncSORestCall(UUID.randomUUID().toString(), wm, UUID.randomUUID().toString(), + asyncRestCallFuture = manager.asyncSoRestCall(UUID.randomUUID().toString(), wm, UUID.randomUUID().toString(), UUID.randomUUID().toString(), UUID.randomUUID().toString(), request); try { - SOResponse response = asyncRestCallFuture.get(); + SoResponse response = asyncRestCallFuture.get(); assertEquals(999, response.getHttpResponseCode()); } catch (Exception e) { fail("test should not throw an exception"); diff --git a/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/SoModelInfoTest.java b/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/SoModelInfoTest.java index 5898f04f0..3cc415cdd 100755 --- a/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/SoModelInfoTest.java +++ b/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/SoModelInfoTest.java @@ -3,6 +3,7 @@ * so * ================================================================================ * + * Modifications 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. @@ -29,7 +30,7 @@ public class SoModelInfoTest { @Test public void testConstructor() { - SOModelInfo obj = new SOModelInfo(); + SoModelInfo obj = new SoModelInfo(); assertTrue(obj.getModelCustomizationId() == null); assertTrue(obj.getModelCustomizationName() == null); @@ -42,7 +43,7 @@ public class SoModelInfoTest { @Test public void testSetGet() { - SOModelInfo obj = new SOModelInfo(); + SoModelInfo obj = new SoModelInfo(); obj.setModelCustomizationId("modelCustomizationId"); assertEquals("modelCustomizationId", obj.getModelCustomizationId()); diff --git a/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/SoPolicyExceptionHolderTest.java b/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/SoPolicyExceptionHolderTest.java index 2dea68d8f..00dfb8dc6 100755 --- a/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/SoPolicyExceptionHolderTest.java +++ b/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/SoPolicyExceptionHolderTest.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * so * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017, 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. @@ -29,7 +29,7 @@ public class SoPolicyExceptionHolderTest { @Test public void testConstructor() { - SOPolicyExceptionHolder obj = new SOPolicyExceptionHolder(); + SoPolicyExceptionHolder obj = new SoPolicyExceptionHolder(); assertTrue(obj.getMessageId() == null); assertTrue(obj.getText() == null); @@ -37,7 +37,7 @@ public class SoPolicyExceptionHolderTest { @Test public void testSetGet() { - SOPolicyExceptionHolder obj = new SOPolicyExceptionHolder(); + SoPolicyExceptionHolder obj = new SoPolicyExceptionHolder(); obj.setMessageId("messageId"); assertEquals("messageId", obj.getMessageId()); diff --git a/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/SoRelatedInstanceListElementTest.java b/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/SoRelatedInstanceListElementTest.java index 4c549361a..c73a0ea05 100755 --- a/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/SoRelatedInstanceListElementTest.java +++ b/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/SoRelatedInstanceListElementTest.java @@ -3,6 +3,7 @@ * so * ================================================================================ * + * Modifications 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. @@ -29,16 +30,16 @@ public class SoRelatedInstanceListElementTest { @Test public void testConstructor() { - SORelatedInstanceListElement obj = new SORelatedInstanceListElement(); + SoRelatedInstanceListElement obj = new SoRelatedInstanceListElement(); assertTrue(obj.getRelatedInstance() == null); } @Test public void testSetGet() { - SORelatedInstanceListElement obj = new SORelatedInstanceListElement(); + SoRelatedInstanceListElement obj = new SoRelatedInstanceListElement(); - SORelatedInstance relatedInstance = new SORelatedInstance(); + SoRelatedInstance relatedInstance = new SoRelatedInstance(); obj.setRelatedInstance(relatedInstance); assertEquals(relatedInstance, obj.getRelatedInstance()); } diff --git a/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/SoRelatedInstanceTest.java b/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/SoRelatedInstanceTest.java index aa137e19f..70f585efe 100755 --- a/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/SoRelatedInstanceTest.java +++ b/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/SoRelatedInstanceTest.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * so * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017, 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. @@ -29,7 +29,7 @@ public class SoRelatedInstanceTest { @Test public void testConstructor() { - SORelatedInstance obj = new SORelatedInstance(); + SoRelatedInstance obj = new SoRelatedInstance(); assertTrue(obj.getInstanceId() == null); assertTrue(obj.getInstanceName() == null); @@ -38,7 +38,7 @@ public class SoRelatedInstanceTest { @Test public void testSetGet() { - SORelatedInstance obj = new SORelatedInstance(); + SoRelatedInstance obj = new SoRelatedInstance(); obj.setInstanceId("instanceId"); assertEquals("instanceId", obj.getInstanceId()); @@ -46,7 +46,7 @@ public class SoRelatedInstanceTest { obj.setInstanceName("instanceName"); assertEquals("instanceName", obj.getInstanceName()); - SOModelInfo modelInfo = new SOModelInfo(); + SoModelInfo modelInfo = new SoModelInfo(); obj.setModelInfo(modelInfo); assertEquals(modelInfo, obj.getModelInfo()); } diff --git a/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/SoRequestDetailsTest.java b/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/SoRequestDetailsTest.java index 71ae7ca66..7233482f6 100755 --- a/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/SoRequestDetailsTest.java +++ b/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/SoRequestDetailsTest.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2018 Ericsson. All rights reserved. * ================================================================================ + * Modifications 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 @@ -35,7 +37,7 @@ public class SoRequestDetailsTest { @Test public void testConstructor() { - SORequestDetails obj = new SORequestDetails(); + SoRequestDetails obj = new SoRequestDetails(); assertTrue(obj.getCloudConfiguration() == null); assertTrue(obj.getModelInfo() == null); @@ -49,68 +51,68 @@ public class SoRequestDetailsTest { @Test public void testSetGet() { - SORequestDetails obj = new SORequestDetails(); + SoRequestDetails obj = new SoRequestDetails(); - SOCloudConfiguration cloudConfiguration = new SOCloudConfiguration(); + SoCloudConfiguration cloudConfiguration = new SoCloudConfiguration(); obj.setCloudConfiguration(cloudConfiguration); assertEquals(cloudConfiguration, obj.getCloudConfiguration()); - SOModelInfo modelInfo = new SOModelInfo(); + SoModelInfo modelInfo = new SoModelInfo(); obj.setModelInfo(modelInfo); assertEquals(modelInfo, obj.getModelInfo()); - SORequestInfo requestInfo = new SORequestInfo(); + SoRequestInfo requestInfo = new SoRequestInfo(); obj.setRequestInfo(requestInfo); assertEquals(requestInfo, obj.getRequestInfo()); - SORequestParameters requestParameters = new SORequestParameters(); + SoRequestParameters requestParameters = new SoRequestParameters(); obj.setRequestParameters(requestParameters); assertEquals(requestParameters, obj.getRequestParameters()); - SOSubscriberInfo subscriberInfo = new SOSubscriberInfo(); + SoSubscriberInfo subscriberInfo = new SoSubscriberInfo(); obj.setSubscriberInfo(subscriberInfo); assertEquals(subscriberInfo, obj.getSubscriberInfo()); } @Test public void testSoMRequestDetailsMethods() { - SORequestDetails details = new SORequestDetails(); + SoRequestDetails details = new SoRequestDetails(); assertNotNull(details); assertNotEquals(0, details.hashCode()); - SOCloudConfiguration cloudConfiguration = new SOCloudConfiguration(); + SoCloudConfiguration cloudConfiguration = new SoCloudConfiguration(); details.setCloudConfiguration(cloudConfiguration); assertEquals(cloudConfiguration, details.getCloudConfiguration()); assertNotEquals(0, details.hashCode()); - SOModelInfo modelInfo = new SOModelInfo(); + SoModelInfo modelInfo = new SoModelInfo(); details.setModelInfo(modelInfo); assertEquals(modelInfo, details.getModelInfo()); assertNotEquals(0, details.hashCode()); - List relatedInstanceList = new ArrayList<>(); + List relatedInstanceList = new ArrayList<>(); details.setRelatedInstanceList(relatedInstanceList); assertEquals(relatedInstanceList, details.getRelatedInstanceList()); assertNotEquals(0, details.hashCode()); - SORequestInfo requestInfo = new SORequestInfo(); + SoRequestInfo requestInfo = new SoRequestInfo(); details.setRequestInfo(requestInfo); assertEquals(requestInfo, details.getRequestInfo()); assertNotEquals(0, details.hashCode()); - SORequestParameters requestParameters = new SORequestParameters(); + SoRequestParameters requestParameters = new SoRequestParameters(); details.setRequestParameters(requestParameters); assertEquals(requestParameters, details.getRequestParameters()); assertNotEquals(0, details.hashCode()); - SOSubscriberInfo subscriberInfo = new SOSubscriberInfo(); + SoSubscriberInfo subscriberInfo = new SoSubscriberInfo(); details.setSubscriberInfo(subscriberInfo); assertEquals(subscriberInfo, details.getSubscriberInfo()); assertNotEquals(0, details.hashCode()); assertEquals("SORequestDetails [modelInfo=org.onap.policy.so", details.toString().substring(0, 46)); - SORequestDetails copiedDetails = new SORequestDetails(details); + SoRequestDetails copiedDetails = new SoRequestDetails(details); assertTrue(details.equals(details)); assertTrue(details.equals(copiedDetails)); diff --git a/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/SoRequestErrorTest.java b/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/SoRequestErrorTest.java index f700fbc70..b870dbd99 100755 --- a/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/SoRequestErrorTest.java +++ b/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/SoRequestErrorTest.java @@ -3,6 +3,7 @@ * so * ================================================================================ * + * Modifications 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. @@ -29,7 +30,7 @@ public class SoRequestErrorTest { @Test public void testConstructor() { - SORequestError obj = new SORequestError(); + SoRequestError obj = new SoRequestError(); assertTrue(obj.getPolicyException() == null); assertTrue(obj.getServiceException() == null); @@ -37,13 +38,13 @@ public class SoRequestErrorTest { @Test public void testSetGet() { - SORequestError obj = new SORequestError(); + SoRequestError obj = new SoRequestError(); - SOPolicyExceptionHolder policyException = new SOPolicyExceptionHolder(); + SoPolicyExceptionHolder policyException = new SoPolicyExceptionHolder(); obj.setPolicyException(policyException); assertEquals(policyException, obj.getPolicyException()); - SOServiceExceptionHolder serviceException = new SOServiceExceptionHolder(); + SoServiceExceptionHolder serviceException = new SoServiceExceptionHolder(); obj.setServiceException(serviceException); assertEquals(serviceException, obj.getServiceException()); } diff --git a/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/SoRequestInfoTest.java b/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/SoRequestInfoTest.java index c09da54dc..0e518018b 100755 --- a/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/SoRequestInfoTest.java +++ b/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/SoRequestInfoTest.java @@ -3,6 +3,7 @@ * so * ================================================================================ * + * Modifications 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. @@ -29,7 +30,7 @@ public class SoRequestInfoTest { @Test public void testConstructor() { - SORequestInfo obj = new SORequestInfo(); + SoRequestInfo obj = new SoRequestInfo(); assertTrue(obj.getBillingAccountNumber() == null); assertTrue(obj.getCallbackUrl() == null); @@ -45,7 +46,7 @@ public class SoRequestInfoTest { @Test public void testSetGet() { - SORequestInfo obj = new SORequestInfo(); + SoRequestInfo obj = new SoRequestInfo(); obj.setBillingAccountNumber("billingAccountNumber"); assertEquals("billingAccountNumber", obj.getBillingAccountNumber()); diff --git a/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/SoRequestParametersTest.java b/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/SoRequestParametersTest.java index db93988c9..7d671f5e1 100755 --- a/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/SoRequestParametersTest.java +++ b/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/SoRequestParametersTest.java @@ -3,6 +3,7 @@ * so * ================================================================================ * + * Modifications 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. @@ -29,7 +30,7 @@ public class SoRequestParametersTest { @Test public void testConstructor() { - SORequestParameters obj = new SORequestParameters(); + SoRequestParameters obj = new SoRequestParameters(); assertTrue(obj.getSubscriptionServiceType() == null); assertTrue(obj.getUserParams() != null); @@ -38,7 +39,7 @@ public class SoRequestParametersTest { @Test public void testSetGet() { - SORequestParameters obj = new SORequestParameters(); + SoRequestParameters obj = new SoRequestParameters(); obj.setSubscriptionServiceType("subscriptionServiceType"); assertEquals("subscriptionServiceType", obj.getSubscriptionServiceType()); diff --git a/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/SoRequestReferencesTest.java b/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/SoRequestReferencesTest.java index 5d6ff2090..549147e4b 100755 --- a/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/SoRequestReferencesTest.java +++ b/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/SoRequestReferencesTest.java @@ -3,6 +3,7 @@ * so * ================================================================================ * + * Modifications 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. @@ -29,7 +30,7 @@ public class SoRequestReferencesTest { @Test public void testConstructor() { - SORequestReferences obj = new SORequestReferences(); + SoRequestReferences obj = new SoRequestReferences(); assertTrue(obj.getInstanceId() == null); assertTrue(obj.getRequestId() == null); @@ -37,7 +38,7 @@ public class SoRequestReferencesTest { @Test public void testSetGet() { - SORequestReferences obj = new SORequestReferences(); + SoRequestReferences obj = new SoRequestReferences(); obj.setInstanceId("instanceId"); assertEquals("instanceId", obj.getInstanceId()); diff --git a/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/SoRequestStatusTest.java b/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/SoRequestStatusTest.java index cd3e1b58a..39a3241a3 100755 --- a/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/SoRequestStatusTest.java +++ b/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/SoRequestStatusTest.java @@ -3,6 +3,7 @@ * so * ================================================================================ * + * Modifications 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. @@ -30,7 +31,7 @@ public class SoRequestStatusTest { @Test public void testConstructor() { - SORequestStatus obj = new SORequestStatus(); + SoRequestStatus obj = new SoRequestStatus(); assertEquals(0, obj.getPercentProgress()); assertTrue(obj.getRequestState() == null); @@ -40,7 +41,7 @@ public class SoRequestStatusTest { @Test public void testSetGet() { - SORequestStatus obj = new SORequestStatus(); + SoRequestStatus obj = new SoRequestStatus(); obj.setPercentProgress(2008); assertEquals(2008, obj.getPercentProgress()); diff --git a/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/SoRequestTest.java b/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/SoRequestTest.java index c09c58471..971b1d190 100755 --- a/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/SoRequestTest.java +++ b/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/SoRequestTest.java @@ -3,6 +3,7 @@ * so * ================================================================================ * + * Modifications 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. @@ -32,7 +33,7 @@ public class SoRequestTest { @Test public void testConstructor() { - SORequest obj = new SORequest(); + SoRequest obj = new SoRequest(); assertTrue(obj.getFinishTime() == null); assertTrue(obj.getRequestDetails() == null); @@ -45,7 +46,7 @@ public class SoRequestTest { @Test public void testSetGet() { - SORequest obj = new SORequest(); + SoRequest obj = new SoRequest(); LocalDateTime finishTime = LocalDateTime.now(); obj.setFinishTime(finishTime); @@ -58,7 +59,7 @@ public class SoRequestTest { obj.setRequestScope("requestScope"); assertEquals("requestScope", obj.getRequestScope()); - SORequestStatus requestStatus = new SORequestStatus(); + SoRequestStatus requestStatus = new SoRequestStatus(); obj.setRequestStatus(requestStatus); assertEquals(requestStatus, obj.getRequestStatus()); diff --git a/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/SoResponseTest.java b/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/SoResponseTest.java index cf396561b..c932ac969 100755 --- a/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/SoResponseTest.java +++ b/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/SoResponseTest.java @@ -3,6 +3,7 @@ * so * ================================================================================ * + * Modifications 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. @@ -29,7 +30,7 @@ public class SoResponseTest { @Test public void testConstructor() { - SOResponse obj = new SOResponse(); + SoResponse obj = new SoResponse(); assertEquals(0, obj.getHttpResponseCode()); assertTrue(obj.getRequest() == null); @@ -39,20 +40,20 @@ public class SoResponseTest { @Test public void testSetGet() { - SOResponse obj = new SOResponse(); + SoResponse obj = new SoResponse(); obj.setHttpResponseCode(2008); assertEquals(2008, obj.getHttpResponseCode()); - SORequest request = new SORequest(); + SoRequest request = new SoRequest(); obj.setRequest(request); assertEquals(request, obj.getRequest()); - SORequestError requestError = new SORequestError(); + SoRequestError requestError = new SoRequestError(); obj.setRequestError(requestError); assertEquals(requestError, obj.getRequestError()); - SORequestReferences requestReferences = new SORequestReferences(); + SoRequestReferences requestReferences = new SoRequestReferences(); obj.setRequestReferences(requestReferences); assertEquals(requestReferences, obj.getRequestReferences()); } diff --git a/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/SoResponseWrapperTest.java b/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/SoResponseWrapperTest.java index 181fe2138..26bd75d2a 100755 --- a/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/SoResponseWrapperTest.java +++ b/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/SoResponseWrapperTest.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * so * ================================================================================ - * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2018-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. @@ -33,33 +33,33 @@ public class SoResponseWrapperTest { @Test public void testConstructor() { - SOResponse response = new SOResponse(); - SOResponseWrapper obj = new SOResponseWrapper(response, "reqID"); + SoResponse response = new SoResponse(); + SoResponseWrapper obj = new SoResponseWrapper(response, "reqID"); assertEquals(response, obj.getSoResponse()); - assertEquals("reqID", obj.getRequestID()); + assertEquals("reqID", obj.getRequestId()); } @Test public void testSetGet() { - SOResponse response = new SOResponse(); - SOResponseWrapper obj = new SOResponseWrapper(response, "reqID"); + SoResponse response = new SoResponse(); + SoResponseWrapper obj = new SoResponseWrapper(response, "reqID"); - SOResponse response2 = new SOResponse(); + SoResponse response2 = new SoResponse(); response2.setHttpResponseCode(2008); obj.setSoResponse(response2); assertEquals(response2, obj.getSoResponse()); - obj.setRequestID("id2"); - assertEquals("id2", obj.getRequestID()); + obj.setRequestId("id2"); + assertEquals("id2", obj.getRequestId()); } @Test public void testSoResponseWrapperMethods() { String requestId = UUID.randomUUID().toString(); - SOResponse response = new SOResponse(); + SoResponse response = new SoResponse(); - SOResponseWrapper responseWrapper = new SOResponseWrapper(response, requestId); + SoResponseWrapper responseWrapper = new SoResponseWrapper(response, requestId); assertNotNull(responseWrapper); assertNotEquals(0, responseWrapper.hashCode()); @@ -69,7 +69,7 @@ public class SoResponseWrapperTest { assertEquals("SOResponseWrapper [SOResponse=org.onap.policy.", responseWrapper.toString().substring(0, 46)); - SOResponseWrapper identicalResponseWrapper = new SOResponseWrapper(response, requestId); + SoResponseWrapper identicalResponseWrapper = new SoResponseWrapper(response, requestId); assertEquals(responseWrapper, responseWrapper); assertEquals(responseWrapper, identicalResponseWrapper); @@ -78,28 +78,28 @@ public class SoResponseWrapperTest { assertFalse(responseWrapper.equals(null)); assertFalse(responseWrapper.equals("AString")); - assertEquals(new SOResponseWrapper(null, null), new SOResponseWrapper(null, null)); - assertNotEquals(new SOResponseWrapper(null, null), identicalResponseWrapper); + assertEquals(new SoResponseWrapper(null, null), new SoResponseWrapper(null, null)); + assertNotEquals(new SoResponseWrapper(null, null), identicalResponseWrapper); - assertNotEquals(0, new SOResponseWrapper(null, null).hashCode()); + assertNotEquals(0, new SoResponseWrapper(null, null).hashCode()); - identicalResponseWrapper.setSoResponse(new SOResponse()); + identicalResponseWrapper.setSoResponse(new SoResponse()); assertNotEquals(responseWrapper, identicalResponseWrapper); identicalResponseWrapper.setSoResponse(response); assertEquals(responseWrapper, identicalResponseWrapper); - identicalResponseWrapper.setRequestID(UUID.randomUUID().toString()); + identicalResponseWrapper.setRequestId(UUID.randomUUID().toString()); assertNotEquals(responseWrapper, identicalResponseWrapper); - identicalResponseWrapper.setRequestID(requestId); + identicalResponseWrapper.setRequestId(requestId); assertEquals(responseWrapper, identicalResponseWrapper); - responseWrapper.setRequestID(null); + responseWrapper.setRequestId(null); assertNotEquals(responseWrapper, identicalResponseWrapper); - identicalResponseWrapper.setRequestID(null); + identicalResponseWrapper.setRequestId(null); assertEquals(responseWrapper, identicalResponseWrapper); - responseWrapper.setRequestID(requestId); + responseWrapper.setRequestId(requestId); assertNotEquals(responseWrapper, identicalResponseWrapper); - identicalResponseWrapper.setRequestID(requestId); + identicalResponseWrapper.setRequestId(requestId); assertEquals(responseWrapper, identicalResponseWrapper); } } diff --git a/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/SoServiceExceptionHolderTest.java b/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/SoServiceExceptionHolderTest.java index b0ce56652..8c9d3a730 100755 --- a/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/SoServiceExceptionHolderTest.java +++ b/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/SoServiceExceptionHolderTest.java @@ -3,6 +3,7 @@ * so * ================================================================================ * + * Modifications 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. @@ -29,7 +30,7 @@ public class SoServiceExceptionHolderTest { @Test public void testConstructor() { - SOServiceExceptionHolder obj = new SOServiceExceptionHolder(); + SoServiceExceptionHolder obj = new SoServiceExceptionHolder(); assertTrue(obj.getMessageId() == null); assertTrue(obj.getText() == null); @@ -39,7 +40,7 @@ public class SoServiceExceptionHolderTest { @Test public void testSetGet() { - SOServiceExceptionHolder obj = new SOServiceExceptionHolder(); + SoServiceExceptionHolder obj = new SoServiceExceptionHolder(); obj.setMessageId("messageId"); assertEquals("messageId", obj.getMessageId()); diff --git a/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/SoSubscriberInfoTest.java b/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/SoSubscriberInfoTest.java index ea38bd597..e68e74e3f 100755 --- a/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/SoSubscriberInfoTest.java +++ b/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/SoSubscriberInfoTest.java @@ -3,6 +3,7 @@ * so * ================================================================================ * + * Modifications 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. @@ -29,7 +30,7 @@ public class SoSubscriberInfoTest { @Test public void testConstructor() { - SOSubscriberInfo obj = new SOSubscriberInfo(); + SoSubscriberInfo obj = new SoSubscriberInfo(); assertTrue(obj.getGlobalSubscriberId() == null); assertTrue(obj.getSubscriberCommonSiteId() == null); @@ -38,7 +39,7 @@ public class SoSubscriberInfoTest { @Test public void testSetGet() { - SOSubscriberInfo obj = new SOSubscriberInfo(); + SoSubscriberInfo obj = new SoSubscriberInfo(); obj.setGlobalSubscriberId("globalSubscriberId"); assertEquals("globalSubscriberId", obj.getGlobalSubscriberId()); diff --git a/controlloop/common/simulators/src/main/java/org/onap/policy/simulators/SoSimulatorJaxRs.java b/controlloop/common/simulators/src/main/java/org/onap/policy/simulators/SoSimulatorJaxRs.java index c99fc12bb..d7d93957f 100644 --- a/controlloop/common/simulators/src/main/java/org/onap/policy/simulators/SoSimulatorJaxRs.java +++ b/controlloop/common/simulators/src/main/java/org/onap/policy/simulators/SoSimulatorJaxRs.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * simulators * ================================================================================ - * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017-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. @@ -28,10 +28,10 @@ import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.Produces; import javax.ws.rs.core.MediaType; -import org.onap.policy.so.SORequest; -import org.onap.policy.so.SORequestReferences; -import org.onap.policy.so.SORequestStatus; -import org.onap.policy.so.SOResponse; +import org.onap.policy.so.SoRequest; +import org.onap.policy.so.SoRequestReferences; +import org.onap.policy.so.SoRequestStatus; +import org.onap.policy.so.SoResponse; @Path("/serviceInstantiation") public class SoSimulatorJaxRs { @@ -49,15 +49,15 @@ public class SoSimulatorJaxRs { @Produces("application/json") public String soPostQuery(@PathParam("serviceInstanceId") final String serviceInstanceId, @PathParam("vnfInstanceId") final String vnfInstanceId) { - final SORequest request = new SORequest(); - final SORequestStatus requestStatus = new SORequestStatus(); + final SoRequest request = new SoRequest(); + final SoRequestStatus requestStatus = new SoRequestStatus(); requestStatus.setRequestState("COMPLETE"); request.setRequestStatus(requestStatus); request.setRequestId(UUID.randomUUID()); - final SOResponse response = new SOResponse(); + final SoResponse response = new SoResponse(); - final SORequestReferences requestReferences = new SORequestReferences(); + final SoRequestReferences requestReferences = new SoRequestReferences(); final String requestId = UUID.randomUUID().toString(); requestReferences.setRequestId(requestId); response.setRequestReferences(requestReferences); diff --git a/controlloop/common/simulators/src/test/java/org/onap/policy/simulators/SoSimulatorTest.java b/controlloop/common/simulators/src/test/java/org/onap/policy/simulators/SoSimulatorTest.java index 86f7b3e96..c704f7653 100644 --- a/controlloop/common/simulators/src/test/java/org/onap/policy/simulators/SoSimulatorTest.java +++ b/controlloop/common/simulators/src/test/java/org/onap/policy/simulators/SoSimulatorTest.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * simulators * ================================================================================ - * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017-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. @@ -32,15 +32,15 @@ import org.onap.policy.common.endpoints.http.server.HttpServletServer; import org.onap.policy.drools.utils.logging.LoggerUtil; import org.onap.policy.rest.RESTManager; import org.onap.policy.rest.RESTManager.Pair; -import org.onap.policy.so.SOCloudConfiguration; -import org.onap.policy.so.SOModelInfo; -import org.onap.policy.so.SORelatedInstance; -import org.onap.policy.so.SORelatedInstanceListElement; -import org.onap.policy.so.SORequest; -import org.onap.policy.so.SORequestDetails; -import org.onap.policy.so.SORequestInfo; -import org.onap.policy.so.SORequestParameters; -import org.onap.policy.so.SOResponse; +import org.onap.policy.so.SoCloudConfiguration; +import org.onap.policy.so.SoModelInfo; +import org.onap.policy.so.SoRelatedInstance; +import org.onap.policy.so.SoRelatedInstanceListElement; +import org.onap.policy.so.SoRequest; +import org.onap.policy.so.SoRequestDetails; +import org.onap.policy.so.SoRequestInfo; +import org.onap.policy.so.SoRequestParameters; +import org.onap.policy.so.SoResponse; import org.onap.policy.so.util.Serialization; public class SoSimulatorTest { @@ -67,16 +67,16 @@ public class SoSimulatorTest { /** * Create dummy SO request for TestResponse() junit. */ - private SORequest createTestRequest() { + private SoRequest createTestRequest() { // Construct SO Request - final SORequest request = new SORequest(); + final SoRequest request = new SoRequest(); request.setRequestId(UUID.randomUUID()); - request.setRequestDetails(new SORequestDetails()); - request.getRequestDetails().setModelInfo(new SOModelInfo()); - request.getRequestDetails().setCloudConfiguration(new SOCloudConfiguration()); - request.getRequestDetails().setRequestInfo(new SORequestInfo()); - request.getRequestDetails().setRequestParameters(new SORequestParameters()); + request.setRequestDetails(new SoRequestDetails()); + request.getRequestDetails().setModelInfo(new SoModelInfo()); + request.getRequestDetails().setCloudConfiguration(new SoCloudConfiguration()); + request.getRequestDetails().setRequestInfo(new SoRequestInfo()); + request.getRequestDetails().setRequestParameters(new SoRequestParameters()); request.getRequestDetails().getRequestParameters().setUserParams(null); // // cloudConfiguration @@ -102,13 +102,13 @@ public class SoSimulatorTest { // // relatedInstanceList // - final SORelatedInstanceListElement relatedInstanceListElement1 = new SORelatedInstanceListElement(); - final SORelatedInstanceListElement relatedInstanceListElement2 = new SORelatedInstanceListElement(); - relatedInstanceListElement1.setRelatedInstance(new SORelatedInstance()); - relatedInstanceListElement2.setRelatedInstance(new SORelatedInstance()); + final SoRelatedInstanceListElement relatedInstanceListElement1 = new SoRelatedInstanceListElement(); + final SoRelatedInstanceListElement relatedInstanceListElement2 = new SoRelatedInstanceListElement(); + relatedInstanceListElement1.setRelatedInstance(new SoRelatedInstance()); + relatedInstanceListElement2.setRelatedInstance(new SoRelatedInstance()); // relatedInstanceListElement1.getRelatedInstance().setInstanceId("cf8426a6-0b53-4e3d-bfa6-4b2f4d5913a5"); - relatedInstanceListElement1.getRelatedInstance().setModelInfo(new SOModelInfo()); + relatedInstanceListElement1.getRelatedInstance().setModelInfo(new SoModelInfo()); relatedInstanceListElement1.getRelatedInstance().getModelInfo().setModelType("service"); relatedInstanceListElement1.getRelatedInstance().getModelInfo() .setModelInvariantId("4fcbc1c0-7793-46d8-8aa1-fa1c2ed9ec7b"); @@ -118,7 +118,7 @@ public class SoSimulatorTest { relatedInstanceListElement1.getRelatedInstance().getModelInfo().setModelVersion("1.0"); // relatedInstanceListElement2.getRelatedInstance().setInstanceId("594e2fe0-48b8-41ff-82e2-3d4bab69b192"); - relatedInstanceListElement2.getRelatedInstance().setModelInfo(new SOModelInfo()); + relatedInstanceListElement2.getRelatedInstance().setModelInfo(new SoModelInfo()); relatedInstanceListElement2.getRelatedInstance().getModelInfo().setModelType("vnf"); relatedInstanceListElement2.getRelatedInstance().getModelInfo() .setModelInvariantId("033a32ed-aa65-4764-a736-36f2942f1aa0"); @@ -143,7 +143,7 @@ public class SoSimulatorTest { "username", "password", new HashMap<>(), "application/json", request); assertNotNull(httpDetails); - final SOResponse response = Serialization.gsonPretty.fromJson(httpDetails.second, SOResponse.class); + final SoResponse response = Serialization.gsonPretty.fromJson(httpDetails.second, SoResponse.class); assertNotNull(response); } } diff --git a/controlloop/templates/archetype-cl-amsterdam/src/main/resources/archetype-resources/src/main/resources/__closedLoopControlName__.drl b/controlloop/templates/archetype-cl-amsterdam/src/main/resources/archetype-resources/src/main/resources/__closedLoopControlName__.drl index 160b75c61..4172b2d37 100644 --- a/controlloop/templates/archetype-cl-amsterdam/src/main/resources/archetype-resources/src/main/resources/__closedLoopControlName__.drl +++ b/controlloop/templates/archetype-cl-amsterdam/src/main/resources/archetype-resources/src/main/resources/__closedLoopControlName__.drl @@ -48,18 +48,8 @@ import org.onap.policy.sdnr.PciResponse; import org.onap.policy.vfc.VfcRequest; import org.onap.policy.vfc.VfcResponse; import org.onap.policy.vfc.VfcManager; -import org.onap.policy.so.SOManager; -import org.onap.policy.so.SORequest; -import org.onap.policy.so.SORequestStatus; -import org.onap.policy.so.SORequestDetails; -import org.onap.policy.so.SOModelInfo; -import org.onap.policy.so.SOCloudConfiguration; -import org.onap.policy.so.SORequestInfo; -import org.onap.policy.so.SORequestParameters; -import org.onap.policy.so.SORelatedInstanceListElement; -import org.onap.policy.so.SORelatedInstance; -import org.onap.policy.so.SOResponse; -import org.onap.policy.so.SOResponseWrapper; +import org.onap.policy.so.SoRequest; +import org.onap.policy.so.SoResponseWrapper; import org.onap.policy.sdnc.SdncRequest; import org.onap.policy.sdnc.SdncManager; import org.onap.policy.sdnc.SdncResponse; @@ -587,7 +577,7 @@ rule "${policyName}.EVENT.MANAGER.OPERATION.LOCKED.GUARD_PERMITTED" // the response recieved and used // in the construction of the SO Request which is stored in operationRequest - if(request instanceof SORequest) { + if(request instanceof SoRequest) { // Call SO. The response will be inserted into memory once it's received SoActorServiceProvider.sendRequest($event.getRequestId().toString(), drools.getWorkingMemory(), request); @@ -1164,7 +1154,7 @@ rule "${policyName}.SO.RESPONSE" $opTimer : ControlLoopTimer( closedLoopControlName == $event.getClosedLoopControlName(), requestID == $event.getRequestId().toString(), timerType == "Operation", !expired ) $lock : TargetLock (requestID == $event.getRequestId()) - $response : SOResponseWrapper(requestID.toString() == $event.getRequestId().toString() ) + $response : SoResponseWrapper(requestId.toString() == $event.getRequestId().toString() ) then Logger logger = LoggerFactory.getLogger(drools.getRule().getPackage()); diff --git a/controlloop/templates/archetype-cl-casablanca/src/main/resources/archetype-resources/src/main/resources/__closedLoopControlName__.drl b/controlloop/templates/archetype-cl-casablanca/src/main/resources/archetype-resources/src/main/resources/__closedLoopControlName__.drl index d8e34313e..d1c8a0739 100644 --- a/controlloop/templates/archetype-cl-casablanca/src/main/resources/archetype-resources/src/main/resources/__closedLoopControlName__.drl +++ b/controlloop/templates/archetype-cl-casablanca/src/main/resources/archetype-resources/src/main/resources/__closedLoopControlName__.drl @@ -49,18 +49,8 @@ import org.onap.policy.sdnr.PciResponse; import org.onap.policy.vfc.VfcRequest; import org.onap.policy.vfc.VfcResponse; import org.onap.policy.vfc.VfcManager; -import org.onap.policy.so.SOManager; -import org.onap.policy.so.SORequest; -import org.onap.policy.so.SORequestStatus; -import org.onap.policy.so.SORequestDetails; -import org.onap.policy.so.SOModelInfo; -import org.onap.policy.so.SOCloudConfiguration; -import org.onap.policy.so.SORequestInfo; -import org.onap.policy.so.SORequestParameters; -import org.onap.policy.so.SORelatedInstanceListElement; -import org.onap.policy.so.SORelatedInstance; -import org.onap.policy.so.SOResponse; -import org.onap.policy.so.SOResponseWrapper; +import org.onap.policy.so.SoRequest; +import org.onap.policy.so.SoResponseWrapper; import org.onap.policy.sdnc.SdncRequest; import org.onap.policy.sdnc.SdncManager; import org.onap.policy.sdnc.SdncResponse; @@ -537,7 +527,7 @@ rule "EVENT.MANAGER.OPERATION.LOCKED.GUARD_PERMITTED" // at this point the AAI named query request should have already been made, the response // recieved and used in the construction of the SO Request which is stored in operationRequest - if(request instanceof SORequest) { + if(request instanceof SoRequest) { // Call SO. The response will be inserted into memory once it's received SoActorServiceProvider.sendRequest($event.getRequestId().toString(), drools.getWorkingMemory(), request); } @@ -1005,7 +995,7 @@ rule "SO.RESPONSE" $opTimer : ControlLoopTimer( closedLoopControlName == $event.getClosedLoopControlName(), requestID == $event.getRequestId().toString(), timerType == "Operation", !expired ) $lock : TargetLock (requestID == $event.getRequestId()) - $response : SOResponseWrapper(requestID.toString() == $event.getRequestId().toString() ) + $response : SoResponseWrapper(requestId.toString() == $event.getRequestId().toString() ) then Logger logger = LoggerFactory.getLogger(drools.getRule().getPackage()); diff --git a/controlloop/templates/template.demo.clc/src/main/resources/__closedLoopControlName__.drl b/controlloop/templates/template.demo.clc/src/main/resources/__closedLoopControlName__.drl index feb5bf499..5a2d8ded3 100644 --- a/controlloop/templates/template.demo.clc/src/main/resources/__closedLoopControlName__.drl +++ b/controlloop/templates/template.demo.clc/src/main/resources/__closedLoopControlName__.drl @@ -45,18 +45,8 @@ import org.onap.policy.appclcm.LcmCommonHeader; import org.onap.policy.vfc.VfcRequest; import org.onap.policy.vfc.VfcResponse; import org.onap.policy.vfc.VfcManager; -import org.onap.policy.so.SOManager; -import org.onap.policy.so.SORequest; -import org.onap.policy.so.SORequestStatus; -import org.onap.policy.so.SORequestDetails; -import org.onap.policy.so.SOModelInfo; -import org.onap.policy.so.SOCloudConfiguration; -import org.onap.policy.so.SORequestInfo; -import org.onap.policy.so.SORequestParameters; -import org.onap.policy.so.SORelatedInstanceListElement; -import org.onap.policy.so.SORelatedInstance; -import org.onap.policy.so.SOResponse; -import org.onap.policy.so.SOResponseWrapper; +import org.onap.policy.so.SoRequest; +import org.onap.policy.so.SoResponseWrapper; import org.onap.policy.guard.PolicyGuard; import org.onap.policy.guard.PolicyGuard.LockResult; import org.onap.policy.guard.TargetLock; @@ -592,7 +582,7 @@ rule "${policyName}.EVENT.MANAGER.OPERATION.LOCKED.GUARD_PERMITTED" // at this point the AAI named query request should have already been made, the response received // and used in the construction of the SO Request which is stored in operationRequest - if(request instanceof SORequest) { + if(request instanceof SoRequest) { // Call SO. The response will be inserted into memory once it's received SoActorServiceProvider.sendRequest($event.getRequestId().toString(), drools.getWorkingMemory(), request); @@ -1019,7 +1009,7 @@ rule "${policyName}.SO.RESPONSE" $operation : ControlLoopOperationManager( onset.closedLoopControlName == $event.getClosedLoopControlName(), onset.getRequestId() == $event.getRequestId() ) $opTimer : OperationTimer( closedLoopControlName == $event.getClosedLoopControlName(), requestID == $event.getRequestId().toString() ) $lock : TargetLock (requestID == $event.getRequestId()) - $response : SOResponseWrapper(requestID.toString() == $event.getRequestId().toString() ) + $response : SoResponseWrapper(requestId.toString() == $event.getRequestId().toString() ) then Logger logger = LoggerFactory.getLogger(drools.getRule().getPackage()); diff --git a/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/VdnsControlLoopTest.java b/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/VdnsControlLoopTest.java index 58f0840ac..6bdba1ef3 100644 --- a/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/VdnsControlLoopTest.java +++ b/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/VdnsControlLoopTest.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * demo * ================================================================================ - * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017-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. @@ -55,7 +55,7 @@ import org.onap.policy.drools.protocol.coders.JsonProtocolFilter; import org.onap.policy.drools.system.PolicyController; import org.onap.policy.drools.system.PolicyEngine; import org.onap.policy.drools.utils.logging.LoggerUtil; -import org.onap.policy.so.SORequest; +import org.onap.policy.so.SoRequest; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -374,7 +374,7 @@ public class VdnsControlLoopTest implements TopicListener { logger.debug("The control loop timed out"); fail("Control Loop Timed Out"); } - } else if (obj instanceof SORequest) { + } else if (obj instanceof SoRequest) { logger.debug("\n============ SO received the request!!! ===========\n"); } } -- cgit 1.2.3-korg