summaryrefslogtreecommitdiffstats
path: root/feature-pooling-dmaap/src
diff options
context:
space:
mode:
authorJim Hahn <jrh3@att.com>2020-04-06 15:33:23 -0400
committerJim Hahn <jrh3@att.com>2020-04-06 19:30:02 -0400
commit15014b8ca386a8bfd5c26435f45de94ca06e95e8 (patch)
tree3cca518b950dfa35da0ea64dab2f9ff2b80f4595 /feature-pooling-dmaap/src
parentece155048af47ea83ff898c999aa5137dc99a988 (diff)
Address sonar issues in drools-pdp
Addressed the following sonar issues: - add "final" to public static fields - commented code; some were bogus - just updated the comments so sonar is happy - use "{}" instead of string concatenation - junit should assert something - when using logger, invoke compute-intensive tasks conditionally - use superclass name instead of subclass name to access static fields - don't always return the same value - remove "transient" from fields of classes that aren't Serializable - don't nest try/catch blocks - use appropriate class name in Logger.getLogger() - use Predicate<T> instead of Function<T,Boolean> - remove unused parameters from private methods - either log or throw - remove duplicate methods - use remove() TLS instead of set(null) - null check is implicit in instanceof check - do something with return value - don't use volatile - don't return "null" list; used Optional instead - add no-arg constructor to non-Serializable superclass - add callSuper=true for EqualsAndHashCode - don't declare "throws XXX" where XXX is a subclass of RuntimeException - remove serialVersionUID field if the class isn't Serializable Also addressed some eclipse warnings: - unused fields - suppress generic typic cast warnings Issue-ID: POLICY-2305 Change-Id: I906d5bf71c1f86531423e23b3667a585cdba45e1 Signed-off-by: Jim Hahn <jrh3@att.com>
Diffstat (limited to 'feature-pooling-dmaap/src')
-rw-r--r--feature-pooling-dmaap/src/main/java/org/onap/policy/drools/pooling/PoolingFeature.java13
-rw-r--r--feature-pooling-dmaap/src/main/java/org/onap/policy/drools/pooling/state/ActiveState.java17
-rw-r--r--feature-pooling-dmaap/src/main/java/org/onap/policy/drools/pooling/state/FilterUtils.java16
-rw-r--r--feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/DmaapManagerTest.java33
-rw-r--r--feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/PoolingManagerImplTest.java37
-rw-r--r--feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/PoolingPropertiesTest.java17
-rw-r--r--feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/SerializerTest.java9
-rw-r--r--feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/message/BucketAssignmentsTest.java15
-rw-r--r--feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/state/StateTest.java9
9 files changed, 82 insertions, 84 deletions
diff --git a/feature-pooling-dmaap/src/main/java/org/onap/policy/drools/pooling/PoolingFeature.java b/feature-pooling-dmaap/src/main/java/org/onap/policy/drools/pooling/PoolingFeature.java
index da8a918f..00b7a215 100644
--- a/feature-pooling-dmaap/src/main/java/org/onap/policy/drools/pooling/PoolingFeature.java
+++ b/feature-pooling-dmaap/src/main/java/org/onap/policy/drools/pooling/PoolingFeature.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* ONAP
* ================================================================================
- * Copyright (C) 2018-2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2018-2020 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.
@@ -158,7 +158,7 @@ public class PoolingFeature implements PolicyEngineFeatureApi, PolicyControllerF
ctlr2pool.computeIfAbsent(name, xxx -> makeManager(host, controller, props, activeLatch));
} catch (PropertyException e) {
- logger.error("pooling disabled due to exception for {}", name, e);
+ logger.error("pooling disabled due to exception for {}", name);
throw new PoolingFeatureRtException(e);
}
@@ -196,12 +196,15 @@ public class PoolingFeature implements PolicyEngineFeatureApi, PolicyControllerF
@Override
public boolean afterShutdown(PolicyController controller) {
- deleteManager(controller);
- return false;
+ return commonShutdown(controller);
}
@Override
public boolean afterHalt(PolicyController controller) {
+ return commonShutdown(controller);
+ }
+
+ private boolean commonShutdown(PolicyController controller) {
deleteManager(controller);
return false;
}
@@ -284,7 +287,7 @@ public class PoolingFeature implements PolicyEngineFeatureApi, PolicyControllerF
boolean success) {
// clear any stored arguments
- offerArgs.set(null);
+ offerArgs.remove();
return false;
}
diff --git a/feature-pooling-dmaap/src/main/java/org/onap/policy/drools/pooling/state/ActiveState.java b/feature-pooling-dmaap/src/main/java/org/onap/policy/drools/pooling/state/ActiveState.java
index 58205ddd..c5ee2ae3 100644
--- a/feature-pooling-dmaap/src/main/java/org/onap/policy/drools/pooling/state/ActiveState.java
+++ b/feature-pooling-dmaap/src/main/java/org/onap/policy/drools/pooling/state/ActiveState.java
@@ -2,14 +2,14 @@
* ============LICENSE_START=======================================================
* ONAP
* ================================================================================
- * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2018, 2020 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.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -67,7 +67,7 @@ public class ActiveState extends ProcessingState {
/**
* Constructor.
- *
+ *
* @param mgr pooling manager
*/
public ActiveState(PoolingManager mgr) {
@@ -97,7 +97,7 @@ public class ActiveState extends ProcessingState {
// wrapped around - successor is the first host in the set
succHost = assigned.first();
}
- logger.info("this host's successor is {} on topic {}", succHost, getTopic());
+ logger.info("this host's successor is {} on topic {}", succHost, getTopic());
if ((predHost = assigned.lower(getHost())) == null) {
// wrapped around - predecessor is the last host in the set
@@ -185,7 +185,6 @@ public class ActiveState extends ProcessingState {
if (src == null) {
logger.warn("Heartbeat message has no source on topic {}", getTopic());
- return null;
} else if (src.equals(getHost())) {
logger.info("saw my heartbeat on topic {}", getTopic());
@@ -194,7 +193,7 @@ public class ActiveState extends ProcessingState {
} else if (src.equals(predHost)) {
logger.info("saw heartbeat from {} on topic {}", src, getTopic());
predHeartbeatSeen = true;
-
+
} else {
logger.info("ignored heartbeat message from {} on topic {}", src, getTopic());
}
@@ -239,10 +238,10 @@ public class ActiveState extends ProcessingState {
} else if (isLeader() || (predHost.equals(src) && predHost.equals(assigned.first()))) {
/*
* Case 1: We are the leader.
- *
+ *
* Case 2: Our predecessor was the leader and it has gone offline - we should
* become the leader.
- *
+ *
* In either case, we are now the leader and we must re-balance the buckets
* since one of the hosts has gone offline.
*/
diff --git a/feature-pooling-dmaap/src/main/java/org/onap/policy/drools/pooling/state/FilterUtils.java b/feature-pooling-dmaap/src/main/java/org/onap/policy/drools/pooling/state/FilterUtils.java
index 1616f03e..5b7012d2 100644
--- a/feature-pooling-dmaap/src/main/java/org/onap/policy/drools/pooling/state/FilterUtils.java
+++ b/feature-pooling-dmaap/src/main/java/org/onap/policy/drools/pooling/state/FilterUtils.java
@@ -2,14 +2,14 @@
* ============LICENSE_START=======================================================
* ONAP
* ================================================================================
- * Copyright (C) 2018-2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2018-2020 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.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -52,7 +52,7 @@ public class FilterUtils {
/**
* Makes a filter that verifies that a field equals a value.
- *
+ *
* @param field name of the field to check
* @param value desired value
* @return a map representing an "equals" filter
@@ -68,11 +68,11 @@ public class FilterUtils {
/**
* Makes an "and" filter, where all of the items must be true.
- *
+ *
* @param items items to be checked
* @return an "and" filter
*/
- public static Map<String, Object> makeAnd(Map<String, Object>... items) {
+ public static Map<String, Object> makeAnd(@SuppressWarnings("unchecked") Map<String, Object>... items) {
Map<String, Object> map = new TreeMap<>();
map.put(JSON_CLASS, CLASS_AND);
map.put(JSON_FILTERS, items);
@@ -82,11 +82,11 @@ public class FilterUtils {
/**
* Makes an "or" filter, where at least one of the items must be true.
- *
+ *
* @param items items to be checked
* @return an "or" filter
*/
- public static Map<String, Object> makeOr(Map<String, Object>... items) {
+ public static Map<String, Object> makeOr(@SuppressWarnings("unchecked") Map<String, Object>... items) {
Map<String, Object> map = new TreeMap<>();
map.put(JSON_CLASS, CLASS_OR);
map.put(JSON_FILTERS, items);
diff --git a/feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/DmaapManagerTest.java b/feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/DmaapManagerTest.java
index 69896d34..d5b397a6 100644
--- a/feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/DmaapManagerTest.java
+++ b/feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/DmaapManagerTest.java
@@ -2,14 +2,14 @@
* ============LICENSE_START=======================================================
* ONAP
* ================================================================================
- * Copyright (C) 2018-2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2018-2020 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.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -20,6 +20,7 @@
package org.onap.policy.drools.pooling;
+import static org.assertj.core.api.Assertions.assertThatCode;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
@@ -48,7 +49,7 @@ public class DmaapManagerTest {
private static final String MY_TOPIC = "my.topic";
private static final String MSG = "a message";
private static final String FILTER = "a filter";
-
+
private TopicListener listener;
private FilterableTopicSource source;
private boolean gotSources;
@@ -58,7 +59,7 @@ public class DmaapManagerTest {
/**
* Setup.
- *
+ *
* @throws Exception throws an exception
*/
@Before
@@ -116,11 +117,6 @@ public class DmaapManagerTest {
assertEquals(MY_TOPIC, mgr.getTopic());
}
- @Test
- public void testFindTopicSource() {
- // getting here means it worked
- }
-
@Test(expected = PoolingFeatureException.class)
public void testFindTopicSource_NotFilterableTopicSource() throws PoolingFeatureException {
@@ -158,11 +154,6 @@ public class DmaapManagerTest {
};
}
- @Test
- public void testFindTopicSink() {
- // getting here means it worked
- }
-
@Test(expected = PoolingFeatureException.class)
public void testFindTopicSink_NotFound() throws PoolingFeatureException {
// one item in list, and its topic doesn't match
@@ -187,7 +178,7 @@ public class DmaapManagerTest {
@Test
public void testStartPublisher() throws PoolingFeatureException {
-
+
mgr.startPublisher();
// restart should have no effect
@@ -210,7 +201,7 @@ public class DmaapManagerTest {
mgr.stopPublisher(0);
// re-stopping should have no effect
- mgr.stopPublisher(0);
+ assertThatCode(() -> mgr.stopPublisher(0)).doesNotThrowAnyException();
}
@Test
@@ -285,7 +276,7 @@ public class DmaapManagerTest {
@Test
public void testSetFilter() throws PoolingFeatureException {
- mgr.setFilter(FILTER);
+ assertThatCode(() -> mgr.setFilter(FILTER)).doesNotThrowAnyException();
}
@Test(expected = PoolingFeatureException.class)
@@ -337,7 +328,7 @@ public class DmaapManagerTest {
mgr.publish(MSG);
}
-
+
/**
* Manager with overrides.
*/
@@ -350,7 +341,7 @@ public class DmaapManagerTest {
@Override
protected List<TopicSource> getTopicSources() {
gotSources = true;
-
+
// three sources, with the desired one in the middle
return Arrays.asList(mock(TopicSource.class), source, mock(TopicSource.class));
}
@@ -358,7 +349,7 @@ public class DmaapManagerTest {
@Override
protected List<TopicSink> getTopicSinks() {
gotSinks = true;
-
+
// three sinks, with the desired one in the middle
return Arrays.asList(mock(TopicSink.class), sink, mock(TopicSink.class));
}
diff --git a/feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/PoolingManagerImplTest.java b/feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/PoolingManagerImplTest.java
index 5293b794..bd3d90b6 100644
--- a/feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/PoolingManagerImplTest.java
+++ b/feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/PoolingManagerImplTest.java
@@ -2,14 +2,14 @@
* ============LICENSE_START=======================================================
* ONAP
* ================================================================================
- * Copyright (C) 2018-2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2018-2020 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.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -20,6 +20,7 @@
package org.onap.policy.drools.pooling;
+import static org.assertj.core.api.Assertions.assertThatCode;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
@@ -286,7 +287,7 @@ public class PoolingManagerImplTest {
Forward msg = new Forward(mgr.getHost(), CommInfrastructure.UEB, TOPIC2, THE_EVENT, REQUEST_ID);
mgr.handle(msg);
verify(dmaap, times(START_PUB + 1)).publish(any());
-
+
mgr.beforeStop();
verify(dmaap).stopConsumer(mgr);
@@ -453,7 +454,7 @@ public class PoolingManagerImplTest {
doThrow(new PoolingFeatureException()).when(dmaap).setFilter(any());
// start should invoke setFilter()
- startMgr();
+ assertThatCode(() -> startMgr()).doesNotThrowAnyException();
// no exception, means success
}
@@ -552,7 +553,7 @@ public class PoolingManagerImplTest {
// generate exception
doThrow(new PoolingFeatureException()).when(dmaap).publish(any());
- mgr.publish(Message.ADMIN, new Offline(mgr.getHost()));
+ assertThatCode(() -> mgr.publish(Message.ADMIN, new Offline(mgr.getHost()))).doesNotThrowAnyException();
}
@Test
@@ -578,7 +579,7 @@ public class PoolingManagerImplTest {
public void testOnTopicEvent_NullEvent() throws Exception {
startMgr();
- mgr.onTopicEvent(CommInfrastructure.UEB, TOPIC2, null);
+ assertThatCode(() -> mgr.onTopicEvent(CommInfrastructure.UEB, TOPIC2, null)).doesNotThrowAnyException();
}
@Test
@@ -780,7 +781,7 @@ public class PoolingManagerImplTest {
return false;
}
};
-
+
startMgr();
when(controller.isLocked()).thenReturn(true);
@@ -801,7 +802,7 @@ public class PoolingManagerImplTest {
throw new UnsupportedOperationException();
}
};
-
+
startMgr();
when(controller.isLocked()).thenReturn(true);
@@ -821,7 +822,7 @@ public class PoolingManagerImplTest {
throw new IllegalArgumentException();
}
};
-
+
startMgr();
when(controller.isLocked()).thenReturn(true);
@@ -841,7 +842,7 @@ public class PoolingManagerImplTest {
throw new IllegalStateException();
}
};
-
+
startMgr();
when(controller.isLocked()).thenReturn(true);
@@ -867,19 +868,19 @@ public class PoolingManagerImplTest {
@Test
public void testMakeForward() throws Exception {
startMgr();
-
+
// route the message to another host
mgr.startDistributing(makeAssignments(false));
assertTrue(mgr.beforeInsert(CommInfrastructure.UEB, TOPIC2, THE_EVENT, DECODED_EVENT));
-
+
verify(dmaap, times(START_PUB + 1)).publish(any());
}
@Test
public void testMakeForward_InvalidMsg() throws Exception {
startMgr();
-
+
// route the message to another host
mgr.startDistributing(makeAssignments(false));
@@ -1136,10 +1137,10 @@ public class PoolingManagerImplTest {
* Configure the mock controller to act like a real controller, invoking beforeOffer
* and then beforeInsert, so we can make sure they pass through. We'll keep count to
* ensure we don't get into infinite recursion.
- *
+ *
* @param invokeBeforeInsert {@code true} if beforeInsert() should be invoked,
* {@code false} if it should be skipped
- *
+ *
* @return a latch that will be counted down if both beforeXxx() methods return false
*/
private CountDownLatch catchRecursion(boolean invokeBeforeInsert) {
@@ -1176,7 +1177,7 @@ public class PoolingManagerImplTest {
/**
* Makes an assignment with two buckets.
- *
+ *
* @param sameHost {@code true} if the {@link #REQUEST_ID} should hash to the
* manager's bucket, {@code false} if it should hash to the other host's bucket
* @return a new bucket assignment
@@ -1198,7 +1199,7 @@ public class PoolingManagerImplTest {
/**
* Invokes methods necessary to start the manager.
- *
+ *
* @throws PoolingFeatureException if an error occurs
*/
private void startMgr() throws PoolingFeatureException {
diff --git a/feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/PoolingPropertiesTest.java b/feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/PoolingPropertiesTest.java
index cc716a2a..b15908dc 100644
--- a/feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/PoolingPropertiesTest.java
+++ b/feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/PoolingPropertiesTest.java
@@ -2,14 +2,14 @@
* ============LICENSE_START=======================================================
* ONAP
* ================================================================================
- * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2018, 2020 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.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -20,6 +20,7 @@
package org.onap.policy.drools.pooling;
+import static org.assertj.core.api.Assertions.assertThatCode;
import static org.junit.Assert.assertEquals;
import static org.onap.policy.drools.pooling.PoolingProperties.ACTIVE_HEARTBEAT_MS;
import static org.onap.policy.drools.pooling.PoolingProperties.FEATURE_ENABLED;
@@ -60,7 +61,7 @@ public class PoolingPropertiesTest {
/**
* Setup.
- *
+ *
* @throws Exception throws an exception
*/
@Before
@@ -73,7 +74,7 @@ public class PoolingPropertiesTest {
@Test
public void testPoolingProperties() throws PropertyException {
// ensure no exceptions
- new PoolingProperties(CONTROLLER, plain);
+ assertThatCode(() -> new PoolingProperties(CONTROLLER, plain)).doesNotThrowAnyException();
}
@Test
@@ -130,7 +131,7 @@ public class PoolingPropertiesTest {
* Tests a particular property. Verifies that the correct value is returned if the
* specialized property has a value or the property has no value. Also verifies that
* the property name can be generalized.
- *
+ *
* @param propnm name of the property of interest
* @param specValue expected specialized value
* @param dfltValue expected default value
@@ -156,7 +157,7 @@ public class PoolingPropertiesTest {
/**
* Makes a set of properties, where all of the properties are specialized for the
* controller.
- *
+ *
* @return a new property set
*/
private Properties makeProperties() {
@@ -178,7 +179,7 @@ public class PoolingPropertiesTest {
/**
* Embeds a specializer within a property name, after the prefix.
- *
+ *
* @param propnm property name into which it should be embedded
* @param spec specializer to be embedded
* @return the property name, with the specializer embedded within it
diff --git a/feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/SerializerTest.java b/feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/SerializerTest.java
index b51a18f2..09e83852 100644
--- a/feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/SerializerTest.java
+++ b/feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/SerializerTest.java
@@ -2,14 +2,14 @@
* ============LICENSE_START=======================================================
* ONAP
* ================================================================================
- * Copyright (C) 2018-2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2018-2020 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.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -20,6 +20,7 @@
package org.onap.policy.drools.pooling;
+import static org.assertj.core.api.Assertions.assertThatCode;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
@@ -39,7 +40,7 @@ public class SerializerTest {
@Test
public void testSerializer() {
- new Serializer();
+ assertThatCode(() -> new Serializer()).doesNotThrowAnyException();
}
@Test
diff --git a/feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/message/BucketAssignmentsTest.java b/feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/message/BucketAssignmentsTest.java
index 5788141b..50cab788 100644
--- a/feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/message/BucketAssignmentsTest.java
+++ b/feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/message/BucketAssignmentsTest.java
@@ -2,14 +2,14 @@
* ============LICENSE_START=======================================================
* ONAP
* ================================================================================
- * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2018, 2020 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.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -20,6 +20,7 @@
package org.onap.policy.drools.pooling.message;
+import static org.assertj.core.api.Assertions.assertThatCode;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
@@ -37,7 +38,7 @@ public class BucketAssignmentsTest {
@Test
public void testBucketAssignments() {
- new BucketAssignments();
+ assertThatCode(() -> new BucketAssignments()).doesNotThrowAnyException();
}
@Test
@@ -172,7 +173,7 @@ public class BucketAssignmentsTest {
/**
* Gets the hosts, sorted, so that the order is predictable.
- *
+ *
* @param asgn assignment whose hosts are to be retrieved
* @return a new, sorted set of hosts
*/
@@ -201,7 +202,7 @@ public class BucketAssignmentsTest {
/*
* get assignments for consecutive integers, including negative numbers and
* numbers extending past the length of the array.
- *
+ *
*/
TreeSet<String> seen = new TreeSet<>();
for (int x = -1; x < arr.length + 2; ++x) {
@@ -342,7 +343,7 @@ public class BucketAssignmentsTest {
/**
* Expects an exception when checkValidity() is called.
- *
+ *
* @param asgn assignments to be checked
*/
private void expectException(BucketAssignments asgn) {
diff --git a/feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/state/StateTest.java b/feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/state/StateTest.java
index 65d9ee31..5284ed11 100644
--- a/feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/state/StateTest.java
+++ b/feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/state/StateTest.java
@@ -2,14 +2,14 @@
* ============LICENSE_START=======================================================
* ONAP
* ================================================================================
- * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2018, 2020 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.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -20,6 +20,7 @@
package org.onap.policy.drools.pooling.state;
+import static org.assertj.core.api.Assertions.assertThatCode;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNull;
@@ -136,7 +137,7 @@ public class StateTest extends SupportBasicStateTester {
@Test
public void testStart() {
- state.start();
+ assertThatCode(() -> state.start()).doesNotThrowAnyException();
}
@Test