summaryrefslogtreecommitdiffstats
path: root/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restrequestor/src
diff options
context:
space:
mode:
authorJim Hahn <jrh3@att.com>2021-08-02 15:28:00 -0400
committerJim Hahn <jrh3@att.com>2021-08-06 09:22:13 -0400
commit338cc2611738783285f9edebd259f7e6bff3973d (patch)
tree86518ff526b89e6f2d24fb7ed1882fe95dd5c8e1 /plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restrequestor/src
parent7438fe5a86a9fcfaf248ee32197b24d1badaecb3 (diff)
Use lombok in apex-pdp #3
Updated plugins thru plugins-persistence-jpa-eclipselink. Issue-ID: POLICY-3391 Change-Id: Id7a5aeca8bb45c7a089f0b9d49c9ecd4bc8a7178 Signed-off-by: Jim Hahn <jrh3@att.com>
Diffstat (limited to 'plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restrequestor/src')
-rw-r--r--plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restrequestor/src/main/java/org/onap/policy/apex/plugins/event/carrier/restrequestor/ApexRestRequest.java71
-rw-r--r--plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restrequestor/src/main/java/org/onap/policy/apex/plugins/event/carrier/restrequestor/ApexRestRequestorConsumer.java14
-rw-r--r--plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restrequestor/src/main/java/org/onap/policy/apex/plugins/event/carrier/restrequestor/ApexRestRequestorProducer.java12
-rw-r--r--plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restrequestor/src/test/java/org/onap/policy/apex/plugins/event/carrier/restrequestor/ApexRestRequestTest.java3
4 files changed, 17 insertions, 83 deletions
diff --git a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restrequestor/src/main/java/org/onap/policy/apex/plugins/event/carrier/restrequestor/ApexRestRequest.java b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restrequestor/src/main/java/org/onap/policy/apex/plugins/event/carrier/restrequestor/ApexRestRequest.java
index 08467f0bd..2cf7af1db 100644
--- a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restrequestor/src/main/java/org/onap/policy/apex/plugins/event/carrier/restrequestor/ApexRestRequest.java
+++ b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restrequestor/src/main/java/org/onap/policy/apex/plugins/event/carrier/restrequestor/ApexRestRequest.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,17 +23,24 @@
package org.onap.policy.apex.plugins.event.carrier.restrequestor;
import java.util.Properties;
+import lombok.Getter;
+import lombok.Setter;
+import lombok.ToString;
/**
* This class holds a record of a REST request for the REST requestor plugin.
*
* @author Liam Fallon (liam.fallon@ericsson.com)
*/
+@Getter
+@ToString
public class ApexRestRequest {
private long executionId;
private String eventName;
private Object event;
+ @ToString.Exclude
private Properties executionProperties;
+ @Setter
private long timestamp;
/**
@@ -49,67 +57,4 @@ public class ApexRestRequest {
this.eventName = eventName;
this.event = event;
}
-
- /**
- * Gets the execution id.
- *
- * @return the execution id
- */
- public long getExecutionId() {
- return executionId;
- }
-
- /**
- * Gets the event name.
- *
- * @return the event name
- */
- public String getEventName() {
- return eventName;
- }
-
- /**
- * Gets the event.
- *
- * @return the event
- */
- public Object getEvent() {
- return event;
- }
-
- /**
- * Gets the executionProperties.
- *
- * @return the executionProperties
- */
- public Properties getExecutionProperties() {
- return executionProperties;
- }
-
- /**
- * Gets the timestamp.
- *
- * @return the timestamp
- */
- public long getTimestamp() {
- return timestamp;
- }
-
- /**
- * Sets the timestamp.
- *
- * @param timestamp the new timestamp
- */
- public void setTimestamp(final long timestamp) {
- this.timestamp = timestamp;
- }
-
- /**
- * {@inheritDoc}.
- */
- @Override
- public String toString() {
- return "ApexRestRequest [executionId=" + executionId + ", eventName=" + eventName + ", event=" + event
- + ", timestamp=" + timestamp + "]";
- }
}
diff --git a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restrequestor/src/main/java/org/onap/policy/apex/plugins/event/carrier/restrequestor/ApexRestRequestorConsumer.java b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restrequestor/src/main/java/org/onap/policy/apex/plugins/event/carrier/restrequestor/ApexRestRequestorConsumer.java
index 81997e351..c0a43a387 100644
--- a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restrequestor/src/main/java/org/onap/policy/apex/plugins/event/carrier/restrequestor/ApexRestRequestorConsumer.java
+++ b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restrequestor/src/main/java/org/onap/policy/apex/plugins/event/carrier/restrequestor/ApexRestRequestorConsumer.java
@@ -3,6 +3,7 @@
* Copyright (C) 2016-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.
@@ -42,6 +43,7 @@ import javax.ws.rs.client.ClientBuilder;
import javax.ws.rs.client.Entity;
import javax.ws.rs.client.Invocation.Builder;
import javax.ws.rs.core.Response;
+import lombok.Getter;
import org.apache.commons.lang3.StringUtils;
import org.onap.policy.apex.core.infrastructure.threading.ThreadUtilities;
import org.onap.policy.apex.service.engine.event.ApexEventException;
@@ -91,7 +93,8 @@ public class ApexRestRequestorConsumer extends ApexPluginsEventConsumer {
// The number of events received to date
private Object eventsReceivedLock = new Object();
- private Integer eventsReceived = 0;
+ @Getter
+ private int eventsReceived = 0;
// The number of the next request runner thread
private static long nextRequestRunnerThreadNo = 0;
@@ -177,15 +180,6 @@ public class ApexRestRequestorConsumer extends ApexPluginsEventConsumer {
}
/**
- * Get the number of events received to date.
- *
- * @return the number of events received
- */
- public int getEventsReceived() {
- return eventsReceived;
- }
-
- /**
* {@inheritDoc}.
*/
@Override
diff --git a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restrequestor/src/main/java/org/onap/policy/apex/plugins/event/carrier/restrequestor/ApexRestRequestorProducer.java b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restrequestor/src/main/java/org/onap/policy/apex/plugins/event/carrier/restrequestor/ApexRestRequestorProducer.java
index 27e9869c6..aebc15d69 100644
--- a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restrequestor/src/main/java/org/onap/policy/apex/plugins/event/carrier/restrequestor/ApexRestRequestorProducer.java
+++ b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restrequestor/src/main/java/org/onap/policy/apex/plugins/event/carrier/restrequestor/ApexRestRequestorProducer.java
@@ -2,6 +2,7 @@
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
* Modifications Copyright (C) 2019-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,6 +23,7 @@
package org.onap.policy.apex.plugins.event.carrier.restrequestor;
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.ApexEventRuntimeException;
@@ -38,6 +40,7 @@ import org.onap.policy.apex.service.parameters.eventhandler.EventHandlerPeeredMo
*/
public class ApexRestRequestorProducer extends ApexPluginsEventProducer {
// The number of events sent
+ @Getter
private int eventsSent = 0;
/**
@@ -80,15 +83,6 @@ public class ApexRestRequestorProducer extends ApexPluginsEventProducer {
}
/**
- * Get the number of events sent to date.
- *
- * @return the number of events received
- */
- public int getEventsSent() {
- return eventsSent;
- }
-
- /**
* {@inheritDoc}.
*/
@Override
diff --git a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restrequestor/src/test/java/org/onap/policy/apex/plugins/event/carrier/restrequestor/ApexRestRequestTest.java b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restrequestor/src/test/java/org/onap/policy/apex/plugins/event/carrier/restrequestor/ApexRestRequestTest.java
index 7c08b772c..d7b418a78 100644
--- a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restrequestor/src/test/java/org/onap/policy/apex/plugins/event/carrier/restrequestor/ApexRestRequestTest.java
+++ b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restrequestor/src/test/java/org/onap/policy/apex/plugins/event/carrier/restrequestor/ApexRestRequestTest.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.
@@ -48,7 +49,7 @@ public class ApexRestRequestTest {
rr.setTimestamp(1234567);
assertEquals(1234567, rr.getTimestamp());
- assertEquals("ApexRestRequest [executionId=1, eventName=EventName, event=The Event String, timestamp=1234567]",
+ assertEquals("ApexRestRequest(executionId=1, eventName=EventName, event=The Event String, timestamp=1234567)",
rr.toString());
}
}