summaryrefslogtreecommitdiffstats
path: root/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/event/comm
diff options
context:
space:
mode:
Diffstat (limited to 'policy-endpoints/src/test/java/org/onap/policy/common/endpoints/event/comm')
-rw-r--r--policy-endpoints/src/test/java/org/onap/policy/common/endpoints/event/comm/bus/BusTopicFactoryTestBase.java6
-rw-r--r--policy-endpoints/src/test/java/org/onap/policy/common/endpoints/event/comm/bus/DmaapTopicSinkFactoryTest.java8
-rw-r--r--policy-endpoints/src/test/java/org/onap/policy/common/endpoints/event/comm/bus/DmaapTopicSourceFactoryTest.java10
-rw-r--r--policy-endpoints/src/test/java/org/onap/policy/common/endpoints/event/comm/bus/internal/BusConsumerTest.java11
-rw-r--r--policy-endpoints/src/test/java/org/onap/policy/common/endpoints/event/comm/bus/internal/BusPublisherTest.java9
-rw-r--r--policy-endpoints/src/test/java/org/onap/policy/common/endpoints/event/comm/bus/internal/BusTopicBaseTest.java1
-rw-r--r--policy-endpoints/src/test/java/org/onap/policy/common/endpoints/event/comm/bus/internal/BusTopicParamsTest.java3
-rw-r--r--policy-endpoints/src/test/java/org/onap/policy/common/endpoints/event/comm/bus/internal/InlineBusTopicSinkTest.java1
-rw-r--r--policy-endpoints/src/test/java/org/onap/policy/common/endpoints/event/comm/bus/internal/InlineDmaapTopicSinkTest.java1
-rw-r--r--policy-endpoints/src/test/java/org/onap/policy/common/endpoints/event/comm/bus/internal/InlineUebTopicSinkTest.java1
10 files changed, 37 insertions, 14 deletions
diff --git a/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/event/comm/bus/BusTopicFactoryTestBase.java b/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/event/comm/bus/BusTopicFactoryTestBase.java
index 919397d9..b5c9e614 100644
--- a/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/event/comm/bus/BusTopicFactoryTestBase.java
+++ b/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/event/comm/bus/BusTopicFactoryTestBase.java
@@ -34,7 +34,7 @@ import static org.onap.policy.common.endpoints.properties.PolicyEndPointProperti
import java.util.Arrays;
import java.util.List;
import java.util.Properties;
-import java.util.function.Function;
+import java.util.function.Predicate;
import org.onap.policy.common.endpoints.event.comm.Topic;
import org.onap.policy.common.endpoints.event.comm.bus.internal.BusTopicParams;
@@ -192,7 +192,7 @@ public abstract class BusTopicFactoryTestBase<T extends Topic> extends TopicFact
* @param values the values to which the property should be set, defaults to
* {@code null} and ""
*/
- protected void checkDefault(String builderName, Function<BusTopicParams, Boolean> validate, Object... values) {
+ protected void checkDefault(String builderName, Predicate<BusTopicParams> validate, Object... values) {
Object[] values2 = (values.length > 0 ? values : new Object[] {null, ""});
for (Object value : values2) {
@@ -209,7 +209,7 @@ public abstract class BusTopicFactoryTestBase<T extends Topic> extends TopicFact
}
assertEquals("size for default " + value, 1, buildTopics(builder.build()).size());
- assertTrue("default for " + value, validate.apply(getLastParams()));
+ assertTrue("default for " + value, validate.test(getLastParams()));
}
}
diff --git a/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/event/comm/bus/DmaapTopicSinkFactoryTest.java b/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/event/comm/bus/DmaapTopicSinkFactoryTest.java
index b4c7fff8..6c9dfcbd 100644
--- a/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/event/comm/bus/DmaapTopicSinkFactoryTest.java
+++ b/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/event/comm/bus/DmaapTopicSinkFactoryTest.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* policy-endpoints
* ================================================================================
- * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2018-2019 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.
@@ -41,6 +41,7 @@ public class DmaapTopicSinkFactoryTest extends DmaapTopicFactoryTestBase<DmaapTo
* Creates the object to be tested.
*/
@Before
+ @Override
public void setUp() {
super.setUp();
@@ -53,17 +54,20 @@ public class DmaapTopicSinkFactoryTest extends DmaapTopicFactoryTestBase<DmaapTo
}
@Test
+ @Override
public void testBuildBusTopicParams() {
super.testBuildBusTopicParams();
super.testBuildBusTopicParams_Ex();
}
@Test
+ @Override
public void testBuildListOfStringString() {
super.testBuildListOfStringString();
}
@Test
+ @Override
public void testBuildProperties() {
super.testBuildProperties();
super.testBuildProperties_Variations();
@@ -75,12 +79,14 @@ public class DmaapTopicSinkFactoryTest extends DmaapTopicFactoryTestBase<DmaapTo
}
@Test
+ @Override
public void testDestroyString_testGet_testInventory() {
super.testDestroyString_testGet_testInventory();
super.testDestroyString_Ex();
}
@Test
+ @Override
public void testDestroy() {
super.testDestroy();
}
diff --git a/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/event/comm/bus/DmaapTopicSourceFactoryTest.java b/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/event/comm/bus/DmaapTopicSourceFactoryTest.java
index ec6fcfcc..d6187420 100644
--- a/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/event/comm/bus/DmaapTopicSourceFactoryTest.java
+++ b/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/event/comm/bus/DmaapTopicSourceFactoryTest.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* ONAP Policy Engine - Common Modules
* ================================================================================
- * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2018-2019 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.
@@ -44,6 +44,7 @@ public class DmaapTopicSourceFactoryTest extends DmaapTopicFactoryTestBase<Dmaap
* Creates the object to be tested.
*/
@Before
+ @Override
public void setUp() {
super.setUp();
@@ -56,12 +57,14 @@ public class DmaapTopicSourceFactoryTest extends DmaapTopicFactoryTestBase<Dmaap
}
@Test
+ @Override
public void testBuildBusTopicParams() {
super.testBuildBusTopicParams();
super.testBuildBusTopicParams_Ex();
}
@Test
+ @Override
public void testBuildProperties() {
super.testBuildProperties();
@@ -79,7 +82,7 @@ public class DmaapTopicSourceFactoryTest extends DmaapTopicFactoryTestBase<Dmaap
checkDefault(PROPERTY_TOPIC_SOURCE_FETCH_LIMIT_SUFFIX,
params2 -> params2.getFetchLimit() == DmaapTopicSource.DEFAULT_LIMIT_FETCH,
null, "", "invalid-limit-number");
-
+
checkDefault(PROPERTY_TOPIC_SOURCE_FETCH_TIMEOUT_SUFFIX,
params2 -> params2.getFetchTimeout() == DmaapTopicSource.DEFAULT_TIMEOUT_MS_FETCH,
null, "", "invalid-timeout-number");
@@ -99,6 +102,7 @@ public class DmaapTopicSourceFactoryTest extends DmaapTopicFactoryTestBase<Dmaap
}
@Test
+ @Override
public void testBuildListOfStringString() {
super.testBuildListOfStringString();
@@ -111,12 +115,14 @@ public class DmaapTopicSourceFactoryTest extends DmaapTopicFactoryTestBase<Dmaap
}
@Test
+ @Override
public void testDestroyString_testGet_testInventory() {
super.testDestroyString_testGet_testInventory();
super.testDestroyString_Ex();
}
@Test
+ @Override
public void testDestroy() {
super.testDestroy();
}
diff --git a/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/event/comm/bus/internal/BusConsumerTest.java b/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/event/comm/bus/internal/BusConsumerTest.java
index c9064d45..ae07798d 100644
--- a/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/event/comm/bus/internal/BusConsumerTest.java
+++ b/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/event/comm/bus/internal/BusConsumerTest.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* policy-endpoints
* ================================================================================
- * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2018-2019 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.
@@ -47,6 +47,7 @@ import org.powermock.reflect.Whitebox;
public class BusConsumerTest extends TopicTestBase {
@Before
+ @Override
public void setUp() {
super.setUp();
}
@@ -88,13 +89,17 @@ public class BusConsumerTest extends TopicTestBase {
cons.fetch();
fail("missing exception");
- } catch (IOException | InterruptedException e) {
+ } catch (IOException e) {
+ assertEquals(ex, e);
+
+ } catch (InterruptedException e) {
+ Thread.currentThread().interrupt();
assertEquals(ex, e);
}
}
@Test
- public void testCambriaConsumerWrapperClose() throws Exception {
+ public void testCambriaConsumerWrapperClose() {
CambriaConsumerWrapper cons = new CambriaConsumerWrapper(builder.build());
// set filter several times to cause different branches of close() to be executed
diff --git a/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/event/comm/bus/internal/BusPublisherTest.java b/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/event/comm/bus/internal/BusPublisherTest.java
index 9c1e4af4..283d44da 100644
--- a/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/event/comm/bus/internal/BusPublisherTest.java
+++ b/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/event/comm/bus/internal/BusPublisherTest.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* policy-endpoints
* ================================================================================
- * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2018-2019 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,6 +48,7 @@ import org.onap.policy.common.endpoints.event.comm.bus.internal.BusPublisher.Dma
public class BusPublisherTest extends TopicTestBase {
@Before
+ @Override
public void setUp() {
super.setUp();
}
@@ -90,7 +91,7 @@ public class BusPublisherTest extends TopicTestBase {
}
@Test
- public void testCambriaPublisherWrapperClose() throws Exception {
+ public void testCambriaPublisherWrapperClose() {
CambriaBatchingPublisher pub = mock(CambriaBatchingPublisher.class);
CambriaPublisherWrapper cambria = new CambriaPublisherWrapper(makeBuilder().build());
cambria.publisher = pub;
@@ -146,7 +147,7 @@ public class BusPublisherTest extends TopicTestBase {
}
@Test
- public void testDmaapPublisherWrapperSend() throws Exception {
+ public void testDmaapPublisherWrapperSend() {
MRSimplerBatchPublisher pub = mock(MRSimplerBatchPublisher.class);
DmaapPublisherWrapper dmaap = new DmaapAafPublisherWrapper(servers, MY_TOPIC, MY_USERNAME, MY_PASSWD, true);
dmaap.publisher = pub;
@@ -168,7 +169,7 @@ public class BusPublisherTest extends TopicTestBase {
}
@Test(expected = IllegalArgumentException.class)
- public void testDmaapPublisherWrapperSend_NullMessage() throws Exception {
+ public void testDmaapPublisherWrapperSend_NullMessage() {
MRSimplerBatchPublisher pub = mock(MRSimplerBatchPublisher.class);
DmaapPublisherWrapper dmaap = new DmaapAafPublisherWrapper(servers, MY_TOPIC, MY_USERNAME, MY_PASSWD, true);
dmaap.publisher = pub;
diff --git a/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/event/comm/bus/internal/BusTopicBaseTest.java b/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/event/comm/bus/internal/BusTopicBaseTest.java
index 5628a239..01028045 100644
--- a/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/event/comm/bus/internal/BusTopicBaseTest.java
+++ b/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/event/comm/bus/internal/BusTopicBaseTest.java
@@ -39,6 +39,7 @@ public class BusTopicBaseTest extends TopicTestBase {
* Initializes the object to be tested.
*/
@Before
+ @Override
public void setUp() {
super.setUp();
diff --git a/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/event/comm/bus/internal/BusTopicParamsTest.java b/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/event/comm/bus/internal/BusTopicParamsTest.java
index 8d1c6343..54531c56 100644
--- a/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/event/comm/bus/internal/BusTopicParamsTest.java
+++ b/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/event/comm/bus/internal/BusTopicParamsTest.java
@@ -35,6 +35,7 @@ import org.onap.policy.common.endpoints.event.comm.bus.internal.BusTopicParams.T
public class BusTopicParamsTest extends TopicTestBase {
@Before
+ @Override
public void setUp() {
super.setUp();
}
@@ -123,7 +124,7 @@ public class BusTopicParamsTest extends TopicTestBase {
* Tests the boolean methods by applying a function, once with {@code false} and once
* with {@code true}. Verifies that all of the boolean methods return the correct
* value by concatenating them.
- *
+ *
* @param expectedTrue the string that is expected when {@code true} is passed to the
* method
* @param function function to be applied to the builder
diff --git a/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/event/comm/bus/internal/InlineBusTopicSinkTest.java b/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/event/comm/bus/internal/InlineBusTopicSinkTest.java
index cb6eb107..2356746e 100644
--- a/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/event/comm/bus/internal/InlineBusTopicSinkTest.java
+++ b/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/event/comm/bus/internal/InlineBusTopicSinkTest.java
@@ -47,6 +47,7 @@ public class InlineBusTopicSinkTest extends TopicTestBase {
* Creates the object to be tested.
*/
@Before
+ @Override
public void setUp() {
super.setUp();
diff --git a/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/event/comm/bus/internal/InlineDmaapTopicSinkTest.java b/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/event/comm/bus/internal/InlineDmaapTopicSinkTest.java
index aaab402c..d9bc990b 100644
--- a/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/event/comm/bus/internal/InlineDmaapTopicSinkTest.java
+++ b/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/event/comm/bus/internal/InlineDmaapTopicSinkTest.java
@@ -37,6 +37,7 @@ public class InlineDmaapTopicSinkTest extends TopicTestBase {
* Creates the object to be tested.
*/
@Before
+ @Override
public void setUp() {
super.setUp();
diff --git a/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/event/comm/bus/internal/InlineUebTopicSinkTest.java b/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/event/comm/bus/internal/InlineUebTopicSinkTest.java
index 2516406f..a45504f2 100644
--- a/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/event/comm/bus/internal/InlineUebTopicSinkTest.java
+++ b/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/event/comm/bus/internal/InlineUebTopicSinkTest.java
@@ -37,6 +37,7 @@ public class InlineUebTopicSinkTest extends TopicTestBase {
* Creates the object to be tested.
*/
@Before
+ @Override
public void setUp() {
super.setUp();