summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--capabilities/src/main/java/org/onap/policy/common/capabilities/Lockable.java6
-rw-r--r--capabilities/src/main/java/org/onap/policy/common/capabilities/Startable.java2
-rw-r--r--common-logging/pom.xml2
-rw-r--r--common-parameters/src/main/java/org/onap/policy/common/parameters/GroupValidationResult.java3
-rw-r--r--common-parameters/src/test/java/org/onap/policy/common/parameters/TestJsonInput.java10
-rw-r--r--common-parameters/src/test/java/org/onap/policy/common/parameters/TestYamlInput.java5
-rw-r--r--common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/EmptyParameterGroup.java2
-rw-r--r--common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/ParameterGroupWithArray.java2
-rw-r--r--common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/ParameterGroupWithCollection.java9
-rw-r--r--common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/ParameterGroupWithIllegalMapKey.java2
-rw-r--r--common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/ParameterGroupWithIllegalMapValue.java2
-rw-r--r--common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/ParameterGroupWithNullCollection.java2
-rw-r--r--common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/ParameterGroupWithNullMapValue.java2
-rw-r--r--common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/ParameterGroupWithParameterGroupCollection.java2
-rw-r--r--common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/TestParametersL00.java5
-rw-r--r--common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/TestParametersL10.java5
-rw-r--r--common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/TestParametersLGeneric.java5
-rw-r--r--policy-endpoints/pom.xml6
-rw-r--r--policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/DmaapTopicSourceFactory.java54
-rw-r--r--policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/UebTopicSourceFactory.java19
-rw-r--r--policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/internal/SingleThreadedBusTopicSource.java257
-rw-r--r--policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/internal/SingleThreadedDmaapTopicSource.java78
-rw-r--r--policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/internal/SingleThreadedUebTopicSource.java23
-rw-r--r--utils/pom.xml2
24 files changed, 343 insertions, 162 deletions
diff --git a/capabilities/src/main/java/org/onap/policy/common/capabilities/Lockable.java b/capabilities/src/main/java/org/onap/policy/common/capabilities/Lockable.java
index 6e5680d1..cc9da0a9 100644
--- a/capabilities/src/main/java/org/onap/policy/common/capabilities/Lockable.java
+++ b/capabilities/src/main/java/org/onap/policy/common/capabilities/Lockable.java
@@ -26,21 +26,21 @@ package org.onap.policy.common.capabilities;
public interface Lockable {
/**
- * locks this entity
+ * Locks this entity.
*
* @return true is the lock operation was successful, false otherwise
*/
public boolean lock();
/**
- * unlocks this entity
+ * Unlocks this entity.
*
* @return true is the unlock operation was successful, false otherwise
*/
public boolean unlock();
/**
- * is this entity locked?
+ * Checks if this entity is locked.
*
* @return true if the entity is in a locked state, false otherwise
*/
diff --git a/capabilities/src/main/java/org/onap/policy/common/capabilities/Startable.java b/capabilities/src/main/java/org/onap/policy/common/capabilities/Startable.java
index 1595272d..49af75f8 100644
--- a/capabilities/src/main/java/org/onap/policy/common/capabilities/Startable.java
+++ b/capabilities/src/main/java/org/onap/policy/common/capabilities/Startable.java
@@ -53,7 +53,7 @@ public interface Startable {
public void shutdown();
/**
- * is it alive?
+ * Checks if the entity is alive.
*
* @return boolean. true if alive, otherwise false
*/
diff --git a/common-logging/pom.xml b/common-logging/pom.xml
index 747e4b2a..143ae6b8 100644
--- a/common-logging/pom.xml
+++ b/common-logging/pom.xml
@@ -45,13 +45,11 @@
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
- <version>3.0.1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
- <version>1.7.12</version>
</dependency>
<dependency>
<groupId>com.att.eelf</groupId>
diff --git a/common-parameters/src/main/java/org/onap/policy/common/parameters/GroupValidationResult.java b/common-parameters/src/main/java/org/onap/policy/common/parameters/GroupValidationResult.java
index 91c3d145..703de927 100644
--- a/common-parameters/src/main/java/org/onap/policy/common/parameters/GroupValidationResult.java
+++ b/common-parameters/src/main/java/org/onap/policy/common/parameters/GroupValidationResult.java
@@ -71,7 +71,7 @@ public class GroupValidationResult implements ValidationResult {
}
/**
- * Construct a validation result for a field
+ * Construct a validation result for a field.
*
* @param field The parameter field
* @param ParameterGroup The parameter group containing the field
@@ -197,7 +197,6 @@ public class GroupValidationResult implements ValidationResult {
/**
* Set the validation result on on a parameter group.
- *
* On a sequence of calls, the most serious validation status is recorded, assuming the status enum ordinal increase
* in order of severity
*
diff --git a/common-parameters/src/test/java/org/onap/policy/common/parameters/TestJsonInput.java b/common-parameters/src/test/java/org/onap/policy/common/parameters/TestJsonInput.java
index 6d0aae5e..ae4dbd2c 100644
--- a/common-parameters/src/test/java/org/onap/policy/common/parameters/TestJsonInput.java
+++ b/common-parameters/src/test/java/org/onap/policy/common/parameters/TestJsonInput.java
@@ -24,6 +24,9 @@ import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
+import com.google.gson.Gson;
+import com.google.gson.GsonBuilder;
+
import java.io.FileReader;
import java.io.IOException;
import java.nio.file.Files;
@@ -32,8 +35,6 @@ import java.nio.file.Paths;
import org.junit.Test;
import org.onap.policy.common.parameters.testclasses.TestParametersL00;
-import com.google.gson.Gson;
-import com.google.gson.GsonBuilder;
public class TestJsonInput {
@@ -45,7 +46,8 @@ public class TestJsonInput {
try {
// Read the parameters from JSON using Gson
final Gson gson = new GsonBuilder().create();
- testParameterGroup = gson.fromJson(new FileReader("src/test/resources/parameters/TestParameters.json"), TestParametersL00.class);
+ testParameterGroup = gson.fromJson(new FileReader("src/test/resources/parameters/TestParameters.json"),
+ TestParametersL00.class);
} catch (final Exception e) {
fail("test should not throw an exception here: " + e.getMessage());
}
@@ -53,7 +55,7 @@ public class TestJsonInput {
GroupValidationResult validationResult = testParameterGroup.validate();
assertTrue(validationResult.isValid());
assertEquals("l00NameFromFile", testParameterGroup.getName());
-
+
String expectedResult = new String(Files.readAllBytes(
Paths.get("src/test/resources/expectedValidationResults/TestJsonYamlValidationResult.txt")))
.replaceAll("\\s+", "");
diff --git a/common-parameters/src/test/java/org/onap/policy/common/parameters/TestYamlInput.java b/common-parameters/src/test/java/org/onap/policy/common/parameters/TestYamlInput.java
index 7d803525..e24f1c8e 100644
--- a/common-parameters/src/test/java/org/onap/policy/common/parameters/TestYamlInput.java
+++ b/common-parameters/src/test/java/org/onap/policy/common/parameters/TestYamlInput.java
@@ -42,7 +42,8 @@ public class TestYamlInput {
try {
// Read the parameters from JSON using Gson
final Yaml yaml = new Yaml();
- testParameterGroup = yaml.loadAs(new FileReader("src/test/resources/parameters/TestParameters.yaml"), TestParametersL00.class);
+ testParameterGroup = yaml.loadAs(new FileReader("src/test/resources/parameters/TestParameters.yaml"),
+ TestParametersL00.class);
} catch (final Exception e) {
fail("test should not throw an exception here: " + e.getMessage());
}
@@ -50,7 +51,7 @@ public class TestYamlInput {
GroupValidationResult validationResult = testParameterGroup.validate();
assertTrue(validationResult.isValid());
assertEquals("l00NameFromFile", testParameterGroup.getName());
-
+
String expectedResult = new String(Files.readAllBytes(
Paths.get("src/test/resources/expectedValidationResults/TestJsonYamlValidationResult.txt")))
.replaceAll("\\s+", "");
diff --git a/common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/EmptyParameterGroup.java b/common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/EmptyParameterGroup.java
index f545ce65..681eb693 100644
--- a/common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/EmptyParameterGroup.java
+++ b/common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/EmptyParameterGroup.java
@@ -20,8 +20,8 @@
package org.onap.policy.common.parameters.testclasses;
-import org.onap.policy.common.parameters.ParameterGroup;
import org.onap.policy.common.parameters.GroupValidationResult;
+import org.onap.policy.common.parameters.ParameterGroup;
public class EmptyParameterGroup implements ParameterGroup {
private String name;
diff --git a/common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/ParameterGroupWithArray.java b/common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/ParameterGroupWithArray.java
index cdab1272..fcb2bb1b 100644
--- a/common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/ParameterGroupWithArray.java
+++ b/common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/ParameterGroupWithArray.java
@@ -20,8 +20,8 @@
package org.onap.policy.common.parameters.testclasses;
-import org.onap.policy.common.parameters.ParameterGroup;
import org.onap.policy.common.parameters.GroupValidationResult;
+import org.onap.policy.common.parameters.ParameterGroup;
public class ParameterGroupWithArray implements ParameterGroup {
private String name;
diff --git a/common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/ParameterGroupWithCollection.java b/common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/ParameterGroupWithCollection.java
index 0f993099..75ae45b8 100644
--- a/common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/ParameterGroupWithCollection.java
+++ b/common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/ParameterGroupWithCollection.java
@@ -23,8 +23,8 @@ package org.onap.policy.common.parameters.testclasses;
import java.util.ArrayList;
import java.util.List;
-import org.onap.policy.common.parameters.ParameterGroup;
import org.onap.policy.common.parameters.GroupValidationResult;
+import org.onap.policy.common.parameters.ParameterGroup;
public class ParameterGroupWithCollection implements ParameterGroup {
private String name;
@@ -32,11 +32,12 @@ public class ParameterGroupWithCollection implements ParameterGroup {
/**
* Create a test parameter group.
+ *
* @param name the parameter group name
*/
public ParameterGroupWithCollection(final String name) {
this.name = name;
-
+
intArrayList.add(1);
intArrayList.add(2);
intArrayList.add(3);
@@ -45,12 +46,12 @@ public class ParameterGroupWithCollection implements ParameterGroup {
public List<Integer> getIntArrayList() {
return intArrayList;
}
-
+
@Override
public String getName() {
return name;
}
-
+
@Override
public GroupValidationResult validate() {
return new GroupValidationResult(this);
diff --git a/common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/ParameterGroupWithIllegalMapKey.java b/common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/ParameterGroupWithIllegalMapKey.java
index 3de3270e..ca441060 100644
--- a/common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/ParameterGroupWithIllegalMapKey.java
+++ b/common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/ParameterGroupWithIllegalMapKey.java
@@ -23,8 +23,8 @@ package org.onap.policy.common.parameters.testclasses;
import java.util.LinkedHashMap;
import java.util.Map;
-import org.onap.policy.common.parameters.ParameterGroup;
import org.onap.policy.common.parameters.GroupValidationResult;
+import org.onap.policy.common.parameters.ParameterGroup;
public class ParameterGroupWithIllegalMapKey implements ParameterGroup {
private String name;
diff --git a/common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/ParameterGroupWithIllegalMapValue.java b/common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/ParameterGroupWithIllegalMapValue.java
index 8eb697a4..9253f158 100644
--- a/common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/ParameterGroupWithIllegalMapValue.java
+++ b/common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/ParameterGroupWithIllegalMapValue.java
@@ -23,8 +23,8 @@ package org.onap.policy.common.parameters.testclasses;
import java.util.LinkedHashMap;
import java.util.Map;
-import org.onap.policy.common.parameters.ParameterGroup;
import org.onap.policy.common.parameters.GroupValidationResult;
+import org.onap.policy.common.parameters.ParameterGroup;
public class ParameterGroupWithIllegalMapValue implements ParameterGroup {
private String name;
diff --git a/common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/ParameterGroupWithNullCollection.java b/common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/ParameterGroupWithNullCollection.java
index 37399da3..0d113dc6 100644
--- a/common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/ParameterGroupWithNullCollection.java
+++ b/common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/ParameterGroupWithNullCollection.java
@@ -22,8 +22,8 @@ package org.onap.policy.common.parameters.testclasses;
import java.util.List;
-import org.onap.policy.common.parameters.ParameterGroup;
import org.onap.policy.common.parameters.GroupValidationResult;
+import org.onap.policy.common.parameters.ParameterGroup;
public class ParameterGroupWithNullCollection implements ParameterGroup {
private String name;
diff --git a/common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/ParameterGroupWithNullMapValue.java b/common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/ParameterGroupWithNullMapValue.java
index 80f55355..9e1601c3 100644
--- a/common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/ParameterGroupWithNullMapValue.java
+++ b/common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/ParameterGroupWithNullMapValue.java
@@ -22,8 +22,8 @@ package org.onap.policy.common.parameters.testclasses;
import java.util.Map;
-import org.onap.policy.common.parameters.ParameterGroup;
import org.onap.policy.common.parameters.GroupValidationResult;
+import org.onap.policy.common.parameters.ParameterGroup;
public class ParameterGroupWithNullMapValue implements ParameterGroup {
private String name;
diff --git a/common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/ParameterGroupWithParameterGroupCollection.java b/common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/ParameterGroupWithParameterGroupCollection.java
index e7d1de75..5ece07b4 100644
--- a/common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/ParameterGroupWithParameterGroupCollection.java
+++ b/common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/ParameterGroupWithParameterGroupCollection.java
@@ -23,8 +23,8 @@ package org.onap.policy.common.parameters.testclasses;
import java.util.ArrayList;
import java.util.List;
-import org.onap.policy.common.parameters.ParameterGroup;
import org.onap.policy.common.parameters.GroupValidationResult;
+import org.onap.policy.common.parameters.ParameterGroup;
public class ParameterGroupWithParameterGroupCollection implements ParameterGroup {
private String name;
diff --git a/common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/TestParametersL00.java b/common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/TestParametersL00.java
index 6b8460cd..6cd65603 100644
--- a/common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/TestParametersL00.java
+++ b/common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/TestParametersL00.java
@@ -24,9 +24,9 @@ import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Map.Entry;
-import org.onap.policy.common.parameters.ParameterGroup;
import org.onap.policy.common.parameters.GroupValidationResult;
import org.onap.policy.common.parameters.ParameterConstants;
+import org.onap.policy.common.parameters.ParameterGroup;
import org.onap.policy.common.parameters.ValidationStatus;
public class TestParametersL00 implements ParameterGroup {
@@ -38,9 +38,10 @@ public class TestParametersL00 implements ParameterGroup {
private Map<String, TestParametersLGeneric> l00LGenericNestedMap = new LinkedHashMap<>();
/**
- * Default constructor
+ * Default constructor.
*/
public TestParametersL00() {
+ // Default Cnstructor
}
/**
diff --git a/common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/TestParametersL10.java b/common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/TestParametersL10.java
index 94a67ec7..6efddac0 100644
--- a/common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/TestParametersL10.java
+++ b/common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/TestParametersL10.java
@@ -24,9 +24,9 @@ import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Map.Entry;
-import org.onap.policy.common.parameters.ParameterGroup;
import org.onap.policy.common.parameters.GroupValidationResult;
import org.onap.policy.common.parameters.ParameterConstants;
+import org.onap.policy.common.parameters.ParameterGroup;
import org.onap.policy.common.parameters.ValidationStatus;
public class TestParametersL10 implements ParameterGroup {
@@ -38,9 +38,10 @@ public class TestParametersL10 implements ParameterGroup {
private Map<String, TestParametersLGeneric> l10LGenericNestedMap = new LinkedHashMap<>();
/**
- * Default constructor
+ * Default constructor.
*/
public TestParametersL10() {
+ // Default Constructor
}
/**
diff --git a/common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/TestParametersLGeneric.java b/common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/TestParametersLGeneric.java
index ce368bac..2e678da0 100644
--- a/common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/TestParametersLGeneric.java
+++ b/common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/TestParametersLGeneric.java
@@ -20,9 +20,9 @@
package org.onap.policy.common.parameters.testclasses;
-import org.onap.policy.common.parameters.ParameterGroup;
import org.onap.policy.common.parameters.GroupValidationResult;
import org.onap.policy.common.parameters.ParameterConstants;
+import org.onap.policy.common.parameters.ParameterGroup;
import org.onap.policy.common.parameters.ValidationStatus;
public class TestParametersLGeneric implements ParameterGroup {
@@ -31,9 +31,10 @@ public class TestParametersLGeneric implements ParameterGroup {
private String lgenericStringField = "Legal " + this.getClass().getCanonicalName();
/**
- * Default constructor
+ * Default constructor.
*/
public TestParametersLGeneric() {
+ // Default Constructor
}
/**
diff --git a/policy-endpoints/pom.xml b/policy-endpoints/pom.xml
index b0e84f87..81c1d86f 100644
--- a/policy-endpoints/pom.xml
+++ b/policy-endpoints/pom.xml
@@ -35,7 +35,7 @@
<description>Endpoints</description>
<properties>
- <jetty.version>9.3.20.v20170531</jetty.version>
+ <jetty.version>9.3.24.v20180605</jetty.version>
<jersey.swagger.version>1.5.18</jersey.swagger.version>
<dmaap.version>1.1.3</dmaap.version>
<cambria.version>1.2.1-oss</cambria.version>
@@ -62,7 +62,6 @@
<dependency>
<groupId>com.att.nsa</groupId>
<artifactId>cambriaClient</artifactId>
- <version>${cambria.version}</version>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
@@ -156,18 +155,15 @@
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
- <version>${http.client.version}</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpcore</artifactId>
- <version>${http.core.version}</version>
</dependency>
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-jersey2-jaxrs</artifactId>
- <version>${jersey.swagger.version}</version>
</dependency>
<dependency>
diff --git a/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/DmaapTopicSourceFactory.java b/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/DmaapTopicSourceFactory.java
index 96ab6c63..4285b3a9 100644
--- a/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/DmaapTopicSourceFactory.java
+++ b/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/DmaapTopicSourceFactory.java
@@ -27,6 +27,7 @@ import java.util.List;
import java.util.Map;
import java.util.Properties;
+import org.onap.policy.common.endpoints.event.comm.bus.internal.SingleThreadedBusTopicSource;
import org.onap.policy.common.endpoints.event.comm.bus.internal.SingleThreadedDmaapTopicSource;
import org.onap.policy.common.endpoints.properties.PolicyEndPointProperties;
import org.slf4j.Logger;
@@ -76,12 +77,12 @@ public interface DmaapTopicSourceFactory {
* @throws IllegalArgumentException if invalid parameters are present
*/
public DmaapTopicSource build(List<String> servers, String topic, String apiKey, String apiSecret, String userName,
- String password, String consumerGroup, String consumerInstance, int fetchTimeout, int fetchLimit,
- boolean managed, boolean useHttps, boolean allowSelfSignedCerts);
+ String password, String consumerGroup, String consumerInstance, int fetchTimeout, int fetchLimit,
+ boolean managed, boolean useHttps, boolean allowSelfSignedCerts);
/**
* Instantiates a new DMAAP Topic Source
- *
+ *
* @param servers list of servers
* @param topic topic name
* @param apiKey API Key
@@ -101,14 +102,14 @@ public interface DmaapTopicSourceFactory {
* @param managed is this endpoind managed?
* @param useHttps does the connection use HTTPS?
* @param allowSelfSignedCerts does connection allow self-signed certificates?
- *
+ *
* @return an DMAAP Topic Source
* @throws IllegalArgumentException if invalid parameters are present
*/
public DmaapTopicSource build(List<String> servers, String topic, String apiKey, String apiSecret, String userName,
- String password, String consumerGroup, String consumerInstance, int fetchTimeout, int fetchLimit,
- String environment, String aftEnvironment, String partner, String latitude, String longitude,
- Map<String, String> additionalProps, boolean managed, boolean useHttps, boolean allowSelfSignedCerts);
+ String password, String consumerGroup, String consumerInstance, int fetchTimeout, int fetchLimit,
+ String environment, String aftEnvironment, String partner, String latitude, String longitude,
+ Map<String, String> additionalProps, boolean managed, boolean useHttps, boolean allowSelfSignedCerts);
/**
* Instantiates a new DMAAP Topic Source
@@ -203,9 +204,26 @@ class IndexedDmaapTopicSourceFactory implements DmaapTopicSourceFactory {
return dmaapTopicSources.get(topic);
}
- DmaapTopicSource dmaapTopicSource = new SingleThreadedDmaapTopicSource(servers, topic, apiKey, apiSecret,
- userName, password, consumerGroup, consumerInstance, fetchTimeout, fetchLimit, environment,
- aftEnvironment, partner, latitude, longitude, additionalProps, useHttps, allowSelfSignedCerts);
+ DmaapTopicSource dmaapTopicSource = new SingleThreadedDmaapTopicSource(SingleThreadedBusTopicSource.BusTopicParams.builder()
+ .servers(servers)
+ .topic(topic)
+ .apiKey(apiKey)
+ .apiSecret(apiSecret)
+ .userName(userName)
+ .password(password)
+ .consumerGroup(consumerGroup)
+ .consumerInstance(consumerInstance)
+ .fetchTimeout(fetchTimeout)
+ .fetchLimit(fetchLimit)
+ .environment(environment)
+ .aftEnvironment(aftEnvironment)
+ .partner(partner)
+ .latitude(latitude)
+ .longitude(longitude)
+ .additionalProps(additionalProps)
+ .useHttps(useHttps)
+ .allowSelfSignedCerts(allowSelfSignedCerts)
+ .build());
if (managed) {
dmaapTopicSources.put(topic, dmaapTopicSource);
@@ -237,8 +255,20 @@ class IndexedDmaapTopicSourceFactory implements DmaapTopicSourceFactory {
}
DmaapTopicSource dmaapTopicSource =
- new SingleThreadedDmaapTopicSource(servers, topic, apiKey, apiSecret, userName, password,
- consumerGroup, consumerInstance, fetchTimeout, fetchLimit, useHttps, allowSelfSignedCerts);
+ new SingleThreadedDmaapTopicSource(SingleThreadedBusTopicSource.BusTopicParams.builder()
+ .servers(servers)
+ .topic(topic)
+ .apiKey(apiKey)
+ .apiSecret(apiSecret)
+ .userName(userName)
+ .password(password)
+ .consumerGroup(consumerGroup)
+ .consumerInstance(consumerInstance)
+ .fetchTimeout(fetchTimeout)
+ .fetchLimit(fetchLimit)
+ .useHttps(useHttps)
+ .allowSelfSignedCerts(allowSelfSignedCerts)
+ .build());
if (managed) {
dmaapTopicSources.put(topic, dmaapTopicSource);
diff --git a/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/UebTopicSourceFactory.java b/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/UebTopicSourceFactory.java
index c6cf3095..4c3cbbf8 100644
--- a/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/UebTopicSourceFactory.java
+++ b/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/UebTopicSourceFactory.java
@@ -26,6 +26,7 @@ import java.util.HashMap;
import java.util.List;
import java.util.Properties;
+import org.onap.policy.common.endpoints.event.comm.bus.internal.SingleThreadedBusTopicSource;
import org.onap.policy.common.endpoints.event.comm.bus.internal.SingleThreadedUebTopicSource;
import org.onap.policy.common.endpoints.properties.PolicyEndPointProperties;
import org.slf4j.Logger;
@@ -63,8 +64,8 @@ public interface UebTopicSourceFactory {
* @throws IllegalArgumentException if invalid parameters are present
*/
public UebTopicSource build(List<String> servers, String topic, String apiKey, String apiSecret,
- String consumerGroup, String consumerInstance, int fetchTimeout, int fetchLimit, boolean managed,
- boolean useHttps, boolean allowSelfSignedCerts);
+ String consumerGroup, String consumerInstance, int fetchTimeout, int fetchLimit, boolean managed,
+ boolean useHttps, boolean allowSelfSignedCerts);
/**
* Instantiates a new UEB Topic Source
@@ -160,8 +161,18 @@ class IndexedUebTopicSourceFactory implements UebTopicSourceFactory {
return uebTopicSources.get(topic);
}
- UebTopicSource uebTopicSource = new SingleThreadedUebTopicSource(servers, topic, apiKey, apiSecret,
- consumerGroup, consumerInstance, fetchTimeout, fetchLimit, useHttps, allowSelfSignedCerts);
+ UebTopicSource uebTopicSource = new SingleThreadedUebTopicSource(SingleThreadedBusTopicSource.BusTopicParams.builder()
+ .servers(servers)
+ .topic(topic)
+ .apiKey(apiKey)
+ .apiSecret(apiSecret)
+ .consumerGroup(consumerGroup)
+ .consumerInstance(consumerInstance)
+ .fetchTimeout(fetchTimeout)
+ .fetchLimit(fetchLimit)
+ .useHttps(useHttps)
+ .allowSelfSignedCerts(allowSelfSignedCerts)
+ .build());
if (managed) {
uebTopicSources.put(topic, uebTopicSource);
diff --git a/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/internal/SingleThreadedBusTopicSource.java b/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/internal/SingleThreadedBusTopicSource.java
index 97ebbd50..74912cae 100644
--- a/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/internal/SingleThreadedBusTopicSource.java
+++ b/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/internal/SingleThreadedBusTopicSource.java
@@ -22,6 +22,7 @@ package org.onap.policy.common.endpoints.event.comm.bus.internal;
import java.net.MalformedURLException;
import java.util.List;
+import java.util.Map;
import java.util.UUID;
import org.onap.policy.common.endpoints.event.comm.FilterableTopicSource;
@@ -79,46 +80,35 @@ public abstract class SingleThreadedBusTopicSource extends BusTopicBase
/**
*
- * @param servers Bus servers
- * @param topic Bus Topic to be monitored
- * @param apiKey Bus API Key (optional)
- * @param apiSecret Bus API Secret (optional)
- * @param consumerGroup Bus Reader Consumer Group
- * @param consumerInstance Bus Reader Instance
- * @param fetchTimeout Bus fetch timeout
- * @param fetchLimit Bus fetch limit
- * @param useHttps does the bus use https
- * @param allowSelfSignedCerts are self-signed certificates allowed
- * @throws IllegalArgumentException An invalid parameter passed in
+ *
+ * @param busTopicParams@throws IllegalArgumentException An invalid parameter passed in
*/
- public SingleThreadedBusTopicSource(List<String> servers, String topic, String apiKey, String apiSecret,
- String consumerGroup, String consumerInstance, int fetchTimeout, int fetchLimit, boolean useHttps,
- boolean allowSelfSignedCerts) {
+ public SingleThreadedBusTopicSource(BusTopicParams busTopicParams) {
- super(servers, topic, apiKey, apiSecret, useHttps, allowSelfSignedCerts);
+ super(busTopicParams.getServers(), busTopicParams.getTopic(), busTopicParams.getApiKey(), busTopicParams.getApiSecret(), busTopicParams.isUseHttps(), busTopicParams.isAllowSelfSignedCerts());
- if (consumerGroup == null || consumerGroup.isEmpty()) {
+ if (busTopicParams.getConsumerGroup() == null || busTopicParams.getConsumerGroup().isEmpty()) {
this.consumerGroup = UUID.randomUUID().toString();
} else {
- this.consumerGroup = consumerGroup;
+ this.consumerGroup = busTopicParams.getConsumerGroup();
}
- if (consumerInstance == null || consumerInstance.isEmpty()) {
+ if (busTopicParams.getConsumerInstance() == null || busTopicParams.getConsumerInstance().isEmpty()) {
this.consumerInstance = NetworkUtil.getHostname();
} else {
- this.consumerInstance = consumerInstance;
+ this.consumerInstance = busTopicParams.getConsumerInstance();
}
- if (fetchTimeout <= 0) {
+ if (busTopicParams.getFetchTimeout() <= 0) {
this.fetchTimeout = NO_TIMEOUT_MS_FETCH;
} else {
- this.fetchTimeout = fetchTimeout;
+ this.fetchTimeout = busTopicParams.getFetchTimeout();
}
- if (fetchLimit <= 0) {
+ if (busTopicParams.getFetchLimit() <= 0) {
this.fetchLimit = NO_LIMIT_FETCH;
} else {
- this.fetchLimit = fetchLimit;
+ this.fetchLimit = busTopicParams.getFetchLimit();
}
}
@@ -322,4 +312,225 @@ public abstract class SingleThreadedBusTopicSource extends BusTopicBase
return fetchLimit;
}
+ /**
+ * Member variables of this Params class are as follows
+ * servers DMaaP servers
+ * topic DMaaP Topic to be monitored
+ * apiKey DMaaP API Key (optional)
+ * apiSecret DMaaP API Secret (optional)
+ * consumerGroup DMaaP Reader Consumer Group
+ * consumerInstance DMaaP Reader Instance
+ * fetchTimeout DMaaP fetch timeout
+ * fetchLimit DMaaP fetch limit
+ * environment DME2 Environment
+ * aftEnvironment DME2 AFT Environment
+ * partner DME2 Partner
+ * latitude DME2 Latitude
+ * longitude DME2 Longitude
+ * additionalProps Additional properties to pass to DME2
+ * useHttps does connection use HTTPS?
+ * allowSelfSignedCerts are self-signed certificates allow
+ *
+ */
+ public static class BusTopicParams {
+
+ public static TopicParamsBuilder builder() {
+ return new TopicParamsBuilder();
+ }
+ private List<String> servers;
+ private String topic;
+ private String apiKey;
+ private String apiSecret;
+ private String consumerGroup;
+ private String consumerInstance;
+ private int fetchTimeout;
+ private int fetchLimit;
+ private boolean useHttps;
+ private boolean allowSelfSignedCerts;
+
+ private String userName;
+ private String password;
+ private String environment;
+ private String aftEnvironment;
+ private String partner;
+ private String latitude;
+ private String longitude;
+ private Map<String, String> additionalProps;
+
+ public String getUserName() {
+ return userName;
+ }
+
+ public String getPassword() {
+ return password;
+ }
+
+ public String getEnvironment() {
+ return environment;
+ }
+
+ public String getAftEnvironment() {
+ return aftEnvironment;
+ }
+
+ public String getPartner() {
+ return partner;
+ }
+
+ public String getLatitude() {
+ return latitude;
+ }
+
+ public String getLongitude() {
+ return longitude;
+ }
+
+ public Map<String, String> getAdditionalProps() {
+ return additionalProps;
+ }
+
+ public List<String> getServers() {
+ return servers;
+ }
+
+ public String getTopic() {
+ return topic;
+ }
+
+ public String getApiKey() {
+ return apiKey;
+ }
+
+ public String getApiSecret() {
+ return apiSecret;
+ }
+
+ public String getConsumerGroup() {
+ return consumerGroup;
+ }
+
+ public String getConsumerInstance() {
+ return consumerInstance;
+ }
+
+ public int getFetchTimeout() {
+ return fetchTimeout;
+ }
+
+ public int getFetchLimit() {
+ return fetchLimit;
+ }
+
+ public boolean isUseHttps() {
+ return useHttps;
+ }
+
+ public boolean isAllowSelfSignedCerts() {
+ return allowSelfSignedCerts;
+ }
+
+
+ public static class TopicParamsBuilder {
+ BusTopicParams m = new BusTopicParams();
+
+ private TopicParamsBuilder() {
+ }
+
+ public TopicParamsBuilder servers(List<String> servers) {
+ this.m.servers = servers;
+ return this;
+ }
+
+ public TopicParamsBuilder topic(String topic) {
+ this.m.topic = topic;
+ return this;
+ }
+
+ public TopicParamsBuilder apiKey(String apiKey) {
+ this.m.apiKey = apiKey;
+ return this;
+ }
+
+ public TopicParamsBuilder apiSecret(String apiSecret) {
+ this.m.apiSecret = apiSecret;
+ return this;
+ }
+
+ public TopicParamsBuilder consumerGroup(String consumerGroup) {
+ this.m.consumerGroup = consumerGroup;
+ return this;
+ }
+
+ public TopicParamsBuilder consumerInstance(String consumerInstance) {
+ this.m.consumerInstance = consumerInstance;
+ return this;
+ }
+
+ public TopicParamsBuilder fetchTimeout(int fetchTimeout) {
+ this.m.fetchTimeout = fetchTimeout;
+ return this;
+ }
+
+ public TopicParamsBuilder fetchLimit(int fetchLimit) {
+ this.m.fetchLimit = fetchLimit;
+ return this;
+ }
+
+ public TopicParamsBuilder useHttps(boolean useHttps) {
+ this.m.useHttps = useHttps;
+ return this;
+ }
+
+ public TopicParamsBuilder allowSelfSignedCerts(boolean allowSelfSignedCerts) {
+ this.m.allowSelfSignedCerts = allowSelfSignedCerts;
+ return this;
+ }
+
+ public TopicParamsBuilder userName(String userName) {
+ this.m.userName = userName;
+ return this;
+ }
+
+ public TopicParamsBuilder password(String password) {
+ this.m.password = password;
+ return this;
+ }
+
+ public TopicParamsBuilder environment(String environment) {
+ this.m.environment = environment;
+ return this;
+ }
+
+ public TopicParamsBuilder aftEnvironment(String aftEnvironment) {
+ this.m.aftEnvironment = aftEnvironment;
+ return this;
+ }
+
+ public TopicParamsBuilder partner(String partner) {
+ this.m.partner = partner;
+ return this;
+ }
+
+ public TopicParamsBuilder latitude(String latitude) {
+ this.m.latitude = latitude;
+ return this;
+ }
+
+ public TopicParamsBuilder longitude(String longitude) {
+ this.m.longitude = longitude;
+ return this;
+ }
+
+ public TopicParamsBuilder additionalProps(Map<String, String> additionalProps) {
+ this.m.additionalProps = additionalProps;
+ return this;
+ }
+
+ public BusTopicParams build() {
+ return m;
+ }
+
+ }
+
+ }
}
diff --git a/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/internal/SingleThreadedDmaapTopicSource.java b/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/internal/SingleThreadedDmaapTopicSource.java
index 8ac41424..c6bd5568 100644
--- a/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/internal/SingleThreadedDmaapTopicSource.java
+++ b/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/internal/SingleThreadedDmaapTopicSource.java
@@ -21,7 +21,6 @@
package org.onap.policy.common.endpoints.event.comm.bus.internal;
import java.net.MalformedURLException;
-import java.util.List;
import java.util.Map;
import org.onap.policy.common.endpoints.event.comm.Topic;
@@ -52,81 +51,28 @@ public class SingleThreadedDmaapTopicSource extends SingleThreadedBusTopicSource
/**
*
- * @param servers DMaaP servers
- * @param topic DMaaP Topic to be monitored
- * @param apiKey DMaaP API Key (optional)
- * @param apiSecret DMaaP API Secret (optional)
- * @param consumerGroup DMaaP Reader Consumer Group
- * @param consumerInstance DMaaP Reader Instance
- * @param fetchTimeout DMaaP fetch timeout
- * @param fetchLimit DMaaP fetch limit
- * @param environment DME2 Environment
- * @param aftEnvironment DME2 AFT Environment
- * @param partner DME2 Partner
- * @param latitude DME2 Latitude
- * @param longitude DME2 Longitude
- * @param additionalProps Additional properties to pass to DME2
- * @param useHttps does connection use HTTPS?
- * @param allowSelfSignedCerts are self-signed certificates allow
- *
+ * @param busTopicParams Parameters object containing all the required inputs *
* @throws IllegalArgumentException An invalid parameter passed in
*/
- public SingleThreadedDmaapTopicSource(List<String> servers, String topic, String apiKey, String apiSecret,
- String userName, String password, String consumerGroup, String consumerInstance, int fetchTimeout,
- int fetchLimit, String environment, String aftEnvironment, String partner, String latitude,
- String longitude, Map<String, String> additionalProps, boolean useHttps, boolean allowSelfSignedCerts) {
-
- super(servers, topic, apiKey, apiSecret, consumerGroup, consumerInstance, fetchTimeout, fetchLimit, useHttps,
- allowSelfSignedCerts);
-
- this.userName = userName;
- this.password = password;
-
- this.environment = environment;
- this.aftEnvironment = aftEnvironment;
- this.partner = partner;
-
- this.latitude = latitude;
- this.longitude = longitude;
-
- this.additionalProps = additionalProps;
- try {
- this.init();
- } catch (Exception e) {
- logger.error("ERROR during init of topic {}", this.topic);
- throw new IllegalArgumentException(e);
- }
- }
+ public SingleThreadedDmaapTopicSource(BusTopicParams busTopicParams) {
- /**
- *
- * @param servers DMaaP servers
- * @param topic DMaaP Topic to be monitored
- * @param apiKey DMaaP API Key (optional)
- * @param apiSecret DMaaP API Secret (optional)
- * @param consumerGroup DMaaP Reader Consumer Group
- * @param consumerInstance DMaaP Reader Instance
- * @param fetchTimeout DMaaP fetch timeout
- * @param fetchLimit DMaaP fetch limit
- * @param useHttps does connection use HTTPS?
- * @param allowSelfSignedCerts are self-signed certificates allow
- * @throws IllegalArgumentException An invalid parameter passed in
- */
- public SingleThreadedDmaapTopicSource(List<String> servers, String topic, String apiKey, String apiSecret,
- String userName, String password, String consumerGroup, String consumerInstance, int fetchTimeout,
- int fetchLimit, boolean useHttps, boolean allowSelfSignedCerts) {
+ super(busTopicParams);
+ this.userName = busTopicParams.getUserName();
+ this.password = busTopicParams.getPassword();
- super(servers, topic, apiKey, apiSecret, consumerGroup, consumerInstance, fetchTimeout, fetchLimit, useHttps,
- allowSelfSignedCerts);
+ this.environment = busTopicParams.getEnvironment();
+ this.aftEnvironment = busTopicParams.getAftEnvironment();
+ this.partner = busTopicParams.getPartner();
- this.userName = userName;
- this.password = password;
+ this.latitude = busTopicParams.getLatitude();
+ this.longitude = busTopicParams.getLongitude();
+ this.additionalProps = busTopicParams.getAdditionalProps();
try {
this.init();
} catch (Exception e) {
- logger.warn("dmaap-source: cannot create topic {} because of {}", topic, e.getMessage(), e);
+ logger.error("ERROR during init in dmaap-source: cannot create topic {} because of {}", topic, e.getMessage(), e);
throw new IllegalArgumentException(e);
}
}
diff --git a/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/internal/SingleThreadedUebTopicSource.java b/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/internal/SingleThreadedUebTopicSource.java
index b7a20503..03273a2b 100644
--- a/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/internal/SingleThreadedUebTopicSource.java
+++ b/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/internal/SingleThreadedUebTopicSource.java
@@ -20,8 +20,6 @@
package org.onap.policy.common.endpoints.event.comm.bus.internal;
-import java.util.List;
-
import org.onap.policy.common.endpoints.event.comm.Topic;
import org.onap.policy.common.endpoints.event.comm.bus.UebTopicSource;
@@ -33,29 +31,16 @@ public class SingleThreadedUebTopicSource extends SingleThreadedBusTopicSource i
/**
*
- * @param servers UEB servers
- * @param topic UEB Topic to be monitored
- * @param apiKey UEB API Key (optional)
- * @param apiSecret UEB API Secret (optional)
- * @param consumerGroup UEB Reader Consumer Group
- * @param consumerInstance UEB Reader Instance
- * @param fetchTimeout UEB fetch timeout
- * @param fetchLimit UEB fetch limit
- * @param useHttps does topicSource use HTTPS?
- * @param allowSelfSignedCerts does topicSource allow self-signed certs?
- *
+ * @param busTopicParams Parameters object containing all the required inputs *
* @throws IllegalArgumentException An invalid parameter passed in
*/
- public SingleThreadedUebTopicSource(List<String> servers, String topic, String apiKey, String apiSecret,
- String consumerGroup, String consumerInstance, int fetchTimeout, int fetchLimit, boolean useHttps,
- boolean allowSelfSignedCerts) {
+ public SingleThreadedUebTopicSource(BusTopicParams busTopicParams) {
- super(servers, topic, apiKey, apiSecret, consumerGroup, consumerInstance, fetchTimeout, fetchLimit, useHttps,
- allowSelfSignedCerts);
+ super(busTopicParams);
- this.allowSelfSignedCerts = allowSelfSignedCerts;
+ this.allowSelfSignedCerts = busTopicParams.isAllowSelfSignedCerts();
this.init();
}
diff --git a/utils/pom.xml b/utils/pom.xml
index 1152d3ad..73fab751 100644
--- a/utils/pom.xml
+++ b/utils/pom.xml
@@ -51,13 +51,11 @@
<dependency>
<groupId>javax.persistence</groupId>
<artifactId>persistence-api</artifactId>
- <version>${javax.persistence.api.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
- <version>${slf4j.version}</version>
<scope>provided</scope>
</dependency>
<dependency>