Use common components in apex
Common ResourceUtil class replaces specific one in APEX
Managed dependency version clashes removed in POMs
Dependency versions with security vulnerabilities changed for
zookeeper
kafka
infinispan
Change-Id: I3c4b367cb5556b2dc255ab62c84f85738165eb81
Issue-ID: POLICY-954
Signed-off-by: liamfallon <liam.fallon@ericsson.com>
diff --git a/testsuites/integration/integration-context-test/pom.xml b/testsuites/integration/integration-context-test/pom.xml
index 95e2c6b..4d13987 100644
--- a/testsuites/integration/integration-context-test/pom.xml
+++ b/testsuites/integration/integration-context-test/pom.xml
@@ -34,6 +34,10 @@
<dependencies>
<dependency>
+ <groupId>org.onap.policy.common</groupId>
+ <artifactId>utils</artifactId>
+ </dependency>
+ <dependency>
<groupId>org.onap.policy.apex-pdp.core</groupId>
<artifactId>core-infrastructure</artifactId>
<version>${project.version}</version>
diff --git a/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/plugins/context/test/locking/TestConcurrentContext.java b/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/plugins/context/test/locking/TestConcurrentContext.java
index 5c13292..87968e6 100644
--- a/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/plugins/context/test/locking/TestConcurrentContext.java
+++ b/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/plugins/context/test/locking/TestConcurrentContext.java
@@ -53,13 +53,13 @@
import org.onap.policy.apex.model.basicmodel.concepts.ApexException;
import org.onap.policy.apex.model.basicmodel.handling.ApexModelException;
import org.onap.policy.apex.model.basicmodel.service.ParameterService;
-import org.onap.policy.apex.model.utilities.ResourceUtils;
import org.onap.policy.apex.plugins.context.distribution.hazelcast.HazelcastContextDistributor;
import org.onap.policy.apex.plugins.context.distribution.infinispan.InfinispanContextDistributor;
import org.onap.policy.apex.plugins.context.distribution.infinispan.InfinispanDistributorParameters;
import org.onap.policy.apex.plugins.context.locking.curator.CuratorLockManager;
import org.onap.policy.apex.plugins.context.locking.curator.CuratorLockManagerParameters;
import org.onap.policy.apex.plugins.context.locking.hazelcast.HazelcastLockManager;
+import org.onap.policy.common.utils.resources.ResourceUtils;
import org.slf4j.ext.XLogger;
import org.slf4j.ext.XLoggerFactory;
diff --git a/testsuites/integration/integration-uservice-test/pom.xml b/testsuites/integration/integration-uservice-test/pom.xml
index 427f70f..3939851 100644
--- a/testsuites/integration/integration-uservice-test/pom.xml
+++ b/testsuites/integration/integration-uservice-test/pom.xml
@@ -37,6 +37,10 @@
<dependencies>
<dependency>
+ <groupId>org.onap.policy.common</groupId>
+ <artifactId>utils</artifactId>
+ </dependency>
+ <dependency>
<groupId>org.onap.policy.apex-pdp.core</groupId>
<artifactId>core-engine</artifactId>
<version>${project.version}</version>
diff --git a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/kafka/TestKafka2Kafka.java b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/kafka/TestKafka2Kafka.java
index 8468b6d..d624d66 100644
--- a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/kafka/TestKafka2Kafka.java
+++ b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/kafka/TestKafka2Kafka.java
@@ -20,7 +20,7 @@
package org.onap.policy.apex.apps.uservice.test.adapt.kafka;
-import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.assertEquals;
import java.io.IOException;
import java.nio.file.Files;
@@ -46,13 +46,12 @@
import kafka.utils.ZkUtils;
import kafka.zk.EmbeddedZookeeper;
-
public class TestKafka2Kafka {
// The method of starting an embedded Kafka server used in this example is based on the method
- // on slashdot at
+ // on stack overflow at
// https://github.com/asmaier/mini-kafka
- private static final long MAX_TEST_LENGTH = 10000;
+ private static final long MAX_TEST_LENGTH = 20000;
private static final int EVENT_COUNT = 100;
private static final int EVENT_INTERVAL = 20;
@@ -79,6 +78,9 @@
brokerProps.setProperty("broker.id", "0");
brokerProps.setProperty("log.dirs", Files.createTempDirectory("kafka-").toAbsolutePath().toString());
brokerProps.setProperty("listeners", "PLAINTEXT://" + BROKERHOST + ":" + BROKERPORT);
+ brokerProps.setProperty("offsets.topic.replication.factor", "1");
+ brokerProps.setProperty("transaction.state.log.replication.factor", "1");
+ brokerProps.setProperty("transaction.state.log.min.isr", "1");
final KafkaConfig config = new KafkaConfig(brokerProps);
final Time mock = new MockTime();
kafkaServer = TestUtils.createServer(config, mock);
@@ -135,9 +137,7 @@
ThreadUtilities.sleep(1000);
- System.out.println("sent event count: " + producer.getEventsSentCount());
- System.out.println("received event count: " + subscriber.getEventsReceivedCount());
- assertTrue(subscriber.getEventsReceivedCount() == producer.getEventsSentCount());
+ assertEquals(producer.getEventsSentCount(), subscriber.getEventsReceivedCount());
apexMain.shutdown();
subscriber.shutdown();
diff --git a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/context/EventAlbumContextTest.java b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/context/EventAlbumContextTest.java
index 284f310..bcdcd57 100644
--- a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/context/EventAlbumContextTest.java
+++ b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/context/EventAlbumContextTest.java
@@ -34,9 +34,9 @@
import org.onap.policy.apex.model.basicmodel.concepts.ApexException;
import org.onap.policy.apex.model.basicmodel.service.ModelService;
import org.onap.policy.apex.model.basicmodel.service.ParameterService;
-import org.onap.policy.apex.model.utilities.ResourceUtils;
import org.onap.policy.apex.model.utilities.TextFileUtils;
import org.onap.policy.apex.service.engine.main.ApexMain;
+import org.onap.policy.common.utils.resources.ResourceUtils;
public class EventAlbumContextTest {
private File tempCommandFile;
diff --git a/testsuites/performance/performance-context-metrics/pom.xml b/testsuites/performance/performance-context-metrics/pom.xml
index 830e6ad..302bfe7 100644
--- a/testsuites/performance/performance-context-metrics/pom.xml
+++ b/testsuites/performance/performance-context-metrics/pom.xml
@@ -32,6 +32,10 @@
<description>[${project.parent.artifactId}] module to calculate metrics using various plugins</description>
<dependencies>
+ <dependency>
+ <groupId>org.onap.policy.common</groupId>
+ <artifactId>utils</artifactId>
+ </dependency>
<dependency>
<groupId>org.onap.policy.apex-pdp.core</groupId>
<artifactId>core-infrastructure</artifactId>
diff --git a/testsuites/performance/performance-context-metrics/src/test/java/org/onap/policy/apex/plugins/context/metrics/TestMetrics.java b/testsuites/performance/performance-context-metrics/src/test/java/org/onap/policy/apex/plugins/context/metrics/TestMetrics.java
index 9f051eb..04b7564 100644
--- a/testsuites/performance/performance-context-metrics/src/test/java/org/onap/policy/apex/plugins/context/metrics/TestMetrics.java
+++ b/testsuites/performance/performance-context-metrics/src/test/java/org/onap/policy/apex/plugins/context/metrics/TestMetrics.java
@@ -32,7 +32,7 @@
import org.junit.Test;
import org.junit.rules.TemporaryFolder;
import org.onap.policy.apex.context.test.utils.NetworkUtils;
-import org.onap.policy.apex.model.utilities.ResourceUtils;
+import org.onap.policy.common.utils.resources.ResourceUtils;
import org.slf4j.ext.XLogger;
import org.slf4j.ext.XLoggerFactory;