diff options
author | Pamela Dragosh <pdragosh@research.att.com> | 2019-12-11 14:47:53 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2019-12-11 14:47:53 +0000 |
commit | f32f276bb5dddfc4d11be9f0c13227547a0110b1 (patch) | |
tree | 2cd7834e044b443d28d702d12eda7ce7ad069714 | |
parent | 360cffc3b859716273251f077a469939fc80e100 (diff) | |
parent | 5a366fdab88b7205cedd2ba687109b80dc374544 (diff) |
Merge "Fix minor checksyle issues in models"
24 files changed, 130 insertions, 124 deletions
diff --git a/models-base/src/main/java/org/onap/policy/models/base/PfConcept.java b/models-base/src/main/java/org/onap/policy/models/base/PfConcept.java index a1cfac4ae..c77c68fd5 100644 --- a/models-base/src/main/java/org/onap/policy/models/base/PfConcept.java +++ b/models-base/src/main/java/org/onap/policy/models/base/PfConcept.java @@ -27,8 +27,8 @@ import java.util.List; import lombok.NonNull; /** - * This class is the base class for all Policy Framework concept classes. It enforces implementation - * of abstract methods and interfaces on all concepts that are sub-classes of this class. + * This class is the base class for all Policy Framework concept classes. It enforces implementation of abstract methods + * and interfaces on all concepts that are sub-classes of this class. */ public abstract class PfConcept implements Serializable, Comparable<PfConcept> { @@ -37,7 +37,9 @@ public abstract class PfConcept implements Serializable, Comparable<PfConcept> { /** * Default constructor. */ - public PfConcept() {} + public PfConcept() { + // Default Constructor + } /** * Copy constructor. @@ -56,8 +58,8 @@ public abstract class PfConcept implements Serializable, Comparable<PfConcept> { public abstract PfKey getKey(); /** - * Gets a list of all keys for this concept and all concepts that are defined or referenced by - * this concept and its sub-concepts. + * Gets a list of all keys for this concept and all concepts that are defined or referenced by this concept and its + * sub-concepts. * * @return the keys used by this concept and its contained concepts */ @@ -67,14 +69,13 @@ public abstract class PfConcept implements Serializable, Comparable<PfConcept> { * Validate that this concept is structurally correct. * * @param result the parameter in which the result of the validation will be returned - * @return the validation result that was passed in in the @{link result} field with the result - * of this validation added + * @return the validation result that was passed in in the @{link result} field with the result of this validation + * added */ public abstract PfValidationResult validate(@NonNull final PfValidationResult result); /** - * Clean this concept, tidy up any superfluous information such as leading and trailing white - * space. + * Clean this concept, tidy up any superfluous information such as leading and trailing white space. */ public abstract void clean(); diff --git a/models-base/src/main/java/org/onap/policy/models/base/PfModelService.java b/models-base/src/main/java/org/onap/policy/models/base/PfModelService.java index 67ba59c8b..134b6213e 100644 --- a/models-base/src/main/java/org/onap/policy/models/base/PfModelService.java +++ b/models-base/src/main/java/org/onap/policy/models/base/PfModelService.java @@ -30,14 +30,13 @@ import lombok.NonNull; /** * The model service makes Policy Framework models available to all classes in a JVM. * - * <p>The reason for having a model service is to avoid having to pass concept and model definitions - * down long call chains in modules such as the Policy Framework engine and editor. The model - * service makes the model and concept definitions available statically. + * <p>The reason for having a model service is to avoid having to pass concept and model definitions down long call + * chains in modules such as the Policy Framework engine and editor. The model service makes the model and concept + * definitions available statically. * - * <p>Note that the use of the model service means that only a single Policy Framework model of a - * particular type may exist in Policy Framework (particularly the engine) at any time. Of course - * the model in a JVM can be changed at any time provided all users of the model are stopped and - * restarted in an orderly manner. + * <p>Note that the use of the model service means that only a single Policy Framework model of a particular type may + * exist in Policy Framework (particularly the engine) at any time. Of course the model in a JVM can be changed at any + * time provided all users of the model are stopped and restarted in an orderly manner. */ public abstract class PfModelService { // The map holding the models @@ -46,7 +45,9 @@ public abstract class PfModelService { /** * This class is an abstract static class that cannot be extended. */ - private PfModelService() {} + private PfModelService() { + // Default constructor + } /** * Register a model with the model service. diff --git a/models-base/src/test/java/org/onap/policy/models/base/PfModelExceptionInfoTest.java b/models-base/src/test/java/org/onap/policy/models/base/PfModelExceptionInfoTest.java index 183b44c13..b418234c7 100644 --- a/models-base/src/test/java/org/onap/policy/models/base/PfModelExceptionInfoTest.java +++ b/models-base/src/test/java/org/onap/policy/models/base/PfModelExceptionInfoTest.java @@ -33,11 +33,12 @@ import org.onap.policy.models.errors.concepts.ErrorResponseInfo; * @author Liam Fallon (liam.fallon@est.tech) */ public class PfModelExceptionInfoTest { + @Test - public void exceptionInfoTest() { + public void testExceptionInfo() { try { throw new PfModelException(Response.Status.ACCEPTED, "HELLO"); - } catch (PfModelException pfme) { + } catch (PfModelException pfme) { String errorMessage = getErrorMessage(pfme); assertEquals("Server returned: Accepted", errorMessage.substring(0, 25)); } diff --git a/models-base/src/test/java/org/onap/policy/models/base/testconcepts/DummyPfKey.java b/models-base/src/test/java/org/onap/policy/models/base/testconcepts/DummyPfKey.java index 058ef37c3..ed2fb9885 100644 --- a/models-base/src/test/java/org/onap/policy/models/base/testconcepts/DummyPfKey.java +++ b/models-base/src/test/java/org/onap/policy/models/base/testconcepts/DummyPfKey.java @@ -33,7 +33,9 @@ import org.onap.policy.models.base.PfValidationResult; public class DummyPfKey extends PfKey { private static final long serialVersionUID = 1L; - public DummyPfKey() { } + public DummyPfKey() { + // Default constructor + } public DummyPfKey(DummyPfKey source) { super(source); diff --git a/models-errors/src/main/java/org/onap/policy/models/errors/concepts/ErrorResponseUtils.java b/models-errors/src/main/java/org/onap/policy/models/errors/concepts/ErrorResponseUtils.java index 5052d36fd..67815a811 100644 --- a/models-errors/src/main/java/org/onap/policy/models/errors/concepts/ErrorResponseUtils.java +++ b/models-errors/src/main/java/org/onap/policy/models/errors/concepts/ErrorResponseUtils.java @@ -32,7 +32,9 @@ public final class ErrorResponseUtils { /** * Private constructor used to prevent sub class instantiation. */ - private ErrorResponseUtils() {} + private ErrorResponseUtils() { + // Default constructor + } /** * Store the cascaded messages from an exception and all its nested exceptions in an ErrorResponse object. @@ -53,4 +55,3 @@ public final class ErrorResponseUtils { } } } - diff --git a/models-interactions/model-actors/actor.appc/src/test/java/org/onap/policy/controlloop/actor/appc/AppcServiceProviderTest.java b/models-interactions/model-actors/actor.appc/src/test/java/org/onap/policy/controlloop/actor/appc/AppcServiceProviderTest.java index 249e1fc25..0dfea32d6 100644 --- a/models-interactions/model-actors/actor.appc/src/test/java/org/onap/policy/controlloop/actor/appc/AppcServiceProviderTest.java +++ b/models-interactions/model-actors/actor.appc/src/test/java/org/onap/policy/controlloop/actor/appc/AppcServiceProviderTest.java @@ -29,6 +29,7 @@ import static org.junit.Assert.assertTrue; import java.time.Instant; import java.util.HashMap; import java.util.UUID; + import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.Test; @@ -72,8 +73,7 @@ public class AppcServiceProviderTest { static { /* - * Construct an onset with an AAI subtag containing generic-vnf.vnf-id and a target type of - * VM. + * Construct an onset with an AAI subtag containing generic-vnf.vnf-id and a target type of VM. */ onsetEvent = new VirtualControlLoopEvent(); onsetEvent.setClosedLoopControlName("closedLoopControlName-Test"); @@ -111,6 +111,7 @@ public class AppcServiceProviderTest { /** * Set up before test class. + * * @throws Exception if the A&AI simulator cannot be started */ @BeforeClass @@ -127,7 +128,7 @@ public class AppcServiceProviderTest { } @Test - public void constructModifyConfigRequestTest() { + public void testConstructModifyConfigRequest() { policy.setPayload(new HashMap<>()); policy.getPayload().put(KEY1, VALUE1); policy.getPayload().put(KEY2, VALUE2); @@ -180,7 +181,7 @@ public class AppcServiceProviderTest { } @Test - public void constructModifyConfigRequestTest_NullPayload() { + public void testConstructModifyConfigRequest_NullPayload() { Request appcRequest; appcRequest = AppcActorServiceProvider.constructRequest(onsetEvent, operation, policy, "vnf01"); diff --git a/models-interactions/model-actors/actor.appclcm/src/test/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmActorServiceProviderTest.java b/models-interactions/model-actors/actor.appclcm/src/test/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmActorServiceProviderTest.java index 88fb6e97f..ef69bc1bc 100644 --- a/models-interactions/model-actors/actor.appclcm/src/test/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmActorServiceProviderTest.java +++ b/models-interactions/model-actors/actor.appclcm/src/test/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmActorServiceProviderTest.java @@ -29,6 +29,7 @@ import java.time.Instant; import java.util.AbstractMap; import java.util.HashMap; import java.util.UUID; + import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.Test; @@ -50,7 +51,6 @@ import org.onap.policy.simulators.Util; import org.slf4j.Logger; import org.slf4j.LoggerFactory; - public class AppcLcmActorServiceProviderTest { private static final String VNF01 = "vnf01"; @@ -76,8 +76,7 @@ public class AppcLcmActorServiceProviderTest { static { /* - * Construct an onset with an AAI subtag containing generic-vnf.vnf-id and a target type of - * VM. + * Construct an onset with an AAI subtag containing generic-vnf.vnf-id and a target type of VM. */ onsetEvent = new VirtualControlLoopEvent(); onsetEvent.setClosedLoopControlName("closedLoopControlName-Test"); @@ -159,6 +158,7 @@ public class AppcLcmActorServiceProviderTest { /** * Set up before test class. + * * @throws Exception if an error occurs */ @BeforeClass @@ -222,8 +222,7 @@ public class AppcLcmActorServiceProviderTest { } /** - * A test to assert that a null pointer exception is thrown if - * the APPC response body is null. + * A test to assert that a null pointer exception is thrown if the APPC response body is null. */ @Test(expected = NullPointerException.class) public void processNullBodyResponseTest() { @@ -231,8 +230,7 @@ public class AppcLcmActorServiceProviderTest { } /** - * A test to assert that a null pointer exception is thrown if - * the APPC response output is null. + * A test to assert that a null pointer exception is thrown if the APPC response output is null. */ @Test(expected = NullPointerException.class) public void processNullOutputResponseTest() { @@ -345,19 +343,19 @@ public class AppcLcmActorServiceProviderTest { } @Test - public void payloadNotPassedWhenNotSupportedByRecipe() { - //given + public void testPayloadNotPassedWhenNotSupportedByRecipe() { + // given Policy migratePolicy = constructPolicyWithRecipe(RECIPE_MIGRATE); Policy rebuildPolicy = constructPolicyWithRecipe(RECIPE_REBUILD); Policy restartPolicy = constructPolicyWithRecipe(RECIPE_RESTART); // when AppcLcmDmaapWrapper migrateRequest = - AppcLcmActorServiceProvider.constructRequest(onsetEvent, operation, migratePolicy, VNF01); + AppcLcmActorServiceProvider.constructRequest(onsetEvent, operation, migratePolicy, VNF01); AppcLcmDmaapWrapper rebuildRequest = - AppcLcmActorServiceProvider.constructRequest(onsetEvent, operation, rebuildPolicy, VNF01); + AppcLcmActorServiceProvider.constructRequest(onsetEvent, operation, rebuildPolicy, VNF01); AppcLcmDmaapWrapper restartRequest = - AppcLcmActorServiceProvider.constructRequest(onsetEvent, operation, restartPolicy, VNF01); + AppcLcmActorServiceProvider.constructRequest(onsetEvent, operation, restartPolicy, VNF01); // then assertNull(migrateRequest.getBody().getInput().getPayload()); @@ -366,17 +364,16 @@ public class AppcLcmActorServiceProviderTest { } @Test - public void payloadNotPassedWhenNotSuppliedOrEmpty() { - //given + public void testPayloadNotPassedWhenNotSuppliedOrEmpty() { + // given Policy noPayloadPolicy = constructHealthCheckPolicyWithPayload(null); Policy emptyPayloadPolicy = constructHealthCheckPolicyWithPayload(new HashMap<>()); // when AppcLcmDmaapWrapper noPayloadRequest = - AppcLcmActorServiceProvider.constructRequest(onsetEvent, operation, noPayloadPolicy, VNF01); + AppcLcmActorServiceProvider.constructRequest(onsetEvent, operation, noPayloadPolicy, VNF01); AppcLcmDmaapWrapper emptyPayloadRequest = - AppcLcmActorServiceProvider.constructRequest(onsetEvent, operation, emptyPayloadPolicy, VNF01); - + AppcLcmActorServiceProvider.constructRequest(onsetEvent, operation, emptyPayloadPolicy, VNF01); // then assertNull(noPayloadRequest.getBody().getInput().getPayload()); @@ -384,7 +381,7 @@ public class AppcLcmActorServiceProviderTest { } @Test - public void payloadParsedProperlyForSinglePayloadParameter() { + public void testPayloadParsedProperlyForSinglePayloadParameter() { // given HashMap<String, String> payload = new HashMap<>(); payload.put("requestParameters", "{\"host-ip-address\":\"10.183.37.25\"}"); @@ -392,37 +389,34 @@ public class AppcLcmActorServiceProviderTest { // when AppcLcmDmaapWrapper dmaapRequest = - AppcLcmActorServiceProvider.constructRequest(onsetEvent, operation, otherPolicy, VNF01); + AppcLcmActorServiceProvider.constructRequest(onsetEvent, operation, otherPolicy, VNF01); // then - assertEquals(dmaapRequest.getBody().getInput().getPayload(), - "{\"requestParameters\": {\"host-ip-address\":\"10.183.37.25\"}}"); + assertEquals("{\"requestParameters\": {\"host-ip-address\":\"10.183.37.25\"}}", + dmaapRequest.getBody().getInput().getPayload()); } - @Test - public void payloadParsedProperlyForMultiplePayloadParameters() { + public void testPayloadParsedProperlyForMultiplePayloadParameters() { // given HashMap<String, String> payload = new HashMap<>(); payload.put("requestParameters", "{\"host-ip-address\":\"10.183.37.25\"}"); - payload.put("configurationParameters", "[{\"ip-addr\":\"$.vf-module-topology.vf-module-parameters.param[9]\"," - + "\"oam-ip-addr\":\"$.vf-module-topology.vf-module-parameters.param[16]\"," - + "\"enabled\":\"$.vf-module-topology.vf-module-parameters.param[23]\"}]"); + payload.put("configurationParameters", + "[{\"ip-addr\":\"$.vf-module-topology.vf-module-parameters.param[9]\"," + + "\"oam-ip-addr\":\"$.vf-module-topology.vf-module-parameters.param[16]\"," + + "\"enabled\":\"$.vf-module-topology.vf-module-parameters.param[23]\"}]"); Policy otherPolicy = constructHealthCheckPolicyWithPayload(payload); // when AppcLcmDmaapWrapper dmaapRequest = - AppcLcmActorServiceProvider.constructRequest(onsetEvent, operation, otherPolicy, VNF01); + AppcLcmActorServiceProvider.constructRequest(onsetEvent, operation, otherPolicy, VNF01); // then assertEquals(dmaapRequest.getBody().getInput().getPayload(), - "{\"requestParameters\": " - + "{\"host-ip-address\":\"10.183.37.25\"}," - + "\"configurationParameters\": " - + "[{\"ip-addr\":\"$.vf-module-topology.vf-module-parameters.param[9]\"," - + "\"oam-ip-addr\":\"$.vf-module-topology.vf-module-parameters.param[16]\"," - + "\"enabled\":\"$.vf-module-topology.vf-module-parameters.param[23]\"}]" - + "}"); + "{\"requestParameters\": " + "{\"host-ip-address\":\"10.183.37.25\"}," + "\"configurationParameters\": " + + "[{\"ip-addr\":\"$.vf-module-topology.vf-module-parameters.param[9]\"," + + "\"oam-ip-addr\":\"$.vf-module-topology.vf-module-parameters.param[16]\"," + + "\"enabled\":\"$.vf-module-topology.vf-module-parameters.param[23]\"}]" + "}"); } private Policy constructHealthCheckPolicyWithPayload(HashMap<String, String> payload) { diff --git a/models-interactions/model-actors/actor.appclcm/src/test/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmRecipeFormatterTest.java b/models-interactions/model-actors/actor.appclcm/src/test/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmRecipeFormatterTest.java index 8e9a4c30c..110dfabd9 100644 --- a/models-interactions/model-actors/actor.appclcm/src/test/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmRecipeFormatterTest.java +++ b/models-interactions/model-actors/actor.appclcm/src/test/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmRecipeFormatterTest.java @@ -25,75 +25,73 @@ import static org.junit.Assert.assertEquals; import org.junit.Test; - - public class AppcLcmRecipeFormatterTest { @Test - public void shouldCorrectlyFormatRestartRequestWhenRestartGiven() { - //given + public void testShouldCorrectlyFormatRestartRequestWhenRestartGiven() { + // given AppcLcmRecipeFormatter recipeFormatter = new AppcLcmRecipeFormatter("Restart"); String expectedUrlRecipe = "restart"; String expectedBodyRecipe = "Restart"; - //when + // when String actualUrlRecipe = recipeFormatter.getUrlRecipe(); String actualBodyRecipe = recipeFormatter.getBodyRecipe(); - //then + // then assertEquals(expectedUrlRecipe, actualUrlRecipe); assertEquals(expectedBodyRecipe, actualBodyRecipe); } @Test - public void shouldReturnCapitalizedBodySingleWordRecipe() { - //given + public void testShouldReturnCapitalizedBodySingleWordRecipe() { + // given AppcLcmRecipeFormatter recipeFormatter = new AppcLcmRecipeFormatter("moDify"); String expectedRecipe = "Modify"; - //when + // when String actualRecipe = recipeFormatter.getBodyRecipe(); - //then + // then assertEquals(expectedRecipe, actualRecipe); } @Test - public void shouldReturnCapitalizeAndJoinedBodyMultiWordRecipe() { - //given + public void testShouldReturnCapitalizeAndJoinedBodyMultiWordRecipe() { + // given AppcLcmRecipeFormatter recipeFormatter = new AppcLcmRecipeFormatter("coNfig-moDify"); String expectedRecipe = "ConfigModify"; - //when + // when String actualRecipe = recipeFormatter.getBodyRecipe(); - //then + // then assertEquals(expectedRecipe, actualRecipe); } @Test - public void shouldReturnLowercasedUrlSingleWordRecipe() { - //given + public void testShouldReturnLowercasedUrlSingleWordRecipe() { + // given AppcLcmRecipeFormatter recipeFormatter = new AppcLcmRecipeFormatter("ModIfy"); String expectedRecipe = "modify"; - //when + // when String actualRecipe = recipeFormatter.getUrlRecipe(); - //then + // then assertEquals(expectedRecipe, actualRecipe); } @Test - public void shouldReturnLowercasedDashJoinedUrlMultiWordRecipe() { - //given + public void testShouldReturnLowercasedDashJoinedUrlMultiWordRecipe() { + // given AppcLcmRecipeFormatter recipeFormatter = new AppcLcmRecipeFormatter("Config-MoDify"); String expectedRecipe = "config-modify"; - //when + // when String actualRecipe = recipeFormatter.getUrlRecipe(); - //then + // then assertEquals(expectedRecipe, actualRecipe); } }
\ No newline at end of file diff --git a/models-interactions/model-actors/actor.sdnr/src/test/java/org/onap/policy/controlloop/actor/sdnr/SdnrActorServiceProviderTest.java b/models-interactions/model-actors/actor.sdnr/src/test/java/org/onap/policy/controlloop/actor/sdnr/SdnrActorServiceProviderTest.java index a9178961a..8101b12fd 100644 --- a/models-interactions/model-actors/actor.sdnr/src/test/java/org/onap/policy/controlloop/actor/sdnr/SdnrActorServiceProviderTest.java +++ b/models-interactions/model-actors/actor.sdnr/src/test/java/org/onap/policy/controlloop/actor/sdnr/SdnrActorServiceProviderTest.java @@ -56,8 +56,7 @@ public class SdnrActorServiceProviderTest { static { /* - * Construct an onset. Using dummy AAI details since the code mandates AAI - * details. + * Construct an onset. Using dummy AAI details since the code mandates AAI details. */ onsetEvent = new VirtualControlLoopEvent(); onsetEvent.setClosedLoopControlName("closedLoopControlName-Test"); @@ -95,7 +94,7 @@ public class SdnrActorServiceProviderTest { } @Test - public void getControlLoopResponseTest() { + public void testGetControlLoopResponse() { PciRequest sdnrRequest; sdnrRequest = SdnrActorServiceProvider.constructRequest(onsetEvent, operation, policy).getBody(); PciResponse sdnrResponse = new PciResponse(sdnrRequest); @@ -114,13 +113,13 @@ public class SdnrActorServiceProviderTest { assertEquals(clRsp.getPolicyName(), onsetEvent.getPolicyName()); assertEquals(clRsp.getPolicyVersion(), onsetEvent.getPolicyVersion()); assertEquals(clRsp.getVersion(), onsetEvent.getVersion()); - assertEquals(clRsp.getFrom(), "SDNR"); - assertEquals(clRsp.getTarget(), "DCAE"); + assertEquals("SDNR", clRsp.getFrom()); + assertEquals("DCAE", clRsp.getTarget()); assertEquals(clRsp.getPayload(), sdnrResponse.getPayload()); } @Test - public void constructModifyConfigRequestTest() { + public void testConstructModifyConfigRequest() { PciRequest sdnrRequest; sdnrRequest = SdnrActorServiceProvider.constructRequest(onsetEvent, operation, policy).getBody(); diff --git a/models-interactions/model-actors/actor.vfc/src/main/java/org/onap/policy/controlloop/actor/vfc/VfcActorServiceProvider.java b/models-interactions/model-actors/actor.vfc/src/main/java/org/onap/policy/controlloop/actor/vfc/VfcActorServiceProvider.java index 482c25730..1ca379f71 100644 --- a/models-interactions/model-actors/actor.vfc/src/main/java/org/onap/policy/controlloop/actor/vfc/VfcActorServiceProvider.java +++ b/models-interactions/model-actors/actor.vfc/src/main/java/org/onap/policy/controlloop/actor/vfc/VfcActorServiceProvider.java @@ -22,8 +22,10 @@ package org.onap.policy.controlloop.actor.vfc; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; + import java.util.Collections; import java.util.List; + import org.onap.policy.aai.AaiCqResponse; import org.onap.policy.controlloop.ControlLoopOperation; import org.onap.policy.controlloop.VirtualControlLoopEvent; @@ -33,14 +35,10 @@ import org.onap.policy.vfc.VfcHealActionVmInfo; import org.onap.policy.vfc.VfcHealAdditionalParams; import org.onap.policy.vfc.VfcHealRequest; import org.onap.policy.vfc.VfcRequest; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; public class VfcActorServiceProvider implements Actor { private static final String GENERIC_VNF_ID = "generic-vnf.vnf-id"; - private static final Logger logger = LoggerFactory.getLogger(VfcActorServiceProvider.class); - // Strings for VFC Actor private static final String VFC_ACTOR = "VFC"; diff --git a/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/util/Serialization.java b/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/util/Serialization.java index 75cafd1b4..e42325f4a 100644 --- a/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/util/Serialization.java +++ b/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/util/Serialization.java @@ -26,9 +26,9 @@ import com.google.gson.GsonBuilder; public final class Serialization { - public static final Gson gsonPretty = new GsonBuilder().disableHtmlEscaping().setPrettyPrinting() - .create(); - - private Serialization() {} + public static final Gson gsonPretty = new GsonBuilder().disableHtmlEscaping().setPrettyPrinting().create(); + private Serialization() { + // Private constructor to prevent subclassing + } } diff --git a/models-interactions/model-impl/appc/src/main/java/org/onap/policy/appc/CommonHeader.java b/models-interactions/model-impl/appc/src/main/java/org/onap/policy/appc/CommonHeader.java index 05507e60e..f0419efe9 100644 --- a/models-interactions/model-impl/appc/src/main/java/org/onap/policy/appc/CommonHeader.java +++ b/models-interactions/model-impl/appc/src/main/java/org/onap/policy/appc/CommonHeader.java @@ -29,6 +29,7 @@ import java.util.ArrayList; import java.util.Collection; import java.util.Map; import java.util.UUID; + import lombok.Getter; import lombok.Setter; @@ -58,7 +59,9 @@ public class CommonHeader implements Serializable { @SerializedName("Flags") private Collection<Map<String, String>> flags = new ArrayList<>(); - public CommonHeader() {} + public CommonHeader() { + // Default constructor + } /** * Construct an instance from an existing instance. diff --git a/models-interactions/model-impl/appc/src/main/java/org/onap/policy/appc/util/Serialization.java b/models-interactions/model-impl/appc/src/main/java/org/onap/policy/appc/util/Serialization.java index 735fb6234..30d4fcb0a 100644 --- a/models-interactions/model-impl/appc/src/main/java/org/onap/policy/appc/util/Serialization.java +++ b/models-interactions/model-impl/appc/src/main/java/org/onap/policy/appc/util/Serialization.java @@ -48,7 +48,9 @@ public final class Serialization { // .registerTypeAdapter(ResponseStatus1607.class, new gsonResponseStatus()) .create(); - private Serialization() {} + private Serialization() { + // Private constructor to prevent subclassing + } public static class GsonUtcAdapter implements JsonSerializer<ZonedDateTime>, JsonDeserializer<ZonedDateTime> { private static final Logger logger = LoggerFactory.getLogger(GsonUtcAdapter.class); diff --git a/models-interactions/model-impl/appc/src/test/java/org/onap/policy/appc/RequestTest.java b/models-interactions/model-impl/appc/src/test/java/org/onap/policy/appc/RequestTest.java index 00ac99de5..3e09bec0a 100644 --- a/models-interactions/model-impl/appc/src/test/java/org/onap/policy/appc/RequestTest.java +++ b/models-interactions/model-impl/appc/src/test/java/org/onap/policy/appc/RequestTest.java @@ -22,10 +22,8 @@ package org.onap.policy.appc; import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotEquals; import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; import java.util.HashMap; import java.util.Map; diff --git a/models-interactions/model-impl/appclcm/src/main/java/org/onap/policy/appclcm/util/Serialization.java b/models-interactions/model-impl/appclcm/src/main/java/org/onap/policy/appclcm/util/Serialization.java index 9b522f323..11da28a36 100644 --- a/models-interactions/model-impl/appclcm/src/main/java/org/onap/policy/appclcm/util/Serialization.java +++ b/models-interactions/model-impl/appclcm/src/main/java/org/onap/policy/appclcm/util/Serialization.java @@ -37,13 +37,15 @@ public final class Serialization { public static final Gson gsonPretty = new GsonBuilder().disableHtmlEscaping().setPrettyPrinting() .registerTypeAdapter(Instant.class, new InstantAdapter()).create(); - public static final Gson gson = new GsonBuilder().disableHtmlEscaping() - .registerTypeAdapter(Instant.class, new InstantAdapter()).create(); + public static final Gson gson = + new GsonBuilder().disableHtmlEscaping().registerTypeAdapter(Instant.class, new InstantAdapter()).create(); public static final Gson gsonJunit = new GsonBuilder().disableHtmlEscaping().setPrettyPrinting() .registerTypeAdapter(Instant.class, new InstantJunitAdapter()).create(); - private Serialization() {} + private Serialization() { + // Private constructor to prevent subclassing + } public static class InstantAdapter implements JsonSerializer<Instant>, JsonDeserializer<Instant> { diff --git a/models-interactions/model-impl/events/src/main/java/org/onap/policy/controlloop/PhysicalControlLoopEvent.java b/models-interactions/model-impl/events/src/main/java/org/onap/policy/controlloop/PhysicalControlLoopEvent.java index 7848d613a..17a23b749 100644 --- a/models-interactions/model-impl/events/src/main/java/org/onap/policy/controlloop/PhysicalControlLoopEvent.java +++ b/models-interactions/model-impl/events/src/main/java/org/onap/policy/controlloop/PhysicalControlLoopEvent.java @@ -24,7 +24,9 @@ package org.onap.policy.controlloop; public class PhysicalControlLoopEvent extends ControlLoopEvent { private static final long serialVersionUID = -7282930271094849487L; - public PhysicalControlLoopEvent() {} + public PhysicalControlLoopEvent() { + // Default constructor + } /** * Construct an instance from an existing instance. diff --git a/models-interactions/model-impl/events/src/main/java/org/onap/policy/controlloop/PhysicalControlLoopNotification.java b/models-interactions/model-impl/events/src/main/java/org/onap/policy/controlloop/PhysicalControlLoopNotification.java index 168f97c86..12c28c761 100644 --- a/models-interactions/model-impl/events/src/main/java/org/onap/policy/controlloop/PhysicalControlLoopNotification.java +++ b/models-interactions/model-impl/events/src/main/java/org/onap/policy/controlloop/PhysicalControlLoopNotification.java @@ -24,7 +24,9 @@ package org.onap.policy.controlloop; public class PhysicalControlLoopNotification extends ControlLoopNotification { private static final long serialVersionUID = 8105197217140032892L; - public PhysicalControlLoopNotification() {} + public PhysicalControlLoopNotification() { + // Default constructor + } /** * Construct an instance from an existing instance. diff --git a/models-interactions/model-impl/events/src/main/java/org/onap/policy/controlloop/util/Serialization.java b/models-interactions/model-impl/events/src/main/java/org/onap/policy/controlloop/util/Serialization.java index 96797ed00..0b94e854f 100644 --- a/models-interactions/model-impl/events/src/main/java/org/onap/policy/controlloop/util/Serialization.java +++ b/models-interactions/model-impl/events/src/main/java/org/onap/policy/controlloop/util/Serialization.java @@ -43,22 +43,20 @@ public final class Serialization { public static final Gson gson = new GsonBuilder().disableHtmlEscaping().registerTypeAdapter(ZonedDateTime.class, new GsonUtcAdapter()) .registerTypeAdapter(Instant.class, new GsonInstantAdapter()) - .registerTypeAdapter(ControlLoopNotificationType.class, new NotificationTypeAdapter()) - .create(); - + .registerTypeAdapter(ControlLoopNotificationType.class, new NotificationTypeAdapter()).create(); public static final Gson gsonPretty = new GsonBuilder().disableHtmlEscaping().setPrettyPrinting() .registerTypeAdapter(ZonedDateTime.class, new GsonUtcAdapter()) .registerTypeAdapter(Instant.class, new GsonInstantAdapter()) - .registerTypeAdapter(ControlLoopNotificationType.class, new NotificationTypeAdapter()) - .create(); + .registerTypeAdapter(ControlLoopNotificationType.class, new NotificationTypeAdapter()).create(); public static final Gson gsonJunit = new GsonBuilder().disableHtmlEscaping().setPrettyPrinting() .registerTypeAdapter(ZonedDateTime.class, new GsonUtcAdapter()) - .registerTypeAdapter(Instant.class, new GsonInstantAdapter()) - .create(); + .registerTypeAdapter(Instant.class, new GsonInstantAdapter()).create(); - private Serialization() {} + private Serialization() { + // Private constructor to prevent subclassing + } public static class NotificationTypeAdapter implements JsonSerializer<ControlLoopNotificationType>, JsonDeserializer<ControlLoopNotificationType> { diff --git a/models-interactions/model-impl/rest/src/test/java/org/onap/policy/rest/HttpDeleteWithBodyTest.java b/models-interactions/model-impl/rest/src/test/java/org/onap/policy/rest/HttpDeleteWithBodyTest.java index cfdc859b1..8579bf1bd 100644 --- a/models-interactions/model-impl/rest/src/test/java/org/onap/policy/rest/HttpDeleteWithBodyTest.java +++ b/models-interactions/model-impl/rest/src/test/java/org/onap/policy/rest/HttpDeleteWithBodyTest.java @@ -30,7 +30,7 @@ public class HttpDeleteWithBodyTest { private static final String NO_URI = "BlahBlah"; @Test - public void getMethod() { + public void testGetMethod() { HttpDeleteWithBody deleteWithBody = new HttpDeleteWithBody(NO_URI); assertEquals("DELETE", deleteWithBody.getMethod()); assertEquals(NO_URI, deleteWithBody.getURI().toString()); diff --git a/models-interactions/model-impl/sdnr/src/main/java/org/onap/policy/sdnr/util/Serialization.java b/models-interactions/model-impl/sdnr/src/main/java/org/onap/policy/sdnr/util/Serialization.java index 31af9468a..7640242e7 100644 --- a/models-interactions/model-impl/sdnr/src/main/java/org/onap/policy/sdnr/util/Serialization.java +++ b/models-interactions/model-impl/sdnr/src/main/java/org/onap/policy/sdnr/util/Serialization.java @@ -38,7 +38,6 @@ import java.time.Instant; import org.onap.policy.sdnr.PciRequest; import org.onap.policy.sdnr.PciResponse; - public final class Serialization { public static final Gson gsonPretty = new GsonBuilder().disableHtmlEscaping().setPrettyPrinting() .registerTypeAdapter(Instant.class, new InstantAdapter()).create(); @@ -50,7 +49,9 @@ public final class Serialization { public static final Gson gsonJunit = new GsonBuilder().disableHtmlEscaping().setPrettyPrinting() .registerTypeAdapter(Instant.class, new InstantJunitAdapter()).create(); - private Serialization() {} + private Serialization() { + // Private constructor to prevent subclassing + } public static class RequestAdapter implements JsonSerializer<PciRequest>, JsonDeserializer<PciRequest> { diff --git a/models-interactions/model-impl/vfc/src/main/java/org/onap/policy/vfc/VfcHealActionVmInfo.java b/models-interactions/model-impl/vfc/src/main/java/org/onap/policy/vfc/VfcHealActionVmInfo.java index 1485b6a04..c7e44d930 100644 --- a/models-interactions/model-impl/vfc/src/main/java/org/onap/policy/vfc/VfcHealActionVmInfo.java +++ b/models-interactions/model-impl/vfc/src/main/java/org/onap/policy/vfc/VfcHealActionVmInfo.java @@ -20,9 +20,8 @@ package org.onap.policy.vfc; -import com.google.gson.annotations.SerializedName; - import java.io.Serializable; + import lombok.Getter; import lombok.Setter; diff --git a/models-provider/src/main/java/org/onap/policy/models/provider/impl/DummyPolicyModelsProviderImpl.java b/models-provider/src/main/java/org/onap/policy/models/provider/impl/DummyPolicyModelsProviderImpl.java index afa4277cb..acc000c61 100644 --- a/models-provider/src/main/java/org/onap/policy/models/provider/impl/DummyPolicyModelsProviderImpl.java +++ b/models-provider/src/main/java/org/onap/policy/models/provider/impl/DummyPolicyModelsProviderImpl.java @@ -60,7 +60,9 @@ public class DummyPolicyModelsProviderImpl implements PolicyModelsProvider { * * @param parameters the parameters for the provider */ - public DummyPolicyModelsProviderImpl(final PolicyModelsProviderParameters parameters) {} + public DummyPolicyModelsProviderImpl(final PolicyModelsProviderParameters parameters) { + // Default constructor + } @Override public void init() throws PfModelException { diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/package-info.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/package-info.java index 2b98f9bc7..1db09b863 100644 --- a/models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/package-info.java +++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/package-info.java @@ -21,10 +21,9 @@ */ /** - * This package includes all TOSCA concept POJOs that can be parsed correctly by swagger-core and rendered - * as expected in swagger-ui. - */ -/** + * This package includes all TOSCA concept POJOs that can be parsed correctly by swagger-core and rendered as expected + * in swagger-ui. + * * @author Chenfei Gao (cgao@research.att.com) * */ diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/utils/ToscaUtils.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/utils/ToscaUtils.java index a73fb85e9..1b509e2a8 100644 --- a/models-tosca/src/main/java/org/onap/policy/models/tosca/utils/ToscaUtils.java +++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/utils/ToscaUtils.java @@ -38,7 +38,9 @@ public final class ToscaUtils { /** * Private constructor to prevent subclassing. */ - private ToscaUtils() {} + private ToscaUtils() { + // Private constructor to prevent subclassing + } /** * Check if policy types have been specified is initialized. |