summaryrefslogtreecommitdiffstats
path: root/plugins/plugins-event/plugins-event-carrier
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/plugins-event/plugins-event-carrier')
-rw-r--r--plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-grpc/pom.xml2
-rw-r--r--plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-grpc/src/main/java/org/onap/policy/apex/plugins/event/carrier/grpc/ApexGrpcProducer.java6
-rw-r--r--plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-grpc/src/test/java/org/onap/policy/apex/plugins/event/carrier/grpc/ApexGrpcProducerTest.java19
-rw-r--r--plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-jms/pom.xml2
-rw-r--r--plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-kafka/pom.xml2
-rw-r--r--plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/pom.xml2
-rw-r--r--plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/src/main/java/org/onap/policy/apex/plugins/event/carrier/restclient/RestClientCarrierTechnologyParameters.java17
-rw-r--r--plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restrequestor/pom.xml2
-rw-r--r--plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restrequestor/src/main/java/org/onap/policy/apex/plugins/event/carrier/restrequestor/RestRequestorCarrierTechnologyParameters.java32
-rw-r--r--plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restserver/pom.xml2
-rw-r--r--plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-websocket/pom.xml2
-rw-r--r--plugins/plugins-event/plugins-event-carrier/pom.xml2
12 files changed, 38 insertions, 52 deletions
diff --git a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-grpc/pom.xml b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-grpc/pom.xml
index ec62303ed..1cad1d699 100644
--- a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-grpc/pom.xml
+++ b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-grpc/pom.xml
@@ -26,7 +26,7 @@
<parent>
<groupId>org.onap.policy.apex-pdp.plugins.plugins-event.plugins-event-carrier</groupId>
<artifactId>plugins-event-carrier</artifactId>
- <version>2.4.0-SNAPSHOT</version>
+ <version>2.4.1-SNAPSHOT</version>
</parent>
<artifactId>plugins-event-carrier-grpc</artifactId>
diff --git a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-grpc/src/main/java/org/onap/policy/apex/plugins/event/carrier/grpc/ApexGrpcProducer.java b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-grpc/src/main/java/org/onap/policy/apex/plugins/event/carrier/grpc/ApexGrpcProducer.java
index 2e4736208..6046a310b 100644
--- a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-grpc/src/main/java/org/onap/policy/apex/plugins/event/carrier/grpc/ApexGrpcProducer.java
+++ b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-grpc/src/main/java/org/onap/policy/apex/plugins/event/carrier/grpc/ApexGrpcProducer.java
@@ -1,6 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2020 Nordix Foundation.
+ * Modifications Copyright (C) 2020 Bell Canada. 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.
@@ -124,9 +125,8 @@ public class ApexGrpcProducer extends ApexPluginsEventProducer implements CdsPro
}
if (!EventType.EVENT_COMPONENT_EXECUTED.equals(cdsResponse.get().getStatus().getEventType())) {
- String errorMessage = "Sending event \"" + eventName + "\" by " + this.name + " to CDS failed, "
- + "response from CDS:\n" + cdsResponse.get();
- throw new ApexEventRuntimeException(errorMessage);
+ LOGGER.error("Sending event \"{}\" by {} to CDS failed. Response from CDS:\n{}", eventName, this.name,
+ cdsResponse.get());
}
consumeEvent(executionId, cdsResponse.get());
diff --git a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-grpc/src/test/java/org/onap/policy/apex/plugins/event/carrier/grpc/ApexGrpcProducerTest.java b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-grpc/src/test/java/org/onap/policy/apex/plugins/event/carrier/grpc/ApexGrpcProducerTest.java
index 53d191e14..13ecaba6a 100644
--- a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-grpc/src/test/java/org/onap/policy/apex/plugins/event/carrier/grpc/ApexGrpcProducerTest.java
+++ b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-grpc/src/test/java/org/onap/policy/apex/plugins/event/carrier/grpc/ApexGrpcProducerTest.java
@@ -1,6 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2020 Nordix Foundation.
+ * Modifications Copyright (C) 2020 Bell Canada. 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,7 +21,6 @@
package org.onap.policy.apex.plugins.event.carrier.grpc;
-import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.mockito.Mockito.spy;
import java.nio.file.Files;
@@ -37,6 +37,7 @@ import org.onap.policy.cds.client.CdsProcessorGrpcClient;
@RunWith(MockitoJUnitRunner.class)
public class ApexGrpcProducerTest {
+ private static final String PRODUCER_NAME = "TestApexGrpcProducer";
private static final String HOST = "localhost";
@Mock
private CdsProcessorGrpcClient grpcClient;
@@ -56,30 +57,30 @@ public class ApexGrpcProducerTest {
@Test(expected = ApexEventException.class)
public void testInit_fail() throws ApexEventException {
- apexGrpcProducer.init("TestApexGrpcProducer", new EventHandlerParameters());
+ apexGrpcProducer.init(PRODUCER_NAME, new EventHandlerParameters());
}
@Test
public void testInit_pass() {
// should not throw an exception
- Assertions.assertThatCode(() -> apexGrpcProducer.init("TestApexGrpcProducer", eventHandlerParameters))
+ Assertions.assertThatCode(() -> apexGrpcProducer.init(PRODUCER_NAME, eventHandlerParameters))
.doesNotThrowAnyException();
}
@Test
public void testStop() throws ApexEventException {
- apexGrpcProducer.init("TestApexGrpcProducer", eventHandlerParameters);
+ apexGrpcProducer.init(PRODUCER_NAME, eventHandlerParameters);
// should not throw an exception
Assertions.assertThatCode(() -> apexGrpcProducer.stop()).doesNotThrowAnyException();
}
@Test
public void testSendEvent() throws ApexEventException {
- apexGrpcProducer.init("TestApexGrpcProducer", eventHandlerParameters);
- assertThatThrownBy(() -> {
- apexGrpcProducer.sendEvent(123, null, "grpcEvent",
- Files.readString(Paths.get("src/test/resources/executionServiceInputEvent.json")));
- }).hasMessageContaining("UNAVAILABLE: io exception");
+ apexGrpcProducer.init(PRODUCER_NAME, eventHandlerParameters);
+ Assertions
+ .assertThatCode(() -> apexGrpcProducer.sendEvent(123, null, "grpcEvent",
+ Files.readString(Paths.get("src/test/resources/executionServiceInputEvent.json"))))
+ .doesNotThrowAnyException();
}
private void populateEventHandlerParameters(String host, int timeout) {
diff --git a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-jms/pom.xml b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-jms/pom.xml
index 578cf7202..a3e8c910a 100644
--- a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-jms/pom.xml
+++ b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-jms/pom.xml
@@ -23,7 +23,7 @@
<parent>
<groupId>org.onap.policy.apex-pdp.plugins.plugins-event.plugins-event-carrier</groupId>
<artifactId>plugins-event-carrier</artifactId>
- <version>2.4.0-SNAPSHOT</version>
+ <version>2.4.1-SNAPSHOT</version>
</parent>
<artifactId>plugins-event-carrier-jms</artifactId>
diff --git a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-kafka/pom.xml b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-kafka/pom.xml
index 381510e8e..1b228a421 100644
--- a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-kafka/pom.xml
+++ b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-kafka/pom.xml
@@ -22,7 +22,7 @@
<parent>
<groupId>org.onap.policy.apex-pdp.plugins.plugins-event.plugins-event-carrier</groupId>
<artifactId>plugins-event-carrier</artifactId>
- <version>2.4.0-SNAPSHOT</version>
+ <version>2.4.1-SNAPSHOT</version>
</parent>
<artifactId>plugins-event-carrier-kafka</artifactId>
diff --git a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/pom.xml b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/pom.xml
index 0ef0cfe73..d2b4625cf 100644
--- a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/pom.xml
+++ b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/pom.xml
@@ -26,7 +26,7 @@
<parent>
<groupId>org.onap.policy.apex-pdp.plugins.plugins-event.plugins-event-carrier</groupId>
<artifactId>plugins-event-carrier</artifactId>
- <version>2.4.0-SNAPSHOT</version>
+ <version>2.4.1-SNAPSHOT</version>
</parent>
<artifactId>plugins-event-carrier-restclient</artifactId>
diff --git a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/src/main/java/org/onap/policy/apex/plugins/event/carrier/restclient/RestClientCarrierTechnologyParameters.java b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/src/main/java/org/onap/policy/apex/plugins/event/carrier/restclient/RestClientCarrierTechnologyParameters.java
index 47e94ff51..d5bca3f5a 100644
--- a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/src/main/java/org/onap/policy/apex/plugins/event/carrier/restclient/RestClientCarrierTechnologyParameters.java
+++ b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/src/main/java/org/onap/policy/apex/plugins/event/carrier/restclient/RestClientCarrierTechnologyParameters.java
@@ -24,6 +24,8 @@ package org.onap.policy.apex.plugins.event.carrier.restclient;
import lombok.Getter;
import lombok.Setter;
import org.onap.policy.apex.service.parameters.carriertechnology.RestPluginCarrierTechnologyParameters;
+import org.onap.policy.common.parameters.GroupValidationResult;
+import org.onap.policy.common.parameters.ValidationStatus;
// @formatter:off
/**
@@ -59,4 +61,19 @@ public class RestClientCarrierTechnologyParameters extends RestPluginCarrierTech
this.setEventProducerPluginClass(ApexRestClientProducer.class.getName());
this.setEventConsumerPluginClass(ApexRestClientConsumer.class.getName());
}
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public GroupValidationResult validateUrl(final GroupValidationResult result) {
+ // Check if the URL has been set for event output
+ final String urlNullMessage = "no URL has been set for event sending on " + getLabel();
+ if (getUrl() == null) {
+ result.setResult("url", ValidationStatus.INVALID, urlNullMessage);
+ return result;
+ }
+
+ return super.validateUrl(result);
+ }
}
diff --git a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restrequestor/pom.xml b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restrequestor/pom.xml
index b70760174..0aceada2b 100644
--- a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restrequestor/pom.xml
+++ b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restrequestor/pom.xml
@@ -26,7 +26,7 @@
<parent>
<groupId>org.onap.policy.apex-pdp.plugins.plugins-event.plugins-event-carrier</groupId>
<artifactId>plugins-event-carrier</artifactId>
- <version>2.4.0-SNAPSHOT</version>
+ <version>2.4.1-SNAPSHOT</version>
</parent>
<artifactId>plugins-event-carrier-restrequestor</artifactId>
diff --git a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restrequestor/src/main/java/org/onap/policy/apex/plugins/event/carrier/restrequestor/RestRequestorCarrierTechnologyParameters.java b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restrequestor/src/main/java/org/onap/policy/apex/plugins/event/carrier/restrequestor/RestRequestorCarrierTechnologyParameters.java
index 9f3a631e1..9e55e22d6 100644
--- a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restrequestor/src/main/java/org/onap/policy/apex/plugins/event/carrier/restrequestor/RestRequestorCarrierTechnologyParameters.java
+++ b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restrequestor/src/main/java/org/onap/policy/apex/plugins/event/carrier/restrequestor/RestRequestorCarrierTechnologyParameters.java
@@ -21,12 +21,9 @@
package org.onap.policy.apex.plugins.event.carrier.restrequestor;
-import java.util.regex.Matcher;
import lombok.Getter;
import lombok.Setter;
import org.onap.policy.apex.service.parameters.carriertechnology.RestPluginCarrierTechnologyParameters;
-import org.onap.policy.common.parameters.GroupValidationResult;
-import org.onap.policy.common.parameters.ValidationStatus;
// @formatter:off
/**
@@ -70,33 +67,4 @@ public class RestRequestorCarrierTechnologyParameters extends RestPluginCarrierT
this.setEventProducerPluginClass(ApexRestRequestorProducer.class.getName());
this.setEventConsumerPluginClass(ApexRestRequestorConsumer.class.getName());
}
-
- // @formatter:off
- /**
- * Validate the URL.
- *
- * <p>Checks:
- * http://www.blah.com/{par1/somethingelse (Missing end tag) use {[^\\{}]*$
- * http://www.blah.com/{par1/{some}thingelse (Nested tag) use {[^}]*{
- * http://www.blah.com/{par1}/some}thingelse (Missing start tag1) use }[^{}]*.}
- * http://www.blah.com/par1}/somethingelse (Missing start tag2) use }[^{}]*}
- * http://www.blah.com/{}/somethingelse (Empty tag) use {[\s]*}
- * @param result the result of the validation
- */
- // @formatter:on
- @Override
- public GroupValidationResult validateUrl(final GroupValidationResult result) {
- // URL is only set on Requestor consumers
- if (getUrl() == null) {
- return result;
- }
-
- Matcher matcher = patternErrorKey.matcher(getUrl());
- if (matcher.find()) {
- result.setResult("url", ValidationStatus.INVALID,
- "no proper URL has been set for event sending on REST requestor");
- }
-
- return result;
- }
}
diff --git a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restserver/pom.xml b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restserver/pom.xml
index ebd6faa18..387a37400 100644
--- a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restserver/pom.xml
+++ b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restserver/pom.xml
@@ -23,7 +23,7 @@
<parent>
<groupId>org.onap.policy.apex-pdp.plugins.plugins-event.plugins-event-carrier</groupId>
<artifactId>plugins-event-carrier</artifactId>
- <version>2.4.0-SNAPSHOT</version>
+ <version>2.4.1-SNAPSHOT</version>
</parent>
<artifactId>plugins-event-carrier-restserver</artifactId>
diff --git a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-websocket/pom.xml b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-websocket/pom.xml
index ac155911b..85240a745 100644
--- a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-websocket/pom.xml
+++ b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-websocket/pom.xml
@@ -22,7 +22,7 @@
<parent>
<groupId>org.onap.policy.apex-pdp.plugins.plugins-event.plugins-event-carrier</groupId>
<artifactId>plugins-event-carrier</artifactId>
- <version>2.4.0-SNAPSHOT</version>
+ <version>2.4.1-SNAPSHOT</version>
</parent>
<artifactId>plugins-event-carrier-websocket</artifactId>
diff --git a/plugins/plugins-event/plugins-event-carrier/pom.xml b/plugins/plugins-event/plugins-event-carrier/pom.xml
index ce55984f0..91d7222c0 100644
--- a/plugins/plugins-event/plugins-event-carrier/pom.xml
+++ b/plugins/plugins-event/plugins-event-carrier/pom.xml
@@ -24,7 +24,7 @@
<parent>
<groupId>org.onap.policy.apex-pdp.plugins.plugins-event</groupId>
<artifactId>plugins-event</artifactId>
- <version>2.4.0-SNAPSHOT</version>
+ <version>2.4.1-SNAPSHOT</version>
</parent>
<groupId>org.onap.policy.apex-pdp.plugins.plugins-event.plugins-event-carrier</groupId>