diff options
Diffstat (limited to 'feature-server-pool/src/test')
9 files changed, 27 insertions, 24 deletions
diff --git a/feature-server-pool/src/test/java/org/onap/policy/drools/serverpool/AdapterImpl.java b/feature-server-pool/src/test/java/org/onap/policy/drools/serverpool/AdapterImpl.java index 70dc2114..789dfe61 100644 --- a/feature-server-pool/src/test/java/org/onap/policy/drools/serverpool/AdapterImpl.java +++ b/feature-server-pool/src/test/java/org/onap/policy/drools/serverpool/AdapterImpl.java @@ -172,7 +172,7 @@ public class AdapterImpl extends Adapter { TimeUnit.MILLISECONDS).until(() -> Leader.getLeader() != null); // wait for each bucket to have an owner - for (int i = 0 ; i < Bucket.BUCKETCOUNT ; i += 1) { + for (int i = 0; i < Bucket.BUCKETCOUNT; i += 1) { Bucket bucket = Bucket.getBucket(i); while (bucket.getOwner() == null) { Thread.sleep(Math.min(endTime - System.currentTimeMillis(), 100L)); @@ -312,7 +312,7 @@ public class AdapterImpl extends Adapter { */ logger.info("{}: Calling 'sendEvent': packages = {}", this, policySession.getKieSession().getKieBase().getKiePackages()); - ((TopicListener)policyController).onTopicEvent( + ((TopicListener) policyController).onTopicEvent( CommInfrastructure.UEB, "JUNIT-TEST-TOPIC", "{\"key\":\"" + key + "\"}"); } @@ -374,7 +374,7 @@ public class AdapterImpl extends Adapter { String rval = null; // try up to 10000 numeric values to locate one on a particular host - for (int i = 0 ; i < 10000 ; i += 1) { + for (int i = 0; i < 10000; i += 1) { // generate key, and see if it is on the desired server String testString = prefix + (startingIndex + i); if (ServerWrapperImpl.getWrapper( diff --git a/feature-server-pool/src/test/java/org/onap/policy/drools/serverpool/BucketWrapperImpl.java b/feature-server-pool/src/test/java/org/onap/policy/drools/serverpool/BucketWrapperImpl.java index ca89d99a..ddd4d553 100644 --- a/feature-server-pool/src/test/java/org/onap/policy/drools/serverpool/BucketWrapperImpl.java +++ b/feature-server-pool/src/test/java/org/onap/policy/drools/serverpool/BucketWrapperImpl.java @@ -22,7 +22,6 @@ package org.onap.policy.drools.serverpool; import java.io.PrintStream; import java.util.IdentityHashMap; - import org.onap.policy.drools.serverpooltest.BucketWrapper; import org.onap.policy.drools.serverpooltest.ServerWrapper; diff --git a/feature-server-pool/src/test/java/org/onap/policy/drools/serverpool/ServerWrapperImpl.java b/feature-server-pool/src/test/java/org/onap/policy/drools/serverpool/ServerWrapperImpl.java index 468d12af..031c3323 100644 --- a/feature-server-pool/src/test/java/org/onap/policy/drools/serverpool/ServerWrapperImpl.java +++ b/feature-server-pool/src/test/java/org/onap/policy/drools/serverpool/ServerWrapperImpl.java @@ -24,7 +24,6 @@ import java.util.ArrayList; import java.util.Collection; import java.util.IdentityHashMap; import java.util.UUID; - import org.onap.policy.drools.serverpooltest.ServerWrapper; /** diff --git a/feature-server-pool/src/test/java/org/onap/policy/drools/serverpool/TargetLockWrapperImpl.java b/feature-server-pool/src/test/java/org/onap/policy/drools/serverpool/TargetLockWrapperImpl.java index 4f496986..e170975a 100644 --- a/feature-server-pool/src/test/java/org/onap/policy/drools/serverpool/TargetLockWrapperImpl.java +++ b/feature-server-pool/src/test/java/org/onap/policy/drools/serverpool/TargetLockWrapperImpl.java @@ -21,8 +21,6 @@ package org.onap.policy.drools.serverpool; import java.io.Serializable; -import java.util.IdentityHashMap; - import org.onap.policy.drools.core.lock.Lock; import org.onap.policy.drools.core.lock.LockCallback; import org.onap.policy.drools.serverpooltest.TargetLockWrapper; @@ -32,6 +30,8 @@ import org.onap.policy.drools.serverpooltest.TargetLockWrapper; * 'TargetLockWrapperImpl' class for each simulated host. */ public class TargetLockWrapperImpl implements TargetLockWrapper { + private static final long serialVersionUID = 1L; + // this is the 'TargetLock' instance associated with the wrapper private TargetLock targetLock; @@ -156,6 +156,8 @@ public class TargetLockWrapperImpl implements TargetLockWrapper { * interface, translating it to a 'TargetLockWrapper.Owner' callback. */ public static class OwnerAdapter implements LockCallback, Serializable { + private static final long serialVersionUID = 1L; + // the 'TargetLockWrapper' instance to pass as an argument in the callback TargetLockWrapper targetLock; diff --git a/feature-server-pool/src/test/java/org/onap/policy/drools/serverpooltest/Adapter.java b/feature-server-pool/src/test/java/org/onap/policy/drools/serverpooltest/Adapter.java index d5d836b4..22404605 100644 --- a/feature-server-pool/src/test/java/org/onap/policy/drools/serverpooltest/Adapter.java +++ b/feature-server-pool/src/test/java/org/onap/policy/drools/serverpooltest/Adapter.java @@ -95,7 +95,7 @@ public abstract class Adapter { ClassLoader saveClassLoader = Thread.currentThread().getContextClassLoader(); if (saveClassLoader instanceof URLClassLoader) { - urls = ((URLClassLoader)saveClassLoader).getURLs(); + urls = ((URLClassLoader) saveClassLoader).getURLs(); } else { // the parent is not a 'URLClassLoader' -- // try to get this information from 'java.class.path' @@ -111,7 +111,7 @@ public abstract class Adapter { urls = tmpUrls.toArray(new URL[0]); } try { - for (int i = 0 ; i < adapters.length ; i += 1) { + for (int i = 0; i < adapters.length; i += 1) { /* * Build a new 'ClassLoader' for this adapter. The * 'ClassLoader' hierarchy is: diff --git a/feature-server-pool/src/test/java/org/onap/policy/drools/serverpooltest/BlockingClassLoader.java b/feature-server-pool/src/test/java/org/onap/policy/drools/serverpooltest/BlockingClassLoader.java index 7930bf27..a21f254d 100644 --- a/feature-server-pool/src/test/java/org/onap/policy/drools/serverpooltest/BlockingClassLoader.java +++ b/feature-server-pool/src/test/java/org/onap/policy/drools/serverpooltest/BlockingClassLoader.java @@ -162,7 +162,7 @@ public class BlockingClassLoader extends ClassLoader { // being blocked int index = name.lastIndexOf('.'); if (index >= 0) { - if (packages.contains(name.substring(0,index))) { + if (packages.contains(name.substring(0, index))) { throw(new ClassNotFoundException(name)); } diff --git a/feature-server-pool/src/test/java/org/onap/policy/drools/serverpooltest/SimDmaap.java b/feature-server-pool/src/test/java/org/onap/policy/drools/serverpooltest/SimDmaap.java index 8513c1f0..03004844 100644 --- a/feature-server-pool/src/test/java/org/onap/policy/drools/serverpooltest/SimDmaap.java +++ b/feature-server-pool/src/test/java/org/onap/policy/drools/serverpooltest/SimDmaap.java @@ -26,7 +26,6 @@ import java.util.concurrent.BlockingQueue; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.LinkedBlockingQueue; import java.util.concurrent.TimeUnit; - import javax.ws.rs.Consumes; import javax.ws.rs.GET; import javax.ws.rs.POST; @@ -35,7 +34,6 @@ import javax.ws.rs.PathParam; import javax.ws.rs.Produces; import javax.ws.rs.QueryParam; import javax.ws.rs.core.MediaType; - import org.eclipse.jetty.server.Server; import org.eclipse.jetty.server.ServerConnector; import org.eclipse.jetty.servlet.ServletContextHandler; @@ -111,7 +109,7 @@ public class SimDmaap { /* ============================================================ */ // maps topic name to 'Topic' instance - static Map<String,Topic> topicTable = new ConcurrentHashMap<>(); + static Map<String, Topic> topicTable = new ConcurrentHashMap<>(); /** * Each instance of this class corresponds to a DMAAP or UEB topic. @@ -121,7 +119,7 @@ public class SimDmaap { String topic; // maps group name into group instance - Map<String,Group> groupTable = new ConcurrentHashMap<>(); + Map<String, Group> groupTable = new ConcurrentHashMap<>(); /** * Create or get a Topic. @@ -179,7 +177,7 @@ public class SimDmaap { // no more messages break; } - String[] prefix = data.substring(cur,leftBrace).split("\\."); + String[] prefix = data.substring(cur, leftBrace).split("\\."); if (prefix.length == 3) { try { // determine length of message, and advance current position @@ -281,7 +279,7 @@ public class SimDmaap { builder.append("[\"").append(message); // add up to '<limit>-1' more messages - for (int i = 1 ; i < limit ; i += 1) { + for (int i = 1; i < limit; i += 1) { // fetch the next message -- don't wait if it isn't currently there message = messages.poll(); if (message == null) { diff --git a/feature-server-pool/src/test/java/org/onap/policy/drools/serverpooltest/Test1.java b/feature-server-pool/src/test/java/org/onap/policy/drools/serverpooltest/Test1.java index ad4ba8e8..436cf77f 100644 --- a/feature-server-pool/src/test/java/org/onap/policy/drools/serverpooltest/Test1.java +++ b/feature-server-pool/src/test/java/org/onap/policy/drools/serverpooltest/Test1.java @@ -40,12 +40,10 @@ import java.util.UUID; import java.util.concurrent.LinkedBlockingQueue; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicReference; - import org.awaitility.Durations; import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.Test; - import org.kie.api.runtime.KieSession; import org.onap.policy.drools.core.DroolsRunnable; import org.onap.policy.drools.serverpool.BucketWrapperImpl; @@ -68,7 +66,7 @@ public class Test1 { if (count > thr.length) { count = thr.length; } - for (int i = 0 ; i < count ; i += 1) { + for (int i = 0; i < count; i += 1) { StringBuilder sb = new StringBuilder(); sb.append(" ").append(thr[i]); if (stackTrace) { @@ -202,7 +200,7 @@ public class Test1 { if (adapter == firstAdapter) { // make sure an owner and primary backup have been chosen // for each bucket (secondary backups aren't implemented yet) - for (int i = 0 ; i < bucketStatic.getBucketCount() ; i += 1) { + for (int i = 0; i < bucketStatic.getBucketCount(); i += 1) { BucketWrapper bucket = bucketStatic.getBucket(i); assertNotNull(bucket.getOwner()); assertNotNull(bucket.getPrimaryBackup()); @@ -210,7 +208,7 @@ public class Test1 { } else { // make sure the bucket assignments are consistent with // the primary backup - for (int i = 0 ; i < bucketStatic.getBucketCount() ; i += 1) { + for (int i = 0; i < bucketStatic.getBucketCount(); i += 1) { BucketWrapper firstBucket = firstBucketStatic.getBucket(i); BucketWrapper bucket = bucketStatic.getBucket(i); assertEquals(firstBucket.getOwner().getUuid(), @@ -586,7 +584,7 @@ public class Test1 { KieSession kieSession = newClient.getKieSession(); for (Object obj : new ArrayList<Object>(kieSession.getObjects())) { if (obj instanceof KeywordWrapper) { - KeywordWrapper kw = (KeywordWrapper)obj; + KeywordWrapper kw = (KeywordWrapper) obj; if ("lmt.owner".equals(kw.id)) { owner = kw.getObject(LockOwner.class); @@ -705,6 +703,8 @@ public class Test1 { // need a 'LockOwner' variant final LockOwner owner = new LockOwner() { + private static final long serialVersionUID = 1L; + /** * {@inheritDoc} */ @@ -840,6 +840,9 @@ public class Test1 { */ public static class LockOwner extends LinkedBlockingQueue<Object[]> implements TargetLockWrapper.Owner, Serializable { + + private static final long serialVersionUID = 1L; + /** * Constructor -- initialize the 'LinkedBlockingQueue'. */ @@ -873,6 +876,8 @@ public class Test1 { * testing. */ public static class KeywordWrapper implements Serializable { + private static final long serialVersionUID = 1L; + // this is the keyword, which determines the associated bucket, // which then determines when this object is migrated public String key; diff --git a/feature-server-pool/src/test/java/org/onap/policy/drools/serverpooltest/TestDroolsObject.java b/feature-server-pool/src/test/java/org/onap/policy/drools/serverpooltest/TestDroolsObject.java index 43aa5de7..a937680f 100644 --- a/feature-server-pool/src/test/java/org/onap/policy/drools/serverpooltest/TestDroolsObject.java +++ b/feature-server-pool/src/test/java/org/onap/policy/drools/serverpooltest/TestDroolsObject.java @@ -21,8 +21,6 @@ package org.onap.policy.drools.serverpooltest; import java.io.Serializable; -import java.util.Objects; - import lombok.EqualsAndHashCode; import lombok.Getter; import lombok.Setter; @@ -37,6 +35,8 @@ import lombok.ToString; @ToString @EqualsAndHashCode public class TestDroolsObject implements Serializable { + private static final long serialVersionUID = 1L; + // determines the bucket number private String key; |