diff options
Diffstat (limited to 'controlloop/common')
45 files changed, 786 insertions, 337 deletions
diff --git a/controlloop/common/actors/actor.appc/src/main/java/org/onap/policy/controlloop/actor/appc/APPCActorServiceProvider.java b/controlloop/common/actors/actor.appc/src/main/java/org/onap/policy/controlloop/actor/appc/AppcActorServiceProvider.java index 8960ee022..865584972 100644 --- a/controlloop/common/actors/actor.appc/src/main/java/org/onap/policy/controlloop/actor/appc/APPCActorServiceProvider.java +++ b/controlloop/common/actors/actor.appc/src/main/java/org/onap/policy/controlloop/actor/appc/AppcActorServiceProvider.java @@ -37,7 +37,7 @@ import org.onap.policy.vnf.trafficgenerator.PGStream; import org.onap.policy.vnf.trafficgenerator.PGStreams; -public class APPCActorServiceProvider implements Actor { +public class AppcActorServiceProvider implements Actor { // Strings for targets private static final String TARGET_VM = "VM"; private static final String TARGET_VNF = "VNF"; diff --git a/controlloop/common/actors/actor.appc/src/main/resources/META-INF/services/org.onap.policy.controlloop.actorServiceProvider.spi.Actor b/controlloop/common/actors/actor.appc/src/main/resources/META-INF/services/org.onap.policy.controlloop.actorServiceProvider.spi.Actor index 8181582b5..f1002a301 100644 --- a/controlloop/common/actors/actor.appc/src/main/resources/META-INF/services/org.onap.policy.controlloop.actorServiceProvider.spi.Actor +++ b/controlloop/common/actors/actor.appc/src/main/resources/META-INF/services/org.onap.policy.controlloop.actorServiceProvider.spi.Actor @@ -1 +1 @@ -org.onap.policy.controlloop.actor.appc.APPCActorServiceProvider
\ No newline at end of file +org.onap.policy.controlloop.actor.appc.AppcActorServiceProvider
\ No newline at end of file diff --git a/controlloop/common/actors/actor.appc/src/test/java/org/onap/policy/controlloop/actor/appc/AppcServiceProviderTest.java b/controlloop/common/actors/actor.appc/src/test/java/org/onap/policy/controlloop/actor/appc/AppcServiceProviderTest.java index 1fffe043c..9f8528fe0 100644 --- a/controlloop/common/actors/actor.appc/src/test/java/org/onap/policy/controlloop/actor/appc/AppcServiceProviderTest.java +++ b/controlloop/common/actors/actor.appc/src/test/java/org/onap/policy/controlloop/actor/appc/AppcServiceProviderTest.java @@ -125,7 +125,7 @@ public class AppcServiceProviderTest { public void constructModifyConfigRequestTest() { Request appcRequest; - appcRequest = APPCActorServiceProvider.constructRequest(onsetEvent, operation, policy, "vnf01"); + appcRequest = AppcActorServiceProvider.constructRequest(onsetEvent, operation, policy, "vnf01"); /* The service provider must return a non null APPC request */ assertNotNull(appcRequest); @@ -168,7 +168,7 @@ public class AppcServiceProviderTest { @Test public void testMethods() { - APPCActorServiceProvider sp = new APPCActorServiceProvider(); + AppcActorServiceProvider sp = new AppcActorServiceProvider(); assertEquals("APPC", sp.actor()); assertEquals(4, sp.recipes().size()); diff --git a/controlloop/common/actors/actor.appclcm/src/main/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmRecipeFormatter.java b/controlloop/common/actors/actor.appclcm/src/main/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmRecipeFormatter.java index c9feb0d2a..12fad9e84 100644 --- a/controlloop/common/actors/actor.appclcm/src/main/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmRecipeFormatter.java +++ b/controlloop/common/actors/actor.appclcm/src/main/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmRecipeFormatter.java @@ -3,6 +3,7 @@ * * ================================================================================ * Copyright (C) 2018 Nokia Intellectual Property. All rights reserved. + * Modifications Copyright (C) 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. @@ -21,9 +22,8 @@ package org.onap.policy.controlloop.actor.appclcm; import com.google.common.collect.Lists; -import org.apache.commons.lang.StringUtils; - import java.util.stream.Collectors; +import org.apache.commons.lang.StringUtils; class AppcLcmRecipeFormatter { 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 7c0214bfb..8edddbb40 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 @@ -49,8 +49,8 @@ import org.onap.policy.so.util.Serialization; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -public class SOActorServiceProvider implements Actor { - private static final Logger logger = LoggerFactory.getLogger(SOActorServiceProvider.class); +public class SoActorServiceProvider implements Actor { + private static final Logger logger = LoggerFactory.getLogger(SoActorServiceProvider.class); // Strings for SO Actor private static final String SO_ACTOR = "SO"; @@ -184,7 +184,7 @@ public class SOActorServiceProvider implements Actor { } /** - * Construct SO request to create vf-module + * Construct SO request to create vf-module. * * @param aaiResponseWrapper the AAI response containing the VF modules * @param policy the policy @@ -287,7 +287,7 @@ public class SOActorServiceProvider implements Actor { } /** - * Construct SO request to delete vf-module + * Construct SO request to delete vf-module. * * @param tenantItem tenant item from A&AI named-query response * @param vnfItem vnf item from A&AI named-query response @@ -320,7 +320,7 @@ public class SOActorServiceProvider implements Actor { } /** - * construct requestInfo for the SO requestDetails + * Construct requestInfo for the SO requestDetails. * * @return SO request information */ @@ -333,7 +333,7 @@ public class SOActorServiceProvider implements Actor { } /** - * construct modelInfo of the vfModule for the SO requestDetails + * Construct modelInfo of the vfModule for the SO requestDetails. * * @param vfModuleItem vf module item from A&AI named-query response * @return SO Model info for the vfModule @@ -355,7 +355,7 @@ public class SOActorServiceProvider implements Actor { } /** - * construct cloudConfiguration for the SO requestDetails + * Construct cloudConfiguration for the SO requestDetails. * * @param tenantItem tenant item from A&AI named-query response * @return SO cloud configuration diff --git a/controlloop/common/actors/actor.so/src/main/resources/META-INF/services/org.onap.policy.controlloop.actorServiceProvider.spi.Actor b/controlloop/common/actors/actor.so/src/main/resources/META-INF/services/org.onap.policy.controlloop.actorServiceProvider.spi.Actor index ad136e98f..a955eb71c 100644 --- a/controlloop/common/actors/actor.so/src/main/resources/META-INF/services/org.onap.policy.controlloop.actorServiceProvider.spi.Actor +++ b/controlloop/common/actors/actor.so/src/main/resources/META-INF/services/org.onap.policy.controlloop.actorServiceProvider.spi.Actor @@ -1 +1 @@ -org.onap.policy.controlloop.actor.so.SOActorServiceProvider
\ No newline at end of file +org.onap.policy.controlloop.actor.so.SoActorServiceProvider
\ No newline at end of file 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 9c1d87888..90a4c2868 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 @@ -63,15 +63,15 @@ public class SoActorServiceProviderTest { policy.setActor("Dorothy"); policy.setRecipe("GoToOz"); - assertNull(new SOActorServiceProvider().constructRequest(onset, operation, policy, aaiNqResp)); + assertNull(new SoActorServiceProvider().constructRequest(onset, operation, policy, aaiNqResp)); policy.setActor("SO"); - assertNull(new SOActorServiceProvider().constructRequest(onset, operation, policy, aaiNqResp)); + assertNull(new SoActorServiceProvider().constructRequest(onset, operation, policy, aaiNqResp)); 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()); @@ -80,7 +80,7 @@ public class SoActorServiceProviderTest { // non-empty policy payload policy.setPayload(makePayload()); - request = new SOActorServiceProvider().constructRequest(onset, operation, policy, aaiNqResp); + request = new SoActorServiceProvider().constructRequest(onset, operation, policy, aaiNqResp); assertNotNull(request); assertEquals(true, request.getRequestDetails().getRequestParameters().isUsePreload()); assertEquals("avalue", request.getRequestDetails().getRequestParameters().getUserParams().get(0).get("akey")); @@ -89,33 +89,33 @@ public class SoActorServiceProviderTest { // payload with config, but no request params policy.setPayload(makePayload()); - policy.getPayload().remove(SOActorServiceProvider.REQ_PARAM_NM); - request = new SOActorServiceProvider().constructRequest(onset, operation, policy, aaiNqResp); + policy.getPayload().remove(SoActorServiceProvider.REQ_PARAM_NM); + request = new SoActorServiceProvider().constructRequest(onset, operation, policy, aaiNqResp); assertNotNull(request); assertNull(request.getRequestDetails().getRequestParameters()); assertNotNull(request.getRequestDetails().getConfigurationParameters()); // payload with request, but no config params policy.setPayload(makePayload()); - policy.getPayload().remove(SOActorServiceProvider.CONFIG_PARAM_NM); - request = new SOActorServiceProvider().constructRequest(onset, operation, policy, aaiNqResp); + policy.getPayload().remove(SoActorServiceProvider.CONFIG_PARAM_NM); + request = new SoActorServiceProvider().constructRequest(onset, operation, policy, aaiNqResp); assertNotNull(request); assertNotNull(request.getRequestDetails().getRequestParameters()); assertNull(request.getRequestDetails().getConfigurationParameters()); // null response - assertNull(new SOActorServiceProvider().constructRequest(onset, operation, policy, null)); + assertNull(new SoActorServiceProvider().constructRequest(onset, operation, policy, null)); // response has no base VF module - assertNull(new SOActorServiceProvider().constructRequest(onset, operation, policy, + assertNull(new SoActorServiceProvider().constructRequest(onset, operation, policy, loadAaiResponse(onset, "aai/AaiNqResponse-NoBase.json"))); // response has no non-base VF modules (other than the "dummy") - assertNull(new SOActorServiceProvider().constructRequest(onset, operation, policy, + assertNull(new SoActorServiceProvider().constructRequest(onset, operation, policy, 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()); @@ -128,22 +128,22 @@ public class SoActorServiceProviderTest { // null tenant aaiNqResp.getAaiNqResponse().getInventoryResponseItems().get(0).getItems().getInventoryResponseItems() .remove(1); - assertNull(new SOActorServiceProvider().constructRequest(onset, operation, policy, aaiNqResp)); + assertNull(new SoActorServiceProvider().constructRequest(onset, operation, policy, aaiNqResp)); // null service item aaiNqResp.getAaiNqResponse().getInventoryResponseItems().get(0).getItems().getInventoryResponseItems().get(0) .setItems(null); - assertNull(new SOActorServiceProvider().constructRequest(onset, operation, policy, aaiNqResp)); + assertNull(new SoActorServiceProvider().constructRequest(onset, operation, policy, aaiNqResp)); // null response aaiNqResp.setAaiNqResponse(null); - assertNull(new SOActorServiceProvider().constructRequest(onset, operation, policy, aaiNqResp)); + assertNull(new SoActorServiceProvider().constructRequest(onset, operation, policy, aaiNqResp)); } @Test public void testSendRequest() { try { - SOActorServiceProvider.sendRequest(UUID.randomUUID().toString(), null, null); + SoActorServiceProvider.sendRequest(UUID.randomUUID().toString(), null, null); } catch (Exception e) { fail("Test should not throw an exception"); } @@ -151,7 +151,7 @@ public class SoActorServiceProviderTest { @Test public void testMethods() { - SOActorServiceProvider sp = new SOActorServiceProvider(); + SoActorServiceProvider sp = new SoActorServiceProvider(); assertEquals("SO", sp.actor()); assertEquals(2, sp.recipes().size()); @@ -170,8 +170,8 @@ public class SoActorServiceProviderTest { private Map<String, String> makePayload() { Map<String, String> payload = new TreeMap<>(); - payload.put(SOActorServiceProvider.REQ_PARAM_NM, makeReqParams()); - payload.put(SOActorServiceProvider.CONFIG_PARAM_NM, makeConfigParams()); + payload.put(SoActorServiceProvider.REQ_PARAM_NM, makeReqParams()); + payload.put(SoActorServiceProvider.CONFIG_PARAM_NM, makeConfigParams()); return payload; } 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 b8aaf854a..8660aa3e2 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,6 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2017-2018 Intel Corp. All rights reserved. + * Modifications Copyright (C) 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. @@ -40,8 +41,8 @@ import org.onap.policy.vfc.VFCRequest; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -public class VFCActorServiceProvider implements Actor { - private static final Logger logger = LoggerFactory.getLogger(VFCActorServiceProvider.class); +public class VfcActorServiceProvider implements Actor { + private static final Logger logger = LoggerFactory.getLogger(VfcActorServiceProvider.class); // Strings for VFC Actor private static final String VFC_ACTOR = "VFC"; diff --git a/controlloop/common/actors/actor.vfc/src/main/resources/META-INF/services/org.onap.policy.controlloop.actorServiceProvider.spi.Actor b/controlloop/common/actors/actor.vfc/src/main/resources/META-INF/services/org.onap.policy.controlloop.actorServiceProvider.spi.Actor index 1476eac1d..e43c726cf 100644 --- a/controlloop/common/actors/actor.vfc/src/main/resources/META-INF/services/org.onap.policy.controlloop.actorServiceProvider.spi.Actor +++ b/controlloop/common/actors/actor.vfc/src/main/resources/META-INF/services/org.onap.policy.controlloop.actorServiceProvider.spi.Actor @@ -1 +1 @@ -org.onap.policy.controlloop.actor.vfc.VFCActorServiceProvider +org.onap.policy.controlloop.actor.vfc.VfcActorServiceProvider 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 934ea134c..02387b641 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 @@ -68,37 +68,37 @@ public class VfcActorServiceProviderTest { Policy policy = new Policy(); policy.setRecipe("GoToOz"); - assertNull(VFCActorServiceProvider.constructRequest(onset, operation, policy, null)); + assertNull(VfcActorServiceProvider.constructRequest(onset, operation, policy, null)); onset.getAai().put("generic-vnf.vnf-id", "dorothy.gale.1939"); - assertNull(VFCActorServiceProvider.constructRequest(onset, operation, policy, null)); + assertNull(VfcActorServiceProvider.constructRequest(onset, operation, policy, null)); PolicyEngine.manager.setEnvironmentProperty("aai.url", "http://localhost:6666"); PolicyEngine.manager.setEnvironmentProperty("aai.username", "AAI"); PolicyEngine.manager.setEnvironmentProperty("aai.password", "AAI"); - assertNull(VFCActorServiceProvider.constructRequest(onset, operation, policy, null)); + assertNull(VfcActorServiceProvider.constructRequest(onset, operation, policy, null)); UUID requestId = UUID.randomUUID(); onset.setRequestId(requestId); - assertNull(VFCActorServiceProvider.constructRequest(onset, operation, policy, null)); + assertNull(VfcActorServiceProvider.constructRequest(onset, operation, policy, null)); onset.getAai().put("generic-vnf.vnf-name", "Dorothy"); PolicyEngine.manager.getEnvironment().remove("aai.password"); - assertNull(VFCActorServiceProvider.constructRequest(onset, operation, policy, null)); + assertNull(VfcActorServiceProvider.constructRequest(onset, operation, policy, null)); PolicyEngine.manager.setEnvironmentProperty("aai.password", "AAI"); - assertNull(VFCActorServiceProvider.constructRequest(onset, operation, policy, null)); + assertNull(VfcActorServiceProvider.constructRequest(onset, operation, policy, null)); onset.getAai().put("service-instance.service-instance-id", ""); - assertNull(VFCActorServiceProvider.constructRequest(onset, operation, policy, null)); + assertNull(VfcActorServiceProvider.constructRequest(onset, operation, policy, null)); - assertNull(VFCActorServiceProvider.constructRequest(onset, operation, policy, new AaiGetVnfResponse())); + assertNull(VfcActorServiceProvider.constructRequest(onset, operation, policy, new AaiGetVnfResponse())); policy.setRecipe("Restart"); - assertNotNull(VFCActorServiceProvider.constructRequest(onset, operation, policy, new AaiGetVnfResponse())); + assertNotNull(VfcActorServiceProvider.constructRequest(onset, operation, policy, new AaiGetVnfResponse())); VFCRequest request = - VFCActorServiceProvider.constructRequest(onset, operation, policy, new AaiGetVnfResponse()); + VfcActorServiceProvider.constructRequest(onset, operation, policy, new AaiGetVnfResponse()); assertEquals(requestId, Objects.requireNonNull(request).getRequestId()); assertEquals("dorothy.gale.1939", request.getHealRequest().getVnfInstanceId()); @@ -107,7 +107,7 @@ public class VfcActorServiceProviderTest { @Test public void testMethods() { - VFCActorServiceProvider sp = new VFCActorServiceProvider(); + VfcActorServiceProvider sp = new VfcActorServiceProvider(); assertEquals("VFC", sp.actor()); assertEquals(1, sp.recipes().size()); diff --git a/controlloop/common/eventmanager/checkstyle-suppressions.xml b/controlloop/common/eventmanager/checkstyle-suppressions.xml new file mode 100644 index 000000000..1bb593962 --- /dev/null +++ b/controlloop/common/eventmanager/checkstyle-suppressions.xml @@ -0,0 +1,33 @@ +<?xml version="1.0"?> +<!-- + ============LICENSE_START======================================================= + Copyright (C) 2018 AT&T Technologies. 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. + + SPDX-License-Identifier: Apache-2.0 + ============LICENSE_END========================================================= +--> + +<!DOCTYPE suppressions PUBLIC + "-//Puppy Crawl//DTD Suppressions 1.0//EN" + "http://www.puppycrawl.com/dtds/suppressions_1_0.dtd"> + +<suppressions> + <suppress checks="AbbreviationAsWordInName" + files="ControlLoopEventManager.java" + lines="1-9999"/> + <suppress checks="TypeName" + files="ControlLoopEventManager.java" + lines="1-9999"/> +</suppressions> diff --git a/controlloop/common/eventmanager/pom.xml b/controlloop/common/eventmanager/pom.xml index 6897317d5..e14d62ffc 100644 --- a/controlloop/common/eventmanager/pom.xml +++ b/controlloop/common/eventmanager/pom.xml @@ -205,4 +205,44 @@ <scope>test</scope> </dependency> </dependencies> + <build> + <plugins> + <plugin> + <artifactId>maven-checkstyle-plugin</artifactId> + <executions> + <execution> + <id>onap-java-style</id> + <goals> + <goal>check</goal> + </goals> + <phase>process-sources</phase> + <configuration> + <!-- Use Google Java Style Guide: + https://github.com/checkstyle/checkstyle/blob/master/src/main/resources/google_checks.xml + with minor changes --> + <configLocation>onap-checkstyle/onap-java-style.xml</configLocation> + <!-- <sourceDirectory> is needed so that checkstyle ignores the generated sources directory --> + <sourceDirectory>${project.build.sourceDirectory}/src/main/java</sourceDirectory> + <includeResources>true</includeResources> + <includeTestSourceDirectory>true</includeTestSourceDirectory> + <includeTestResources>true</includeTestResources> + <excludes> + </excludes> + <consoleOutput>true</consoleOutput> + <failsOnViolation>true</failsOnViolation> + <violationSeverity>warning</violationSeverity> + </configuration> + </execution> + </executions> + <dependencies> + <dependency> + <groupId>org.onap.oparent</groupId> + <artifactId>checkstyle</artifactId> + <version>${oparent.version}</version> + <scope>compile</scope> + </dependency> + </dependencies> + </plugin> + </plugins> + </build> </project> diff --git a/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopEventManager.java b/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopEventManager.java index 93535efc1..5241bd2fc 100644 --- a/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopEventManager.java +++ b/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopEventManager.java @@ -29,8 +29,8 @@ import java.util.HashMap; import java.util.LinkedList; import java.util.List; import java.util.Map; -import java.util.UUID; import java.util.NoSuchElementException; +import java.util.UUID; import org.onap.policy.aai.AaiGetVnfResponse; import org.onap.policy.aai.AaiGetVserverResponse; @@ -91,7 +91,7 @@ public class ControlLoopEventManager implements LockCallback, Serializable { private static final long serialVersionUID = -1216568161322872641L; public final String closedLoopControlName; - public final UUID requestID; + private final UUID requestId; private String controlLoopResult; private ControlLoopProcessor processor = null; @@ -125,9 +125,9 @@ public class ControlLoopEventManager implements LockCallback, Serializable { requiredAAIKeys.add(VM_NAME); } - public ControlLoopEventManager(String closedLoopControlName, UUID requestID) { + public ControlLoopEventManager(String closedLoopControlName, UUID requestId) { this.closedLoopControlName = closedLoopControlName; - this.requestID = requestID; + this.requestId = requestId; } public String getClosedLoopControlName() { @@ -187,7 +187,7 @@ public class ControlLoopEventManager implements LockCallback, Serializable { } public UUID getRequestID() { - return requestID; + return requestId; } /** @@ -499,7 +499,8 @@ public class ControlLoopEventManager implements LockCallback, Serializable { this.currentOperation.getTargetEntity(), this.onset.getRequestId(), this); this.targetLock = lock; - LockResult<GuardResult, TargetLock> lockResult = LockResult.createLockResult(GuardResult.LOCK_ACQUIRED, lock); + LockResult<GuardResult, TargetLock> lockResult = + LockResult.createLockResult(GuardResult.LOCK_ACQUIRED, lock); return lockResult; } // @@ -637,7 +638,7 @@ public class ControlLoopEventManager implements LockCallback, Serializable { logger.error("{}: commitAbatement: no operation manager", this); return; } - try{ + try { this.lastOperationManager.commitAbatement(message,outcome); } catch (NoSuchElementException e) { logger.error("{}: commitAbatement threw an exception ", this, e); @@ -1027,7 +1028,7 @@ public class ControlLoopEventManager implements LockCallback, Serializable { @Override public String toString() { - return "ControlLoopEventManager [closedLoopControlName=" + closedLoopControlName + ", requestID=" + requestID + return "ControlLoopEventManager [closedLoopControlName=" + closedLoopControlName + ", requestId=" + requestId + ", processor=" + processor + ", onset=" + (onset != null ? onset.getRequestId() : "null") + ", numOnsets=" + numOnsets + ", numAbatements=" + numAbatements + ", isActivated=" + isActivated + ", currentOperation=" + currentOperation + ", targetLock=" + targetLock + "]"; 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 466c826b1..c5344e38b 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 @@ -41,11 +41,11 @@ import org.onap.policy.controlloop.ControlLoopEvent; import org.onap.policy.controlloop.ControlLoopException; import org.onap.policy.controlloop.ControlLoopOperation; import org.onap.policy.controlloop.VirtualControlLoopEvent; -import org.onap.policy.controlloop.actor.appc.APPCActorServiceProvider; +import org.onap.policy.controlloop.actor.appc.AppcActorServiceProvider; import org.onap.policy.controlloop.actor.appclcm.AppcLcmActorServiceProvider; import org.onap.policy.controlloop.actor.sdnr.SdnrActorServiceProvider; -import org.onap.policy.controlloop.actor.so.SOActorServiceProvider; -import org.onap.policy.controlloop.actor.vfc.VFCActorServiceProvider; +import org.onap.policy.controlloop.actor.so.SoActorServiceProvider; +import org.onap.policy.controlloop.actor.vfc.VfcActorServiceProvider; import org.onap.policy.controlloop.policy.Policy; import org.onap.policy.controlloop.policy.PolicyResult; import org.onap.policy.drools.system.PolicyEngine; @@ -258,7 +258,7 @@ public class ControlLoopOperationManager implements Serializable { */ this.currentOperation = operation; if ("ModifyConfig".equalsIgnoreCase(policy.getRecipe())) { - this.operationRequest = APPCActorServiceProvider.constructRequest((VirtualControlLoopEvent) onset, + this.operationRequest = AppcActorServiceProvider.constructRequest((VirtualControlLoopEvent) onset, operation.clOperation, this.policy, this.targetEntity); } else { this.operationRequest = AppcLcmActorServiceProvider.constructRequest( @@ -270,7 +270,7 @@ public class ControlLoopOperationManager implements Serializable { return operationRequest; case "SO": - SOActorServiceProvider soActorSp = new SOActorServiceProvider(); + SoActorServiceProvider soActorSp = new SoActorServiceProvider(); this.operationRequest = soActorSp.constructRequest((VirtualControlLoopEvent) onset, operation.clOperation, this.policy, eventManager.getNqVserverFromAai()); @@ -283,7 +283,7 @@ public class ControlLoopOperationManager implements Serializable { return operationRequest; case "VFC": - this.operationRequest = VFCActorServiceProvider.constructRequest((VirtualControlLoopEvent) onset, + this.operationRequest = VfcActorServiceProvider.constructRequest((VirtualControlLoopEvent) onset, operation.clOperation, this.policy, this.eventManager.getVnfResponse()); this.currentOperation = operation; if (this.operationRequest == null) { @@ -935,5 +935,5 @@ public class ControlLoopOperationManager implements Serializable { // Clear the current operation field // this.currentOperation = null; - } + } } diff --git a/controlloop/common/feature-controlloop-trans/checkstyle-suppressions.xml b/controlloop/common/feature-controlloop-trans/checkstyle-suppressions.xml new file mode 100644 index 000000000..f4ceebd66 --- /dev/null +++ b/controlloop/common/feature-controlloop-trans/checkstyle-suppressions.xml @@ -0,0 +1,30 @@ +<?xml version="1.0"?> +<!-- + ============LICENSE_START======================================================= + Copyright (C) 2018 AT&T Technologies. 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. + + SPDX-License-Identifier: Apache-2.0 + ============LICENSE_END========================================================= +--> + +<!DOCTYPE suppressions PUBLIC + "-//Puppy Crawl//DTD Suppressions 1.0//EN" + "http://www.puppycrawl.com/dtds/suppressions_1_0.dtd"> + +<suppressions> + <suppress checks="OneTopLevelClass" + files="ControlLoopMetrics.java" + lines="1-9999"/> +</suppressions> diff --git a/controlloop/common/feature-controlloop-trans/pom.xml b/controlloop/common/feature-controlloop-trans/pom.xml index 05bc4f8e7..2e609d0ed 100644 --- a/controlloop/common/feature-controlloop-trans/pom.xml +++ b/controlloop/common/feature-controlloop-trans/pom.xml @@ -61,7 +61,6 @@ </execution> </executions> </plugin> - <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-dependency-plugin</artifactId> @@ -85,6 +84,42 @@ </execution> </executions> </plugin> + <plugin> + <artifactId>maven-checkstyle-plugin</artifactId> + <executions> + <execution> + <id>onap-java-style</id> + <goals> + <goal>check</goal> + </goals> + <phase>process-sources</phase> + <configuration> + <!-- Use Google Java Style Guide: + https://github.com/checkstyle/checkstyle/blob/master/src/main/resources/google_checks.xml + with minor changes --> + <configLocation>onap-checkstyle/onap-java-style.xml</configLocation> + <!-- <sourceDirectory> is needed so that checkstyle ignores the generated sources directory --> + <sourceDirectory>${project.build.sourceDirectory}/src/main/java</sourceDirectory> + <includeResources>true</includeResources> + <includeTestSourceDirectory>true</includeTestSourceDirectory> + <includeTestResources>true</includeTestResources> + <excludes> + </excludes> + <consoleOutput>true</consoleOutput> + <failsOnViolation>true</failsOnViolation> + <violationSeverity>warning</violationSeverity> + </configuration> + </execution> + </executions> + <dependencies> + <dependency> + <groupId>org.onap.oparent</groupId> + <artifactId>checkstyle</artifactId> + <version>${oparent.version}</version> + <scope>compile</scope> + </dependency> + </dependencies> + </plugin> </plugins> </build> diff --git a/controlloop/common/feature-controlloop-trans/src/main/java/org/onap/policy/drools/apps/controlloop/feature/trans/ControlLoopMetricsFeature.java b/controlloop/common/feature-controlloop-trans/src/main/java/org/onap/policy/drools/apps/controlloop/feature/trans/ControlLoopMetricsFeature.java index f1d577d43..259925324 100644 --- a/controlloop/common/feature-controlloop-trans/src/main/java/org/onap/policy/drools/apps/controlloop/feature/trans/ControlLoopMetricsFeature.java +++ b/controlloop/common/feature-controlloop-trans/src/main/java/org/onap/policy/drools/apps/controlloop/feature/trans/ControlLoopMetricsFeature.java @@ -65,7 +65,7 @@ public class ControlLoopMetricsFeature implements PolicyControllerFeatureAPI { * @param protocol - protocol * @param topic - topic * @param event - event object - * @return + * @return false do not take ownership else true */ @Override public boolean beforeDeliver(PolicyController controller, CommInfrastructure protocol, String topic, Object event) { diff --git a/controlloop/common/guard/checkstyle-suppressions.xml b/controlloop/common/guard/checkstyle-suppressions.xml new file mode 100644 index 000000000..9b071df87 --- /dev/null +++ b/controlloop/common/guard/checkstyle-suppressions.xml @@ -0,0 +1,30 @@ +<?xml version="1.0"?> +<!-- + ============LICENSE_START======================================================= + Copyright (C) 2018 AT&T Technologies. 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. + + SPDX-License-Identifier: Apache-2.0 + ============LICENSE_END========================================================= +--> + +<!DOCTYPE suppressions PUBLIC + "-//Puppy Crawl//DTD Suppressions 1.0//EN" + "http://www.puppycrawl.com/dtds/suppressions_1_0.dtd"> + +<suppressions> + <suppress checks="AbbreviationAsWordInName" + files="PNFTargetLock.java|VNFTargetLock.java|VMTargetLock.java|PolicyGuardRequest.java|PolicyGuardResponse.java|PolicyGuardXacmlHelper.java|TargetLock.java" + lines="1-9999"/> +</suppressions> diff --git a/controlloop/common/guard/pom.xml b/controlloop/common/guard/pom.xml index a3ecf961f..08e403e41 100644 --- a/controlloop/common/guard/pom.xml +++ b/controlloop/common/guard/pom.xml @@ -107,4 +107,44 @@ <scope>test</scope> </dependency> </dependencies> + <build> + <plugins> + <plugin> + <artifactId>maven-checkstyle-plugin</artifactId> + <executions> + <execution> + <id>onap-java-style</id> + <goals> + <goal>check</goal> + </goals> + <phase>process-sources</phase> + <configuration> + <!-- Use Google Java Style Guide: + https://github.com/checkstyle/checkstyle/blob/master/src/main/resources/google_checks.xml + with minor changes --> + <configLocation>onap-checkstyle/onap-java-style.xml</configLocation> + <!-- <sourceDirectory> is needed so that checkstyle ignores the generated sources directory --> + <sourceDirectory>${project.build.sourceDirectory}/src/main/java</sourceDirectory> + <includeResources>true</includeResources> + <includeTestSourceDirectory>true</includeTestSourceDirectory> + <includeTestResources>true</includeTestResources> + <excludes> + </excludes> + <consoleOutput>true</consoleOutput> + <failsOnViolation>true</failsOnViolation> + <violationSeverity>warning</violationSeverity> + </configuration> + </execution> + </executions> + <dependencies> + <dependency> + <groupId>org.onap.oparent</groupId> + <artifactId>checkstyle</artifactId> + <version>${oparent.version}</version> + <scope>compile</scope> + </dependency> + </dependencies> + </plugin> + </plugins> + </build> </project> diff --git a/controlloop/common/guard/src/main/java/org/onap/policy/guard/CallGuardTask.java b/controlloop/common/guard/src/main/java/org/onap/policy/guard/CallGuardTask.java index 146f42170..59a1816b7 100644 --- a/controlloop/common/guard/src/main/java/org/onap/policy/guard/CallGuardTask.java +++ b/controlloop/common/guard/src/main/java/org/onap/policy/guard/CallGuardTask.java @@ -20,6 +20,8 @@ package org.onap.policy.guard; +import com.att.research.xacml.api.DataTypeException; +import com.att.research.xacml.std.annotations.RequestParser; import java.util.HashSet; import java.util.Set; import java.util.UUID; @@ -27,8 +29,6 @@ import java.util.function.Supplier; import org.drools.core.WorkingMemory; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import com.att.research.xacml.api.DataTypeException; -import com.att.research.xacml.std.annotations.RequestParser; public class CallGuardTask implements Runnable { @@ -36,14 +36,14 @@ public class CallGuardTask implements Runnable { /** * Actor/recipe pairs whose guard requests need a VF Module count. Each element is of - * the form "<actor>:<recipe>". + * the form "<actor>:<recipe>". */ private static final Set<String> NEEDS_VF_COUNT = new HashSet<>(); /** * Actor/recipe pairs whose guard requests need the VF Module count to be incremented * (i.e., because a module is being added). Each element is of the form - * "<actor>:<recipe>". + * "<actor>:<recipe>". */ private static final Set<String> INCR_VF_COUNT = new HashSet<>(); @@ -69,7 +69,8 @@ public class CallGuardTask implements Runnable { /** * Guard url is grabbed from PolicyEngine.manager properties */ - public CallGuardTask(WorkingMemory wm, String cl, String act, String rec, String tar, String reqId, Supplier<Integer> vfcnt) { + public CallGuardTask(WorkingMemory wm, String cl, String act, + String rec, String tar, String reqId, Supplier<Integer> vfcnt) { workingMemory = wm; clname = cl; actor = act; diff --git a/controlloop/common/guard/src/main/java/org/onap/policy/guard/PipEngineGetStatus.java b/controlloop/common/guard/src/main/java/org/onap/policy/guard/PipEngineGetStatus.java index 40b26c847..36bb36f5c 100644 --- a/controlloop/common/guard/src/main/java/org/onap/policy/guard/PipEngineGetStatus.java +++ b/controlloop/common/guard/src/main/java/org/onap/policy/guard/PipEngineGetStatus.java @@ -39,14 +39,12 @@ import java.util.Collection; import java.util.Collections; import java.util.HashSet; import java.util.Iterator; -import java.util.List; import java.util.Properties; import java.util.Set; import javax.persistence.EntityManager; import javax.persistence.EntityManagerFactory; import javax.persistence.NoResultException; -import javax.persistence.NonUniqueResultException; import javax.persistence.Persistence; import javax.persistence.Query; @@ -66,26 +64,12 @@ public class PipEngineGetStatus extends StdConfigurableEngine { private static final String XML_SCHEMA_STRING = "http://www.w3.org/2001/XMLSchema#string"; - private static final String XACML_SUBJECT_CATEGORY_ACCESS_SUBJECT = - "urn:oasis:names:tc:xacml:1.0:subject-category:access-subject"; - private static final String XACML_ACTOR_ACTOR_ID = "urn:oasis:names:tc:xacml:1.0:actor:actor-id"; - private static final String XACML_ATTRIBUTE_CATEGORY_ACTION = - "urn:oasis:names:tc:xacml:3.0:attribute-category:action"; - private static final String XACML_OPERATION_OPERATION_ID = "urn:oasis:names:tc:xacml:1.0:operation:operation-id"; private static final String XACML_ATTRIBUTE_CATEGORY_RESOURCE = "urn:oasis:names:tc:xacml:3.0:attribute-category:resource"; private static final String XACML_TARGET_TARGET_ID = "urn:oasis:names:tc:xacml:1.0:target:target-id"; private static final String XACML_TEST_SQL_RESOURCE_OPERATIONS_STATUS = "com:att:research:xacml:test:sql:resource:operations:status"; - private static final PIPRequest PIP_REQUEST_ACTOR = - new StdPIPRequest(new IdentifierImpl(XACML_SUBJECT_CATEGORY_ACCESS_SUBJECT), - new IdentifierImpl(XACML_ACTOR_ACTOR_ID), new IdentifierImpl(XML_SCHEMA_STRING)); - - private static final PIPRequest PIP_REQUEST_RECIPE = - new StdPIPRequest(new IdentifierImpl(XACML_ATTRIBUTE_CATEGORY_ACTION), - new IdentifierImpl(XACML_OPERATION_OPERATION_ID), new IdentifierImpl(XML_SCHEMA_STRING)); - private static final PIPRequest PIP_REQUEST_TARGET = new StdPIPRequest(new IdentifierImpl(XACML_ATTRIBUTE_CATEGORY_RESOURCE), new IdentifierImpl(XACML_TARGET_TARGET_ID), new IdentifierImpl(XML_SCHEMA_STRING)); @@ -121,7 +105,7 @@ public class PipEngineGetStatus extends StdConfigurableEngine { } else if (!issuer.contains(this.getIssuer())) { // Notice, we are checking here for the base issuer prefix. logger.debug("Requested issuer '{}' does not match {}", issuer, getIssuer()); - logger.debug("Status PIP - Issuer {} does not match with: ", issuer, this.getIssuer()); + logger.debug("Status PIP - Issuer {} does not match with: {}", issuer, this.getIssuer()); return StdPIPResponse.PIP_RESPONSE_EMPTY; } @@ -282,13 +266,13 @@ public class PipEngineGetStatus extends StdConfigurableEngine { // Run the query // String ret = null; - try{ + try { ret = ((String)nq.getSingleResult()); - } catch(NoResultException ex) { + } catch (NoResultException ex) { logger.debug("NoResultException for getSingleResult()"); ret = "NO_MATCHING_ENTRY"; - } catch(Exception ex){ - logger.error("getStatusFromDB threw: ", ex); + } catch (Exception ex) { + logger.error("getStatusFromDB threw an exception", ex); } if (ret != null) { logger.debug("SQL query result: {}", ret); @@ -298,13 +282,13 @@ public class PipEngineGetStatus extends StdConfigurableEngine { // try { em.close(); - } catch(Exception ex){ - logger.error("getStatusFromDB threw: ", ex); + } catch (Exception ex) { + logger.error("getStatusFromDB threw an exception ", ex); } try { emf.close(); - } catch(Exception ex){ - logger.error("getStatusFromDB threw: ", ex); + } catch (Exception ex) { + logger.error("getStatusFromDB threw an exception ", ex); } return ret; } diff --git a/controlloop/common/guard/src/main/java/org/onap/policy/guard/PolicyGuard.java b/controlloop/common/guard/src/main/java/org/onap/policy/guard/PolicyGuard.java index a7b4f73f2..865a442b9 100644 --- a/controlloop/common/guard/src/main/java/org/onap/policy/guard/PolicyGuard.java +++ b/controlloop/common/guard/src/main/java/org/onap/policy/guard/PolicyGuard.java @@ -85,28 +85,28 @@ public class PolicyGuard { * * @param targetType the target type * @param targetInstance the target instance - * @param requestID the request Id + * @param requestId the request Id * @return the TargetLock * @throws IllegalArgumentException if an argument is null */ public static TargetLock createTargetLock(TargetType targetType, String targetInstance, - UUID requestID, LockCallback callback) { + UUID requestId, LockCallback callback) { switch (targetType) { case PNF: // // Create the Lock object // - return new PNFTargetLock(targetType, targetInstance, requestID, callback); + return new PNFTargetLock(targetType, targetInstance, requestId, callback); case VM: // // Create the Lock object // - return new VMTargetLock(targetType, targetInstance, requestID, callback); + return new VMTargetLock(targetType, targetInstance, requestId, callback); case VNF: // // Create the Lock object // - return new VNFTargetLock(targetType, targetInstance, requestID, callback); + return new VNFTargetLock(targetType, targetInstance, requestId, callback); default: logger.error("invalid target type {} for lock on {}", targetType, targetInstance); return null; @@ -118,21 +118,21 @@ public class PolicyGuard { * * @param targetType the target type * @param targetInstance the target instance - * @param requestID the request Id + * @param requestId the request Id * @param callback the LockCallback * @param holdSec maximum number of seconds to hold the lock * @return the LockResult * @throws IllegalArgumentException if an argument is null */ public static LockResult<GuardResult, TargetLock> lockTarget(TargetType targetType, String targetInstance, - UUID requestID, LockCallback callback, int holdSec) { - String owner = makeOwner(targetType, requestID); + UUID requestId, LockCallback callback, int holdSec) { + String owner = makeOwner(targetType, requestId); boolean result = factory.getManager().lock(targetInstance, owner, holdSec); if (!result) { return LockResult.createLockResult(GuardResult.LOCK_DENIED, null); } - TargetLock lock = createTargetLock(targetType, targetInstance, requestID, callback); + TargetLock lock = createTargetLock(targetType, targetInstance, requestId, callback); if (lock == null) { // // Bad lock type: unlock and return exception result @@ -188,12 +188,12 @@ public class PolicyGuard { * * @param targetType the target type * @param targetInstance the target instance - * @param requestID the request Id + * @param requestId the request Id * @return <code>true</code> if the target is locked, <code>false</code> otherwise * @throws IllegalArgumentException if an argument is null */ - public static boolean isLocked(TargetType targetType, String targetInstance, UUID requestID) { - String owner = makeOwner(targetType, requestID); + public static boolean isLocked(TargetType targetType, String targetInstance, UUID requestId) { + String owner = makeOwner(targetType, requestId); return factory.getManager().isLockedBy(targetInstance, owner); } @@ -204,16 +204,16 @@ public class PolicyGuard { * @return the "owner" of a resource * @throws IllegalArgumentException if either argument is null */ - private static String makeOwner(TargetType targetType, UUID requestID) { + private static String makeOwner(TargetType targetType, UUID requestId) { if (targetType == null) { - throw new IllegalArgumentException("null targetType for lock request id " + requestID); + throw new IllegalArgumentException("null targetType for lock request id " + requestId); } - if (requestID == null) { + if (requestId == null) { throw new IllegalArgumentException("null requestID for lock type " + targetType); } - return targetType + ":" + requestID; + return targetType + ":" + requestId; } /** diff --git a/controlloop/common/guard/src/main/java/org/onap/policy/guard/PolicyGuardRequest.java b/controlloop/common/guard/src/main/java/org/onap/policy/guard/PolicyGuardRequest.java index bca31d904..5cb080fa5 100644 --- a/controlloop/common/guard/src/main/java/org/onap/policy/guard/PolicyGuardRequest.java +++ b/controlloop/common/guard/src/main/java/org/onap/policy/guard/PolicyGuardRequest.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * guard * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * 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. @@ -33,14 +33,14 @@ public class PolicyGuardRequest { * * @param actor the actor * @param target the target - * @param requestID the request Id + * @param requestId the request Id * @param operation the operation */ - public PolicyGuardRequest(String actor, String target, UUID requestID, String operation) { + public PolicyGuardRequest(String actor, String target, UUID requestId, String operation) { super(); this.actor = actor; this.target = target; - this.requestId = requestID; + this.requestId = requestId; this.operation = operation; } @@ -70,8 +70,8 @@ public class PolicyGuardRequest { return requestId; } - public void setRequestID(UUID requestID) { - this.requestId = requestID; + public void setRequestID(UUID requestId) { + this.requestId = requestId; } public String getOperation() { diff --git a/controlloop/common/guard/src/main/java/org/onap/policy/guard/PolicyGuardResponse.java b/controlloop/common/guard/src/main/java/org/onap/policy/guard/PolicyGuardResponse.java index e9ff435f8..d7ece3081 100644 --- a/controlloop/common/guard/src/main/java/org/onap/policy/guard/PolicyGuardResponse.java +++ b/controlloop/common/guard/src/main/java/org/onap/policy/guard/PolicyGuardResponse.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * guard * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * 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. @@ -49,8 +49,8 @@ public class PolicyGuardResponse { return requestId; } - public void setRequestID(UUID requestID) { - this.requestId = requestID; + public void setRequestID(UUID requestId) { + this.requestId = requestId; } public String getResult() { diff --git a/controlloop/common/guard/src/main/java/org/onap/policy/guard/PolicyGuardXacmlHelper.java b/controlloop/common/guard/src/main/java/org/onap/policy/guard/PolicyGuardXacmlHelper.java index 53ba6075e..ec4ebf9cd 100644 --- a/controlloop/common/guard/src/main/java/org/onap/policy/guard/PolicyGuardXacmlHelper.java +++ b/controlloop/common/guard/src/main/java/org/onap/policy/guard/PolicyGuardXacmlHelper.java @@ -115,7 +115,7 @@ public class PolicyGuardXacmlHelper { UrlEntry urlEntry = restUrls[restUrlIndex]; String jsonRequestString = jsonReq.toString(); netLogger.info("[OUT|{}|{}|]{}{}", "GUARD", urlEntry.restUrl, SYSTEM_LS, jsonRequestString); - response = callRESTfulPDP(new ByteArrayInputStream(jsonReq.toString().getBytes()), urlEntry.restUrl, + response = callRestfulPdp(new ByteArrayInputStream(jsonReq.toString().getBytes()), urlEntry.restUrl, urlEntry.authorization, urlEntry.clientAuth, urlEntry.environment); netLogger.info("[IN|{}|{}|]{}{}", "GUARD", urlEntry.restUrl, SYSTEM_LS, response); } catch (Exception e) { @@ -134,7 +134,7 @@ public class PolicyGuardXacmlHelper { * @param environment the Environment * @return response from guard which contains "Permit" or "Deny" */ - private String callRESTfulPDP(InputStream is, URL restURL, String authorization, String clientauth, + private String callRestfulPdp(InputStream is, URL restUrl, String authorization, String clientauth, String environment) { HttpURLConnection connection = null; @@ -142,7 +142,7 @@ public class PolicyGuardXacmlHelper { // // Open up the connection // - connection = (HttpURLConnection) restURL.openConnection(); + connection = (HttpURLConnection) restUrl.openConnection(); connection.setRequestProperty("Content-Type", "application/json"); // // Setup our method and headers diff --git a/controlloop/common/guard/src/main/java/org/onap/policy/guard/impl/VMTargetLock.java b/controlloop/common/guard/src/main/java/org/onap/policy/guard/impl/VMTargetLock.java index dc81712cd..6046e3a32 100644 --- a/controlloop/common/guard/src/main/java/org/onap/policy/guard/impl/VMTargetLock.java +++ b/controlloop/common/guard/src/main/java/org/onap/policy/guard/impl/VMTargetLock.java @@ -41,14 +41,14 @@ public class VMTargetLock implements TargetLock, Serializable { * * @param targetType the target type * @param target the target - * @param requestID the request Id + * @param requestId the request Id * @param callback the callback */ - public VMTargetLock(TargetType targetType, String target, UUID requestID, LockCallback callback) { + public VMTargetLock(TargetType targetType, String target, UUID requestId, LockCallback callback) { this.lockId = UUID.randomUUID(); this.targetType = targetType; this.target = target; - this.requestId = requestID; + this.requestId = requestId; this.callback = callback; } diff --git a/controlloop/common/guard/src/main/java/org/onap/policy/guard/impl/VNFTargetLock.java b/controlloop/common/guard/src/main/java/org/onap/policy/guard/impl/VNFTargetLock.java index 307c11acf..418a3ed78 100644 --- a/controlloop/common/guard/src/main/java/org/onap/policy/guard/impl/VNFTargetLock.java +++ b/controlloop/common/guard/src/main/java/org/onap/policy/guard/impl/VNFTargetLock.java @@ -42,14 +42,14 @@ public class VNFTargetLock implements TargetLock, Serializable { * * @param type the type * @param target the target - * @param requestID the request Id + * @param requestId the request Id * @param callback the callback */ - public VNFTargetLock(TargetType type, String target, UUID requestID, LockCallback callback) { + public VNFTargetLock(TargetType type, String target, UUID requestId, LockCallback callback) { this.lockId = UUID.randomUUID(); this.targetType = type; this.target = target; - this.requestId = requestID; + this.requestId = requestId; this.callback = callback; } diff --git a/controlloop/common/guard/src/test/java/org/onap/policy/guard/PipEngineGetStatusTest.java b/controlloop/common/guard/src/test/java/org/onap/policy/guard/PipEngineGetStatusTest.java index cf83c883c..5e99b0605 100644 --- a/controlloop/common/guard/src/test/java/org/onap/policy/guard/PipEngineGetStatusTest.java +++ b/controlloop/common/guard/src/test/java/org/onap/policy/guard/PipEngineGetStatusTest.java @@ -27,34 +27,14 @@ import static org.junit.Assert.fail; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; -import com.att.research.xacml.api.Attribute; -import com.att.research.xacml.api.AttributeValue; -import com.att.research.xacml.api.Identifier; -import com.att.research.xacml.api.Status; -import com.att.research.xacml.api.pip.PIPEngine; import com.att.research.xacml.api.pip.PIPException; -import com.att.research.xacml.api.pip.PIPFinder; -import com.att.research.xacml.api.pip.PIPRequest; -import com.att.research.xacml.api.pip.PIPResponse; -import com.att.research.xacml.std.IdentifierImpl; -import com.att.research.xacml.std.StdAttribute; -import com.att.research.xacml.std.StdAttributeValue; -import com.att.research.xacml.std.StdStatus; -import com.att.research.xacml.std.StdStatusCode; import com.att.research.xacml.std.pip.StdPIPRequest; import com.att.research.xacml.std.pip.StdPIPResponse; import com.att.research.xacml.std.pip.finders.EngineFinder; -import com.att.research.xacml.util.FactoryException; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; -import java.net.URI; -import java.net.URISyntaxException; -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; import java.util.Properties; -import java.util.UUID; import javax.persistence.EntityManager; import javax.persistence.EntityManagerFactory; @@ -268,144 +248,4 @@ public class PipEngineGetStatusTest { pegs.configure("Dorothy", new Properties()); } - private class DummyPipFinder implements PIPFinder { - @Override - public PIPResponse getAttributes(PIPRequest pipRequest, PIPEngine exclude) throws PIPException { - return null; - } - - @Override - public PIPResponse getAttributes(PIPRequest pipRequest, PIPEngine exclude, PIPFinder pipFinderParent) - throws PIPException { - return null; - } - - @Override - public PIPResponse getMatchingAttributes(PIPRequest pipRequest, PIPEngine exclude) throws PIPException { - try { - List<Attribute> attributeList = new ArrayList<>(); - Identifier categoryIdIn = new IdentifierImpl(new URI("http://somewhere.over.the.rainbow/category")); - Identifier dataTypeIdIn = new IdentifierImpl(new URI("http://www.w3.org/2001/XMLSchema#string")); - - Identifier attributeIdIn0 = new IdentifierImpl(new URI(UUID.randomUUID().toString())); - AttributeValue<String> valueIn0 = new StdAttributeValue<String>(dataTypeIdIn, "ActorDorothy"); - Attribute attribute0 = new StdAttribute(categoryIdIn, attributeIdIn0, valueIn0); - attributeList.add(attribute0); - - Identifier attributeIdIn1 = new IdentifierImpl(new URI(UUID.randomUUID().toString())); - AttributeValue<String> valueIn1 = new StdAttributeValue<String>(dataTypeIdIn, "OperationHomeFromOZ"); - Attribute attribute1 = new StdAttribute(categoryIdIn, attributeIdIn1, valueIn1); - attributeList.add(attribute1); - - Identifier attributeIdIn2 = new IdentifierImpl(new URI(UUID.randomUUID().toString())); - AttributeValue<String> valueIn2 = new StdAttributeValue<String>(dataTypeIdIn, "TargetWickedWitch"); - Attribute attribute2 = new StdAttribute(categoryIdIn, attributeIdIn2, valueIn2); - attributeList.add(attribute2); - - return new StdPIPResponse(attributeList); - } catch (Exception e) { - return null; - } - } - - @Override - public PIPResponse getMatchingAttributes(PIPRequest pipRequest, PIPEngine exclude, PIPFinder pipFinderParent) - throws PIPException { - return null; - } - - @Override - public Collection<PIPEngine> getPIPEngines() { - return null; - } - } - - private class DummyPipFinderPipException implements PIPFinder { - @Override - public PIPResponse getAttributes(PIPRequest pipRequest, PIPEngine exclude) throws PIPException { - return null; - } - - @Override - public PIPResponse getAttributes(PIPRequest pipRequest, PIPEngine exclude, PIPFinder pipFinderParent) - throws PIPException { - return null; - } - - @Override - public PIPResponse getMatchingAttributes(PIPRequest pipRequest, PIPEngine exclude) throws PIPException { - throw new PIPException(); - } - - @Override - public PIPResponse getMatchingAttributes(PIPRequest pipRequest, PIPEngine exclude, PIPFinder pipFinderParent) - throws PIPException { - return null; - } - - @Override - public Collection<PIPEngine> getPIPEngines() { - return null; - } - } - - private class DummyPipFinderResponseStatusNok implements PIPFinder { - @Override - public PIPResponse getAttributes(PIPRequest pipRequest, PIPEngine exclude) throws PIPException { - return null; - } - - @Override - public PIPResponse getAttributes(PIPRequest pipRequest, PIPEngine exclude, PIPFinder pipFinderParent) - throws PIPException { - return null; - } - - @Override - public PIPResponse getMatchingAttributes(PIPRequest pipRequest, PIPEngine exclude) throws PIPException { - Status status = new StdStatus(StdStatusCode.STATUS_CODE_PROCESSING_ERROR, "Processing Error"); - return new StdPIPResponse(status); - } - - @Override - public PIPResponse getMatchingAttributes(PIPRequest pipRequest, PIPEngine exclude, PIPFinder pipFinderParent) - throws PIPException { - return null; - } - - @Override - public Collection<PIPEngine> getPIPEngines() { - return null; - } - } - - private class DummyPipFinderResponseEmptyAttrs implements PIPFinder { - @Override - public PIPResponse getAttributes(PIPRequest pipRequest, PIPEngine exclude) throws PIPException { - return null; - } - - @Override - public PIPResponse getAttributes(PIPRequest pipRequest, PIPEngine exclude, PIPFinder pipFinderParent) - throws PIPException { - return null; - } - - @Override - public PIPResponse getMatchingAttributes(PIPRequest pipRequest, PIPEngine exclude) throws PIPException { - List<Attribute> attributeList = new ArrayList<>(); - return new StdPIPResponse(attributeList); - } - - @Override - public PIPResponse getMatchingAttributes(PIPRequest pipRequest, PIPEngine exclude, PIPFinder pipFinderParent) - throws PIPException { - return null; - } - - @Override - public Collection<PIPEngine> getPIPEngines() { - return null; - } - } } diff --git a/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/ControlLoopEvent.java b/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/ControlLoopEvent.java index 2753ececc..944bef754 100644 --- a/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/ControlLoopEvent.java +++ b/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/ControlLoopEvent.java @@ -20,11 +20,10 @@ package org.onap.policy.controlloop; +import com.google.gson.annotations.SerializedName; import java.io.Serializable; import java.util.UUID; -import com.google.gson.annotations.SerializedName; - public abstract class ControlLoopEvent implements Serializable { private static final long serialVersionUID = 2391252138583119195L; diff --git a/controlloop/common/model-impl/rest/checkstyle-suppressions.xml b/controlloop/common/model-impl/rest/checkstyle-suppressions.xml new file mode 100644 index 000000000..19202a9f0 --- /dev/null +++ b/controlloop/common/model-impl/rest/checkstyle-suppressions.xml @@ -0,0 +1,30 @@ +<?xml version="1.0"?> +<!-- + ============LICENSE_START======================================================= + Copyright (C) 2018 AT&T Technologies. 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. + + SPDX-License-Identifier: Apache-2.0 + ============LICENSE_END========================================================= +--> + +<!DOCTYPE suppressions PUBLIC + "-//Puppy Crawl//DTD Suppressions 1.0//EN" + "http://www.puppycrawl.com/dtds/suppressions_1_0.dtd"> + +<suppressions> + <suppress checks="AbbreviationAsWordInName" + files="RESTManager.java" + lines="1-9999"/> +</suppressions> diff --git a/controlloop/common/model-impl/rest/pom.xml b/controlloop/common/model-impl/rest/pom.xml index adaee84a4..2ca997b9c 100644 --- a/controlloop/common/model-impl/rest/pom.xml +++ b/controlloop/common/model-impl/rest/pom.xml @@ -46,4 +46,46 @@ <scope>provided</scope> </dependency> </dependencies> + + <build> + <plugins> + <plugin> + <artifactId>maven-checkstyle-plugin</artifactId> + <executions> + <execution> + <id>onap-java-style</id> + <goals> + <goal>check</goal> + </goals> + <phase>process-sources</phase> + <configuration> + <!-- Use Google Java Style Guide: + https://github.com/checkstyle/checkstyle/blob/master/src/main/resources/google_checks.xml + with minor changes --> + <configLocation>onap-checkstyle/onap-java-style.xml</configLocation> + <!-- <sourceDirectory> is needed so that checkstyle ignores the generated sources directory --> + <sourceDirectory>${project.build.sourceDirectory}</sourceDirectory> + <includeResources>true</includeResources> + <includeTestSourceDirectory>true</includeTestSourceDirectory> + <includeTestResources>true</includeTestResources> + <excludes> + </excludes> + <suppressionsLocation>${project.basedir}/checkstyle-suppressions.xml</suppressionsLocation> + <consoleOutput>true</consoleOutput> + <failsOnViolation>true</failsOnViolation> + <violationSeverity>warning</violationSeverity> + </configuration> + </execution> + </executions> + <dependencies> + <dependency> + <groupId>org.onap.oparent</groupId> + <artifactId>checkstyle</artifactId> + <version>${oparent.version}</version> + <scope>compile</scope> + </dependency> + </dependencies> + </plugin> + </plugins> + </build> </project> diff --git a/controlloop/common/model-impl/rest/src/main/java/org/onap/policy/rest/HttpDeleteWithBody.java b/controlloop/common/model-impl/rest/src/main/java/org/onap/policy/rest/HttpDeleteWithBody.java index 262872262..dc75334a2 100644 --- a/controlloop/common/model-impl/rest/src/main/java/org/onap/policy/rest/HttpDeleteWithBody.java +++ b/controlloop/common/model-impl/rest/src/main/java/org/onap/policy/rest/HttpDeleteWithBody.java @@ -3,6 +3,7 @@ * rest * ================================================================================ * Copyright (C) 2018 Amdocs. All rights reserved. + * Modifications Copyright (C) 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. @@ -20,10 +21,8 @@ package org.onap.policy.rest; -import org.apache.http.client.methods.HttpEntityEnclosingRequestBase; - import java.net.URI; - +import org.apache.http.client.methods.HttpEntityEnclosingRequestBase; /** * Allows for HTTP DELETE requests to contain a body, which the HttpDelete diff --git a/controlloop/common/model-impl/sdc/checkstyle-suppressions.xml b/controlloop/common/model-impl/sdc/checkstyle-suppressions.xml new file mode 100644 index 000000000..fd73d24e3 --- /dev/null +++ b/controlloop/common/model-impl/sdc/checkstyle-suppressions.xml @@ -0,0 +1,30 @@ +<?xml version="1.0"?> +<!-- + ============LICENSE_START======================================================= + Copyright (C) 2018 AT&T Technologies. 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. + + SPDX-License-Identifier: Apache-2.0 + ============LICENSE_END========================================================= +--> + +<!DOCTYPE suppressions PUBLIC + "-//Puppy Crawl//DTD Suppressions 1.0//EN" + "http://www.puppycrawl.com/dtds/suppressions_1_0.dtd"> + +<suppressions> + <suppress checks="AbbreviationAsWordInName" + files="ResourceInstance.java|ServiceInstance.java|Service.java" + lines="1-9999"/> +</suppressions> diff --git a/controlloop/common/model-impl/sdc/pom.xml b/controlloop/common/model-impl/sdc/pom.xml index 970e53083..77bca7d6c 100644 --- a/controlloop/common/model-impl/sdc/pom.xml +++ b/controlloop/common/model-impl/sdc/pom.xml @@ -38,4 +38,46 @@ <scope>test</scope> </dependency> </dependencies> + + <build> + <plugins> + <plugin> + <artifactId>maven-checkstyle-plugin</artifactId> + <executions> + <execution> + <id>onap-java-style</id> + <goals> + <goal>check</goal> + </goals> + <phase>process-sources</phase> + <configuration> + <!-- Use Google Java Style Guide: + https://github.com/checkstyle/checkstyle/blob/master/src/main/resources/google_checks.xml + with minor changes --> + <configLocation>onap-checkstyle/onap-java-style.xml</configLocation> + <!-- <sourceDirectory> is needed so that checkstyle ignores the generated sources directory --> + <sourceDirectory>${project.build.sourceDirectory}</sourceDirectory> + <includeResources>true</includeResources> + <includeTestSourceDirectory>true</includeTestSourceDirectory> + <includeTestResources>true</includeTestResources> + <excludes> + </excludes> + <suppressionsLocation>${project.basedir}/checkstyle-suppressions.xml</suppressionsLocation> + <consoleOutput>true</consoleOutput> + <failsOnViolation>true</failsOnViolation> + <violationSeverity>warning</violationSeverity> + </configuration> + </execution> + </executions> + <dependencies> + <dependency> + <groupId>org.onap.oparent</groupId> + <artifactId>checkstyle</artifactId> + <version>${oparent.version}</version> + <scope>compile</scope> + </dependency> + </dependencies> + </plugin> + </plugins> + </build> </project> diff --git a/controlloop/common/model-impl/so/checkstyle-suppressions.xml b/controlloop/common/model-impl/so/checkstyle-suppressions.xml new file mode 100644 index 000000000..01bb15f8a --- /dev/null +++ b/controlloop/common/model-impl/so/checkstyle-suppressions.xml @@ -0,0 +1,30 @@ +<?xml version="1.0"?> +<!-- + ============LICENSE_START======================================================= + Copyright (C) 2018 AT&T Technologies. 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. + + SPDX-License-Identifier: Apache-2.0 + ============LICENSE_END========================================================= +--> + +<!DOCTYPE suppressions PUBLIC + "-//Puppy Crawl//DTD Suppressions 1.0//EN" + "http://www.puppycrawl.com/dtds/suppressions_1_0.dtd"> + +<suppressions> + <suppress checks="AbbreviationAsWordInName" + files="SORequest.java|SORequestDetails.java|SORequestReference.java|SORequestInfo.java|SORequestError.java|SORequestParameters.java|SOResponse.java|SOResponseWrapper.java|SOServiceExceptionHolder.java|SOSubscriberInfo.java|SOManager.java|SOCloudConfiguration.java|SOAsyncRequestStatus.java|SOInstanceReferences.java|SOModelInfo.java|SORelatedInstance.java|SORelatedInstanceList.java|SORequestStatus.java|SORequestReferences.java|SOPolicyExceptionHolder.java|SORelatedInstanceListElement.java" + lines="1-9999"/> +</suppressions> diff --git a/controlloop/common/model-impl/so/pom.xml b/controlloop/common/model-impl/so/pom.xml index 549f3a40c..d09a2b2ec 100644 --- a/controlloop/common/model-impl/so/pom.xml +++ b/controlloop/common/model-impl/so/pom.xml @@ -70,4 +70,45 @@ <scope>test</scope> </dependency> </dependencies> + <build> + <plugins> + <plugin> + <artifactId>maven-checkstyle-plugin</artifactId> + <executions> + <execution> + <id>onap-java-style</id> + <goals> + <goal>check</goal> + </goals> + <phase>process-sources</phase> + <configuration> + <!-- Use Google Java Style Guide: + https://github.com/checkstyle/checkstyle/blob/master/src/main/resources/google_checks.xml + with minor changes --> + <configLocation>onap-checkstyle/onap-java-style.xml</configLocation> + <!-- <sourceDirectory> is needed so that checkstyle ignores the generated sources directory --> + <sourceDirectory>${project.build.sourceDirectory}</sourceDirectory> + <includeResources>true</includeResources> + <includeTestSourceDirectory>true</includeTestSourceDirectory> + <includeTestResources>true</includeTestResources> + <excludes> + </excludes> + <suppressionsLocation>${project.basedir}/checkstyle-suppressions.xml</suppressionsLocation> + <consoleOutput>true</consoleOutput> + <failsOnViolation>true</failsOnViolation> + <violationSeverity>warning</violationSeverity> + </configuration> + </execution> + </executions> + <dependencies> + <dependency> + <groupId>org.onap.oparent</groupId> + <artifactId>checkstyle</artifactId> + <version>${oparent.version}</version> + <scope>compile</scope> + </dependency> + </dependencies> + </plugin> + </plugins> + </build> </project> 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 index 5acd973ef..20b1ac57b 100644 --- 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 @@ -77,7 +77,7 @@ public final class SOManager { * @param username user name on SO * @param password password on SO * @param request the request to issue to SO - * @return + * @return the SO Response object */ public SOResponse createModuleInstance(final String url, final String urlBase, final String username, final String password, final SORequest request) { @@ -89,7 +89,7 @@ public final class SOManager { restManager.post(url, username, password, createSimpleHeaders(), MEDIA_TYPE, requestJson); // Process the response from SO - SOResponse response = waitForSOOperationCompletion(urlBase, username, password, url, httpResponse); + SOResponse response = waitForSoOperationCompletion(urlBase, username, password, url, httpResponse); if (SO_RESPONSE_ERROR != response.getHttpResponseCode()) { return response; } else { @@ -98,22 +98,21 @@ public final class SOManager { } /** - * Works just like {@link SOManager#asyncSORestCall(String, WorkingMemory, String, String, String, SORequest) - * except the vfModuleInstanceId is always null + * Works just like SOManager#asyncSORestCall(String, WorkingMemory, String, String, String, SORequest) + * except the vfModuleInstanceId is always null. * - * @see SOManager#asyncSORestCall(String, WorkingMemory, String, String, String, SORequest) */ - public Future<SOResponse> asyncSORestCall(final String requestID, final WorkingMemory wm, + public Future<SOResponse> asyncSORestCall(final String requestId, final WorkingMemory wm, final String serviceInstanceId, final String vnfInstanceId, final SORequest request) { - return asyncSORestCall(requestID, wm, serviceInstanceId, vnfInstanceId, null, 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 + * @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 @@ -122,18 +121,20 @@ public final class SOManager { * @param request the SO request * @return a concurrent Future for the thread that handles the request */ - public Future<SOResponse> 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, + public Future<SOResponse> 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<SOResponse> { - final String requestID; + private class AsyncSoRestCallThread implements Callable<SOResponse> { + final String requestId; final WorkingMemory wm; final String serviceInstanceId; final String vnfInstanceId; @@ -150,9 +151,11 @@ public final class SOManager { * @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; + 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; @@ -191,10 +194,10 @@ public final class SOManager { } // Process the response from SO - SOResponse response = waitForSOOperationCompletion(urlBase, username, password, url, httpResponse); + SOResponse response = waitForSoOperationCompletion(urlBase, username, password, url, httpResponse); // Return the response to Drools in its working memory - SOResponseWrapper soWrapper = new SOResponseWrapper(response, requestID); + SOResponseWrapper soWrapper = new SOResponseWrapper(response, requestId); wm.insert(soWrapper); return response; @@ -211,11 +214,11 @@ public final class SOManager { * @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, + private SOResponse waitForSoOperationCompletion(final String urlBaseSO, final String username, final String password, final String initialRequestURL, final Pair<Integer, String> initialHTTPResponse) { // Process the initial response from SO, the response to a post - SOResponse response = processSOResponse(initialRequestURL, initialHTTPResponse); + SOResponse response = processSoResponse(initialRequestURL, initialHTTPResponse); if (SO_RESPONSE_ERROR == response.getHttpResponseCode()) { return response; } @@ -224,7 +227,7 @@ public final class SOManager { String urlGet = urlBaseSO + "/orchestrationRequests/v5/" + response.getRequestReferences().getRequestId(); // The HTTP status code of the latest response - Pair<Integer, String> latestHTTPResponse = initialHTTPResponse; + Pair<Integer, String> latestHttpResponse = initialHTTPResponse; // Wait for the response from SO for (int attemptsLeft = GET_REQUESTS_BEFORE_TIMEOUT; attemptsLeft >= 0; attemptsLeft--) { @@ -232,7 +235,7 @@ public final class SOManager { // response // here before // issuing any other requests - if (isRequestStateFinished(latestHTTPResponse, response)) { + if (isRequestStateFinished(latestHttpResponse, response)) { return response; } @@ -252,13 +255,13 @@ public final class SOManager { Pair<Integer, String> httpResponse = restManager.get(urlGet, username, password, createSimpleHeaders()); // Get our response - response = processSOResponse(urlGet, httpResponse); + response = processSoResponse(urlGet, httpResponse); if (SO_RESPONSE_ERROR == response.getHttpResponseCode()) { return response; } // Our latest HTTP response code - latestHTTPResponse = httpResponse; + latestHttpResponse = httpResponse; } // We have timed out on the SO request @@ -273,7 +276,7 @@ public final class SOManager { * @param httpResponse The HTTP message returned from SO * @return The parsed response */ - private SOResponse processSOResponse(final String requestURL, final Pair<Integer, String> httpResponse) { + private SOResponse processSoResponse(final String requestUrl, final Pair<Integer, String> httpResponse) { SOResponse response = new SOResponse(); // A null httpDetails indicates a HTTP problem, a valid response from SO must be @@ -299,10 +302,10 @@ public final class SOManager { response.setHttpResponseCode(httpResponse.first); } - netLogger.info("[IN|{}|{}|]{}{}", "SO", requestURL, LINE_SEPARATOR, httpResponse.second); + netLogger.info("[IN|{}|{}|]{}{}", "SO", requestUrl, LINE_SEPARATOR, httpResponse.second); if (logger.isDebugEnabled()) { - logger.debug("***** Response to SO Request to URL {}:", requestURL); + logger.debug("***** Response to SO Request to URL {}:", requestUrl); logger.debug(httpResponse.second); } @@ -332,12 +335,12 @@ public final class SOManager { /** * Check that the request state of a response is finished. * - * @param latestHTTPDetails the HTTP details of the response + * @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<Integer, String> latestHTTPDetails, final SOResponse response) { - if (latestHTTPDetails != null && 200 == latestHTTPDetails.first && isRequestStateDefined(response)) { + private boolean isRequestStateFinished(final Pair<Integer, String> 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 { diff --git a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SoOperationType.java b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SoOperationType.java index 7619e3a84..191ee05d2 100644 --- a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SoOperationType.java +++ b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SoOperationType.java @@ -3,6 +3,7 @@ * so * ================================================================================ * Copyright (C) 2018 Amdocs. All rights reserved. + * Modifications Copyright (C) 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. @@ -21,7 +22,7 @@ package org.onap.policy.so; /** - * Enumeration of SO Operations type that can be performed by a policy + * Enumeration of SO Operations type that can be performed by a policy. */ public enum SoOperationType { SCALE_OUT("Create Vf Module"), diff --git a/controlloop/common/model-impl/trafficgenerator/checkstyle-suppressions.xml b/controlloop/common/model-impl/trafficgenerator/checkstyle-suppressions.xml new file mode 100644 index 000000000..57d62196f --- /dev/null +++ b/controlloop/common/model-impl/trafficgenerator/checkstyle-suppressions.xml @@ -0,0 +1,30 @@ +<?xml version="1.0"?> +<!-- + ============LICENSE_START======================================================= + Copyright (C) 2018 AT&T Technologies. 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. + + SPDX-License-Identifier: Apache-2.0 + ============LICENSE_END========================================================= +--> + +<!DOCTYPE suppressions PUBLIC + "-//Puppy Crawl//DTD Suppressions 1.0//EN" + "http://www.puppycrawl.com/dtds/suppressions_1_0.dtd"> + +<suppressions> + <suppress checks="AbbreviationAsWordInName" + files="PGRequest.java|PGStream.java|PGStreams.java" + lines="1-9999"/> +</suppressions> diff --git a/controlloop/common/model-impl/trafficgenerator/pom.xml b/controlloop/common/model-impl/trafficgenerator/pom.xml index c1684e7c1..02fc90865 100644 --- a/controlloop/common/model-impl/trafficgenerator/pom.xml +++ b/controlloop/common/model-impl/trafficgenerator/pom.xml @@ -41,4 +41,46 @@ <scope>provided</scope> </dependency> </dependencies> + + <build> + <plugins> + <plugin> + <artifactId>maven-checkstyle-plugin</artifactId> + <executions> + <execution> + <id>onap-java-style</id> + <goals> + <goal>check</goal> + </goals> + <phase>process-sources</phase> + <configuration> + <!-- Use Google Java Style Guide: + https://github.com/checkstyle/checkstyle/blob/master/src/main/resources/google_checks.xml + with minor changes --> + <configLocation>onap-checkstyle/onap-java-style.xml</configLocation> + <!-- <sourceDirectory> is needed so that checkstyle ignores the generated sources directory --> + <sourceDirectory>${project.build.sourceDirectory}</sourceDirectory> + <includeResources>true</includeResources> + <includeTestSourceDirectory>true</includeTestSourceDirectory> + <includeTestResources>true</includeTestResources> + <excludes> + </excludes> + <suppressionsLocation>${project.basedir}/checkstyle-suppressions.xml</suppressionsLocation> + <consoleOutput>true</consoleOutput> + <failsOnViolation>true</failsOnViolation> + <violationSeverity>warning</violationSeverity> + </configuration> + </execution> + </executions> + <dependencies> + <dependency> + <groupId>org.onap.oparent</groupId> + <artifactId>checkstyle</artifactId> + <version>${oparent.version}</version> + <scope>compile</scope> + </dependency> + </dependencies> + </plugin> + </plugins> + </build> </project> diff --git a/controlloop/common/model-impl/vfc/checkstyle-suppressions.xml b/controlloop/common/model-impl/vfc/checkstyle-suppressions.xml new file mode 100644 index 000000000..ea04e03f1 --- /dev/null +++ b/controlloop/common/model-impl/vfc/checkstyle-suppressions.xml @@ -0,0 +1,30 @@ +<?xml version="1.0"?> +<!-- + ============LICENSE_START======================================================= + Copyright (C) 2018 AT&T Technologies. 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. + + SPDX-License-Identifier: Apache-2.0 + ============LICENSE_END========================================================= +--> + +<!DOCTYPE suppressions PUBLIC + "-//Puppy Crawl//DTD Suppressions 1.0//EN" + "http://www.puppycrawl.com/dtds/suppressions_1_0.dtd"> + +<suppressions> + <suppress checks="AbbreviationAsWordInName" + files="VFCManager.java|VFCHealActionVmInfo.java|VFCHealAdditionalParams.java|VFCHealRequest.java|VFCRequest.java|VFCResponseDescriptor.java|VFCResponse.java" + lines="1-9999"/> +</suppressions> diff --git a/controlloop/common/model-impl/vfc/pom.xml b/controlloop/common/model-impl/vfc/pom.xml index 2992009c9..75f2ff244 100644 --- a/controlloop/common/model-impl/vfc/pom.xml +++ b/controlloop/common/model-impl/vfc/pom.xml @@ -69,4 +69,45 @@ <scope>provided</scope> </dependency> </dependencies> + <build> + <plugins> + <plugin> + <artifactId>maven-checkstyle-plugin</artifactId> + <executions> + <execution> + <id>onap-java-style</id> + <goals> + <goal>check</goal> + </goals> + <phase>process-sources</phase> + <configuration> + <!-- Use Google Java Style Guide: + https://github.com/checkstyle/checkstyle/blob/master/src/main/resources/google_checks.xml + with minor changes --> + <configLocation>onap-checkstyle/onap-java-style.xml</configLocation> + <!-- <sourceDirectory> is needed so that checkstyle ignores the generated sources directory --> + <sourceDirectory>${project.build.sourceDirectory}</sourceDirectory> + <includeResources>true</includeResources> + <includeTestSourceDirectory>true</includeTestSourceDirectory> + <includeTestResources>true</includeTestResources> + <excludes> + </excludes> + <suppressionsLocation>${project.basedir}/checkstyle-suppressions.xml</suppressionsLocation> + <consoleOutput>true</consoleOutput> + <failsOnViolation>true</failsOnViolation> + <violationSeverity>warning</violationSeverity> + </configuration> + </execution> + </executions> + <dependencies> + <dependency> + <groupId>org.onap.oparent</groupId> + <artifactId>checkstyle</artifactId> + <version>${oparent.version}</version> + <scope>compile</scope> + </dependency> + </dependencies> + </plugin> + </plugins> + </build> </project> diff --git a/controlloop/common/policy-yaml/pom.xml b/controlloop/common/policy-yaml/pom.xml index 633bd9c4f..b48e74d67 100644 --- a/controlloop/common/policy-yaml/pom.xml +++ b/controlloop/common/policy-yaml/pom.xml @@ -79,4 +79,53 @@ <scope>test</scope> </dependency> </dependencies> + + <!-- + Without this defined here, the checkstyle plugin just simply fails outright. This needs to be investigated + further as there was no real debugging details as to why or any configuration issue detected. + NOTE: I had to append src/main/java to the sourceDirectory. + Is it a reactor ordering issue? I'm wondering why it is being compiled after aai, in between the sub-modules + in model-impl. Dependency ordering?? Circular dependency?? + --> + <build> + <plugins> + <plugin> + <artifactId>maven-checkstyle-plugin</artifactId> + <executions> + <execution> + <id>onap-java-style</id> + <goals> + <goal>check</goal> + </goals> + <phase>process-sources</phase> + <configuration> + <!-- Use Google Java Style Guide: + https://github.com/checkstyle/checkstyle/blob/master/src/main/resources/google_checks.xml + with minor changes --> + <configLocation>onap-checkstyle/onap-java-style.xml</configLocation> + <!-- <sourceDirectory> is needed so that checkstyle ignores the generated sources directory --> + <sourceDirectory>${project.build.sourceDirectory}/src/main/java</sourceDirectory> + <includeResources>true</includeResources> + <includeTestSourceDirectory>true</includeTestSourceDirectory> + <includeTestResources>true</includeTestResources> + <excludes> + </excludes> + <consoleOutput>true</consoleOutput> + <failsOnViolation>true</failsOnViolation> + <violationSeverity>warning</violationSeverity> + </configuration> + </execution> + </executions> + <dependencies> + <dependency> + <groupId>org.onap.oparent</groupId> + <artifactId>checkstyle</artifactId> + <version>${oparent.version}</version> + <scope>compile</scope> + </dependency> + </dependencies> + </plugin> + </plugins> + </build> + </project> diff --git a/controlloop/common/simulators/src/main/java/org/onap/policy/simulators/AaiSimulatorJaxRs.java b/controlloop/common/simulators/src/main/java/org/onap/policy/simulators/AaiSimulatorJaxRs.java index 3dd8347f2..3bacead01 100644 --- a/controlloop/common/simulators/src/main/java/org/onap/policy/simulators/AaiSimulatorJaxRs.java +++ b/controlloop/common/simulators/src/main/java/org/onap/policy/simulators/AaiSimulatorJaxRs.java @@ -96,12 +96,13 @@ public class AaiSimulatorJaxRs { } else { Map<String, String> params = new TreeMap<>(); params.put("vnfId", "" + vnfId); - params.put("vnfName", getUUIDValue(vnfId, "ZRDM2MMEX39")); + params.put("vnfName", getUuidValue(vnfId, "ZRDM2MMEX39")); params.put("pnfVndName", "pnf-test-" + vnfId); - params.put("pnfVnfId", getUUIDValue(params.get("pnfVndName"), "jimmy-test")); + params.put("pnfVnfId", getUuidValue(params.get("pnfVndName"), "jimmy-test")); params.put("serviceInstanceVnfName", "service-instance-test-" + vnfId); - params.put("serviceInstanceVnfId", getUUIDValue(params.get("serviceInstanceVnfName"), "jimmy-test-vnf2")); + params.put("serviceInstanceVnfId", + getUuidValue(params.get("serviceInstanceVnfName"), "jimmy-test-vnf2")); return load("aai/AaiNqResponse-GenericVnf.json", params); } @@ -132,7 +133,8 @@ public class AaiSimulatorJaxRs { + "equipment-role\": \"UCPE\", \"orchestration-status\": \"created\", \"management-option\": \"" + "ATT\", \"ipv4-oam-address\": \"32.40.68.35\", \"ipv4-loopback0-address\": \"32.40.64.57\", \"" + "nm-lan-v6-address\": \"2001:1890:e00e:fffe::1345\", \"management-v6-address\": \"" - + "2001:1890:e00e:fffd::36\", \"in-maint\": false, \"prov-status\":\"ACTIVE\", \"is-closed-loop-disabled\": " + isDisabled + + "2001:1890:e00e:fffd::36\", \"in-maint\": false, \"prov-status\":\"ACTIVE\", " + + "\"is-closed-loop-disabled\": " + isDisabled + ", \"resource-version\": \"1493389458092\", \"relationship-list\": {\"relationship\":[{ \"" + "related-to\": \"service-instance\", \"related-link\": \"/aai/v11/business/customers/customer/" + "1610_Func_Global_20160817084727/service-subscriptions/service-subscription/uCPE-VMS/" @@ -154,13 +156,14 @@ public class AaiSimulatorJaxRs { + "USUCP0PCOIL0110UJZZ01-vsrx\" }]} ]}}"; } - final String vnfId = getUUIDValue(vnfName, "5e49ca06-2972-4532-9ed4-6d071588d792"); + final String vnfId = getUuidValue(vnfName, "5e49ca06-2972-4532-9ed4-6d071588d792"); return "{ \"vnf-id\": \"" + vnfId + "\", \"vnf-name\": \"" + vnfName + "\", \"vnf-type\": \"RT\", \"service-id\": \"d7bb0a21-66f2-4e6d-87d9-9ef3ced63ae4\", \"" + "equipment-role\": \"UCPE\", \"orchestration-status\": \"created\", \"management-option\": \"ATT" + "\", \"ipv4-oam-address\": \"32.40.68.35\", \"ipv4-loopback0-address\": \"32.40.64.57\", \"" + "nm-lan-v6-address\": \"2001:1890:e00e:fffe::1345\", \"management-v6-address\": \"" - + "2001:1890:e00e:fffd::36\", \"in-maint\": false, \"prov-status\":\"ACTIVE\", \"is-closed-loop-disabled\": " + isDisabled + + "2001:1890:e00e:fffd::36\", \"in-maint\": false, \"prov-status\":\"ACTIVE\", " + + "\"is-closed-loop-disabled\": " + isDisabled + ", \"resource-version\": \"1493389458092\", \"relationship-list\": {\"relationship\":[{ \"" + "related-to\": \"service-instance\", \"related-link\": \"/aai/v11/business/customers/customer" + "/1610_Func_Global_20160817084727/service-subscriptions/service-subscription/uCPE-VMS/" @@ -199,13 +202,14 @@ public class AaiSimulatorJaxRs { + "generic-vnfs/generic-vnf/getFail\",\"ERR.5.4.6114\"]}}}"; } final boolean isDisabled = "disableClosedLoop".equals(vnfId); - final String vnfName = getUUIDValue(vnfId, "USUCP0PCOIL0110UJRT01"); + final String vnfName = getUuidValue(vnfId, "USUCP0PCOIL0110UJRT01"); return "{ \"vnf-id\": \"" + vnfId + "\", \"vnf-name\": \"" + vnfName + "\", \"vnf-type\": \"RT\", \"service-id\": \"" + "d7bb0a21-66f2-4e6d-87d9-9ef3ced63ae4\", \"equipment-role\": \"UCPE\", \"orchestration-status" + "\": \"created\", \"management-option\": \"ATT\", \"ipv4-oam-address\": \"32.40.68.35\", \"" + "ipv4-loopback0-address\": \"32.40.64.57\", \"nm-lan-v6-address\": \"2001:1890:e00e:fffe::1345" - + "\", \"management-v6-address\": \"2001:1890:e00e:fffd::36\", \"in-maint\": false, \"prov-status\":\"ACTIVE\", \"" + "" + + "\", \"management-v6-address\": \"2001:1890:e00e:fffd::36\", \"in-maint\": false, " + + "\"prov-status\":\"ACTIVE\", \"" + "" + "is-closed-loop-disabled\": " + isDisabled + ", \"resource-version\": \"1493389458092\", \"" + "relationship-list\": {\"relationship\":[{ \"related-to\": \"service-instance\", \"related-link" + "\": \"/aai/v11/business/customers/customer/1610_Func_Global_20160817084727/service-subscriptions" @@ -243,11 +247,12 @@ public class AaiSimulatorJaxRs { + " Found:No Node of type generic-vnf found at nodes/vservers\",\"ERR.5.4.6114\"]}}}"; } final boolean isDisabled = "disableClosedLoop".equals(vserverName); - final String vserverId = getUUIDValue(vserverName, "d0668d4f-c25e-4a1b-87c4-83845c01efd8"); + final String vserverId = getUuidValue(vserverName, "d0668d4f-c25e-4a1b-87c4-83845c01efd8"); return "{\"vserver\": [{ \"vserver-id\": \"" + vserverId + "\", \"vserver-name\": \"" + vserverName + "\", \"vserver-name2\": \"vjunos0\", \"vserver-selflink\": \"https://aai-ext1.test.att.com:8443/aai/v7/cloud-infrastructure/cloud-regions/cloud-region/att-aic/AAIAIC25/tenants/tenant/USMSO1SX7NJ0103UJZZ01%3A%3AuCPE-VMS/vservers/vserver/d0668d4f-c25e-4a1b-87c4-83845c01efd8\", \"in-maint\": false, \"is-closed-loop-disabled\": " + isDisabled - + ", \"prov-status\":\"ACTIVE\", \"resource-version\": \"1494001931513\", \"relationship-list\": {\"relationship\":[{ \"related-to" + + ", \"prov-status\":\"ACTIVE\", \"resource-version\": \"1494001931513\", " + + "\"relationship-list\": {\"relationship\":[{ \"related-to" + "\": \"generic-vnf\", \"related-link\": \"/aai/v11/network/generic-vnfs/generic-vnf/" + "e1a41e99-4ede-409a-8f9d-b5e12984203a\", \"relationship-data\": [ {\"relationship-key\": \"" + "generic-vnf.vnf-id\",\"relationship-value\": \"e1a41e99-4ede-409a-8f9d-b5e12984203a\" }], \"" @@ -258,7 +263,7 @@ public class AaiSimulatorJaxRs { + "related-to-property\": [{\"property-key\": \"pserver.pserver-name2\"}]} ]}}]}"; } - private String getUUIDValue(final String value, final String defaultValue) { + private String getUuidValue(final String value, final String defaultValue) { return value != null ? UUID.nameUUIDFromBytes(value.getBytes()).toString() : defaultValue; } 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 35abf55b0..8bab8bba4 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 @@ -20,6 +20,7 @@ package org.onap.policy.simulators; +import com.att.aft.dme2.internal.gson.Gson; import java.util.UUID; import javax.ws.rs.Consumes; import javax.ws.rs.POST; @@ -31,7 +32,6 @@ 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 com.att.aft.dme2.internal.gson.Gson; @Path("/serviceInstantiation") public class SoSimulatorJaxRs { |