From dc101c2ad5e27d5a0afd4e2feeb8885f24728806 Mon Sep 17 00:00:00 2001 From: Jim Hahn Date: Tue, 24 Aug 2021 13:20:26 -0400 Subject: Use CompareToBuilder Also added lombok to test classes. Issue-ID: POLICY-3391 Change-Id: I9ecf479f3861a2e5211b037e885029d1719b6a56 Signed-off-by: Jim Hahn --- .../apex/auth/clicodegen/DummyStErrorListener.java | 30 +- .../apex/auth/clicodegen/SupportKeyInfoGetter.java | 13 +- .../apex/auth/clieditor/tosca/CommonTestData.java | 11 +- .../context/impl/schema/java/SupportBaseClass.java | 14 +- .../executor/DummyStateFinalizerExecutor.java | 7 +- .../core/engine/executor/DummyTaskExecutor.java | 13 +- .../engine/executor/DummyTaskSelectExecutor.java | 19 +- .../engine/executor/StateMachineExecutorTest.java | 19 +- .../engine/executor/context/DummyContextAlbum.java | 20 +- .../policy/apex/core/protocols/DummyAction.java | 59 +--- .../apex/core/protocols/SupportMessageTester.java | 6 +- .../apex/examples/aadm/TestApexActionListener.java | 13 +- .../examples/adaptive/TestApexActionListener.java | 25 +- .../myfirstpolicy/TestSaleAuthListener.java | 23 +- .../restclient/SupportApexEventReceiver.java | 20 +- .../restserver/SupportApexEventReceiver.java | 20 +- .../event/protocol/xml/XmlEventGenerator.java | 12 +- .../entities/ArtifactKeyTestEntity.java | 101 +------ .../entities/ReferenceKeyTestEntity.java | 101 +------ .../service/engine/event/testpojos/DummyPojo.java | 49 +--- .../engine/event/testpojos/DummyPojoList.java | 18 +- .../engine/event/testpojos/DummySubPojo.java | 49 +--- .../engine/event/testpojos/DummySubSubPojo.java | 37 +-- .../dummyclasses/DummyStateFinalizerExecutor.java | 4 +- .../parameters/dummyclasses/DummyTaskExecutor.java | 4 +- .../dummyclasses/DummyTaskSelectExecutor.java | 3 +- .../SuperDooperCarrierTechnologyParameters.java | 301 +-------------------- .../SuperDooperDistributorParameters.java | 57 +--- .../dummyclasses/SuperDooperEventProducer.java | 15 +- .../dummyclasses/SuperDooperEventSubscriber.java | 11 +- .../dummyclasses/DummyStateFinalizerExecutor.java | 4 +- .../parameters/dummyclasses/DummyTaskExecutor.java | 4 +- .../dummyclasses/DummyTaskSelectExecutor.java | 3 +- .../context/entities/ArtifactKeyTestEntity.java | 13 +- .../context/entities/ReferenceKeyTestEntity.java | 13 +- 35 files changed, 187 insertions(+), 924 deletions(-) diff --git a/auth/cli-codegen/src/test/java/org/onap/policy/apex/auth/clicodegen/DummyStErrorListener.java b/auth/cli-codegen/src/test/java/org/onap/policy/apex/auth/clicodegen/DummyStErrorListener.java index 45d307b47..572b40e74 100644 --- a/auth/cli-codegen/src/test/java/org/onap/policy/apex/auth/clicodegen/DummyStErrorListener.java +++ b/auth/cli-codegen/src/test/java/org/onap/policy/apex/auth/clicodegen/DummyStErrorListener.java @@ -1,25 +1,29 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. + * Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * + * * SPDX-License-Identifier: Apache-2.0 * ============LICENSE_END========================================================= */ package org.onap.policy.apex.auth.clicodegen; +import lombok.AccessLevel; +import lombok.Getter; +import lombok.Setter; import org.stringtemplate.v4.STErrorListener; import org.stringtemplate.v4.misc.STMessage; @@ -31,6 +35,8 @@ import org.stringtemplate.v4.misc.STMessage; public class DummyStErrorListener implements STErrorListener { /** Counts errors of the listener. */ + @Getter(AccessLevel.PROTECTED) + @Setter(AccessLevel.PROTECTED) private int errorCount; /** @@ -90,22 +96,4 @@ public class DummyStErrorListener implements STErrorListener { setErrorCount(getErrorCount() + 1); System.err.println("STG/ST (" + msg.error + ") " + msg.arg + " -> " + msg.cause); } - - /** - * Gets the error count. - * - * @return the error count - */ - protected int getErrorCount() { - return errorCount; - } - - /** - * Sets the error count. - * - * @param errorCount the new error count - */ - protected void setErrorCount(final int errorCount) { - this.errorCount = errorCount; - } } diff --git a/auth/cli-codegen/src/test/java/org/onap/policy/apex/auth/clicodegen/SupportKeyInfoGetter.java b/auth/cli-codegen/src/test/java/org/onap/policy/apex/auth/clicodegen/SupportKeyInfoGetter.java index 5547aa4f7..567991666 100644 --- a/auth/cli-codegen/src/test/java/org/onap/policy/apex/auth/clicodegen/SupportKeyInfoGetter.java +++ b/auth/cli-codegen/src/test/java/org/onap/policy/apex/auth/clicodegen/SupportKeyInfoGetter.java @@ -1,6 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. + * Modifications Copyright (C) 2021 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,6 +21,7 @@ package org.onap.policy.apex.auth.clicodegen; +import lombok.AllArgsConstructor; import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey; import org.onap.policy.apex.model.basicmodel.concepts.AxKeyInfo; import org.onap.policy.apex.model.basicmodel.concepts.AxReferenceKey; @@ -30,21 +32,12 @@ import org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel; * * @author John Keeney (john.keeney@ericsson.com) */ - +@AllArgsConstructor public class SupportKeyInfoGetter { /** The policy model for the getters. */ private final AxPolicyModel model; - /** - * Creates a new key getter. - * - * @param model the policy model to use - */ - public SupportKeyInfoGetter(final AxPolicyModel model) { - this.model = model; - } - /** * Returns the key name as string. * diff --git a/auth/cli-editor/src/test/java/org/onap/policy/apex/auth/clieditor/tosca/CommonTestData.java b/auth/cli-editor/src/test/java/org/onap/policy/apex/auth/clieditor/tosca/CommonTestData.java index ce88f9795..23d927e24 100644 --- a/auth/cli-editor/src/test/java/org/onap/policy/apex/auth/clieditor/tosca/CommonTestData.java +++ b/auth/cli-editor/src/test/java/org/onap/policy/apex/auth/clieditor/tosca/CommonTestData.java @@ -1,6 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2019 Nordix Foundation. + * Modifications Copyright (C) 2021 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,16 +21,16 @@ package org.onap.policy.apex.auth.clieditor.tosca; +import lombok.AccessLevel; +import lombok.NoArgsConstructor; + /** * Class to hold/create all parameters for test cases. * * @author Ajith Sreekumar (ajith.sreekumar@est.tech) */ -public class CommonTestData { - - private CommonTestData() { - // This class cannot be initialized - } +@NoArgsConstructor(access = AccessLevel.PRIVATE) +public final class CommonTestData { public static final String INPUT_TOSCA_TEMPLATE_FILE_NAME = "src/test/resources/tosca/ToscaTemplate.json"; public static final String APEX_CONFIG_FILE_NAME = "src/test/resources/tosca/ApexConfig.json"; diff --git a/context/context-management/src/test/java/org/onap/policy/apex/context/impl/schema/java/SupportBaseClass.java b/context/context-management/src/test/java/org/onap/policy/apex/context/impl/schema/java/SupportBaseClass.java index 004737559..6dd090ecd 100644 --- a/context/context-management/src/test/java/org/onap/policy/apex/context/impl/schema/java/SupportBaseClass.java +++ b/context/context-management/src/test/java/org/onap/policy/apex/context/impl/schema/java/SupportBaseClass.java @@ -1,6 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. + * Modifications Copyright (C) 2021 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,14 +21,11 @@ package org.onap.policy.apex.context.impl.schema.java; +import lombok.AllArgsConstructor; +import lombok.Getter; + +@Getter +@AllArgsConstructor public class SupportBaseClass { final String stringField; - - public SupportBaseClass(final String stringField) { - this.stringField = stringField; - } - - public String getStringField() { - return stringField; - } } diff --git a/core/core-engine/src/test/java/org/onap/policy/apex/core/engine/executor/DummyStateFinalizerExecutor.java b/core/core-engine/src/test/java/org/onap/policy/apex/core/engine/executor/DummyStateFinalizerExecutor.java index 5a011b2aa..e4e3ddf0d 100644 --- a/core/core-engine/src/test/java/org/onap/policy/apex/core/engine/executor/DummyStateFinalizerExecutor.java +++ b/core/core-engine/src/test/java/org/onap/policy/apex/core/engine/executor/DummyStateFinalizerExecutor.java @@ -2,6 +2,7 @@ * ============LICENSE_START======================================================= * Copyright (C) 2018 Ericsson. All rights reserved. * Modifications Copyright (C) 2019 Nordix Foundation. + * Modifications Copyright (C) 2021 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. @@ -23,21 +24,19 @@ package org.onap.policy.apex.core.engine.executor; import java.util.Map; import java.util.Properties; +import lombok.NoArgsConstructor; import org.onap.policy.apex.context.ContextException; import org.onap.policy.apex.core.engine.executor.exception.StateMachineException; /** * Dummy state finalizer executor for testing. */ +@NoArgsConstructor public class DummyStateFinalizerExecutor extends StateFinalizerExecutor { private boolean override; private boolean returnBad; - public DummyStateFinalizerExecutor() { - this(false); - } - public DummyStateFinalizerExecutor(final boolean override) { this.override = override; } diff --git a/core/core-engine/src/test/java/org/onap/policy/apex/core/engine/executor/DummyTaskExecutor.java b/core/core-engine/src/test/java/org/onap/policy/apex/core/engine/executor/DummyTaskExecutor.java index 75c4c0d7c..8172eefcc 100644 --- a/core/core-engine/src/test/java/org/onap/policy/apex/core/engine/executor/DummyTaskExecutor.java +++ b/core/core-engine/src/test/java/org/onap/policy/apex/core/engine/executor/DummyTaskExecutor.java @@ -3,6 +3,7 @@ * Copyright (C) 2018 Ericsson. All rights reserved. * Modifications Copyright (C) 2019-2020 Nordix Foundation. * Modifications Copyright (C) 2021 Bell Canada. All rights reserved. + * Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -24,6 +25,8 @@ package org.onap.policy.apex.core.engine.executor; import java.util.Map; import java.util.Properties; +import lombok.AllArgsConstructor; +import lombok.NoArgsConstructor; import org.onap.policy.apex.context.ContextException; import org.onap.policy.apex.core.engine.event.EnEvent; import org.onap.policy.apex.core.engine.executor.exception.StateMachineException; @@ -34,18 +37,12 @@ import org.onap.policy.apex.model.policymodel.concepts.AxTask; /** * Dummy task executor for testing. */ +@NoArgsConstructor +@AllArgsConstructor public class DummyTaskExecutor extends TaskExecutor { private static final String EVENT_KEY = "Event1:0.0.1"; private boolean override; - public DummyTaskExecutor() { - this(false); - } - - public DummyTaskExecutor(final boolean override) { - this.override = override; - } - @Override public void prepare() throws StateMachineException { if (!override) { diff --git a/core/core-engine/src/test/java/org/onap/policy/apex/core/engine/executor/DummyTaskSelectExecutor.java b/core/core-engine/src/test/java/org/onap/policy/apex/core/engine/executor/DummyTaskSelectExecutor.java index 02a32d4e7..a5525ac83 100644 --- a/core/core-engine/src/test/java/org/onap/policy/apex/core/engine/executor/DummyTaskSelectExecutor.java +++ b/core/core-engine/src/test/java/org/onap/policy/apex/core/engine/executor/DummyTaskSelectExecutor.java @@ -2,6 +2,7 @@ * ============LICENSE_START======================================================= * Copyright (C) 2018 Ericsson. All rights reserved. * Modifications Copyright (C) 2019 Nordix Foundation. + * Modifications Copyright (C) 2021 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. @@ -22,6 +23,9 @@ package org.onap.policy.apex.core.engine.executor; import java.util.Properties; +import lombok.AllArgsConstructor; +import lombok.NoArgsConstructor; +import lombok.Setter; import org.onap.policy.apex.context.ContextException; import org.onap.policy.apex.core.engine.event.EnEvent; import org.onap.policy.apex.core.engine.executor.exception.StateMachineException; @@ -30,19 +34,14 @@ import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey; /** * Dummy task selection executor for testing. */ +@NoArgsConstructor +@AllArgsConstructor public class DummyTaskSelectExecutor extends TaskSelectExecutor { private boolean override; + @Setter private static int taskNo; - public DummyTaskSelectExecutor() { - this(false); - } - - public DummyTaskSelectExecutor(final boolean override) { - this.override = override; - } - @Override public void prepare() throws StateMachineException { if (!override) { @@ -63,10 +62,6 @@ public class DummyTaskSelectExecutor extends TaskSelectExecutor { return new AxArtifactKey("task" + (taskNo++) + ":0.0.1"); } - public void setTaskNo(int incomingTaskNo) { - taskNo = incomingTaskNo; - } - /** * {@inheritDoc}. */ diff --git a/core/core-engine/src/test/java/org/onap/policy/apex/core/engine/executor/StateMachineExecutorTest.java b/core/core-engine/src/test/java/org/onap/policy/apex/core/engine/executor/StateMachineExecutorTest.java index 2d274bd2e..5d91bd2b3 100644 --- a/core/core-engine/src/test/java/org/onap/policy/apex/core/engine/executor/StateMachineExecutorTest.java +++ b/core/core-engine/src/test/java/org/onap/policy/apex/core/engine/executor/StateMachineExecutorTest.java @@ -3,6 +3,7 @@ * Copyright (C) 2018 Ericsson. All rights reserved. * Modifications Copyright (C) 2020 Nordix Foundation. * Modifications Copyright (C) 2021 Bell Canada. All rights reserved. + * Modifications Copyright (C) 2021 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. @@ -222,26 +223,26 @@ public class StateMachineExecutorTest { executor.setContext(null, axPolicy, internalContextMock); executor.execute(0, null, incomingEventMock); - dummyTsle.setTaskNo(0); + DummyTaskSelectExecutor.setTaskNo(0); executor.execute(0, null, incomingEventMock); AxReferenceKey badStateKey = new AxReferenceKey("Policy:0.0.1:PName:BadState"); axPolicy.getStateMap().get("State1").getStateOutputs().get("stateOutput1").setNextState(badStateKey); - dummyTsle.setTaskNo(0); + DummyTaskSelectExecutor.setTaskNo(0); assertThatThrownBy(() -> executor.execute(0, null, incomingEventMock)) .hasMessage("state execution failed, next state \"Policy:0.0.1:PName:BadState\" not found"); axPolicy.getStateMap().get("State1").getStateOutputs().get("stateOutput1") .setNextState(AxReferenceKey.getNullKey()); - dummyTsle.setTaskNo(0); + DummyTaskSelectExecutor.setTaskNo(0); executor.execute(0, null, incomingEventMock); axPolicy.getStateMap().get("State1").setTrigger(new AxArtifactKey("BadTrigger:0.0.1")); - dummyTsle.setTaskNo(0); + DummyTaskSelectExecutor.setTaskNo(0); assertThatThrownBy(() -> executor.execute(0, null, incomingEventMock)) .hasMessage("incoming event \"Event1:0.0.1\" does not match trigger \"BadTrigger:0.0.1\" " + "of state \"Policy:0.0.1:NULL:state1\""); axPolicy.getStateMap().get("State1").setTrigger(new AxArtifactKey("Event1:0.0.1")); - dummyTsle.setTaskNo(0); + DummyTaskSelectExecutor.setTaskNo(0); executor.execute(0, null, incomingEventMock); AxStateFinalizerLogic savedSfl = axPolicy.getStateMap().get("State1").getStateFinalizerLogicMap().get("sfl"); @@ -255,7 +256,7 @@ public class StateMachineExecutorTest { axPolicy.getStateMap().get("State1").getStateFinalizerLogicMap().put("sfl", savedSfl); executor.setContext(null, axPolicy, internalContextMock); - dummyTsle.setTaskNo(0); + DummyTaskSelectExecutor.setTaskNo(0); executor.execute(0, null, incomingEventMock); AxArtifactKey task1Key = new AxArtifactKey("task1:0.0.1"); @@ -271,16 +272,16 @@ public class StateMachineExecutorTest { .setStateTaskOutputType(AxStateTaskOutputType.LOGIC); executor.setContext(null, axPolicy, internalContextMock); - dummyTsle.setTaskNo(0); + DummyTaskSelectExecutor.setTaskNo(0); executor.execute(0, null, incomingEventMock); - dummyTsle.setTaskNo(0); + DummyTaskSelectExecutor.setTaskNo(0); dummySfle.setReturnBad(true); assertThatThrownBy(() -> executor.execute(0, null, incomingEventMock)) .hasMessage("State execution of state \"Policy:0.0.1:NULL:state1\" on task \"task1:0.0.1\"" + " failed: state output definition for state output \"stateOutputBad\" not found for " + "state \"Policy:0.0.1:NULL:state1\""); - dummyTsle.setTaskNo(0); + DummyTaskSelectExecutor.setTaskNo(0); dummySfle.setReturnBad(false); executor.execute(0, null, incomingEventMock); diff --git a/core/core-engine/src/test/java/org/onap/policy/apex/core/engine/executor/context/DummyContextAlbum.java b/core/core-engine/src/test/java/org/onap/policy/apex/core/engine/executor/context/DummyContextAlbum.java index 156e64b16..efb53a682 100644 --- a/core/core-engine/src/test/java/org/onap/policy/apex/core/engine/executor/context/DummyContextAlbum.java +++ b/core/core-engine/src/test/java/org/onap/policy/apex/core/engine/executor/context/DummyContextAlbum.java @@ -1,19 +1,20 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2018 Ericsson. All rights reserved. + * Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * + * * SPDX-License-Identifier: Apache-2.0 * ============LICENSE_END========================================================= */ @@ -23,6 +24,7 @@ package org.onap.policy.apex.core.engine.executor.context; import java.util.Collection; import java.util.Map; import java.util.Set; +import lombok.AllArgsConstructor; import org.apache.commons.lang3.NotImplementedException; import org.onap.policy.apex.context.ContextAlbum; import org.onap.policy.apex.context.ContextException; @@ -34,18 +36,10 @@ import org.onap.policy.apex.model.contextmodel.concepts.AxContextAlbum; /** * Dummy context album for testing. */ +@AllArgsConstructor public class DummyContextAlbum implements ContextAlbum { private final AxArtifactKey key; - /** - * Constructor. - * @param key the key - */ - public DummyContextAlbum(AxArtifactKey key) { - super(); - this.key = key; - } - /** * {@inheritDoc}. */ @@ -53,7 +47,7 @@ public class DummyContextAlbum implements ContextAlbum { public void clear() { throw new NotImplementedException("Not implemented on dummy class"); } - + /** * {@inheritDoc}. */ diff --git a/core/core-protocols/src/test/java/org/onap/policy/apex/core/protocols/DummyAction.java b/core/core-protocols/src/test/java/org/onap/policy/apex/core/protocols/DummyAction.java index 3d15a8c01..876052296 100644 --- a/core/core-protocols/src/test/java/org/onap/policy/apex/core/protocols/DummyAction.java +++ b/core/core-protocols/src/test/java/org/onap/policy/apex/core/protocols/DummyAction.java @@ -2,6 +2,7 @@ * ============LICENSE_START======================================================= * Copyright (C) 2018 Ericsson. All rights reserved. * Modifications Copyright (C) 2020 Nordix Foundation. + * Modifications Copyright (C) 2021 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,60 +22,20 @@ package org.onap.policy.apex.core.protocols; +import lombok.AllArgsConstructor; +import lombok.EqualsAndHashCode; +import lombok.Getter; +import lombok.Setter; + /** * Dummy action for testing. */ +@Getter +@Setter +@EqualsAndHashCode +@AllArgsConstructor public class DummyAction implements Action { private static final long serialVersionUID = 9178856761163651594L; private String actionString = "An Action String"; - - public DummyAction(final String actionString) { - this.actionString = actionString; - } - - /** - * {@inheritDoc}. - */ - @Override - public String getActionString() { - return actionString; - } - - public void setActionString(final String actionString) { - this.actionString = actionString; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((actionString == null) ? 0 : actionString.hashCode()); - return result; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - - if (obj == null) { - return false; - } - - if (getClass() != obj.getClass()) { - return false; - } - - DummyAction other = (DummyAction) obj; - if (actionString == null) { - if (other.actionString != null) { - return false; - } - } else if (!actionString.equals(other.actionString)) { - return false; - } - return true; - } } diff --git a/core/core-protocols/src/test/java/org/onap/policy/apex/core/protocols/SupportMessageTester.java b/core/core-protocols/src/test/java/org/onap/policy/apex/core/protocols/SupportMessageTester.java index f275f4b79..7bc352025 100644 --- a/core/core-protocols/src/test/java/org/onap/policy/apex/core/protocols/SupportMessageTester.java +++ b/core/core-protocols/src/test/java/org/onap/policy/apex/core/protocols/SupportMessageTester.java @@ -22,6 +22,7 @@ package org.onap.policy.apex.core.protocols; +import static org.assertj.core.api.Assertions.assertThat; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotEquals; import static org.junit.Assert.assertNotNull; @@ -41,8 +42,9 @@ public class SupportMessageTester { DummyMessage dummyMessage = new DummyMessage(new DummyAction(null), new AxArtifactKey("Target:0.0.1")); assertEquals(new DummyAction(null), dummyMessage.getAction()); - assertEquals("Message(action=org.onap.policy.apex.core.protocols.DummyAction@1f, " - + "targetKey=AxArtifactKey:(name=Target,version=0.0.1), messageData=null)", dummyMessage.toString()); + assertThat(dummyMessage.toString()) + .startsWith("Message(action=org.onap.policy.apex.core.protocols.DummyAction@") + .endsWith("targetKey=AxArtifactKey:(name=Target,version=0.0.1), messageData=null)"); dummyMessage.setMessageData("Message Data"); assertEquals("Message Data", dummyMessage.getMessageData()); diff --git a/examples/examples-aadm/src/test/java/org/onap/policy/apex/examples/aadm/TestApexActionListener.java b/examples/examples-aadm/src/test/java/org/onap/policy/apex/examples/aadm/TestApexActionListener.java index 37a916a1e..825ce5866 100644 --- a/examples/examples-aadm/src/test/java/org/onap/policy/apex/examples/aadm/TestApexActionListener.java +++ b/examples/examples-aadm/src/test/java/org/onap/policy/apex/examples/aadm/TestApexActionListener.java @@ -24,6 +24,7 @@ package org.onap.policy.apex.examples.aadm; import java.util.ArrayList; import java.util.List; +import lombok.AllArgsConstructor; import lombok.Getter; import org.onap.policy.apex.core.engine.engine.EnEventListener; import org.onap.policy.apex.core.engine.event.EnEvent; @@ -36,21 +37,13 @@ import org.onap.policy.apex.core.engine.event.EnEvent; * * @author Liam Fallon (liam.fallon@ericsson.com) */ +@AllArgsConstructor public class TestApexActionListener implements EnEventListener { - List resultEvents = new ArrayList(); + private final List resultEvents = new ArrayList(); @Getter private final String id; - /** - * Instantiates a new test apex action listener. - * - * @param id the id - */ - public TestApexActionListener(final String id) { - this.id = id; - } - /** * Gets the result. * diff --git a/examples/examples-adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/TestApexActionListener.java b/examples/examples-adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/TestApexActionListener.java index 702b050fd..273d8b77d 100644 --- a/examples/examples-adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/TestApexActionListener.java +++ b/examples/examples-adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/TestApexActionListener.java @@ -2,6 +2,7 @@ * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. * Modifications Copyright (C) 2020 Nordix Foundation. + * Modifications Copyright (C) 2021 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. @@ -26,6 +27,8 @@ import static org.awaitility.Awaitility.await; import java.util.ArrayList; import java.util.List; import java.util.concurrent.TimeUnit; +import lombok.AllArgsConstructor; +import lombok.Getter; import org.onap.policy.apex.core.engine.engine.EnEventListener; import org.onap.policy.apex.core.engine.event.EnEvent; @@ -37,20 +40,13 @@ import org.onap.policy.apex.core.engine.event.EnEvent; * * @author Liam Fallon (liam.fallon@ericsson.com) */ +@AllArgsConstructor public class TestApexActionListener implements EnEventListener { - private List resultEvents = new ArrayList<>(); + private final List resultEvents = new ArrayList<>(); + @Getter private final String id; - /** - * Instantiates a new test apex action listener. - * - * @param id the id - */ - public TestApexActionListener(final String id) { - this.id = id; - } - /** * Gets the result. * @@ -71,13 +67,4 @@ public class TestApexActionListener implements EnEventListener { resultEvents.add(actionEvent); } } - - /** - * Gets the id. - * - * @return the id - */ - public String getId() { - return id; - } } diff --git a/examples/examples-myfirstpolicy/src/test/java/org/onap/policy/apex/examples/myfirstpolicy/TestSaleAuthListener.java b/examples/examples-myfirstpolicy/src/test/java/org/onap/policy/apex/examples/myfirstpolicy/TestSaleAuthListener.java index 1281c515d..01c24d6de 100644 --- a/examples/examples-myfirstpolicy/src/test/java/org/onap/policy/apex/examples/myfirstpolicy/TestSaleAuthListener.java +++ b/examples/examples-myfirstpolicy/src/test/java/org/onap/policy/apex/examples/myfirstpolicy/TestSaleAuthListener.java @@ -2,6 +2,7 @@ * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. * Modifications Copyright (C) 2020 Nordix Foundation. + * Modifications Copyright (C) 2021 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. @@ -26,6 +27,8 @@ import static org.awaitility.Awaitility.await; import java.util.ArrayList; import java.util.List; import java.util.concurrent.TimeUnit; +import lombok.AllArgsConstructor; +import lombok.Getter; import org.onap.policy.apex.core.engine.engine.EnEventListener; import org.onap.policy.apex.core.engine.event.EnEvent; @@ -37,22 +40,15 @@ import org.onap.policy.apex.core.engine.event.EnEvent; * * @author Liam Fallon (liam.fallon@ericsson.com) */ +@AllArgsConstructor public class TestSaleAuthListener implements EnEventListener { // CHECKSTYLE:OFF: MagicNumber private final List resultEvents = new ArrayList<>(); + @Getter private final String id; - /** - * Instantiates a new action listener. - * - * @param id the id - */ - public TestSaleAuthListener(final String id) { - this.id = id; - } - /** * Gets the result. * @@ -73,13 +69,4 @@ public class TestSaleAuthListener implements EnEventListener { resultEvents.add(saleauthEvent); } } - - /** - * Gets the id. - * - * @return the id - */ - public String getId() { - return id; - } } diff --git a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/src/test/java/org/onap/policy/apex/plugins/event/carrier/restclient/SupportApexEventReceiver.java b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/src/test/java/org/onap/policy/apex/plugins/event/carrier/restclient/SupportApexEventReceiver.java index f2201379d..49135f5d4 100644 --- a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/src/test/java/org/onap/policy/apex/plugins/event/carrier/restclient/SupportApexEventReceiver.java +++ b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/src/test/java/org/onap/policy/apex/plugins/event/carrier/restclient/SupportApexEventReceiver.java @@ -2,6 +2,7 @@ * ============LICENSE_START======================================================= * Copyright (C) 2018 Ericsson. All rights reserved. * Modifications Copyright (C) 2019 Nordix Foundation. + * Modifications Copyright (C) 2021 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. @@ -22,6 +23,7 @@ package org.onap.policy.apex.plugins.event.carrier.restclient; import java.util.Properties; +import lombok.Getter; import org.onap.policy.apex.service.engine.event.ApexEventException; import org.onap.policy.apex.service.engine.event.ApexEventReceiver; @@ -29,6 +31,7 @@ import org.onap.policy.apex.service.engine.event.ApexEventReceiver; * Support Apex event reveiver for unit test. * */ +@Getter public class SupportApexEventReceiver implements ApexEventReceiver { private long lastExecutionId; private Object lastEvent; @@ -53,21 +56,4 @@ public class SupportApexEventReceiver implements ApexEventReceiver { this.lastEvent = event; this.eventCount++; } - - public long getLastExecutionId() { - return lastExecutionId; - } - - public Object getLastEvent() { - return lastEvent; - } - - /** - * Get the number of events received. - * - * @return the number of events received - */ - public int getEventCount() { - return eventCount; - } } diff --git a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restserver/src/test/java/org/onap/policy/apex/plugins/event/carrier/restserver/SupportApexEventReceiver.java b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restserver/src/test/java/org/onap/policy/apex/plugins/event/carrier/restserver/SupportApexEventReceiver.java index cd60c220d..773ecafb2 100644 --- a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restserver/src/test/java/org/onap/policy/apex/plugins/event/carrier/restserver/SupportApexEventReceiver.java +++ b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restserver/src/test/java/org/onap/policy/apex/plugins/event/carrier/restserver/SupportApexEventReceiver.java @@ -1,6 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2018 Ericsson. All rights reserved. + * Modifications Copyright (C) 2021 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,6 +22,7 @@ package org.onap.policy.apex.plugins.event.carrier.restserver; import java.util.Properties; +import lombok.Getter; import org.onap.policy.apex.service.engine.event.ApexEventException; import org.onap.policy.apex.service.engine.event.ApexEventReceiver; @@ -28,6 +30,7 @@ import org.onap.policy.apex.service.engine.event.ApexEventReceiver; * Support Apex event reveiver for unit test. * */ +@Getter public class SupportApexEventReceiver implements ApexEventReceiver { private long lastExecutionId; private Object lastEvent; @@ -52,21 +55,4 @@ public class SupportApexEventReceiver implements ApexEventReceiver { this.lastEvent = event; this.eventCount++; } - - public long getLastExecutionId() { - return lastExecutionId; - } - - public Object getLastEvent() { - return lastEvent; - } - - /** - * Get the number of events received. - * - * @return the number of events received - */ - public int getEventCount() { - return eventCount; - } } diff --git a/plugins/plugins-event/plugins-event-protocol/plugins-event-protocol-xml/src/test/java/org/onap/policy/apex/plugins/event/protocol/xml/XmlEventGenerator.java b/plugins/plugins-event/plugins-event-protocol/plugins-event-protocol-xml/src/test/java/org/onap/policy/apex/plugins/event/protocol/xml/XmlEventGenerator.java index f85d9119e..9c8696c6c 100644 --- a/plugins/plugins-event/plugins-event-protocol/plugins-event-protocol-xml/src/test/java/org/onap/policy/apex/plugins/event/protocol/xml/XmlEventGenerator.java +++ b/plugins/plugins-event/plugins-event-protocol/plugins-event-protocol-xml/src/test/java/org/onap/policy/apex/plugins/event/protocol/xml/XmlEventGenerator.java @@ -1,6 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. + * Modifications Copyright (C) 2021 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,11 +22,13 @@ package org.onap.policy.apex.plugins.event.protocol.xml; import java.util.Random; +import lombok.Getter; /** * The Class XmlEventGenerator. */ public class XmlEventGenerator { + @Getter private static int nextEventNo = 0; /** @@ -113,13 +116,4 @@ public class XmlEventGenerator { System.out.println(xmlEvents(eventCount)); } - - /** - * Gets the next event no. - * - * @return the next event no - */ - public static int getNextEventNo() { - return nextEventNo; - } } diff --git a/plugins/plugins-persistence/plugins-persistence-jpa/plugins-persistence-jpa-eclipselink/src/test/java/org/onap/policy/apex/plugins/persistence/jpa/eclipselink/entities/ArtifactKeyTestEntity.java b/plugins/plugins-persistence/plugins-persistence-jpa/plugins-persistence-jpa-eclipselink/src/test/java/org/onap/policy/apex/plugins/persistence/jpa/eclipselink/entities/ArtifactKeyTestEntity.java index f1561c2b8..98a4c5738 100644 --- a/plugins/plugins-persistence/plugins-persistence-jpa/plugins-persistence-jpa-eclipselink/src/test/java/org/onap/policy/apex/plugins/persistence/jpa/eclipselink/entities/ArtifactKeyTestEntity.java +++ b/plugins/plugins-persistence/plugins-persistence-jpa/plugins-persistence-jpa-eclipselink/src/test/java/org/onap/policy/apex/plugins/persistence/jpa/eclipselink/entities/ArtifactKeyTestEntity.java @@ -1,6 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2019 Nordix Foundation. + * Modifications Copyright (C) 2021 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. @@ -26,6 +27,11 @@ import javax.persistence.EmbeddedId; import javax.persistence.Entity; import javax.persistence.Table; import javax.xml.bind.annotation.XmlElement; +import lombok.EqualsAndHashCode; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; +import org.apache.commons.lang3.builder.CompareToBuilder; import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey; import org.onap.policy.apex.model.basicmodel.concepts.AxConcept; import org.onap.policy.apex.model.basicmodel.concepts.AxKey; @@ -36,6 +42,10 @@ import org.onap.policy.apex.model.basicmodel.concepts.AxValidationResult; */ @Entity @Table(name = "ArtifactKeyTestEntity") +@Getter +@Setter +@ToString +@EqualsAndHashCode(callSuper = false) public class ArtifactKeyTestEntity extends AxConcept { private static final long serialVersionUID = -2962570563281067896L; @@ -74,14 +84,6 @@ public class ArtifactKeyTestEntity extends AxConcept { this.doubleValue = doubleValue; } - /** - * {@inheritDoc}. - */ - @Override - public AxArtifactKey getKey() { - return key; - } - /** * {@inheritDoc}. */ @@ -90,15 +92,6 @@ public class ArtifactKeyTestEntity extends AxConcept { return Arrays.asList((AxKey) getKey()); } - /** - * Sets the key. - * - * @param key the new key - */ - public void setKey(final AxArtifactKey key) { - this.key = key; - } - /** * Check set key. * @@ -108,24 +101,6 @@ public class ArtifactKeyTestEntity extends AxConcept { return (this.key != null); } - /** - * Gets the double value. - * - * @return the double value - */ - public double getDoubleValue() { - return doubleValue; - } - - /** - * Sets the double value. - * - * @param doubleValue the new double value - */ - public void setDoubleValue(final double doubleValue) { - this.doubleValue = doubleValue; - } - /** * {@inheritDoc}. */ @@ -142,14 +117,6 @@ public class ArtifactKeyTestEntity extends AxConcept { key.clean(); } - /** - * {@inheritDoc}. - */ - @Override - public String toString() { - return "ArtifactKeyTestEntity [key=" + key + ", doubleValue=" + doubleValue + "]"; - } - /** * {@inheritDoc}. */ @@ -170,42 +137,6 @@ public class ArtifactKeyTestEntity extends AxConcept { } } - /** - * {@inheritDoc}. - */ - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((key == null) ? 0 : key.hashCode()); - return result; - } - - /** - * {@inheritDoc}. - */ - @Override - public boolean equals(final Object obj) { - if (obj == null) { - return false; - } - if (this == obj) { - return true; - } - if (getClass() != obj.getClass()) { - return false; - } - final ArtifactKeyTestEntity other = (ArtifactKeyTestEntity) obj; - if (key == null) { - if (other.key != null) { - return false; - } - } else if (!key.equals(other.key)) { - return false; - } - return (Double.compare(doubleValue, other.doubleValue) == 0); - } - /** * {@inheritDoc}. */ @@ -221,13 +152,9 @@ public class ArtifactKeyTestEntity extends AxConcept { return -1; } final ArtifactKeyTestEntity other = (ArtifactKeyTestEntity) otherObj; - if (key == null) { - if (other.key != null) { - return 1; - } - } else if (!key.equals(other.key)) { - return key.compareTo(other.key); - } - return Double.compare(doubleValue, other.doubleValue); + return new CompareToBuilder() + .append(key, other.key) + .append(doubleValue, other.doubleValue) + .toComparison(); } } diff --git a/plugins/plugins-persistence/plugins-persistence-jpa/plugins-persistence-jpa-eclipselink/src/test/java/org/onap/policy/apex/plugins/persistence/jpa/eclipselink/entities/ReferenceKeyTestEntity.java b/plugins/plugins-persistence/plugins-persistence-jpa/plugins-persistence-jpa-eclipselink/src/test/java/org/onap/policy/apex/plugins/persistence/jpa/eclipselink/entities/ReferenceKeyTestEntity.java index afeeb84fd..cadc9b8db 100644 --- a/plugins/plugins-persistence/plugins-persistence-jpa/plugins-persistence-jpa-eclipselink/src/test/java/org/onap/policy/apex/plugins/persistence/jpa/eclipselink/entities/ReferenceKeyTestEntity.java +++ b/plugins/plugins-persistence/plugins-persistence-jpa/plugins-persistence-jpa-eclipselink/src/test/java/org/onap/policy/apex/plugins/persistence/jpa/eclipselink/entities/ReferenceKeyTestEntity.java @@ -1,6 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2019 Nordix Foundation. + * Modifications Copyright (C) 2021 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. @@ -27,6 +28,11 @@ import javax.persistence.Entity; import javax.persistence.Table; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; +import lombok.EqualsAndHashCode; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; +import org.apache.commons.lang3.builder.CompareToBuilder; import org.onap.policy.apex.model.basicmodel.concepts.AxConcept; import org.onap.policy.apex.model.basicmodel.concepts.AxKey; import org.onap.policy.apex.model.basicmodel.concepts.AxReferenceKey; @@ -38,6 +44,10 @@ import org.onap.policy.apex.model.basicmodel.xml.AxReferenceKeyAdapter; */ @Entity @Table(name = "ReferenceKeyTestEntity") +@Getter +@Setter +@ToString +@EqualsAndHashCode(callSuper = false) public class ReferenceKeyTestEntity extends AxConcept { private static final long serialVersionUID = -2962570563281067895L; @@ -77,14 +87,6 @@ public class ReferenceKeyTestEntity extends AxConcept { this.doubleValue = doubleValue; } - /** - * {@inheritDoc}. - */ - @Override - public AxReferenceKey getKey() { - return key; - } - /** * {@inheritDoc}. */ @@ -93,15 +95,6 @@ public class ReferenceKeyTestEntity extends AxConcept { return Arrays.asList((AxKey) getKey()); } - /** - * Sets the key. - * - * @param key the new key - */ - public void setKey(final AxReferenceKey key) { - this.key = key; - } - /** * Check set key. * @@ -111,24 +104,6 @@ public class ReferenceKeyTestEntity extends AxConcept { return (this.key != null); } - /** - * Gets the double value. - * - * @return the double value - */ - public double getDoubleValue() { - return doubleValue; - } - - /** - * Sets the double value. - * - * @param doubleValue the new double value - */ - public void setDoubleValue(final double doubleValue) { - this.doubleValue = doubleValue; - } - /** * {@inheritDoc}. */ @@ -145,14 +120,6 @@ public class ReferenceKeyTestEntity extends AxConcept { key.clean(); } - /** - * {@inheritDoc}. - */ - @Override - public String toString() { - return "ReferenceKeyTestEntity [key=" + key + ", doubleValue=" + doubleValue + "]"; - } - /** * {@inheritDoc}. */ @@ -173,42 +140,6 @@ public class ReferenceKeyTestEntity extends AxConcept { } } - /** - * {@inheritDoc}. - */ - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((key == null) ? 0 : key.hashCode()); - return result; - } - - /** - * {@inheritDoc}. - */ - @Override - public boolean equals(final Object obj) { - if (obj == null) { - return false; - } - if (this == obj) { - return true; - } - if (getClass() != obj.getClass()) { - return false; - } - final ReferenceKeyTestEntity other = (ReferenceKeyTestEntity) obj; - if (key == null) { - if (other.key != null) { - return false; - } - } else if (!key.equals(other.key)) { - return false; - } - return (Double.compare(doubleValue, other.doubleValue) == 0); - } - /** * {@inheritDoc}. */ @@ -224,13 +155,9 @@ public class ReferenceKeyTestEntity extends AxConcept { return -1; } final ReferenceKeyTestEntity other = (ReferenceKeyTestEntity) otherObj; - if (key == null) { - if (other.key != null) { - return 1; - } - } else if (!key.equals(other.key)) { - return key.compareTo(other.key); - } - return Double.compare(doubleValue, other.doubleValue); + return new CompareToBuilder() + .append(key, other.key) + .append(doubleValue, other.doubleValue) + .toComparison(); } } diff --git a/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/event/testpojos/DummyPojo.java b/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/event/testpojos/DummyPojo.java index f87c72521..f6902f976 100644 --- a/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/event/testpojos/DummyPojo.java +++ b/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/event/testpojos/DummyPojo.java @@ -1,69 +1,36 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2018 Ericsson. All rights reserved. + * Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * + * * SPDX-License-Identifier: Apache-2.0 * ============LICENSE_END========================================================= */ package org.onap.policy.apex.service.engine.event.testpojos; +import lombok.Getter; + /** * A test Pojo for pojo decoding and encoding in Apex. */ +@Getter public class DummyPojo { private int anInt; private Integer anInteger; private String someString; - - private DummySubPojo testSubPojo; - - /** - * Gets the an int. - * - * @return the an int - */ - public int getAnInt() { - return anInt; - } - - /** - * Gets the an integer. - * - * @return the an integer - */ - public Integer getAnInteger() { - return anInteger; - } - - /** - * Gets the a string. - * - * @return the a string - */ - public String getSomeString() { - return someString; - } - - /** - * Gets the test sub pojo. - * - * @return the test sub pojo - */ - public DummySubPojo getTestSubPojo() { - return testSubPojo; - } + private DummySubPojo testSubPojo; } diff --git a/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/event/testpojos/DummyPojoList.java b/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/event/testpojos/DummyPojoList.java index 13c0e9652..8a0d82d71 100644 --- a/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/event/testpojos/DummyPojoList.java +++ b/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/event/testpojos/DummyPojoList.java @@ -1,19 +1,20 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2018 Ericsson. All rights reserved. + * Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * + * * SPDX-License-Identifier: Apache-2.0 * ============LICENSE_END========================================================= */ @@ -21,19 +22,12 @@ package org.onap.policy.apex.service.engine.event.testpojos; import java.util.List; +import lombok.Getter; /** * A test list of POJO for decoding and encoding. */ +@Getter public class DummyPojoList { private List testPojoList; - - /** - * Gets the test pojo list. - * - * @return the test pojo list - */ - public List getTestPojoList() { - return testPojoList; - } } diff --git a/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/event/testpojos/DummySubPojo.java b/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/event/testpojos/DummySubPojo.java index 121cc81a8..48614a6b9 100644 --- a/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/event/testpojos/DummySubPojo.java +++ b/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/event/testpojos/DummySubPojo.java @@ -1,69 +1,36 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2018 Ericsson. All rights reserved. + * Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * + * * SPDX-License-Identifier: Apache-2.0 * ============LICENSE_END========================================================= */ package org.onap.policy.apex.service.engine.event.testpojos; +import lombok.Getter; + /** * A test Pojo for pojo decoding and encoding in Apex. */ +@Getter public class DummySubPojo { private int anInt; private Integer anInteger; private String someString; - - private DummySubSubPojo testSubSubPojo; - - /** - * Gets the an int. - * - * @return the an int - */ - public int getAnInt() { - return anInt; - } - - /** - * Gets the an integer. - * - * @return the an integer - */ - public Integer getAnInteger() { - return anInteger; - } - - /** - * Gets the a string. - * - * @return the a string - */ - public String getSomeString() { - return someString; - } - - /** - * Gets the test sub sub pojo. - * - * @return the test sub sub pojo - */ - public DummySubSubPojo getTestSubSubPojo() { - return testSubSubPojo; - } + private DummySubSubPojo testSubSubPojo; } diff --git a/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/event/testpojos/DummySubSubPojo.java b/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/event/testpojos/DummySubSubPojo.java index d2e55f462..f10e433c0 100644 --- a/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/event/testpojos/DummySubSubPojo.java +++ b/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/event/testpojos/DummySubSubPojo.java @@ -1,57 +1,34 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2018 Ericsson. All rights reserved. + * Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * + * * SPDX-License-Identifier: Apache-2.0 * ============LICENSE_END========================================================= */ package org.onap.policy.apex.service.engine.event.testpojos; +import lombok.Getter; + /** * A test Pojo for pojo decoding and encoding in Apex. */ +@Getter public class DummySubSubPojo { private int anInt; private Integer anInteger; private String someString; - - /** - * Gets the an int. - * - * @return the an int - */ - public int getAnInt() { - return anInt; - } - - /** - * Gets the an integer. - * - * @return the an integer - */ - public Integer getAnInteger() { - return anInteger; - } - - /** - * Gets the a string. - * - * @return the a string - */ - public String getSomeString() { - return someString; - } } diff --git a/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/dummyclasses/DummyStateFinalizerExecutor.java b/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/dummyclasses/DummyStateFinalizerExecutor.java index ec06ce97f..c12db9692 100644 --- a/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/dummyclasses/DummyStateFinalizerExecutor.java +++ b/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/dummyclasses/DummyStateFinalizerExecutor.java @@ -1,6 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2018 Ericsson. All rights reserved. + * Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -30,9 +31,6 @@ import org.onap.policy.apex.core.engine.executor.exception.StateMachineException * Dummy state finalizer executor for testing. */ public class DummyStateFinalizerExecutor extends StateFinalizerExecutor { - public DummyStateFinalizerExecutor() { - // Default constructor - } @Override public String execute(final long executionId, final Properties executorProperties, diff --git a/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/dummyclasses/DummyTaskExecutor.java b/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/dummyclasses/DummyTaskExecutor.java index 56f0af5c6..d4b400279 100644 --- a/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/dummyclasses/DummyTaskExecutor.java +++ b/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/dummyclasses/DummyTaskExecutor.java @@ -2,6 +2,7 @@ * ============LICENSE_START======================================================= * Copyright (C) 2018 Ericsson. All rights reserved. * Modifications Copyright (C) 2021 Bell Canada. All rights reserved. + * Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -34,9 +35,6 @@ import org.onap.policy.apex.model.policymodel.concepts.AxTask; * Dummy task executor for testing. */ public class DummyTaskExecutor extends TaskExecutor { - public DummyTaskExecutor() { - // Default constructor - } @Override public void prepare() throws StateMachineException { diff --git a/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/dummyclasses/DummyTaskSelectExecutor.java b/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/dummyclasses/DummyTaskSelectExecutor.java index 22f6b4431..39374cdc9 100644 --- a/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/dummyclasses/DummyTaskSelectExecutor.java +++ b/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/dummyclasses/DummyTaskSelectExecutor.java @@ -1,6 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2018 Ericsson. All rights reserved. + * Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -31,8 +32,6 @@ import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey; * Dummy task selection executor for testing. */ public class DummyTaskSelectExecutor extends TaskSelectExecutor { - public DummyTaskSelectExecutor() { - } @Override public void prepare() throws StateMachineException { diff --git a/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/dummyclasses/SuperDooperCarrierTechnologyParameters.java b/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/dummyclasses/SuperDooperCarrierTechnologyParameters.java index d7a502c7f..b23acdd01 100644 --- a/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/dummyclasses/SuperDooperCarrierTechnologyParameters.java +++ b/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/dummyclasses/SuperDooperCarrierTechnologyParameters.java @@ -24,6 +24,8 @@ package org.onap.policy.apex.service.engine.parameters.dummyclasses; import java.util.Arrays; import java.util.Collection; import java.util.Properties; +import lombok.Getter; +import lombok.Setter; import org.apache.commons.lang3.StringUtils; import org.onap.policy.apex.service.parameters.carriertechnology.CarrierTechnologyParameters; import org.onap.policy.common.parameters.BeanValidationResult; @@ -40,6 +42,8 @@ import org.onap.policy.models.base.Validated; */ @NotNull @NotBlank +@Getter +@Setter public class SuperDooperCarrierTechnologyParameters extends CarrierTechnologyParameters { // Default parameter values private static final String DEFAULT_ACKS = "all"; @@ -149,114 +153,6 @@ public class SuperDooperCarrierTechnologyParameters extends CarrierTechnologyPar return superDooperProperties; } - /** - * Gets the bootstrap servers. - * - * @return the bootstrap servers - */ - public String getBootstrapServers() { - return bootstrapServers; - } - - /** - * Gets the acks. - * - * @return the acks - */ - public String getAcks() { - return acks; - } - - /** - * Gets the retries. - * - * @return the retries - */ - public int getRetries() { - return retries; - } - - /** - * Gets the batch size. - * - * @return the batch size - */ - public int getBatchSize() { - return batchSize; - } - - /** - * Gets the linger time. - * - * @return the linger time - */ - public int getLingerTime() { - return lingerTime; - } - - /** - * Gets the buffer memory. - * - * @return the buffer memory - */ - public long getBufferMemory() { - return bufferMemory; - } - - /** - * Gets the group id. - * - * @return the group id - */ - public String getGroupId() { - return groupId; - } - - /** - * Checks if is enable auto commit. - * - * @return true, if checks if is enable auto commit - */ - public boolean isEnableAutoCommit() { - return enableAutoCommit; - } - - /** - * Gets the auto commit time. - * - * @return the auto commit time - */ - public int getAutoCommitTime() { - return autoCommitTime; - } - - /** - * Gets the session timeout. - * - * @return the session timeout - */ - public int getSessionTimeout() { - return sessionTimeout; - } - - /** - * Gets the producer topic. - * - * @return the producer topic - */ - public String getProducerTopic() { - return producerTopic; - } - - /** - * Gets the consumer poll time. - * - * @return the consumer poll time - */ - public long getConsumerPollTime() { - return consumerPollTime; - } - /** * Gets the consumer topic list. * @@ -266,195 +162,6 @@ public class SuperDooperCarrierTechnologyParameters extends CarrierTechnologyPar return Arrays.asList(consumerTopicList); } - /** - * Gets the key serializer. - * - * @return the key serializer - */ - public String getKeySerializer() { - return keySerializer; - } - - /** - * Gets the value serializer. - * - * @return the value serializer - */ - public String getValueSerializer() { - return valueSerializer; - } - - /** - * Gets the key deserializer. - * - * @return the key deserializer - */ - public String getKeyDeserializer() { - return keyDeserializer; - } - - /** - * Gets the value deserializer. - * - * @return the value deserializer - */ - public String getValueDeserializer() { - return valueDeserializer; - } - - /** - * Sets the bootstrap servers. - * - * @param bootstrapServers the new bootstrap servers - */ - public void setBootstrapServers(String bootstrapServers) { - this.bootstrapServers = bootstrapServers; - } - - /** - * Sets the acks. - * - * @param acks the new acks - */ - public void setAcks(String acks) { - this.acks = acks; - } - - /** - * Sets the retries. - * - * @param retries the new retries - */ - public void setRetries(int retries) { - this.retries = retries; - } - - /** - * Sets the batch size. - * - * @param batchSize the new batch size - */ - public void setBatchSize(int batchSize) { - this.batchSize = batchSize; - } - - /** - * Sets the linger time. - * - * @param lingerTime the new linger time - */ - public void setLingerTime(int lingerTime) { - this.lingerTime = lingerTime; - } - - /** - * Sets the buffer memory. - * - * @param bufferMemory the new buffer memory - */ - public void setBufferMemory(long bufferMemory) { - this.bufferMemory = bufferMemory; - } - - /** - * Sets the group id. - * - * @param groupId the new group id - */ - public void setGroupId(String groupId) { - this.groupId = groupId; - } - - /** - * Sets the enable auto commit. - * - * @param enableAutoCommit the new enable auto commit - */ - public void setEnableAutoCommit(boolean enableAutoCommit) { - this.enableAutoCommit = enableAutoCommit; - } - - /** - * Sets the auto commit time. - * - * @param autoCommitTime the new auto commit time - */ - public void setAutoCommitTime(int autoCommitTime) { - this.autoCommitTime = autoCommitTime; - } - - /** - * Sets the session timeout. - * - * @param sessionTimeout the new session timeout - */ - public void setSessionTimeout(int sessionTimeout) { - this.sessionTimeout = sessionTimeout; - } - - /** - * Sets the producer topic. - * - * @param producerTopic the new producer topic - */ - public void setProducerTopic(String producerTopic) { - this.producerTopic = producerTopic; - } - - /** - * Sets the consumer poll time. - * - * @param consumerPollTime the new consumer poll time - */ - public void setConsumerPollTime(int consumerPollTime) { - this.consumerPollTime = consumerPollTime; - } - - /** - * Sets the consumer topic list. - * - * @param consumerTopicList the new consumer topic list - */ - public void setConsumerTopicList(String[] consumerTopicList) { - this.consumerTopicList = consumerTopicList; - } - - /** - * Sets the key serializer. - * - * @param keySerializer the new key serializer - */ - public void setKeySerializer(String keySerializer) { - this.keySerializer = keySerializer; - } - - /** - * Sets the value serializer. - * - * @param valueSerializer the new value serializer - */ - public void setValueSerializer(String valueSerializer) { - this.valueSerializer = valueSerializer; - } - - /** - * Sets the key deserializer. - * - * @param keyDeserializer the new key deserializer - */ - public void setKeyDeserializer(String keyDeserializer) { - this.keyDeserializer = keyDeserializer; - } - - /** - * Sets the value deserializer. - * - * @param valueDeserializer the new value deserializer - */ - public void setValueDeserializer(String valueDeserializer) { - this.valueDeserializer = valueDeserializer; - } - /** * {@inheritDoc}. */ diff --git a/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/dummyclasses/SuperDooperDistributorParameters.java b/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/dummyclasses/SuperDooperDistributorParameters.java index 0d021c919..3c34369d0 100644 --- a/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/dummyclasses/SuperDooperDistributorParameters.java +++ b/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/dummyclasses/SuperDooperDistributorParameters.java @@ -1,33 +1,40 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. + * Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * + * * SPDX-License-Identifier: Apache-2.0 * ============LICENSE_END========================================================= */ package org.onap.policy.apex.service.engine.parameters.dummyclasses; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; import org.onap.policy.apex.context.parameters.DistributorParameters; /** * Distributor parameters for the Super Dooper Distributor. - * + * * @author Liam Fallon (liam.fallon@ericsson.com) * @version */ +@Getter +@Setter +@ToString public class SuperDooperDistributorParameters extends DistributorParameters { // Constants for SuperDooper configuration file locations public static final String DEFAULT_SUPER_DOOPER_DISTRIBUTION_CONFIG_FILE = "superDooper/superDooper.xml"; @@ -41,46 +48,4 @@ public class SuperDooperDistributorParameters extends DistributorParameters { private String jgroupsFile = DEFAULT_SUPER_DOOPER_DISTRIBUTION_JGROUPS_FILE; private boolean preferIPv4Stack = DEFAULT_SUPER_DOOPER_JAVA_NET_PREFER_IPV4_STACK; private String jgroupsBindAddress = DEFAULT_INFINSPAN_JGROUPS_BIND_ADDRESS; - - public SuperDooperDistributorParameters() { - super(); - } - - public String getConfigFile() { - return configFile; - } - - public void setConfigFile(final String configFile) { - this.configFile = configFile; - } - - public String getJgroupsFile() { - return jgroupsFile; - } - - public void setJgroupsFile(final String jgroupsFile) { - this.jgroupsFile = jgroupsFile; - } - - public boolean isPreferIPv4Stack() { - return preferIPv4Stack; - } - - public void setPreferIPv4Stack(final boolean preferIPv4Stack) { - this.preferIPv4Stack = preferIPv4Stack; - } - - public String getJgroupsBindAddress() { - return jgroupsBindAddress; - } - - public void setjGroupsBindAddress(final String jgroupsBindAddress) { - this.jgroupsBindAddress = jgroupsBindAddress; - } - - @Override - public String toString() { - return "SuperDooperDistributorParameters [configFile=" + configFile + ", jgroupsFile=" + jgroupsFile - + ", preferIPv4Stack=" + preferIPv4Stack + ", jGroupsBindAddress=" + jgroupsBindAddress + "]"; - } } diff --git a/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/dummyclasses/SuperDooperEventProducer.java b/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/dummyclasses/SuperDooperEventProducer.java index 367bf5ce2..5bbc121da 100644 --- a/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/dummyclasses/SuperDooperEventProducer.java +++ b/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/dummyclasses/SuperDooperEventProducer.java @@ -2,6 +2,7 @@ * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. * Modifications Copyright (C) 2019 Nordix Foundation. + * Modifications Copyright (C) 2021 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. @@ -22,6 +23,7 @@ package org.onap.policy.apex.service.engine.parameters.dummyclasses; import java.util.Properties; +import lombok.Getter; import org.onap.policy.apex.service.engine.event.ApexEventException; import org.onap.policy.apex.service.engine.event.ApexEventProducer; import org.onap.policy.apex.service.engine.event.PeeredReference; @@ -39,12 +41,9 @@ public class SuperDooperEventProducer implements ApexEventProducer { private static final XLogger LOGGER = XLoggerFactory.getXLogger(SuperDooperEventProducer.class); + @Getter private String name; - public SuperDooperEventProducer() { - // Default constructor - } - /** * {@inheritDoc}. */ @@ -53,14 +52,6 @@ public class SuperDooperEventProducer implements ApexEventProducer { this.name = name; } - /** - * {@inheritDoc}. - */ - @Override - public String getName() { - return name; - } - /** * {@inheritDoc}. */ diff --git a/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/dummyclasses/SuperDooperEventSubscriber.java b/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/dummyclasses/SuperDooperEventSubscriber.java index 8eb1ca13e..64e23f570 100644 --- a/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/dummyclasses/SuperDooperEventSubscriber.java +++ b/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/dummyclasses/SuperDooperEventSubscriber.java @@ -2,6 +2,7 @@ * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. * Modifications Copyright (C) 2019 Nordix Foundation. + * Modifications Copyright (C) 2021 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,6 +22,7 @@ package org.onap.policy.apex.service.engine.parameters.dummyclasses; +import lombok.Getter; import org.onap.policy.apex.service.engine.event.ApexEventConsumer; import org.onap.policy.apex.service.engine.event.ApexEventException; import org.onap.policy.apex.service.engine.event.ApexEventReceiver; @@ -34,11 +36,9 @@ public class SuperDooperEventSubscriber implements ApexEventConsumer { private static final XLogger LOGGER = XLoggerFactory.getXLogger(SuperDooperEventSubscriber.class); + @Getter private String name; - public SuperDooperEventSubscriber() { - } - @Override public void init(final String name, final EventHandlerParameters consumerParameters, final ApexEventReceiver apexEventReceiver) throws ApexEventException { @@ -46,11 +46,6 @@ public class SuperDooperEventSubscriber implements ApexEventConsumer { LOGGER.info("Initialising Apex Consumer: " + this.getClass().getName() + ":" + this.name); } - @Override - public String getName() { - return name; - } - /** * {@inheritDoc}. */ diff --git a/services/services-onappf/src/test/java/org/onap/policy/apex/services/onappf/parameters/dummyclasses/DummyStateFinalizerExecutor.java b/services/services-onappf/src/test/java/org/onap/policy/apex/services/onappf/parameters/dummyclasses/DummyStateFinalizerExecutor.java index c23da64d4..2342542e4 100644 --- a/services/services-onappf/src/test/java/org/onap/policy/apex/services/onappf/parameters/dummyclasses/DummyStateFinalizerExecutor.java +++ b/services/services-onappf/src/test/java/org/onap/policy/apex/services/onappf/parameters/dummyclasses/DummyStateFinalizerExecutor.java @@ -2,6 +2,7 @@ * ============LICENSE_START======================================================= * Copyright (C) 2018 Ericsson. All rights reserved. * Modifications Copyright (C) 2019 Nordix Foundation. + * Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -31,9 +32,6 @@ import org.onap.policy.apex.core.engine.executor.exception.StateMachineException * Dummy state finalizer executor for testing. */ public class DummyStateFinalizerExecutor extends StateFinalizerExecutor { - public DummyStateFinalizerExecutor() { - // Default constructor - } @Override public String execute(final long executionId, final Properties executorProperties, diff --git a/services/services-onappf/src/test/java/org/onap/policy/apex/services/onappf/parameters/dummyclasses/DummyTaskExecutor.java b/services/services-onappf/src/test/java/org/onap/policy/apex/services/onappf/parameters/dummyclasses/DummyTaskExecutor.java index 01f45a53e..eac2ec3ba 100644 --- a/services/services-onappf/src/test/java/org/onap/policy/apex/services/onappf/parameters/dummyclasses/DummyTaskExecutor.java +++ b/services/services-onappf/src/test/java/org/onap/policy/apex/services/onappf/parameters/dummyclasses/DummyTaskExecutor.java @@ -3,6 +3,7 @@ * Copyright (C) 2018 Ericsson. All rights reserved. * Modifications Copyright (C) 2019 Nordix Foundation. * Modifications Copyright (C) 2021 Bell Canada. All rights reserved. + * Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -35,9 +36,6 @@ import org.onap.policy.apex.model.policymodel.concepts.AxTask; * Dummy task executor for testing. */ public class DummyTaskExecutor extends TaskExecutor { - public DummyTaskExecutor() { - // Default constructor - } @Override public void prepare() throws StateMachineException { diff --git a/services/services-onappf/src/test/java/org/onap/policy/apex/services/onappf/parameters/dummyclasses/DummyTaskSelectExecutor.java b/services/services-onappf/src/test/java/org/onap/policy/apex/services/onappf/parameters/dummyclasses/DummyTaskSelectExecutor.java index 76b5b4e56..5a6a98f4e 100644 --- a/services/services-onappf/src/test/java/org/onap/policy/apex/services/onappf/parameters/dummyclasses/DummyTaskSelectExecutor.java +++ b/services/services-onappf/src/test/java/org/onap/policy/apex/services/onappf/parameters/dummyclasses/DummyTaskSelectExecutor.java @@ -2,6 +2,7 @@ * ============LICENSE_START======================================================= * Copyright (C) 2018 Ericsson. All rights reserved. * Modifications Copyright (C) 2019 Nordix Foundation. + * Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -32,8 +33,6 @@ import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey; * Dummy task selection executor for testing. */ public class DummyTaskSelectExecutor extends TaskSelectExecutor { - public DummyTaskSelectExecutor() { - } @Override public void prepare() throws StateMachineException { diff --git a/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/entities/ArtifactKeyTestEntity.java b/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/entities/ArtifactKeyTestEntity.java index 3b8394dbb..500405422 100644 --- a/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/entities/ArtifactKeyTestEntity.java +++ b/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/entities/ArtifactKeyTestEntity.java @@ -33,6 +33,7 @@ import lombok.EqualsAndHashCode; import lombok.Getter; import lombok.Setter; import lombok.ToString; +import org.apache.commons.lang3.builder.CompareToBuilder; import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey; import org.onap.policy.apex.model.basicmodel.concepts.AxConcept; import org.onap.policy.apex.model.basicmodel.concepts.AxKey; @@ -143,13 +144,9 @@ public class ArtifactKeyTestEntity extends AxConcept { return -1; } final ArtifactKeyTestEntity other = (ArtifactKeyTestEntity) otherObj; - if (key == null) { - if (other.key != null) { - return 1; - } - } else if (!key.equals(other.key)) { - return key.compareTo(other.key); - } - return Double.compare(doubleValue, other.doubleValue); + return new CompareToBuilder() + .append(key, other.key) + .append(doubleValue, other.doubleValue) + .toComparison(); } } diff --git a/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/entities/ReferenceKeyTestEntity.java b/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/entities/ReferenceKeyTestEntity.java index da478f0dd..a8b90d17a 100644 --- a/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/entities/ReferenceKeyTestEntity.java +++ b/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/entities/ReferenceKeyTestEntity.java @@ -34,6 +34,7 @@ import lombok.EqualsAndHashCode; import lombok.Getter; import lombok.Setter; import lombok.ToString; +import org.apache.commons.lang3.builder.CompareToBuilder; import org.onap.policy.apex.model.basicmodel.concepts.AxConcept; import org.onap.policy.apex.model.basicmodel.concepts.AxKey; import org.onap.policy.apex.model.basicmodel.concepts.AxReferenceKey; @@ -146,13 +147,9 @@ public class ReferenceKeyTestEntity extends AxConcept { return -1; } final ReferenceKeyTestEntity other = (ReferenceKeyTestEntity) otherObj; - if (key == null) { - if (other.key != null) { - return 1; - } - } else if (!key.equals(other.key)) { - return key.compareTo(other.key); - } - return Double.compare(doubleValue, other.doubleValue); + return new CompareToBuilder() + .append(key, other.key) + .append(doubleValue, other.doubleValue) + .toComparison(); } } -- cgit 1.2.3-korg