From efdaa0d840ed5289bda63ea15d76d8a5446c1746 Mon Sep 17 00:00:00 2001 From: liamfallon Date: Fri, 3 Aug 2018 16:12:01 +0100 Subject: 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 --- testsuites/integration/integration-uservice-test/pom.xml | 4 ++++ .../apps/uservice/test/adapt/kafka/TestKafka2Kafka.java | 14 +++++++------- .../apps/uservice/test/context/EventAlbumContextTest.java | 2 +- 3 files changed, 12 insertions(+), 8 deletions(-) (limited to 'testsuites/integration/integration-uservice-test') diff --git a/testsuites/integration/integration-uservice-test/pom.xml b/testsuites/integration/integration-uservice-test/pom.xml index 427f70f27..3939851e3 100644 --- a/testsuites/integration/integration-uservice-test/pom.xml +++ b/testsuites/integration/integration-uservice-test/pom.xml @@ -36,6 +36,10 @@ + + org.onap.policy.common + utils + org.onap.policy.apex-pdp.core core-engine 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 8468b6d7f..d624d66bf 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.ZKStringSerializer$; 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 @@ public class TestKafka2Kafka { 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 @@ public class TestKafka2Kafka { 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 284f31013..bcdcd571f 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.core.infrastructure.threading.ThreadUtilities; 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; -- cgit 1.2.3-korg