diff options
author | Jim Hahn <jrh3@att.com> | 2021-07-30 16:06:49 -0400 |
---|---|---|
committer | Jim Hahn <jrh3@att.com> | 2021-08-02 09:42:54 -0400 |
commit | 038c19d4042de980d4adccbfa82c1534b53abe5f (patch) | |
tree | da447592a6a90c2d869e34642712edf4413dc6c1 /services/services-engine | |
parent | 1036206455218a4722079b749e628ca96825418d (diff) |
Use lombok annotations in apex-pdp
Updated projects: services-engine through utilities
Issue-ID: POLICY-3391
Change-Id: I35ebb40d86e9bda360f7819516290b3fea88335c
Signed-off-by: Jim Hahn <jrh3@att.com>
Diffstat (limited to 'services/services-engine')
27 files changed, 139 insertions, 723 deletions
diff --git a/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/ApexEvent.java b/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/ApexEvent.java index 2364d0cb4..76a1c03a2 100644 --- a/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/ApexEvent.java +++ b/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/ApexEvent.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. @@ -27,6 +28,7 @@ import java.util.Properties; import java.util.concurrent.atomic.AtomicLong; import lombok.EqualsAndHashCode; import lombok.Getter; +import lombok.Setter; import lombok.ToString; import org.onap.policy.apex.model.basicmodel.concepts.AxReferenceKey; import org.slf4j.Logger; @@ -119,12 +121,15 @@ public class ApexEvent extends HashMap<String, Object> implements Serializable { // An identifier for the current event execution. The default value here will always be unique // in a single JVM + @Setter private long executionId = ApexEvent.getNextExecutionId(); // Event related properties used during processing of this event + @Setter private Properties executionProperties = new Properties(); // A string holding a message that indicates why processing of this event threw an exception + @Setter private String exceptionMessage; /** @@ -196,36 +201,6 @@ public class ApexEvent extends HashMap<String, Object> implements Serializable { } } - /** - * Sets the pass-thru executionID for this event. - * - * <p>The default value for executionID is unique in the current JVM. For some applications/deployments this - * executionID may need to be globally unique - * - * @param executionId the executionID - */ - public void setExecutionId(final long executionId) { - this.executionId = executionId; - } - - /** - * Set the execution properties for this event. - * - * @param executionProperties the execution properties to set - */ - public void setExecutionProperties(Properties executionProperties) { - this.executionProperties = executionProperties; - } - - /** - * Sets the exception message explaining why processing of this event to fail. - * - * @param exceptionMessage the exception message - */ - public void setExceptionMessage(final String exceptionMessage) { - this.exceptionMessage = exceptionMessage; - } - /* * Map overrides from here */ diff --git a/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/ApexPluginsEventConsumer.java b/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/ApexPluginsEventConsumer.java index 95a263e10..aeee8399d 100644 --- a/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/ApexPluginsEventConsumer.java +++ b/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/ApexPluginsEventConsumer.java @@ -1,6 +1,7 @@ /*- * ============LICENSE_START======================================================= * 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. @@ -22,11 +23,13 @@ package org.onap.policy.apex.service.engine.event; import java.util.EnumMap; import java.util.Map; +import lombok.Getter; import org.onap.policy.apex.core.infrastructure.threading.ApplicationThreadFactory; import org.onap.policy.apex.service.parameters.eventhandler.EventHandlerPeeredMode; public abstract class ApexPluginsEventConsumer implements ApexEventConsumer, Runnable { // The name for this consumer + @Getter protected String name = null; // The peer references for this event handler @@ -53,14 +56,6 @@ public abstract class ApexPluginsEventConsumer implements ApexEventConsumer, Run * {@inheritDoc}. */ @Override - public String getName() { - return name; - } - - /** - * {@inheritDoc}. - */ - @Override public PeeredReference getPeeredReference(final EventHandlerPeeredMode peeredMode) { return peerReferenceMap.get(peeredMode); } diff --git a/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/ApexPluginsEventProducer.java b/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/ApexPluginsEventProducer.java index d1e9ffd6c..5f3e5f8cd 100644 --- a/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/ApexPluginsEventProducer.java +++ b/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/ApexPluginsEventProducer.java @@ -1,6 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2020-2021 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,10 +24,12 @@ package org.onap.policy.apex.service.engine.event; import java.util.EnumMap; import java.util.Map; import java.util.Properties; +import lombok.Getter; import org.onap.policy.apex.service.parameters.eventhandler.EventHandlerPeeredMode; public abstract class ApexPluginsEventProducer implements ApexEventProducer { // The name for this producer + @Getter protected String name = null; // The peer references for this event handler protected Map<EventHandlerPeeredMode, PeeredReference> peerReferenceMap = @@ -36,14 +39,6 @@ public abstract class ApexPluginsEventProducer implements ApexEventProducer { * {@inheritDoc}. */ @Override - public String getName() { - return name; - } - - /** - * {@inheritDoc}. - */ - @Override public PeeredReference getPeeredReference(final EventHandlerPeeredMode peeredMode) { return peerReferenceMap.get(peeredMode); } diff --git a/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/PeeredReference.java b/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/PeeredReference.java index 14ca3f0fa..1167426e4 100644 --- a/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/PeeredReference.java +++ b/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/PeeredReference.java @@ -1,32 +1,35 @@ /*- * ============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.event; +import lombok.Getter; import org.onap.policy.apex.service.parameters.eventhandler.EventHandlerPeeredMode; /** * This class holds a reference to an event consumer and producer that have been peered. - * + * * @author Liam Fallon (liam.fallon@ericsson.com) */ +@Getter public class PeeredReference { // The consumer putting events into APEX private final ApexEventConsumer peeredConsumer; @@ -36,7 +39,7 @@ public class PeeredReference { /** * Create a peered consumer/producer reference. - * + * * @param peeredMode the peered mode for which to return the reference * @param consumer the consumer that is receiving event * @param producer the producer that is sending events @@ -50,22 +53,4 @@ public class PeeredReference { peeredConsumer.setPeeredReference(peeredMode, this); peeredProducer.setPeeredReference(peeredMode, this); } - - /** - * Gets the synchronous consumer putting events into the cache. - * - * @return the source synchronous consumer - */ - public ApexEventConsumer getPeeredConsumer() { - return peeredConsumer; - } - - /** - * Gets the synchronous producer taking events from the cache. - * - * @return the synchronous producer that is taking events from the cache - */ - public ApexEventProducer getPeeredProducer() { - return peeredProducer; - } } diff --git a/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/SynchronousEventCache.java b/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/SynchronousEventCache.java index 39c5c2c62..5f1dcc9cf 100644 --- a/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/SynchronousEventCache.java +++ b/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/SynchronousEventCache.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. @@ -27,6 +28,7 @@ import java.util.HashSet; import java.util.Map; import java.util.Map.Entry; import java.util.Set; +import lombok.Getter; import org.onap.policy.apex.core.infrastructure.threading.ThreadUtilities; import org.onap.policy.apex.service.parameters.eventhandler.EventHandlerPeeredMode; import org.slf4j.ext.XLogger; @@ -51,6 +53,7 @@ public class SynchronousEventCache extends PeeredReference implements Runnable { private static final long CACHE_STOP_WAIT_INTERVAL = 10; // The time in milliseconds to wait for the reply to a sent synchronous event + @Getter private long synchronousEventTimeout = DEFAULT_SYNCHRONOUS_EVENT_TIMEOUT; // Map holding outstanding synchronous events @@ -88,15 +91,6 @@ public class SynchronousEventCache extends PeeredReference implements Runnable { } /** - * Gets the timeout value for synchronous events. - * - * @return the synchronous event timeout - */ - public long getSynchronousEventTimeout() { - return synchronousEventTimeout; - } - - /** * Cache a synchronized event sent into Apex in the event cache. * * @param executionId the execution ID that was assigned to the event diff --git a/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/impl/enevent/ApexEvent2EnEventConverter.java b/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/impl/enevent/ApexEvent2EnEventConverter.java index ab54d426c..27fa50988 100644 --- a/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/impl/enevent/ApexEvent2EnEventConverter.java +++ b/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/impl/enevent/ApexEvent2EnEventConverter.java @@ -3,6 +3,7 @@ * Copyright (C) 2016-2018 Ericsson. All rights reserved. * Modifications Copyright (C) 2021 Bell Canada. All rights reserved. * Modifications Copyright (C) 2021 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. @@ -24,6 +25,7 @@ package org.onap.policy.apex.service.engine.event.impl.enevent; import java.util.ArrayList; import java.util.List; +import lombok.AllArgsConstructor; import org.onap.policy.apex.core.engine.engine.ApexEngine; import org.onap.policy.apex.core.engine.event.EnEvent; import org.onap.policy.apex.model.basicmodel.concepts.ApexException; @@ -41,21 +43,13 @@ import org.onap.policy.apex.service.engine.event.ApexEventRuntimeException; * * @author Liam Fallon (liam.fallon@ericsson.com) */ +@AllArgsConstructor public final class ApexEvent2EnEventConverter implements ApexEventConverter { // The Apex engine with its event definitions private final ApexEngine apexEngine; /** - * Set up the event converter. - * - * @param apexEngine The engine to use to create events to be converted - */ - public ApexEvent2EnEventConverter(final ApexEngine apexEngine) { - this.apexEngine = apexEngine; - } - - /** * {@inheritDoc}. */ @Override diff --git a/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/impl/eventrequestor/EventRequestorConsumer.java b/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/impl/eventrequestor/EventRequestorConsumer.java index f5ceff4a7..1194a2ce8 100644 --- a/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/impl/eventrequestor/EventRequestorConsumer.java +++ b/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/impl/eventrequestor/EventRequestorConsumer.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. @@ -26,6 +27,7 @@ import java.util.Properties; import java.util.concurrent.BlockingQueue; import java.util.concurrent.LinkedBlockingQueue; import java.util.concurrent.TimeUnit; +import lombok.Getter; import org.onap.policy.apex.core.infrastructure.threading.ApplicationThreadFactory; import org.onap.policy.apex.core.infrastructure.threading.ThreadUtilities; import org.onap.policy.apex.service.engine.event.ApexEventConsumer; @@ -56,6 +58,7 @@ public class EventRequestorConsumer implements ApexEventConsumer, Runnable { private ApexEventReceiver eventReceiver; // The name for this consumer + @Getter private String name = null; // The peer references for this event handler @@ -70,6 +73,7 @@ public class EventRequestorConsumer implements ApexEventConsumer, Runnable { private boolean stopOrderedFlag = false; // The number of events received to date + @Getter private int eventsReceived = 0; @Override @@ -131,23 +135,6 @@ public class EventRequestorConsumer implements ApexEventConsumer, Runnable { * {@inheritDoc}. */ @Override - public String getName() { - return name; - } - - /** - * Get the number of events received to date. - * - * @return the number of events received - */ - public int getEventsReceived() { - return eventsReceived; - } - - /** - * {@inheritDoc}. - */ - @Override public PeeredReference getPeeredReference(final EventHandlerPeeredMode peeredMode) { return peerReferenceMap.get(peeredMode); } diff --git a/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/impl/eventrequestor/EventRequestorProducer.java b/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/impl/eventrequestor/EventRequestorProducer.java index b1abeb527..36f3b9423 100644 --- a/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/impl/eventrequestor/EventRequestorProducer.java +++ b/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/impl/eventrequestor/EventRequestorProducer.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. @@ -24,6 +25,7 @@ package org.onap.policy.apex.service.engine.event.impl.eventrequestor; import java.util.EnumMap; import java.util.Map; import java.util.Properties; +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.ApexEventProducer; @@ -46,6 +48,7 @@ public class EventRequestorProducer implements ApexEventProducer { private static final Logger LOGGER = LoggerFactory.getLogger(EventRequestorProducer.class); // The name for this producer + @Getter private String name = null; // The peer references for this event handler @@ -53,6 +56,7 @@ public class EventRequestorProducer implements ApexEventProducer { new EnumMap<>(EventHandlerPeeredMode.class); // The number of events sent + @Getter private int eventsSent = 0; /** @@ -85,23 +89,6 @@ public class EventRequestorProducer implements ApexEventProducer { * {@inheritDoc}. */ @Override - public String getName() { - return name; - } - - /** - * Get the number of events sent to date. - * - * @return the number of events received - */ - public int getEventsSent() { - return eventsSent; - } - - /** - * {@inheritDoc}. - */ - @Override public PeeredReference getPeeredReference(final EventHandlerPeeredMode peeredMode) { return peerReferenceMap.get(peeredMode); } diff --git a/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/impl/filecarrierplugin/FileCarrierTechnologyParameters.java b/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/impl/filecarrierplugin/FileCarrierTechnologyParameters.java index eceb0b4f9..a85997315 100644 --- a/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/impl/filecarrierplugin/FileCarrierTechnologyParameters.java +++ b/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/impl/filecarrierplugin/FileCarrierTechnologyParameters.java @@ -24,6 +24,7 @@ package org.onap.policy.apex.service.engine.event.impl.filecarrierplugin; import java.io.File; import lombok.Getter; import lombok.Setter; +import lombok.ToString; import org.onap.policy.apex.service.engine.event.impl.filecarrierplugin.consumer.ApexFileEventConsumer; import org.onap.policy.apex.service.engine.event.impl.filecarrierplugin.producer.ApexFileEventProducer; import org.onap.policy.apex.service.parameters.carriertechnology.CarrierTechnologyParameters; @@ -51,6 +52,7 @@ import org.onap.policy.models.base.Validated; */ @Getter @Setter +@ToString public class FileCarrierTechnologyParameters extends CarrierTechnologyParameters { // @formatter:off /** The label of this carrier technology. */ @@ -89,16 +91,6 @@ public class FileCarrierTechnologyParameters extends CarrierTechnologyParameters * {@inheritDoc}. */ @Override - public String toString() { - return "FILECarrierTechnologyParameters [fileName=" + fileName + ", standardIO=" + standardIo - + ", standardError=" + standardError + ", streamingMode=" + streamingMode + ", startDelay=" - + startDelay + "]"; - } - - /** - * {@inheritDoc}. - */ - @Override public String getName() { return this.getLabel(); } diff --git a/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/impl/filecarrierplugin/consumer/HeaderDelimitedTextBlockReader.java b/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/impl/filecarrierplugin/consumer/HeaderDelimitedTextBlockReader.java index 67b7cb871..c2f14a261 100644 --- a/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/impl/filecarrierplugin/consumer/HeaderDelimitedTextBlockReader.java +++ b/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/impl/filecarrierplugin/consumer/HeaderDelimitedTextBlockReader.java @@ -2,6 +2,7 @@ * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. * Modifications Copyright (C) 2020-2021 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. @@ -53,9 +54,6 @@ public class HeaderDelimitedTextBlockReader implements TextBlockReader, Runnable private final boolean delimiterAtStart; private boolean blockEndTokenUsed; - // The thread used to read the text from the stream - private Thread textConsumputionThread; - // The input stream for text private InputStream inputStream; @@ -108,7 +106,7 @@ public class HeaderDelimitedTextBlockReader implements TextBlockReader, Runnable this.inputStream = incomingInputStream; // Configure and start the text reading thread - textConsumputionThread = new ApplicationThreadFactory(this.getClass().getName()).newThread(this); + Thread textConsumputionThread = new ApplicationThreadFactory(this.getClass().getName()).newThread(this); textConsumputionThread.setDaemon(true); textConsumputionThread.start(); } diff --git a/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/impl/filecarrierplugin/consumer/TextBlock.java b/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/impl/filecarrierplugin/consumer/TextBlock.java index 526d9c318..f42182b33 100644 --- a/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/impl/filecarrierplugin/consumer/TextBlock.java +++ b/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/impl/filecarrierplugin/consumer/TextBlock.java @@ -1,30 +1,36 @@ /*- * ============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.event.impl.filecarrierplugin.consumer; +import lombok.Getter; +import lombok.Setter; + /** * This class is a bean that holds a block of text read from an incoming text file. * * @author Liam Fallon (liam.fallon@ericsson.com) */ +@Getter +@Setter public class TextBlock { private boolean endOfText = false; private String text; @@ -39,40 +45,4 @@ public class TextBlock { this.endOfText = endOfText; this.text = text; } - - /** - * Checks if is end of text. - * - * @return true, if checks if is end of text - */ - public boolean isEndOfText() { - return endOfText; - } - - /** - * Sets whether end of text has been reached. - * - * @param endOfText the end of text flag value - */ - public void setEndOfText(final boolean endOfText) { - this.endOfText = endOfText; - } - - /** - * Gets the text of the text block. - * - * @return the text of the text block - */ - public String getText() { - return text; - } - - /** - * Sets the text of the text block. - * - * @param text the text of the text block - */ - public void setText(final String text) { - this.text = text; - } } diff --git a/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/impl/jsonprotocolplugin/JsonEventProtocolParameters.java b/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/impl/jsonprotocolplugin/JsonEventProtocolParameters.java index b5aa1cde8..51e9b6d40 100644 --- a/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/impl/jsonprotocolplugin/JsonEventProtocolParameters.java +++ b/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/impl/jsonprotocolplugin/JsonEventProtocolParameters.java @@ -1,25 +1,28 @@ /*- * ============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.event.impl.jsonprotocolplugin; +import lombok.Getter; +import lombok.Setter; import org.onap.policy.apex.service.parameters.eventprotocol.EventProtocolTextCharDelimitedParameters; // @formatter:off @@ -42,10 +45,12 @@ import org.onap.policy.apex.service.parameters.eventprotocol.EventProtocolTextCh * definition in this field name in the schema, there must be one and only one field in the * event definition, the event has a single parameter whose type is the Pojo. This parameter is optional. * </ol> - * + * * @author Liam Fallon (liam.fallon@ericsson.com) */ //@formatter:on +@Getter +@Setter public class JsonEventProtocolParameters extends EventProtocolTextCharDelimitedParameters { /** The label of this event protocol. */ public static final String JSON_EVENT_PROTOCOL_LABEL = "JSON"; @@ -99,112 +104,4 @@ public class JsonEventProtocolParameters extends EventProtocolTextCharDelimitedP public String getName() { return this.getLabel(); } - - /** - * Gets the name alias. - * - * @return the name alias - */ - public String getNameAlias() { - return nameAlias; - } - - /** - * Gets the version alias. - * - * @return the version alias - */ - public String getVersionAlias() { - return versionAlias; - } - - /** - * Gets the name space alias. - * - * @return the name space alias - */ - public String getNameSpaceAlias() { - return nameSpaceAlias; - } - - /** - * Gets the source alias. - * - * @return the source alias - */ - public String getSourceAlias() { - return sourceAlias; - } - - /** - * Gets the target alias. - * - * @return the target alias - */ - public String getTargetAlias() { - return targetAlias; - } - - /** - * Return the name of the POJO field to use for POJO decoding and encoding. - * - * @return the name of the POJO field - */ - public String getPojoField() { - return pojoField; - } - - /** - * Sets the name alias. - * - * @param nameAlias the new name alias - */ - public void setNameAlias(String nameAlias) { - this.nameAlias = nameAlias; - } - - /** - * Sets the version alias. - * - * @param versionAlias the new version alias - */ - public void setVersionAlias(String versionAlias) { - this.versionAlias = versionAlias; - } - - /** - * Sets the name space alias. - * - * @param nameSpaceAlias the new name space alias - */ - public void setNameSpaceAlias(String nameSpaceAlias) { - this.nameSpaceAlias = nameSpaceAlias; - } - - /** - * Sets the source alias. - * - * @param sourceAlias the new source alias - */ - public void setSourceAlias(String sourceAlias) { - this.sourceAlias = sourceAlias; - } - - /** - * Sets the target alias. - * - * @param targetAlias the new target alias - */ - public void setTargetAlias(String targetAlias) { - this.targetAlias = targetAlias; - } - - /** - * Sets the POJO field that name for POJO decoding and encoding. - * - * @param pojoField The name of the POJO field to use on the event - */ - public void setPojoField(final String pojoField) { - this.pojoField = pojoField; - } } diff --git a/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/main/ApexEngineServiceHandler.java b/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/main/ApexEngineServiceHandler.java index ca76a53a6..6e1311efb 100644 --- a/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/main/ApexEngineServiceHandler.java +++ b/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/main/ApexEngineServiceHandler.java @@ -2,6 +2,7 @@ * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. * Modifications Copyright (C) 2021 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.main; +import lombok.AllArgsConstructor; import org.onap.policy.apex.model.basicmodel.concepts.ApexException; import org.onap.policy.apex.service.engine.event.ApexEvent; import org.onap.policy.apex.service.engine.runtime.EngineService; @@ -32,6 +34,7 @@ import org.slf4j.ext.XLoggerFactory; * service and the EngDep service for that engine. It also acts as an event * receiver for asynchronous and synchronous events. */ +@AllArgsConstructor public class ApexEngineServiceHandler { // The logger for this class private static final XLogger LOGGER = XLoggerFactory.getXLogger(ApexEngineServiceHandler.class); @@ -40,15 +43,6 @@ public class ApexEngineServiceHandler { private final EngineService apexEngineService; /** - * Instantiates a new engine holder with its engine service and EngDep service. - * - * @param apexEngineService the apex engine service - */ - ApexEngineServiceHandler(final EngineService apexEngineService) { - this.apexEngineService = apexEngineService; - } - - /** * This method forwards an event to the Apex service. * * @param apexEvent The event to forward to Apex diff --git a/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/main/ApexEventMarshaller.java b/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/main/ApexEventMarshaller.java index 08014f92e..71f04d6e9 100644 --- a/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/main/ApexEventMarshaller.java +++ b/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/main/ApexEventMarshaller.java @@ -2,6 +2,7 @@ * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. * Modifications Copyright (C) 2021 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. @@ -24,6 +25,7 @@ package org.onap.policy.apex.service.engine.main; import java.util.concurrent.BlockingQueue; import java.util.concurrent.LinkedBlockingQueue; import java.util.concurrent.TimeUnit; +import lombok.Getter; import org.onap.policy.apex.core.infrastructure.threading.ApplicationThreadFactory; import org.onap.policy.apex.core.infrastructure.threading.ThreadUtilities; import org.onap.policy.apex.service.engine.event.ApexEvent; @@ -55,6 +57,7 @@ public class ApexEventMarshaller implements ApexEventListener, Runnable { private static final long EVENT_QUEUE_POLL_INTERVAL = 20; // The name of the marshaler + @Getter private final String name; // The engine service and producer parameters @@ -63,7 +66,9 @@ public class ApexEventMarshaller implements ApexEventListener, Runnable { // Apex event producer and event converter, all conversions are to and from string // representation of events + @Getter private ApexEventProducer producer; + @Getter private ApexEventProtocolConverter converter; // Temporary event holder for events coming out of Apex @@ -112,33 +117,6 @@ public class ApexEventMarshaller implements ApexEventListener, Runnable { } /** - * Gets the name of the marshaler. - * - * @return the marshaler name - */ - public String getName() { - return name; - } - - /** - * Gets the technology specific producer for this marshaler. - * - * @return the producer - */ - public ApexEventProducer getProducer() { - return producer; - } - - /** - * Gets the event protocol converter for this marshaler. - * - * @return the event protocol converter - */ - public ApexEventProtocolConverter getConverter() { - return converter; - } - - /** * Callback method called on implementations of this interface when Apex emits an event. * * @param apexEvent the apex event emitted by Apex diff --git a/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/main/ApexEventUnmarshaller.java b/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/main/ApexEventUnmarshaller.java index 4e62f5c0f..8f3bb858f 100644 --- a/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/main/ApexEventUnmarshaller.java +++ b/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/main/ApexEventUnmarshaller.java @@ -3,6 +3,7 @@ * Copyright (C) 2016-2018 Ericsson. All rights reserved. * Modifications Copyright (C) 2019-2021 Nordix Foundation. * Modifications Copyright (C) 2020-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. @@ -30,6 +31,7 @@ import java.util.Properties; import java.util.concurrent.BlockingQueue; import java.util.concurrent.LinkedBlockingQueue; import java.util.concurrent.TimeUnit; +import lombok.Getter; import lombok.NonNull; import org.onap.policy.apex.core.infrastructure.threading.ApplicationThreadFactory; import org.onap.policy.apex.core.infrastructure.threading.ThreadUtilities; @@ -66,6 +68,7 @@ public class ApexEventUnmarshaller implements ApexEventReceiver, Runnable { private static final long EVENT_QUEUE_POLL_INTERVAL = 20; // The name of the unmarshaler + @Getter private final String name; // The engine service and consumer parameters @@ -76,7 +79,9 @@ public class ApexEventUnmarshaller implements ApexEventReceiver, Runnable { private ApexEngineServiceHandler engineServiceHandler; // Apex event producer and event converter, all events are sent as string representations + @Getter private ApexEventConsumer consumer; + @Getter private ApexEventProtocolConverter converter; // Temporary event holder for events going into Apex @@ -132,33 +137,6 @@ public class ApexEventUnmarshaller implements ApexEventReceiver, Runnable { } /** - * Gets the name of the unmarshaler. - * - * @return the unmarshaler name - */ - public String getName() { - return name; - } - - /** - * Gets the technology specific consumer for this unmarshaler. - * - * @return the consumer - */ - public ApexEventConsumer getConsumer() { - return consumer; - } - - /** - * Gets the event protocol converter for this unmarshaler. - * - * @return the event protocol converter - */ - public ApexEventProtocolConverter getConverter() { - return converter; - } - - /** * Connect a synchronous unmarshaler with a synchronous marshaler. * * @param peeredMode the peered mode under which the unmarshaler and marshaler are connected diff --git a/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/main/ApexPolicyStatisticsManager.java b/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/main/ApexPolicyStatisticsManager.java index f49e8cd22..1924d9f8a 100644 --- a/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/main/ApexPolicyStatisticsManager.java +++ b/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/main/ApexPolicyStatisticsManager.java @@ -1,6 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2020-2021 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,10 +22,12 @@ package org.onap.policy.apex.service.engine.main; import java.util.concurrent.atomic.AtomicLong; +import lombok.NoArgsConstructor; import org.onap.policy.common.utils.services.Registry; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +@NoArgsConstructor public class ApexPolicyStatisticsManager { private static final Logger LOGGER = LoggerFactory.getLogger(ApexPolicyStatisticsManager.class); public static final String REG_APEX_PDP_POLICY_COUNTER = "object:pdp/statistics/policy/counter"; @@ -39,13 +42,6 @@ public class ApexPolicyStatisticsManager { private final AtomicLong policyExecutedFailCount = new AtomicLong(0); /** - * Constructs the object. - */ - public ApexPolicyStatisticsManager() { - super(); - } - - /** * To get the ApexPolicyStatisticsManager in Registry. * * @return ApexPolicyStatisticsManager The obj in Registry. diff --git a/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/runtime/impl/EnEventListenerImpl.java b/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/runtime/impl/EnEventListenerImpl.java index 877ac85f1..483c8f5f9 100644 --- a/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/runtime/impl/EnEventListenerImpl.java +++ b/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/runtime/impl/EnEventListenerImpl.java @@ -1,25 +1,27 @@ /*- * ============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.runtime.impl; +import lombok.AllArgsConstructor; import org.onap.policy.apex.core.engine.engine.EnEventListener; import org.onap.policy.apex.core.engine.event.EnEvent; import org.onap.policy.apex.model.basicmodel.concepts.ApexException; @@ -36,24 +38,13 @@ import org.onap.policy.apex.service.engine.runtime.ApexEventListener; * * @author Liam Fallon (liam.fallon@ericsson.com) */ +@AllArgsConstructor public final class EnEventListenerImpl implements EnEventListener { // Listener for ApexEvents - private ApexEventListener apexEventListener = null; + private final ApexEventListener apexEventListener; // Converter for Engine events to Apex Events - private ApexEvent2EnEventConverter apexEnEventConverter = null; - - /** - * Instantiates a new listener implementation. - * - * @param apexEventListener the apex event listener - * @param apexEnEventConverter the ApexEvent to enEvent converter - */ - public EnEventListenerImpl(final ApexEventListener apexEventListener, - final ApexEvent2EnEventConverter apexEnEventConverter) { - this.apexEventListener = apexEventListener; - this.apexEnEventConverter = apexEnEventConverter; - } + private final ApexEvent2EnEventConverter apexEnEventConverter; /** * {@inheritDoc}. diff --git a/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/runtime/impl/EngineServiceImpl.java b/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/runtime/impl/EngineServiceImpl.java index 22a6a27d5..dcae42f2f 100644 --- a/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/runtime/impl/EngineServiceImpl.java +++ b/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/runtime/impl/EngineServiceImpl.java @@ -661,7 +661,7 @@ public final class EngineServiceImpl implements EngineService, EngineServiceEven public void startPeriodicEvents(final long period) throws ApexException { // Check if periodic events are already started if (periodicEventGenerator != null) { - String message = "Peiodic event geneation already running on engine " + engineServiceKey.getId() + ", " + String message = "Periodic event geneation already running on engine " + engineServiceKey.getId() + ", " + periodicEventGenerator.toString(); LOGGER.warn(message); throw new ApexException(message); @@ -682,8 +682,8 @@ public final class EngineServiceImpl implements EngineService, EngineServiceEven public void stopPeriodicEvents() throws ApexException { // Check if periodic events are already started if (periodicEventGenerator == null) { - LOGGER.warn("Peiodic event geneation not running on engine " + engineServiceKey.getId()); - throw new ApexException("Peiodic event geneation not running on engine " + engineServiceKey.getId()); + LOGGER.warn("Periodic event geneation not running on engine " + engineServiceKey.getId()); + throw new ApexException("Periodic event geneation not running on engine " + engineServiceKey.getId()); } // Stop periodic events diff --git a/services/services-engine/src/main/java/org/onap/policy/apex/service/parameters/ApexParameterConstants.java b/services/services-engine/src/main/java/org/onap/policy/apex/service/parameters/ApexParameterConstants.java index 4cef1e10b..1159f2c28 100644 --- a/services/services-engine/src/main/java/org/onap/policy/apex/service/parameters/ApexParameterConstants.java +++ b/services/services-engine/src/main/java/org/onap/policy/apex/service/parameters/ApexParameterConstants.java @@ -1,38 +1,35 @@ /*- * ============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.parameters; +import lombok.AccessLevel; +import lombok.NoArgsConstructor; + /** * This class holds constants used when managing parameter groups in apex. */ -public abstract class ApexParameterConstants { +@NoArgsConstructor(access = AccessLevel.PRIVATE) +public final class ApexParameterConstants { public static final String MAIN_GROUP_NAME = "APEX_PARAMETERS"; public static final String ENGINE_SERVICE_GROUP_NAME = "ENGINE_SERVICE_PARAMETERS"; public static final String EVENT_HANDLER_GROUP_NAME = "EVENT_HANDLER_PARAMETERS"; - - /** - * Private default constructor to prevent subclassing. - */ - private ApexParameterConstants() { - // Prevents subclassing - } - } diff --git a/services/services-engine/src/main/java/org/onap/policy/apex/service/parameters/carriertechnology/CarrierTechnologyParameters.java b/services/services-engine/src/main/java/org/onap/policy/apex/service/parameters/carriertechnology/CarrierTechnologyParameters.java index 503d4c5d7..7515de8a1 100644 --- a/services/services-engine/src/main/java/org/onap/policy/apex/service/parameters/carriertechnology/CarrierTechnologyParameters.java +++ b/services/services-engine/src/main/java/org/onap/policy/apex/service/parameters/carriertechnology/CarrierTechnologyParameters.java @@ -21,6 +21,8 @@ package org.onap.policy.apex.service.parameters.carriertechnology; +import lombok.AccessLevel; +import lombok.NoArgsConstructor; import org.onap.policy.common.parameters.ParameterGroupImpl; import org.onap.policy.common.parameters.ParameterRuntimeException; import org.onap.policy.common.parameters.annotations.ClassName; @@ -40,6 +42,7 @@ import org.onap.policy.common.parameters.annotations.NotNull; */ @NotNull @NotBlank +@NoArgsConstructor(access = AccessLevel.PROTECTED) public abstract class CarrierTechnologyParameters extends ParameterGroupImpl { // The carrier technology label @@ -51,14 +54,6 @@ public abstract class CarrierTechnologyParameters extends ParameterGroupImpl { private @ClassName String eventConsumerPluginClass = null; /** - * Constructor to create a carrier technology parameters instance with the name of a sub class of this class and - * register the instance with the parameter service. - */ - protected CarrierTechnologyParameters() { - super(); - } - - /** * Gets the label of the carrier technology. * * @return the label of the carrier technology diff --git a/services/services-engine/src/main/java/org/onap/policy/apex/service/parameters/carriertechnology/RestPluginCarrierTechnologyParameters.java b/services/services-engine/src/main/java/org/onap/policy/apex/service/parameters/carriertechnology/RestPluginCarrierTechnologyParameters.java index 2c5c4c05a..9e47926bc 100644 --- a/services/services-engine/src/main/java/org/onap/policy/apex/service/parameters/carriertechnology/RestPluginCarrierTechnologyParameters.java +++ b/services/services-engine/src/main/java/org/onap/policy/apex/service/parameters/carriertechnology/RestPluginCarrierTechnologyParameters.java @@ -32,6 +32,7 @@ import java.util.regex.PatternSyntaxException; import javax.ws.rs.core.MultivaluedHashMap; import javax.ws.rs.core.MultivaluedMap; import lombok.Getter; +import lombok.NoArgsConstructor; import lombok.Setter; import org.apache.commons.lang3.StringUtils; import org.onap.policy.common.parameters.BeanValidationResult; @@ -64,6 +65,7 @@ import org.slf4j.LoggerFactory; //@formatter:on @Setter @Getter +@NoArgsConstructor public class RestPluginCarrierTechnologyParameters extends CarrierTechnologyParameters { // Get a reference to the logger private static final Logger LOGGER = LoggerFactory.getLogger(RestPluginCarrierTechnologyParameters.class); @@ -97,14 +99,6 @@ public class RestPluginCarrierTechnologyParameters extends CarrierTechnologyPara protected String httpCodeFilter = DEFAULT_HTTP_CODE_FILTER; /** - * Constructor to create a REST carrier technology parameters instance and - * register the instance with the parameter service. - */ - public RestPluginCarrierTechnologyParameters() { - super(); - } - - /** * Check if http headers have been set for the REST request. * * @return true if headers have been set diff --git a/services/services-engine/src/main/java/org/onap/policy/apex/service/parameters/eventhandler/EventHandlerParameters.java b/services/services-engine/src/main/java/org/onap/policy/apex/service/parameters/eventhandler/EventHandlerParameters.java index 7fb4584fe..98fc73f66 100644 --- a/services/services-engine/src/main/java/org/onap/policy/apex/service/parameters/eventhandler/EventHandlerParameters.java +++ b/services/services-engine/src/main/java/org/onap/policy/apex/service/parameters/eventhandler/EventHandlerParameters.java @@ -23,6 +23,9 @@ package org.onap.policy.apex.service.parameters.eventhandler; import java.util.regex.Pattern; import java.util.regex.PatternSyntaxException; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; import org.onap.policy.apex.service.parameters.ApexParameterConstants; import org.onap.policy.apex.service.parameters.carriertechnology.CarrierTechnologyParameters; import org.onap.policy.apex.service.parameters.eventprotocol.EventProtocolParameters; @@ -55,12 +58,17 @@ import org.slf4j.LoggerFactory; * * @author Liam Fallon (liam.fallon@ericsson.com) */ +@Getter +@ToString public class EventHandlerParameters implements ParameterGroup { // Get a reference to the logger private static final Logger LOGGER = LoggerFactory.getLogger(EventHandlerParameters.class); + @Setter private String name = null; + @Setter private @NotNull @Valid CarrierTechnologyParameters carrierTechnologyParameters = null; + @Setter private @NotNull @Valid EventProtocolParameters eventProtocolParameters = null; private boolean synchronousMode = false; private String synchronousPeer = null; @@ -68,7 +76,9 @@ public class EventHandlerParameters implements ParameterGroup { private boolean requestorMode = false; private String requestorPeer = null; private long requestorTimeout = 0; + @Setter private String eventName = null; + @Setter private String eventNameFilter = null; /** @@ -82,24 +92,6 @@ public class EventHandlerParameters implements ParameterGroup { } /** - * Gets the name of the event handler. - * - * @return the event handler name - */ - public String getName() { - return name; - } - - /** - * Sets the name of the event handler. - * - * @param name the event handler name - */ - public void setName(final String name) { - this.name = name; - } - - /** * Checks if the name of the event handler is set. * * @return true if the name is set @@ -109,42 +101,6 @@ public class EventHandlerParameters implements ParameterGroup { } /** - * Gets the carrier technology parameters of the event handler. - * - * @return the carrierTechnologyParameters of the event handler - */ - public CarrierTechnologyParameters getCarrierTechnologyParameters() { - return carrierTechnologyParameters; - } - - /** - * Sets the carrier technology parameters of the event handler. - * - * @param carrierTechnologyParameters the carrierTechnologyParameters to set - */ - public void setCarrierTechnologyParameters(final CarrierTechnologyParameters carrierTechnologyParameters) { - this.carrierTechnologyParameters = carrierTechnologyParameters; - } - - /** - * Gets the event protocol parameters of the event handler. - * - * @return the eventProtocolParameters - */ - public EventProtocolParameters getEventProtocolParameters() { - return eventProtocolParameters; - } - - /** - * Sets the event protocol parameters. - * - * @param eventProtocolParameters the eventProtocolParameters to set - */ - public void setEventProtocolParameters(final EventProtocolParameters eventProtocolParameters) { - this.eventProtocolParameters = eventProtocolParameters; - } - - /** * Checks if the event handler is in the given peered mode. * * @param peeredMode the peer mode @@ -262,24 +218,6 @@ public class EventHandlerParameters implements ParameterGroup { } /** - * Gets the event name for this event handler. - * - * @return the event name - */ - public String getEventName() { - return eventName; - } - - /** - * Sets the event name for this event handler. - * - * @param eventName the event name - */ - public void setEventName(final String eventName) { - this.eventName = eventName; - } - - /** * Check if event name filtering is being used. * * @return true if event name filtering is being used @@ -289,24 +227,6 @@ public class EventHandlerParameters implements ParameterGroup { } /** - * Gets the event name filter for this event handler. - * - * @return the event name filter - */ - public String getEventNameFilter() { - return eventNameFilter; - } - - /** - * Sets the event name filter for this event handler. - * - * @param eventNameFilter the event name filter - */ - public void setEventNameFilter(final String eventNameFilter) { - this.eventNameFilter = eventNameFilter; - } - - /** * {@inheritDoc}. */ @Override @@ -325,71 +245,4 @@ public class EventHandlerParameters implements ParameterGroup { return result; } - - /** - * Check if we're using synchronous mode. - * - * @return true if if we're using synchronous mode - */ - public boolean isSynchronousMode() { - return synchronousMode; - } - - /** - * The synchronous peer for this event handler. - * - * @return the synchronous peer for this event handler - */ - public String getSynchronousPeer() { - return synchronousPeer; - } - - /** - * Get the timeout for synchronous operations. - * - * @return the timeout for synchronous operations - */ - public long getSynchronousTimeout() { - return synchronousTimeout; - } - - /** - * Check if this event handler will use requestor mode. - * - * @return true if this event handler will use requestor mode - */ - public boolean isRequestorMode() { - return requestorMode; - } - - /** - * The requestor peer for this event handler. - * - * @return the requestor peer for this event handler - */ - public String getRequestorPeer() { - return requestorPeer; - } - - /** - * Get the requestor timeout. - * - * @return the requestorTimeout. - */ - public long getRequestorTimeout() { - return requestorTimeout; - } - - /** - * {@inheritDoc}. - */ - @Override - public String toString() { - return "EventHandlerParameters [name=" + name + ", carrierTechnologyParameters=" + carrierTechnologyParameters - + ", eventProtocolParameters=" + eventProtocolParameters + ", synchronousMode=" - + synchronousMode + ", synchronousPeer=" + synchronousPeer + ", synchronousTimeout=" - + synchronousTimeout + ", requestorMode=" + requestorMode + ", requestorPeer=" + requestorPeer - + ", requestorTimeout=" + requestorTimeout + ", eventName=" + eventName + ", eventNameFilter=" - + eventNameFilter + "]"; - } } diff --git a/services/services-engine/src/main/java/org/onap/policy/apex/service/parameters/eventprotocol/EventProtocolParameters.java b/services/services-engine/src/main/java/org/onap/policy/apex/service/parameters/eventprotocol/EventProtocolParameters.java index 1fd8e7489..fe59486f3 100644 --- a/services/services-engine/src/main/java/org/onap/policy/apex/service/parameters/eventprotocol/EventProtocolParameters.java +++ b/services/services-engine/src/main/java/org/onap/policy/apex/service/parameters/eventprotocol/EventProtocolParameters.java @@ -21,6 +21,10 @@ package org.onap.policy.apex.service.parameters.eventprotocol; +import lombok.AccessLevel; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.ToString; import org.onap.policy.common.parameters.ParameterGroupImpl; import org.onap.policy.common.parameters.ParameterRuntimeException; import org.onap.policy.common.parameters.annotations.ClassName; @@ -42,6 +46,9 @@ import org.onap.policy.common.parameters.annotations.NotNull; */ @NotNull @NotBlank +@Getter +@ToString +@NoArgsConstructor(access = AccessLevel.PROTECTED) public abstract class EventProtocolParameters extends ParameterGroupImpl { // The event protocol label private String label = null; @@ -50,23 +57,6 @@ public abstract class EventProtocolParameters extends ParameterGroupImpl { private @ClassName String eventProtocolPluginClass; /** - * Constructor to create an event protocol parameters instance with the name of a sub class of this class and - * register the instance with the parameter service. - */ - protected EventProtocolParameters() { - super(); - } - - /** - * Gets the label of the event protocol. - * - * @return the label of the event protocol - */ - public String getLabel() { - return label; - } - - /** * Sets the label of the event protocol. * * @param label the label of the event protocol @@ -76,15 +66,6 @@ public abstract class EventProtocolParameters extends ParameterGroupImpl { } /** - * Gets the event event protocol plugin class. - * - * @return the event event protocol plugin class - */ - public String getEventProtocolPluginClass() { - return eventProtocolPluginClass; - } - - /** * Sets the event event protocol plugin class. * * @param eventProtocolPluginClass the event event protocol plugin class @@ -93,15 +74,6 @@ public abstract class EventProtocolParameters extends ParameterGroupImpl { this.eventProtocolPluginClass = eventProtocolPluginClass.replaceAll("\\s+", ""); } - /** - * {@inheritDoc}. - */ - @Override - public String toString() { - return "CarrierTechnologyParameters [label=" + label + ", EventProtocolPluginClass=" + eventProtocolPluginClass - + "]"; - } - @Override public String getName() { return this.getLabel(); diff --git a/services/services-engine/src/main/java/org/onap/policy/apex/service/parameters/eventprotocol/EventProtocolTextCharDelimitedParameters.java b/services/services-engine/src/main/java/org/onap/policy/apex/service/parameters/eventprotocol/EventProtocolTextCharDelimitedParameters.java index 3875d4a14..d13059f1f 100644 --- a/services/services-engine/src/main/java/org/onap/policy/apex/service/parameters/eventprotocol/EventProtocolTextCharDelimitedParameters.java +++ b/services/services-engine/src/main/java/org/onap/policy/apex/service/parameters/eventprotocol/EventProtocolTextCharDelimitedParameters.java @@ -21,6 +21,11 @@ package org.onap.policy.apex.service.parameters.eventprotocol; +import lombok.AccessLevel; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import lombok.ToString; import org.onap.policy.common.parameters.BeanValidationResult; import org.onap.policy.common.parameters.ValidationStatus; @@ -36,64 +41,16 @@ import org.onap.policy.common.parameters.ValidationStatus; * * @author Liam Fallon (liam.fallon@ericsson.com) */ +@Getter +@Setter +@ToString(callSuper = true) +@NoArgsConstructor(access = AccessLevel.PROTECTED) public abstract class EventProtocolTextCharDelimitedParameters extends EventProtocolParameters { // The starting and ending character delimiter private char startChar = '\0'; private char endChar = '\0'; /** - * Constructor to create an event protocol parameters instance with the name of a sub class of this class. - */ - protected EventProtocolTextCharDelimitedParameters() { - super(); - } - - /** - * Gets the start character that delimits the start of text blocks. - * - * @return the start char - */ - public char getStartChar() { - return startChar; - } - - /** - * Sets the start character that delimits the start of text blocks. - * - * @param startChar the start character - */ - public void setStartChar(final char startChar) { - this.startChar = startChar; - } - - /** - * Gets the end character that delimits the end of text blocks. - * - * @return the end character - */ - public char getEndChar() { - return endChar; - } - - /** - * Sets the end character that delimits the end of text blocks. - * - * @param endChar the end character - */ - public void setEndChar(final char endChar) { - this.endChar = endChar; - } - - /** - * {@inheritDoc}. - */ - @Override - public String toString() { - return "EventProtocolTextCharDelimitedParameters {" + super.toString() + "} [startChar=" + startChar - + ", endChar=" + endChar + "]"; - } - - /** * {@inheritDoc}. */ @Override diff --git a/services/services-engine/src/main/java/org/onap/policy/apex/service/parameters/eventprotocol/EventProtocolTextTokenDelimitedParameters.java b/services/services-engine/src/main/java/org/onap/policy/apex/service/parameters/eventprotocol/EventProtocolTextTokenDelimitedParameters.java index 32883301e..deb827a5e 100644 --- a/services/services-engine/src/main/java/org/onap/policy/apex/service/parameters/eventprotocol/EventProtocolTextTokenDelimitedParameters.java +++ b/services/services-engine/src/main/java/org/onap/policy/apex/service/parameters/eventprotocol/EventProtocolTextTokenDelimitedParameters.java @@ -21,6 +21,11 @@ package org.onap.policy.apex.service.parameters.eventprotocol; +import lombok.AccessLevel; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import lombok.ToString; import org.onap.policy.common.parameters.annotations.NotBlank; import org.onap.policy.common.parameters.annotations.NotNull; @@ -40,79 +45,13 @@ import org.onap.policy.common.parameters.annotations.NotNull; * * @author Liam Fallon (liam.fallon@ericsson.com) */ +@Getter +@Setter +@ToString +@NoArgsConstructor(access = AccessLevel.PROTECTED) public abstract class EventProtocolTextTokenDelimitedParameters extends EventProtocolParameters { // The delimiter token for text blocks private @NotNull @NotBlank String startDelimiterToken = null; private String endDelimiterToken = null; private boolean delimiterAtStart = true; - - /** - * Constructor to create an event protocol parameters instance with the name of a sub class of this class. - */ - protected EventProtocolTextTokenDelimitedParameters() { - super(); - } - - /** - * Gets the start delimiter token that delimits events in the text. - * - * @return the start delimiter token - */ - public String getStartDelimiterToken() { - return startDelimiterToken; - } - - /** - * Sets the start delimiter token that delimits events in the text. - * - * @param startDelimiterToken - * delimiterToken the delimiter token - */ - public void setStartDelimiterToken(final String startDelimiterToken) { - this.startDelimiterToken = startDelimiterToken; - } - - /** - * Gets the end delimiter token that delimits events in the text. - * - * @return the end delimiter token - */ - public String getEndDelimiterToken() { - return endDelimiterToken; - } - - /** - * Sets the end delimiter token that delimits events in the text. - * - * @param endDelimiterToken - * delimiterToken the delimiter token - */ - public void setEndDelimiterToken(final String endDelimiterToken) { - this.endDelimiterToken = endDelimiterToken; - } - - /** - * Check if there must be a delimiter at the start of the first text block. - * - * @return true if there must be a delimiter at the start of the text block - */ - public boolean isDelimiterAtStart() { - return delimiterAtStart; - } - - /** - * Sets if there has to be a delimiter at the start of the first text block. - * - * @param delimiterAtStart - * true if there must be a delimiter at the start of the text block - */ - public void setDelimiterAtStart(boolean delimiterAtStart) { - this.delimiterAtStart = delimiterAtStart; - } - - @Override - public String toString() { - return "EventProtocolTextTokenDelimitedParameters [startDelimiterToken=" + startDelimiterToken - + ", endDelimiterToken=" + endDelimiterToken + ", delimiterAtStart=" + delimiterAtStart + "]"; - } } diff --git a/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/event/ApexPeriodicEventGeneratorTest.java b/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/event/ApexPeriodicEventGeneratorTest.java index e40e570cb..ee72e6ea4 100644 --- a/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/event/ApexPeriodicEventGeneratorTest.java +++ b/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/event/ApexPeriodicEventGeneratorTest.java @@ -1,6 +1,7 @@ /* * ============LICENSE_START======================================================= * Copyright (C) 2021. 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. @@ -33,7 +34,8 @@ public class ApexPeriodicEventGeneratorTest { public void run() throws ApexEventException { final EngineServiceEventInterface engineServiceEventInterface = Mockito.mock(EngineServiceEventInterface.class); - final int period = random.nextInt(200); + // don't want the timer to fire, so make it wait at least two seconds + final int period = random.nextInt(2000) + 2000; final ApexPeriodicEventGenerator generator = new ApexPeriodicEventGenerator(engineServiceEventInterface, period); diff --git a/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/runtime/impl/EngineServiceImplTest.java b/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/runtime/impl/EngineServiceImplTest.java index 3fe96a64f..ed1afe4da 100644 --- a/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/runtime/impl/EngineServiceImplTest.java +++ b/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/runtime/impl/EngineServiceImplTest.java @@ -3,6 +3,7 @@ * Copyright (C) 2018 Ericsson. All rights reserved. * Modifications Copyright (C) 2020-2021 Nordix Foundation. * Modifications Copyright (C) 2020 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. @@ -243,13 +244,13 @@ public class EngineServiceImplTest { esImpl.startPeriodicEvents(100000); assertThatThrownBy(() -> esImpl.startPeriodicEvents(100000)).isInstanceOf(ApexException.class) - .hasMessage("Peiodic event geneation already running on engine Engine:0.0.1, ApexPeriodicEventGenerator " + .hasMessage("Periodic event geneation already running on engine Engine:0.0.1, ApexPeriodicEventGenerator " + "[period=100000, firstEventTime=0, lastEventTime=0, eventCount=0]"); esImpl.stopPeriodicEvents(); assertThatThrownBy(() -> esImpl.stopPeriodicEvents()).isInstanceOf(ApexException.class) - .hasMessage("Peiodic event geneation not running on engine Engine:0.0.1"); + .hasMessage("Periodic event geneation not running on engine Engine:0.0.1"); assertThatThrownBy(() -> esImpl.clear(null)).isInstanceOf(ApexException.class) .hasMessage("engine key must be specified and may not be null"); @@ -395,7 +396,7 @@ public class EngineServiceImplTest { esImpl.startPeriodicEvents(100000); fail("test should throw an exception"); } catch (ApexException apEx) { - assertEquals("Peiodic event geneation already running on engine Engine:0.0.1, ApexPeriodicEventGenerator " + assertEquals("Periodic event geneation already running on engine Engine:0.0.1, ApexPeriodicEventGenerator " + "[period=100000, firstEventTime=0, lastEventTime=0, eventCount=0]", apEx.getMessage()); } @@ -404,7 +405,7 @@ public class EngineServiceImplTest { esImpl.stopPeriodicEvents(); fail("test should throw an exception"); } catch (ApexException apEx) { - assertEquals("Peiodic event geneation not running on engine Engine:0.0.1", apEx.getMessage()); + assertEquals("Periodic event geneation not running on engine Engine:0.0.1", apEx.getMessage()); } try { |