From 485559b57a49a449c6fc3baeda1b0ffd8b05cf6b Mon Sep 17 00:00:00 2001 From: Jim Hahn Date: Thu, 10 Jan 2019 09:57:51 -0500 Subject: [PATCH] Remove model-impl/vfc checkstyle suppressions Entails renaming VFCxxx classes and updated drl files, as well. Change-Id: Ib31c61a35536df22772de6090761b22beb1b561b Issue-ID: POLICY-1145 Signed-off-by: Jim Hahn --- .../actor/vfc/VfcActorServiceProvider.java | 22 +++++------ .../actor/vfc/VfcActorServiceProviderTest.java | 8 ++-- .../eventmanager/ControlLoopOperationManager.java | 10 ++--- .../ControlLoopOperationManagerTest.java | 10 ++--- .../model-impl/vfc/checkstyle-suppressions.xml | 30 -------------- controlloop/common/model-impl/vfc/pom.xml | 1 - ...lActionVmInfo.java => VfcHealActionVmInfo.java} | 8 ++-- ...nalParams.java => VfcHealAdditionalParams.java} | 14 +++---- .../{VFCHealRequest.java => VfcHealRequest.java} | 14 +++---- .../vfc/{VFCManager.java => VfcManager.java} | 34 ++++++++-------- .../vfc/{VFCRequest.java => VfcRequest.java} | 18 ++++----- .../vfc/{VFCResponse.java => VfcResponse.java} | 14 +++---- ...eDescriptor.java => VfcResponseDescriptor.java} | 14 +++---- .../test/java/org/onap/policy/vfc/DemoTest.java | 20 +++++----- .../onap/policy/vfc/VfcHealActionVmInfoTest.java | 4 +- .../policy/vfc/VfcHealAdditionalParamsTest.java | 6 +-- .../org/onap/policy/vfc/VfcHealRequestTest.java | 6 +-- .../java/org/onap/policy/vfc/VfcManagerTest.java | 46 +++++++++++----------- .../java/org/onap/policy/vfc/VfcRequestTest.java | 10 ++--- .../onap/policy/vfc/VfcResponseDescriptorTest.java | 6 +-- .../java/org/onap/policy/vfc/VfcResponseTest.java | 6 +-- .../onap/policy/simulators/VfcSimulatorTest.java | 8 ++-- .../main/resources/__closedLoopControlName__.drl | 14 +++---- .../main/resources/__closedLoopControlName__.drl | 14 +++---- .../main/resources/__closedLoopControlName__.drl | 14 +++---- .../policy/template/demo/VfcControlLoopTest.java | 6 +-- 26 files changed, 163 insertions(+), 194 deletions(-) delete mode 100644 controlloop/common/model-impl/vfc/checkstyle-suppressions.xml rename controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/{VFCHealActionVmInfo.java => VfcHealActionVmInfo.java} (86%) rename controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/{VFCHealAdditionalParams.java => VfcHealAdditionalParams.java} (77%) rename controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/{VFCHealRequest.java => VfcHealRequest.java} (81%) rename controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/{VFCManager.java => VfcManager.java} (87%) rename controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/{VFCRequest.java => VfcRequest.java} (78%) rename controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/{VFCResponse.java => VfcResponse.java} (81%) rename controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/{VFCResponseDescriptor.java => VfcResponseDescriptor.java} (85%) diff --git a/controlloop/common/actors/actor.vfc/src/main/java/org/onap/policy/controlloop/actor/vfc/VfcActorServiceProvider.java b/controlloop/common/actors/actor.vfc/src/main/java/org/onap/policy/controlloop/actor/vfc/VfcActorServiceProvider.java index 8660aa3e2..323b54d9c 100644 --- a/controlloop/common/actors/actor.vfc/src/main/java/org/onap/policy/controlloop/actor/vfc/VfcActorServiceProvider.java +++ b/controlloop/common/actors/actor.vfc/src/main/java/org/onap/policy/controlloop/actor/vfc/VfcActorServiceProvider.java @@ -1,7 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2017-2018 Intel Corp. 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. @@ -34,10 +34,10 @@ import org.onap.policy.controlloop.actorserviceprovider.spi.Actor; import org.onap.policy.controlloop.policy.Policy; import org.onap.policy.drools.system.PolicyEngine; import org.onap.policy.rest.RESTManager; -import org.onap.policy.vfc.VFCHealActionVmInfo; -import org.onap.policy.vfc.VFCHealAdditionalParams; -import org.onap.policy.vfc.VFCHealRequest; -import org.onap.policy.vfc.VFCRequest; +import org.onap.policy.vfc.VfcHealActionVmInfo; +import org.onap.policy.vfc.VfcHealAdditionalParams; +import org.onap.policy.vfc.VfcHealRequest; +import org.onap.policy.vfc.VfcRequest; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -86,11 +86,11 @@ public class VfcActorServiceProvider implements Actor { * @param vnfResponse the VNF response * @return the constructed request */ - public static VFCRequest constructRequest(VirtualControlLoopEvent onset, ControlLoopOperation operation, + public static VfcRequest constructRequest(VirtualControlLoopEvent onset, ControlLoopOperation operation, Policy policy, AaiGetVnfResponse vnfResponse) { // Construct an VFC request - VFCRequest request = new VFCRequest(); + VfcRequest request = new VfcRequest(); String serviceInstance = onset.getAai().get("service-instance.service-instance-id"); if (serviceInstance == null || "".equals(serviceInstance)) { AaiGetVnfResponse tempVnfResp = vnfResponse; @@ -103,16 +103,16 @@ public class VfcActorServiceProvider implements Actor { } serviceInstance = tempVnfResp.getServiceId(); } - request.setNSInstanceId(serviceInstance); + request.setNsInstanceId(serviceInstance); request.setRequestId(onset.getRequestId()); - request.setHealRequest(new VFCHealRequest()); + request.setHealRequest(new VfcHealRequest()); request.getHealRequest().setVnfInstanceId(onset.getAai().get("generic-vnf.vnf-id")); request.getHealRequest().setCause(operation.getMessage()); - request.getHealRequest().setAdditionalParams(new VFCHealAdditionalParams()); + request.getHealRequest().setAdditionalParams(new VfcHealAdditionalParams()); if (policy.getRecipe().toLowerCase().equalsIgnoreCase(RECIPE_RESTART)) { request.getHealRequest().getAdditionalParams().setAction("restartvm"); - request.getHealRequest().getAdditionalParams().setActionInfo(new VFCHealActionVmInfo()); + request.getHealRequest().getAdditionalParams().setActionInfo(new VfcHealActionVmInfo()); request.getHealRequest().getAdditionalParams().getActionInfo() .setVmid(onset.getAai().get("vserver.vserver-id")); request.getHealRequest().getAdditionalParams().getActionInfo() diff --git a/controlloop/common/actors/actor.vfc/src/test/java/org/onap/policy/controlloop/actor/vfc/VfcActorServiceProviderTest.java b/controlloop/common/actors/actor.vfc/src/test/java/org/onap/policy/controlloop/actor/vfc/VfcActorServiceProviderTest.java index 02387b641..9e6b5b827 100644 --- a/controlloop/common/actors/actor.vfc/src/test/java/org/onap/policy/controlloop/actor/vfc/VfcActorServiceProviderTest.java +++ b/controlloop/common/actors/actor.vfc/src/test/java/org/onap/policy/controlloop/actor/vfc/VfcActorServiceProviderTest.java @@ -1,9 +1,9 @@ /*- * ============LICENSE_START======================================================= - * TestVFCActorServiceProvider + * ONAP - Policy Drools Applications * ================================================================================ * Copyright (C) 2018 Ericsson. All rights reserved. - * Modifications Copyright (C) 2018 AT&T Corp. All rights reserved. + * Modifications Copyright (C) 2018-2019 AT&T Corp. 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. @@ -39,7 +39,7 @@ import org.onap.policy.controlloop.VirtualControlLoopEvent; import org.onap.policy.controlloop.policy.Policy; import org.onap.policy.drools.system.PolicyEngine; import org.onap.policy.simulators.Util; -import org.onap.policy.vfc.VFCRequest; +import org.onap.policy.vfc.VfcRequest; public class VfcActorServiceProviderTest { @@ -97,7 +97,7 @@ public class VfcActorServiceProviderTest { policy.setRecipe("Restart"); assertNotNull(VfcActorServiceProvider.constructRequest(onset, operation, policy, new AaiGetVnfResponse())); - VFCRequest request = + VfcRequest request = VfcActorServiceProvider.constructRequest(onset, operation, policy, new AaiGetVnfResponse()); assertEquals(requestId, Objects.requireNonNull(request).getRequestId()); 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 5abfca47b..36db9fe53 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 @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * controlloop operation manager * ================================================================================ - * 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. @@ -54,7 +54,7 @@ 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.vfc.VFCResponse; +import org.onap.policy.vfc.VfcResponse; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -351,11 +351,11 @@ public class ControlLoopOperationManager implements Serializable { // Cast SO response and handle it // return onResponse((SOResponseWrapper) response); - } else if (response instanceof VFCResponse) { + } else if (response instanceof VfcResponse) { // // Cast VFC response and handle it // - return onResponse((VFCResponse) response); + return onResponse((VfcResponse) response); } else if (response instanceof SdncResponse) { // // Cast SDNC response and handle it @@ -563,7 +563,7 @@ public class ControlLoopOperationManager implements Serializable { * @param vfcResponse the VFC response * @return The result of the response handling */ - private PolicyResult onResponse(VFCResponse vfcResponse) { + private PolicyResult onResponse(VfcResponse vfcResponse) { if ("finished".equalsIgnoreCase(vfcResponse.getResponseDescriptor().getStatus())) { // // Consider it as success 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 0afe9d2d3..f761d69b7 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 @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * unit test * ================================================================================ - * 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. @@ -73,8 +73,8 @@ 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.vfc.VFCResponse; -import org.onap.policy.vfc.VFCResponseDescriptor; +import org.onap.policy.vfc.VfcResponse; +import org.onap.policy.vfc.VfcResponseDescriptor; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -753,8 +753,8 @@ public class ControlLoopOperationManagerTest { soResponse.setHttpResponseCode(500); assertEquals(PolicyResult.FAILURE, clom.onResponse(soRw)); - VFCResponse vfcResponse = new VFCResponse(); - VFCResponseDescriptor responseDescriptor = new VFCResponseDescriptor(); + VfcResponse vfcResponse = new VfcResponse(); + VfcResponseDescriptor responseDescriptor = new VfcResponseDescriptor(); vfcResponse.setResponseDescriptor(responseDescriptor); responseDescriptor.setStatus("finished"); diff --git a/controlloop/common/model-impl/vfc/checkstyle-suppressions.xml b/controlloop/common/model-impl/vfc/checkstyle-suppressions.xml deleted file mode 100644 index ea04e03f1..000000000 --- a/controlloop/common/model-impl/vfc/checkstyle-suppressions.xml +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - diff --git a/controlloop/common/model-impl/vfc/pom.xml b/controlloop/common/model-impl/vfc/pom.xml index d5de89f6e..1df42831b 100644 --- a/controlloop/common/model-impl/vfc/pom.xml +++ b/controlloop/common/model-impl/vfc/pom.xml @@ -92,7 +92,6 @@ true - ${project.basedir}/checkstyle-suppressions.xml true true warning diff --git a/controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/VFCHealActionVmInfo.java b/controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/VfcHealActionVmInfo.java similarity index 86% rename from controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/VFCHealActionVmInfo.java rename to controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/VfcHealActionVmInfo.java index 0286a7d8b..c154f7226 100644 --- a/controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/VFCHealActionVmInfo.java +++ b/controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/VfcHealActionVmInfo.java @@ -1,7 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2017 Intel Corp. All rights reserved. - * Modifications Copyright (C) 2018 AT&T Corporation. All rights reserved. + * Modifications Copyright (C) 2018-2019 AT&T Corporation. 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. @@ -23,7 +23,7 @@ import com.google.gson.annotations.SerializedName; import java.io.Serializable; -public class VFCHealActionVmInfo implements Serializable { +public class VfcHealActionVmInfo implements Serializable { private static final long serialVersionUID = 3208673205100673119L; @@ -33,8 +33,8 @@ public class VFCHealActionVmInfo implements Serializable { @SerializedName("vmname") private String vmname; - public VFCHealActionVmInfo() { - // Default constructor for VFCHealActionVmInfo + public VfcHealActionVmInfo() { + // Default constructor } public String getVmid() { diff --git a/controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/VFCHealAdditionalParams.java b/controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/VfcHealAdditionalParams.java similarity index 77% rename from controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/VFCHealAdditionalParams.java rename to controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/VfcHealAdditionalParams.java index 393e3761f..2c5de3a22 100644 --- a/controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/VFCHealAdditionalParams.java +++ b/controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/VfcHealAdditionalParams.java @@ -1,7 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2017 Intel Corp. All rights reserved. - * Modifications Copyright (C) 2018 AT&T Corporation. All rights reserved. + * Modifications Copyright (C) 2018-2019 AT&T Corporation. 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. @@ -23,7 +23,7 @@ import com.google.gson.annotations.SerializedName; import java.io.Serializable; -public class VFCHealAdditionalParams implements Serializable { +public class VfcHealAdditionalParams implements Serializable { private static final long serialVersionUID = 2656694137285096191L; @@ -31,10 +31,10 @@ public class VFCHealAdditionalParams implements Serializable { private String action; @SerializedName("actionvminfo") - private VFCHealActionVmInfo actionInfo; + private VfcHealActionVmInfo actionInfo; - public VFCHealAdditionalParams() { - // Default constructor for VFCHealAdditionalParams + public VfcHealAdditionalParams() { + // Default constructor } public String getAction() { @@ -45,11 +45,11 @@ public class VFCHealAdditionalParams implements Serializable { this.action = action; } - public VFCHealActionVmInfo getActionInfo() { + public VfcHealActionVmInfo getActionInfo() { return actionInfo; } - public void setActionInfo(VFCHealActionVmInfo actionInfo) { + public void setActionInfo(VfcHealActionVmInfo actionInfo) { this.actionInfo = actionInfo; } } diff --git a/controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/VFCHealRequest.java b/controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/VfcHealRequest.java similarity index 81% rename from controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/VFCHealRequest.java rename to controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/VfcHealRequest.java index 75b9566b1..55ca4ac5c 100644 --- a/controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/VFCHealRequest.java +++ b/controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/VfcHealRequest.java @@ -1,7 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2017 Intel Corp. All rights reserved. - * Modifications Copyright (C) 2018 AT&T Corporation. All rights reserved. + * Modifications Copyright (C) 2018-2019 AT&T Corporation. 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. @@ -23,7 +23,7 @@ import com.google.gson.annotations.SerializedName; import java.io.Serializable; -public class VFCHealRequest implements Serializable { +public class VfcHealRequest implements Serializable { private static final long serialVersionUID = -7341931593089709247L; @@ -34,10 +34,10 @@ public class VFCHealRequest implements Serializable { private String cause; @SerializedName("additionalParams") - private VFCHealAdditionalParams additionalParams; + private VfcHealAdditionalParams additionalParams; - public VFCHealRequest() { - // Default constructor for VFCHealRequest + public VfcHealRequest() { + // Default constructor } public String getVnfInstanceId() { @@ -56,11 +56,11 @@ public class VFCHealRequest implements Serializable { this.cause = cause; } - public VFCHealAdditionalParams getAdditionalParams() { + public VfcHealAdditionalParams getAdditionalParams() { return additionalParams; } - public void setAdditionalParams(VFCHealAdditionalParams additionalParams) { + public void setAdditionalParams(VfcHealAdditionalParams additionalParams) { this.additionalParams = additionalParams; } } diff --git a/controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/VFCManager.java b/controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/VfcManager.java similarity index 87% rename from controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/VFCManager.java rename to controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/VfcManager.java index d84d0403f..2a004bd04 100644 --- a/controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/VFCManager.java +++ b/controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/VfcManager.java @@ -1,7 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2017-2018 Intel Corp, AT&T. All rights reserved. - * Modifications Copyright (C) 2018 AT&T Corporation. All rights reserved. + * Modifications Copyright (C) 2018-2019 AT&T Corporation. 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.vfc.util.Serialization; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -public final class VFCManager implements Runnable { +public final class VfcManager implements Runnable { private static final String SYSTEM_LS = System.lineSeparator(); private String vfcUrlBase; private String username; private String password; - private VFCRequest vfcRequest; + private VfcRequest vfcRequest; private WorkingMemory workingMem; - private static final Logger logger = LoggerFactory.getLogger(VFCManager.class); + private static final Logger logger = LoggerFactory.getLogger(VfcManager.class); private static final Logger netLogger = LoggerFactory.getLogger(org.onap.policy.common.endpoints.event.comm.Topic.NETWORK_LOGGER); @@ -53,10 +53,10 @@ public final class VFCManager implements Runnable { * @param wm Drools working memory * @param request request */ - public VFCManager(WorkingMemory wm, VFCRequest request) { + public VfcManager(WorkingMemory wm, VfcRequest request) { if (wm == null || request == null) { throw new IllegalArgumentException( - "the parameters \"wm\" and \"request\" on the VFCManager constructor may not be null"); + "the parameters \"wm\" and \"request\" on the VfcManager constructor may not be null"); } workingMem = wm; vfcRequest = request; @@ -64,7 +64,7 @@ public final class VFCManager implements Runnable { restManager = new RESTManager(); // use getPEManagerEnvProperty() for required properties; others are optional - setVFCParams(getPEManagerEnvProperty("vfc.url"), PolicyEngine.manager.getEnvironmentProperty("vfc.username"), + setVfcParams(getPeManagerEnvProperty("vfc.url"), PolicyEngine.manager.getEnvironmentProperty("vfc.username"), PolicyEngine.manager.getEnvironmentProperty("vfc.password")); } @@ -75,7 +75,7 @@ public final class VFCManager implements Runnable { * @param name username * @param pwd password */ - public void setVFCParams(String baseUrl, String name, String pwd) { + public void setVfcParams(String baseUrl, String name, String pwd) { vfcUrlBase = baseUrl + "/api/nslcm/v1"; username = name; password = pwd; @@ -86,12 +86,12 @@ public final class VFCManager implements Runnable { Map headers = new HashMap<>(); Pair httpDetails; - VFCResponse responseError = new VFCResponse(); - responseError.setResponseDescriptor(new VFCResponseDescriptor()); + VfcResponse responseError = new VfcResponse(); + responseError.setResponseDescriptor(new VfcResponseDescriptor()); responseError.getResponseDescriptor().setStatus("error"); headers.put("Accept", "application/json"); - String vfcUrl = vfcUrlBase + "/ns/" + vfcRequest.getNSInstanceId() + "/heal"; + String vfcUrl = vfcUrlBase + "/ns/" + vfcRequest.getNsInstanceId() + "/heal"; try { String vfcRequestJson = Serialization.gsonPretty.toJson(vfcRequest); netLogger.info("[OUT|{}|{}|]{}{}", "VFC", vfcUrl, SYSTEM_LS, vfcRequestJson); @@ -114,7 +114,7 @@ public final class VFCManager implements Runnable { } try { - VFCResponse response = Serialization.gsonPretty.fromJson(httpDetails.second, VFCResponse.class); + VfcResponse response = Serialization.gsonPretty.fromJson(httpDetails.second, VfcResponse.class); netLogger.info("[IN|{}|{}|]{}{}", "VFC", vfcUrl, SYSTEM_LS, httpDetails.second); String body = Serialization.gsonPretty.toJson(response); logger.debug("Response to VFC Heal post:"); @@ -124,12 +124,12 @@ public final class VFCManager implements Runnable { int attemptsLeft = 20; String urlGet = vfcUrlBase + "/jobs/" + jobId; - VFCResponse responseGet = null; + VfcResponse responseGet = null; while (attemptsLeft-- > 0) { netLogger.info("[OUT|{}|{}|]", "VFC", urlGet); Pair httpDetailsGet = restManager.get(urlGet, username, password, headers); - responseGet = Serialization.gsonPretty.fromJson(httpDetailsGet.second, VFCResponse.class); + responseGet = Serialization.gsonPretty.fromJson(httpDetailsGet.second, VfcResponse.class); netLogger.info("[IN|{}|{}|]{}{}", "VFC", urlGet, SYSTEM_LS, httpDetailsGet.second); responseGet.setRequestId(vfcRequest.getRequestId().toString()); body = Serialization.gsonPretty.toJson(responseGet); @@ -152,12 +152,12 @@ public final class VFCManager implements Runnable { workingMem.insert(responseGet); } } catch (JsonSyntaxException e) { - logger.error("Failed to deserialize into VFCResponse {}", e.getLocalizedMessage(), e); + logger.error("Failed to deserialize into VfcResponse {}", e.getLocalizedMessage(), e); } catch (InterruptedException e) { logger.error("Interrupted exception: {}", e.getLocalizedMessage(), e); Thread.currentThread().interrupt(); } catch (Exception e) { - logger.error("Unknown error deserializing into VFCResponse {}", e.getLocalizedMessage(), e); + logger.error("Unknown error deserializing into VfcResponse {}", e.getLocalizedMessage(), e); } } @@ -178,7 +178,7 @@ public final class VFCManager implements Runnable { * @return the property value */ - private String getPEManagerEnvProperty(String enginePropertyName) { + private String getPeManagerEnvProperty(String enginePropertyName) { String enginePropertyValue = PolicyEngine.manager.getEnvironmentProperty(enginePropertyName); if (enginePropertyValue == null) { throw new IllegalArgumentException("The value of policy engine manager environment property \"" diff --git a/controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/VFCRequest.java b/controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/VfcRequest.java similarity index 78% rename from controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/VFCRequest.java rename to controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/VfcRequest.java index cfcaf8039..c4473e7f1 100644 --- a/controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/VFCRequest.java +++ b/controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/VfcRequest.java @@ -1,7 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2017 Intel Corp. All rights reserved. - * Modifications Copyright (C) 2018 AT&T Corporation. All rights reserved. + * Modifications Copyright (C) 2018-2019 AT&T Corporation. 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,7 +24,7 @@ import com.google.gson.annotations.SerializedName; import java.io.Serializable; import java.util.UUID; -public class VFCRequest implements Serializable { +public class VfcRequest implements Serializable { private static final long serialVersionUID = 3736300970326332512L; // These fields are not serialized and not part of JSON @@ -32,17 +32,17 @@ public class VFCRequest implements Serializable { private transient UUID requestId; @SerializedName("healVnfData") - private VFCHealRequest healRequest; + private VfcHealRequest healRequest; - public VFCRequest() { - // Default constructor for VFCRequest + public VfcRequest() { + // Default constructor } - public String getNSInstanceId() { + public String getNsInstanceId() { return nsInstanceId; } - public void setNSInstanceId(String nsInstanceId) { + public void setNsInstanceId(String nsInstanceId) { this.nsInstanceId = nsInstanceId; } @@ -54,11 +54,11 @@ public class VFCRequest implements Serializable { this.requestId = requestId; } - public VFCHealRequest getHealRequest() { + public VfcHealRequest getHealRequest() { return healRequest; } - public void setHealRequest(VFCHealRequest healRequest) { + public void setHealRequest(VfcHealRequest healRequest) { this.healRequest = healRequest; } } diff --git a/controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/VFCResponse.java b/controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/VfcResponse.java similarity index 81% rename from controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/VFCResponse.java rename to controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/VfcResponse.java index 21e9472b7..2183be71b 100644 --- a/controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/VFCResponse.java +++ b/controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/VfcResponse.java @@ -1,7 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2017 Intel Corp. All rights reserved. - * Modifications Copyright (C) 2018 AT&T Corporation. All rights reserved. + * Modifications Copyright (C) 2018-2019 AT&T Corporation. 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. @@ -23,7 +23,7 @@ import com.google.gson.annotations.SerializedName; import java.io.Serializable; -public class VFCResponse implements Serializable { +public class VfcResponse implements Serializable { private static final long serialVersionUID = 9151443891238218455L; @@ -31,12 +31,12 @@ public class VFCResponse implements Serializable { private String jobId; @SerializedName("responseDescriptor") - private VFCResponseDescriptor responseDescriptor; + private VfcResponseDescriptor responseDescriptor; private transient String requestId; - public VFCResponse() { - // Default constructor for VFCResponse + public VfcResponse() { + // Default constructor } public String getJobId() { @@ -47,11 +47,11 @@ public class VFCResponse implements Serializable { this.jobId = jobId; } - public VFCResponseDescriptor getResponseDescriptor() { + public VfcResponseDescriptor getResponseDescriptor() { return responseDescriptor; } - public void setResponseDescriptor(VFCResponseDescriptor responseDescriptor) { + public void setResponseDescriptor(VfcResponseDescriptor responseDescriptor) { this.responseDescriptor = responseDescriptor; } diff --git a/controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/VFCResponseDescriptor.java b/controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/VfcResponseDescriptor.java similarity index 85% rename from controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/VFCResponseDescriptor.java rename to controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/VfcResponseDescriptor.java index cdd4a39a9..147b937dc 100644 --- a/controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/VFCResponseDescriptor.java +++ b/controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/VfcResponseDescriptor.java @@ -1,7 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2017 Intel Corp. All rights reserved. - * Modifications Copyright (C) 2018 AT&T Corporation. All rights reserved. + * Modifications Copyright (C) 2018-2019 AT&T Corporation. 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,7 +24,7 @@ import com.google.gson.annotations.SerializedName; import java.io.Serializable; import java.util.List; -public class VFCResponseDescriptor implements Serializable { +public class VfcResponseDescriptor implements Serializable { private static final long serialVersionUID = 6827782899144150158L; @@ -44,10 +44,10 @@ public class VFCResponseDescriptor implements Serializable { private String responseId; @SerializedName("responseHistoryList") - private List responseHistoryList; + private List responseHistoryList; - public VFCResponseDescriptor() { - // Default constructor for VFCResponseDescriptor + public VfcResponseDescriptor() { + // Default constructor } public String getStatus() { @@ -86,11 +86,11 @@ public class VFCResponseDescriptor implements Serializable { this.responseId = responseId; } - public List getResponseHistoryList() { + public List getResponseHistoryList() { return responseHistoryList; } - public void setResponseHistoryList(List responseHistoryList) { + public void setResponseHistoryList(List responseHistoryList) { this.responseHistoryList = responseHistoryList; } diff --git a/controlloop/common/model-impl/vfc/src/test/java/org/onap/policy/vfc/DemoTest.java b/controlloop/common/model-impl/vfc/src/test/java/org/onap/policy/vfc/DemoTest.java index dae87b6a6..d334d232f 100644 --- a/controlloop/common/model-impl/vfc/src/test/java/org/onap/policy/vfc/DemoTest.java +++ b/controlloop/common/model-impl/vfc/src/test/java/org/onap/policy/vfc/DemoTest.java @@ -1,7 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2017 Intel Corp. All rights reserved. - * Modifications Copyright (C) 2018 AT&T Corporation. All rights reserved. + * Modifications Copyright (C) 2018-2019 AT&T Corporation. 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,30 +28,30 @@ public class DemoTest { @Test public void test() { - VFCRequest request = new VFCRequest(); + VfcRequest request = new VfcRequest(); - request.setNSInstanceId("100"); - request.setHealRequest(new VFCHealRequest()); + request.setNsInstanceId("100"); + request.setHealRequest(new VfcHealRequest()); request.getHealRequest().setVnfInstanceId("1"); request.getHealRequest().setCause("vm is down"); - request.getHealRequest().setAdditionalParams(new VFCHealAdditionalParams()); + request.getHealRequest().setAdditionalParams(new VfcHealAdditionalParams()); request.getHealRequest().getAdditionalParams().setAction("restartvm"); - request.getHealRequest().getAdditionalParams().setActionInfo(new VFCHealActionVmInfo()); + request.getHealRequest().getAdditionalParams().setActionInfo(new VfcHealActionVmInfo()); request.getHealRequest().getAdditionalParams().getActionInfo().setVmid("33"); request.getHealRequest().getAdditionalParams().getActionInfo().setVmname("xgw-smp11"); String body = Serialization.gsonPretty.toJson(request); System.out.println(body); - VFCResponse response = new VFCResponse(); + VfcResponse response = new VfcResponse(); response.setJobId("1"); body = Serialization.gsonPretty.toJson(response); System.out.println(body); - response.setResponseDescriptor(new VFCResponseDescriptor()); + response.setResponseDescriptor(new VfcResponseDescriptor()); response.getResponseDescriptor().setProgress("40"); response.getResponseDescriptor().setStatus("processing"); response.getResponseDescriptor().setStatusDescription("OMC VMs are decommissioned in VIM"); @@ -60,7 +60,7 @@ public class DemoTest { body = Serialization.gsonPretty.toJson(response); System.out.println(body); - VFCResponseDescriptor responseDescriptor = new VFCResponseDescriptor(); + VfcResponseDescriptor responseDescriptor = new VfcResponseDescriptor(); responseDescriptor.setProgress("20"); responseDescriptor.setStatus("processing"); responseDescriptor.setStatusDescription("OMC VMs are decommissioned in VIM"); @@ -73,7 +73,7 @@ public class DemoTest { body = Serialization.gsonPretty.toJson(response); System.out.println(body); - response = Serialization.gsonPretty.fromJson(body, VFCResponse.class); + response = Serialization.gsonPretty.fromJson(body, VfcResponse.class); body = Serialization.gsonPretty.toJson(response); System.out.println(body); diff --git a/controlloop/common/model-impl/vfc/src/test/java/org/onap/policy/vfc/VfcHealActionVmInfoTest.java b/controlloop/common/model-impl/vfc/src/test/java/org/onap/policy/vfc/VfcHealActionVmInfoTest.java index 10964a909..8b5b118d2 100644 --- a/controlloop/common/model-impl/vfc/src/test/java/org/onap/policy/vfc/VfcHealActionVmInfoTest.java +++ b/controlloop/common/model-impl/vfc/src/test/java/org/onap/policy/vfc/VfcHealActionVmInfoTest.java @@ -3,7 +3,7 @@ * vfc * ================================================================================ * Copyright (C) 2018 Ericsson. All rights reserved. - * Modifications Copyright (C) 2018 AT&T Corporation. All rights reserved. + * Modifications Copyright (C) 2018-2019 AT&T Corporation. 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 +31,7 @@ public class VfcHealActionVmInfoTest { @Test public void testVfcHealActionVmInfo() { - VFCHealActionVmInfo actionInfo = new VFCHealActionVmInfo(); + VfcHealActionVmInfo actionInfo = new VfcHealActionVmInfo(); assertNotNull(actionInfo); assertNotEquals(0, actionInfo.hashCode()); diff --git a/controlloop/common/model-impl/vfc/src/test/java/org/onap/policy/vfc/VfcHealAdditionalParamsTest.java b/controlloop/common/model-impl/vfc/src/test/java/org/onap/policy/vfc/VfcHealAdditionalParamsTest.java index ca2d844c1..e7cb79fef 100644 --- a/controlloop/common/model-impl/vfc/src/test/java/org/onap/policy/vfc/VfcHealAdditionalParamsTest.java +++ b/controlloop/common/model-impl/vfc/src/test/java/org/onap/policy/vfc/VfcHealAdditionalParamsTest.java @@ -3,7 +3,7 @@ * vfc * ================================================================================ * Copyright (C) 2018 Ericsson. All rights reserved. - * Modifications Copyright (C) 2018 AT&T Corporation. All rights reserved. + * Modifications Copyright (C) 2018-2019 AT&T Corporation. 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 +31,7 @@ public class VfcHealAdditionalParamsTest { @Test public void testVfcHealAdditionalParameters() { - VFCHealAdditionalParams additionalParams = new VFCHealAdditionalParams(); + VfcHealAdditionalParams additionalParams = new VfcHealAdditionalParams(); assertNotNull(additionalParams); assertNotEquals(0, additionalParams.hashCode()); @@ -39,7 +39,7 @@ public class VfcHealAdditionalParamsTest { additionalParams.setAction(action); assertEquals(action, additionalParams.getAction()); - VFCHealActionVmInfo actionInfo = new VFCHealActionVmInfo(); + VfcHealActionVmInfo actionInfo = new VfcHealActionVmInfo(); additionalParams.setActionInfo(actionInfo ); assertEquals(actionInfo, additionalParams.getActionInfo()); diff --git a/controlloop/common/model-impl/vfc/src/test/java/org/onap/policy/vfc/VfcHealRequestTest.java b/controlloop/common/model-impl/vfc/src/test/java/org/onap/policy/vfc/VfcHealRequestTest.java index 0a256a59b..b67b9ac07 100644 --- a/controlloop/common/model-impl/vfc/src/test/java/org/onap/policy/vfc/VfcHealRequestTest.java +++ b/controlloop/common/model-impl/vfc/src/test/java/org/onap/policy/vfc/VfcHealRequestTest.java @@ -3,7 +3,7 @@ * vfc * ================================================================================ * Copyright (C) 2018 Ericsson. All rights reserved. - * Modifications Copyright (C) 2018 AT&T Corporation. All rights reserved. + * Modifications Copyright (C) 2018-2019 AT&T Corporation. 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 +31,7 @@ public class VfcHealRequestTest { @Test public void testVfcHealRequest() { - VFCHealRequest request = new VFCHealRequest(); + VfcHealRequest request = new VfcHealRequest(); assertNotNull(request); assertNotEquals(0, request.hashCode()); @@ -43,7 +43,7 @@ public class VfcHealRequestTest { request.setCause(cause); assertEquals(cause, request.getCause()); - VFCHealAdditionalParams additionalParams = new VFCHealAdditionalParams(); + VfcHealAdditionalParams additionalParams = new VfcHealAdditionalParams(); request.setAdditionalParams(additionalParams); assertEquals(additionalParams, request.getAdditionalParams()); diff --git a/controlloop/common/model-impl/vfc/src/test/java/org/onap/policy/vfc/VfcManagerTest.java b/controlloop/common/model-impl/vfc/src/test/java/org/onap/policy/vfc/VfcManagerTest.java index ab8161164..f5d06de36 100644 --- a/controlloop/common/model-impl/vfc/src/test/java/org/onap/policy/vfc/VfcManagerTest.java +++ b/controlloop/common/model-impl/vfc/src/test/java/org/onap/policy/vfc/VfcManagerTest.java @@ -3,7 +3,7 @@ * vfc * ================================================================================ * Copyright (C) 2018 Ericsson, AT&T. All rights reserved. - * Modifications Copyright (C) 2018 AT&T Corporation. All rights reserved. + * Modifications Copyright (C) 2018-2019 AT&T Corporation. 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. @@ -56,8 +56,8 @@ public class VfcManagerTest { private Pair httpResponseBadResponse; private Pair httpResponseErr; - private VFCRequest request; - private VFCResponse response; + private VfcRequest request; + private VfcResponse response; @BeforeClass public static void beforeTestVfcManager() { @@ -82,28 +82,28 @@ public class VfcManagerTest { */ @Before public void createRequestAndResponse() { - VFCHealActionVmInfo actionInfo = new VFCHealActionVmInfo(); + VfcHealActionVmInfo actionInfo = new VfcHealActionVmInfo(); actionInfo.setVmid("TheWizard"); actionInfo.setVmname("The Wizard of Oz"); - VFCHealAdditionalParams additionalParams = new VFCHealAdditionalParams(); + VfcHealAdditionalParams additionalParams = new VfcHealAdditionalParams(); additionalParams.setAction("Go Home"); additionalParams.setActionInfo(actionInfo); - VFCHealRequest healRequest = new VFCHealRequest(); + VfcHealRequest healRequest = new VfcHealRequest(); healRequest.setAdditionalParams(additionalParams); healRequest.setCause("WestWitch"); healRequest.setVnfInstanceId("EmeraldCity"); final UUID requestId = UUID.randomUUID(); - request = new VFCRequest(); + request = new VfcRequest(); request.setHealRequest(healRequest); - request.setNSInstanceId("Dorothy"); + request.setNsInstanceId("Dorothy"); request.setRequestId(requestId); - List responseHistoryList = new ArrayList<>();; + List responseHistoryList = new ArrayList<>();; - VFCResponseDescriptor responseDescriptor = new VFCResponseDescriptor(); + VfcResponseDescriptor responseDescriptor = new VfcResponseDescriptor(); responseDescriptor.setErrorCode("1234"); responseDescriptor.setProgress("Follow The Yellow Brick Road"); responseDescriptor.setResponseHistoryList(responseHistoryList); @@ -111,7 +111,7 @@ public class VfcManagerTest { responseDescriptor.setStatus("finished"); responseDescriptor.setStatusDescription("There's no place like home"); - response = new VFCResponse(); + response = new VfcResponse(); response.setJobId("1234"); response.setRequestId(request.getRequestId().toString()); response.setResponseDescriptor(responseDescriptor); @@ -130,25 +130,25 @@ public class VfcManagerTest { @Test public void testVfcInitiation() { try { - new VFCManager(null, null); + new VfcManager(null, null); fail("test should throw an exception here"); } catch (IllegalArgumentException e) { - assertEquals("the parameters \"wm\" and \"request\" on the VFCManager constructor may not be null", + assertEquals("the parameters \"wm\" and \"request\" on the VfcManager constructor may not be null", e.getMessage()); } try { - new VFCManager(mockedWorkingMemory, null); + new VfcManager(mockedWorkingMemory, null); fail("test should throw an exception here"); } catch (IllegalArgumentException e) { - assertEquals("the parameters \"wm\" and \"request\" on the VFCManager constructor may not be null", + assertEquals("the parameters \"wm\" and \"request\" on the VfcManager constructor may not be null", e.getMessage()); } try { - new VFCManager(mockedWorkingMemory, request); + new VfcManager(mockedWorkingMemory, request); fail("test should throw an exception here"); } catch (IllegalArgumentException e) { @@ -158,14 +158,14 @@ public class VfcManagerTest { // add url; username & password are not required PolicyEngine.manager.getEnvironment().put("vfc.url", "http://somewhere.over.the.rainbow"); - new VFCManager(mockedWorkingMemory, request); + new VfcManager(mockedWorkingMemory, request); // url & username, but no password PolicyEngine.manager.getEnvironment().put("vfc.username", "Dorothy"); // url, username, and password PolicyEngine.manager.getEnvironment().put("vfc.password", "Toto"); - new VFCManager(mockedWorkingMemory, request); + new VfcManager(mockedWorkingMemory, request); } @Test @@ -174,7 +174,7 @@ public class VfcManagerTest { PolicyEngine.manager.getEnvironment().put("vfc.username", "Dorothy"); PolicyEngine.manager.getEnvironment().put("vfc.password", "Exception"); - VFCManager manager = new VFCManager(mockedWorkingMemory, request); + VfcManager manager = new VfcManager(mockedWorkingMemory, request); manager.setRestManager(mockedRestManager); Thread managerThread = new Thread(manager); @@ -202,7 +202,7 @@ public class VfcManagerTest { PolicyEngine.manager.getEnvironment().put("vfc.username", "Dorothy"); PolicyEngine.manager.getEnvironment().put("vfc.password", "Null"); - VFCManager manager = new VFCManager(mockedWorkingMemory, request); + VfcManager manager = new VfcManager(mockedWorkingMemory, request); manager.setRestManager(mockedRestManager); Thread managerThread = new Thread(manager); @@ -225,7 +225,7 @@ public class VfcManagerTest { PolicyEngine.manager.getEnvironment().put("vfc.username", "Dorothy"); PolicyEngine.manager.getEnvironment().put("vfc.password", "Error0"); - VFCManager manager = new VFCManager(mockedWorkingMemory, request); + VfcManager manager = new VfcManager(mockedWorkingMemory, request); manager.setRestManager(mockedRestManager); Thread managerThread = new Thread(manager); @@ -248,7 +248,7 @@ public class VfcManagerTest { PolicyEngine.manager.getEnvironment().put("vfc.username", "Dorothy"); PolicyEngine.manager.getEnvironment().put("vfc.password", "BadResponse"); - VFCManager manager = new VFCManager(mockedWorkingMemory, request); + VfcManager manager = new VfcManager(mockedWorkingMemory, request); manager.setRestManager(mockedRestManager); Thread managerThread = new Thread(manager); @@ -271,7 +271,7 @@ public class VfcManagerTest { PolicyEngine.manager.getEnvironment().put("vfc.username", "Dorothy"); PolicyEngine.manager.getEnvironment().put("vfc.password", "OK"); - VFCManager manager = new VFCManager(mockedWorkingMemory, request); + VfcManager manager = new VfcManager(mockedWorkingMemory, request); manager.setRestManager(mockedRestManager); Thread managerThread = new Thread(manager); diff --git a/controlloop/common/model-impl/vfc/src/test/java/org/onap/policy/vfc/VfcRequestTest.java b/controlloop/common/model-impl/vfc/src/test/java/org/onap/policy/vfc/VfcRequestTest.java index 95589154f..7dede1b7b 100644 --- a/controlloop/common/model-impl/vfc/src/test/java/org/onap/policy/vfc/VfcRequestTest.java +++ b/controlloop/common/model-impl/vfc/src/test/java/org/onap/policy/vfc/VfcRequestTest.java @@ -3,7 +3,7 @@ * vfc * ================================================================================ * Copyright (C) 2018 Ericsson. All rights reserved. - * Modifications Copyright (C) 2018 AT&T Corporation. All rights reserved. + * Modifications Copyright (C) 2018-2019 AT&T Corporation. 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,19 +33,19 @@ public class VfcRequestTest { @Test public void testVfcRequest() { - VFCRequest request = new VFCRequest(); + VfcRequest request = new VfcRequest(); assertNotNull(request); assertNotEquals(0, request.hashCode()); String nsInstanceId = "Dorothy"; - request.setNSInstanceId(nsInstanceId); - assertEquals(nsInstanceId, request.getNSInstanceId()); + request.setNsInstanceId(nsInstanceId); + assertEquals(nsInstanceId, request.getNsInstanceId()); UUID requestId = UUID.randomUUID(); request.setRequestId(requestId); assertEquals(requestId, request.getRequestId()); - VFCHealRequest healRequest = new VFCHealRequest(); + VfcHealRequest healRequest = new VfcHealRequest(); request.setHealRequest(healRequest); assertEquals(healRequest, request.getHealRequest()); diff --git a/controlloop/common/model-impl/vfc/src/test/java/org/onap/policy/vfc/VfcResponseDescriptorTest.java b/controlloop/common/model-impl/vfc/src/test/java/org/onap/policy/vfc/VfcResponseDescriptorTest.java index 9ab180767..b4dc81b44 100644 --- a/controlloop/common/model-impl/vfc/src/test/java/org/onap/policy/vfc/VfcResponseDescriptorTest.java +++ b/controlloop/common/model-impl/vfc/src/test/java/org/onap/policy/vfc/VfcResponseDescriptorTest.java @@ -3,7 +3,7 @@ * vfc * ================================================================================ * Copyright (C) 2018 Ericsson. All rights reserved. - * Modifications Copyright (C) 2018 AT&T Corporation. All rights reserved. + * Modifications Copyright (C) 2018-2019 AT&T Corporation. 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. @@ -34,7 +34,7 @@ public class VfcResponseDescriptorTest { @Test public void testVfcResponseDescriptor() { - VFCResponseDescriptor descriptor = new VFCResponseDescriptor(); + VfcResponseDescriptor descriptor = new VfcResponseDescriptor(); assertNotNull(descriptor); assertNotEquals(0, descriptor.hashCode()); @@ -46,7 +46,7 @@ public class VfcResponseDescriptorTest { descriptor.setProgress(progress); assertEquals(progress, descriptor.getProgress()); - List responseHistoryList = new ArrayList<>(); + List responseHistoryList = new ArrayList<>(); descriptor.setResponseHistoryList(responseHistoryList); assertEquals(responseHistoryList, descriptor.getResponseHistoryList()); diff --git a/controlloop/common/model-impl/vfc/src/test/java/org/onap/policy/vfc/VfcResponseTest.java b/controlloop/common/model-impl/vfc/src/test/java/org/onap/policy/vfc/VfcResponseTest.java index f333c4165..15ba6f520 100644 --- a/controlloop/common/model-impl/vfc/src/test/java/org/onap/policy/vfc/VfcResponseTest.java +++ b/controlloop/common/model-impl/vfc/src/test/java/org/onap/policy/vfc/VfcResponseTest.java @@ -3,7 +3,7 @@ * vfc * ================================================================================ * Copyright (C) 2018 Ericsson. All rights reserved. - * Modifications Copyright (C) 2018 AT&T Corporation. All rights reserved. + * Modifications Copyright (C) 2018-2019 AT&T Corporation. 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 +31,7 @@ public class VfcResponseTest { @Test public void testVfcResponse() { - VFCResponse response = new VFCResponse(); + VfcResponse response = new VfcResponse(); assertNotNull(response); assertNotEquals(0, response.hashCode()); @@ -43,7 +43,7 @@ public class VfcResponseTest { response.setRequestId(requestId); assertEquals(requestId, response.getRequestId()); - VFCResponseDescriptor responseDescriptor = new VFCResponseDescriptor(); + VfcResponseDescriptor responseDescriptor = new VfcResponseDescriptor(); response.setResponseDescriptor(responseDescriptor); assertEquals(responseDescriptor, response.getResponseDescriptor()); diff --git a/controlloop/common/simulators/src/test/java/org/onap/policy/simulators/VfcSimulatorTest.java b/controlloop/common/simulators/src/test/java/org/onap/policy/simulators/VfcSimulatorTest.java index 0e083bb6c..6e778d86c 100644 --- a/controlloop/common/simulators/src/test/java/org/onap/policy/simulators/VfcSimulatorTest.java +++ b/controlloop/common/simulators/src/test/java/org/onap/policy/simulators/VfcSimulatorTest.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. @@ -33,7 +33,7 @@ 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.vfc.VFCResponse; +import org.onap.policy.vfc.VfcResponse; import org.onap.policy.vfc.util.Serialization; public class VfcSimulatorTest { @@ -64,7 +64,7 @@ public class VfcSimulatorTest { new HashMap(), "application/json", "Some Request Here"); assertNotNull(httpDetails); assertTrue(httpDetails.first == 202); - final VFCResponse response = Serialization.gsonPretty.fromJson(httpDetails.second, VFCResponse.class); + final VfcResponse response = Serialization.gsonPretty.fromJson(httpDetails.second, VfcResponse.class); assertNotNull(response); } @@ -73,7 +73,7 @@ public class VfcSimulatorTest { final Pair httpDetails = new RESTManager().get("http://localhost:6668/api/nslcm/v1/jobs/1234", "username", "password", new HashMap()); assertNotNull(httpDetails); - final VFCResponse response = Serialization.gsonPretty.fromJson(httpDetails.second, VFCResponse.class); + final VfcResponse response = Serialization.gsonPretty.fromJson(httpDetails.second, VfcResponse.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 be399d9f7..160b75c61 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 @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * ONAP * ================================================================================ - * 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. @@ -45,9 +45,9 @@ import org.onap.policy.sdnr.PciRequestWrapper; import org.onap.policy.sdnr.PciResponseWrapper; import org.onap.policy.sdnr.PciRequest; 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.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; @@ -594,9 +594,9 @@ rule "${policyName}.EVENT.MANAGER.OPERATION.LOCKED.GUARD_PERMITTED" } break; case "VFC": - if (request instanceof VFCRequest) { + if (request instanceof VfcRequest) { // Start VFC thread - Thread t = new Thread(new VFCManager(drools.getWorkingMemory(), (VFCRequest)request)); + Thread t = new Thread(new VfcManager(drools.getWorkingMemory(), (VfcRequest)request)); t.start(); } break; @@ -1252,7 +1252,7 @@ rule "${policyName}.VFC.RESPONSE" $opTimer : ControlLoopTimer( closedLoopControlName == $event.getClosedLoopControlName(), requestID == $event.getRequestId().toString(), timerType == "Operation", !expired ) $lock : TargetLock (requestID == $event.getRequestId()) - $response : VFCResponse( requestId.toString() == $event.getRequestId().toString() ) + $response : VfcResponse( requestId.toString() == $event.getRequestId().toString() ) then Logger logger = LoggerFactory.getLogger(drools.getRule().getPackage()); logger.info("{}: {}", $params.getClosedLoopControlName(), drools.getRule().getName()); 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 dc585261c..d8e34313e 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 @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * ONAP * ================================================================================ - * 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. @@ -46,9 +46,9 @@ import org.onap.policy.sdnr.PciRequestWrapper; import org.onap.policy.sdnr.PciResponseWrapper; import org.onap.policy.sdnr.PciRequest; 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.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; @@ -543,9 +543,9 @@ rule "EVENT.MANAGER.OPERATION.LOCKED.GUARD_PERMITTED" } break; case "VFC": - if (request instanceof VFCRequest) { + if (request instanceof VfcRequest) { // Start VFC thread - Thread t = new Thread(new VFCManager(drools.getWorkingMemory(), (VFCRequest)request)); + Thread t = new Thread(new VfcManager(drools.getWorkingMemory(), (VfcRequest)request)); t.start(); } break; @@ -1093,7 +1093,7 @@ rule "VFC.RESPONSE" $opTimer : ControlLoopTimer( closedLoopControlName == $event.getClosedLoopControlName(), requestID == $event.getRequestId().toString(), timerType == "Operation", !expired ) $lock : TargetLock (requestID == $event.getRequestId()) - $response : VFCResponse( requestId.toString() == $event.getRequestId().toString() ) + $response : VfcResponse( requestId.toString() == $event.getRequestId().toString() ) then Logger logger = LoggerFactory.getLogger(drools.getRule().getPackage()); logger.info("{}: {}", $clName, $params.getPolicyName() + "." + drools.getRule().getName()); 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 f7f04af81..feb5bf499 100644 --- a/controlloop/templates/template.demo.clc/src/main/resources/__closedLoopControlName__.drl +++ b/controlloop/templates/template.demo.clc/src/main/resources/__closedLoopControlName__.drl @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * ONAP * ================================================================================ - * 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. @@ -42,9 +42,9 @@ import org.onap.policy.appclcm.LcmResponseWrapper; import org.onap.policy.appclcm.LcmRequest; import org.onap.policy.appclcm.LcmResponse; 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.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; @@ -599,9 +599,9 @@ rule "${policyName}.EVENT.MANAGER.OPERATION.LOCKED.GUARD_PERMITTED" } break; case "VFC": - if (request instanceof VFCRequest) { + if (request instanceof VfcRequest) { // Start VFC thread - Thread t = new Thread(new VFCManager(drools.getWorkingMemory(), (VFCRequest)request)); + Thread t = new Thread(new VfcManager(drools.getWorkingMemory(), (VfcRequest)request)); t.start(); } break; @@ -1103,7 +1103,7 @@ rule "${policyName}.VFC.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 : VFCResponse( requestId.toString() == $event.getRequestId().toString() ) + $response : VfcResponse( requestId.toString() == $event.getRequestId().toString() ) then Logger logger = LoggerFactory.getLogger(drools.getRule().getPackage()); logger.info("{}: {}", $params.getClosedLoopControlName(), drools.getRule().getName()); diff --git a/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/VfcControlLoopTest.java b/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/VfcControlLoopTest.java index aa4c108c5..57ed52ad7 100644 --- a/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/VfcControlLoopTest.java +++ b/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/VfcControlLoopTest.java @@ -3,7 +3,7 @@ * demo * ================================================================================ * Copyright (C) 2017-2018 Intel Corp. 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. @@ -57,7 +57,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.vfc.VFCRequest; +import org.onap.policy.vfc.VfcRequest; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -340,7 +340,7 @@ public class VfcControlLoopTest implements TopicListener { logger.debug("The control loop timed out"); fail("Control Loop Timed Out"); } - } else if (obj instanceof VFCRequest) { + } else if (obj instanceof VfcRequest) { logger.debug("\n============ VFC received the request!!! ===========\n"); } } -- 2.16.6