Fix cluster test warnings 55/12555/3
authorRobert Varga <rovarga@cisco.com>
Thu, 6 Nov 2014 10:11:36 +0000 (11:11 +0100)
committerRobert Varga <rovarga@cisco.com>
Thu, 6 Nov 2014 13:51:38 +0000 (14:51 +0100)
Remove use of raw types, suppress serialVersionUUID warnings and the use
of deprecated junit classes.

Change-Id: I14f8e28b4bd27944b7001cbc1018479ae7b24f12
Signed-off-by: Robert Varga <rovarga@cisco.com>
13 files changed:
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/ConfigurationImplTest.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/DataChangeListenerProxyTest.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/ShardTest.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/ShardTransactionFailureTest.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/ShardTransactionTest.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/shardstrategy/DefaultShardStrategyTest.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/shardstrategy/ModuleShardStrategyTest.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/shardstrategy/ShardStrategyFactoryTest.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/utils/MockConfiguration.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/utils/TestUtils.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/md/cluster/datastore/model/CarsModel.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/md/cluster/datastore/model/PeopleModel.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/md/cluster/datastore/model/SampleModelsTest.java

index 8c253596b8b752c264f81cced7090087fc02879b..afc060318ce783a8a8041e4b38c008181df3e16f 100644 (file)
@@ -1,17 +1,15 @@
 package org.opendaylight.controller.cluster.datastore;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
 import com.typesafe.config.ConfigFactory;
-import junit.framework.Assert;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
 import java.io.File;
 import java.util.List;
 import java.util.Set;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
+import org.junit.Assert;
+import org.junit.BeforeClass;
+import org.junit.Test;
 
 public class ConfigurationImplTest {
 
index c79d76203589c51126dbd281adfd7dcaf4712db4..55250dd5e9cd3ea71c0356f5313c09d930700c00 100644 (file)
@@ -3,6 +3,11 @@ package org.opendaylight.controller.cluster.datastore;
 
 import akka.actor.ActorRef;
 import akka.actor.Props;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
 import org.junit.Assert;
 import org.junit.Test;
 import org.opendaylight.controller.cluster.datastore.messages.DataChanged;
@@ -17,18 +22,12 @@ import org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeEvent;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
 
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
 public class DataChangeListenerProxyTest extends AbstractActorTest {
 
   private static class MockDataChangedEvent implements AsyncDataChangeEvent<YangInstanceIdentifier, NormalizedNode<?, ?>> {
-    Map<YangInstanceIdentifier,NormalizedNode<?,?>> createdData = new HashMap();
-    Map<YangInstanceIdentifier,NormalizedNode<?,?>> updatedData = new HashMap();
-    Map<YangInstanceIdentifier,NormalizedNode<?,?>> originalData = new HashMap();
+    Map<YangInstanceIdentifier,NormalizedNode<?,?>> createdData = new HashMap<>();
+    Map<YangInstanceIdentifier,NormalizedNode<?,?>> updatedData = new HashMap<>();
+    Map<YangInstanceIdentifier,NormalizedNode<?,?>> originalData = new HashMap<>();
 
 
 
@@ -88,7 +87,7 @@ public class DataChangeListenerProxyTest extends AbstractActorTest {
 
         Assert.assertTrue(messages instanceof List);
 
-        List<Object> listMessages = (List<Object>) messages;
+        List<?> listMessages = (List<?>) messages;
 
         Assert.assertEquals(1, listMessages.size());
 
index c6bb0d6b37061b8055d4065a990cc2acad21c935..e5b5643297b88d49ab74bffdf90637a61988a72e 100644 (file)
@@ -1,5 +1,16 @@
 package org.opendaylight.controller.cluster.datastore;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+import static org.mockito.Mockito.doAnswer;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.inOrder;
+import static org.mockito.Mockito.mock;
+import static org.opendaylight.controller.cluster.datastore.messages.CreateTransaction.CURRENT_VERSION;
 import akka.actor.ActorRef;
 import akka.actor.PoisonPill;
 import akka.actor.Props;
@@ -16,6 +27,16 @@ import com.google.common.util.concurrent.Futures;
 import com.google.common.util.concurrent.ListenableFuture;
 import com.google.common.util.concurrent.MoreExecutors;
 import com.google.common.util.concurrent.Uninterruptibles;
+import java.io.IOException;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicInteger;
+import java.util.concurrent.atomic.AtomicReference;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
@@ -80,29 +101,6 @@ import scala.concurrent.Await;
 import scala.concurrent.Future;
 import scala.concurrent.duration.FiniteDuration;
 
-import java.io.IOException;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.atomic.AtomicInteger;
-import java.util.concurrent.atomic.AtomicReference;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-import static org.mockito.Mockito.doAnswer;
-import static org.mockito.Mockito.doReturn;
-import static org.mockito.Mockito.inOrder;
-import static org.mockito.Mockito.mock;
-import static org.opendaylight.controller.cluster.datastore.messages.CreateTransaction.CURRENT_VERSION;
-
 
 public class ShardTest extends AbstractActorTest {
 
@@ -308,6 +306,7 @@ public class ShardTest extends AbstractActorTest {
         }};
     }
 
+    @SuppressWarnings("serial")
     @Test
     public void testPeerAddressResolved() throws Exception {
         new ShardTestKit(getSystem()) {{
@@ -509,7 +508,7 @@ public class ShardTest extends AbstractActorTest {
         shard.tell(PoisonPill.getInstance(), ActorRef.noSender());
     }
 
-    private CompositeModificationPayload newPayload(Modification... mods) {
+    private CompositeModificationPayload newPayload(final Modification... mods) {
         MutableCompositeModification compMod = new MutableCompositeModification();
         for(Modification mod: mods) {
             compMod.addModification(mod);
@@ -518,15 +517,15 @@ public class ShardTest extends AbstractActorTest {
         return new CompositeModificationPayload(compMod.toSerializable());
     }
 
-    private DOMStoreThreePhaseCommitCohort setupMockWriteTransaction(String cohortName,
-            InMemoryDOMDataStore dataStore, YangInstanceIdentifier path, NormalizedNode data,
-            MutableCompositeModification modification) {
+    private DOMStoreThreePhaseCommitCohort setupMockWriteTransaction(final String cohortName,
+            final InMemoryDOMDataStore dataStore, final YangInstanceIdentifier path, final NormalizedNode<?, ?> data,
+            final MutableCompositeModification modification) {
         return setupMockWriteTransaction(cohortName, dataStore, path, data, modification, null);
     }
 
-    private DOMStoreThreePhaseCommitCohort setupMockWriteTransaction(String cohortName,
-            InMemoryDOMDataStore dataStore, YangInstanceIdentifier path, NormalizedNode data,
-            MutableCompositeModification modification,
+    private DOMStoreThreePhaseCommitCohort setupMockWriteTransaction(final String cohortName,
+            final InMemoryDOMDataStore dataStore, final YangInstanceIdentifier path, final NormalizedNode<?, ?> data,
+            final MutableCompositeModification modification,
             final Function<DOMStoreThreePhaseCommitCohort,ListenableFuture<Void>> preCommit) {
 
         DOMStoreWriteTransaction tx = dataStore.newWriteOnlyTransaction();
@@ -536,14 +535,14 @@ public class ShardTest extends AbstractActorTest {
 
         doAnswer(new Answer<ListenableFuture<Boolean>>() {
             @Override
-            public ListenableFuture<Boolean> answer(InvocationOnMock invocation) {
+            public ListenableFuture<Boolean> answer(final InvocationOnMock invocation) {
                 return realCohort.canCommit();
             }
         }).when(cohort).canCommit();
 
         doAnswer(new Answer<ListenableFuture<Void>>() {
             @Override
-            public ListenableFuture<Void> answer(InvocationOnMock invocation) throws Throwable {
+            public ListenableFuture<Void> answer(final InvocationOnMock invocation) throws Throwable {
                 if(preCommit != null) {
                     return preCommit.apply(realCohort);
                 } else {
@@ -554,14 +553,14 @@ public class ShardTest extends AbstractActorTest {
 
         doAnswer(new Answer<ListenableFuture<Void>>() {
             @Override
-            public ListenableFuture<Void> answer(InvocationOnMock invocation) throws Throwable {
+            public ListenableFuture<Void> answer(final InvocationOnMock invocation) throws Throwable {
                 return realCohort.commit();
             }
         }).when(cohort).commit();
 
         doAnswer(new Answer<ListenableFuture<Void>>() {
             @Override
-            public ListenableFuture<Void> answer(InvocationOnMock invocation) throws Throwable {
+            public ListenableFuture<Void> answer(final InvocationOnMock invocation) throws Throwable {
                 return realCohort.abort();
             }
         }).when(cohort).abort();
@@ -658,12 +657,12 @@ public class ShardTest extends AbstractActorTest {
             class OnFutureComplete extends OnComplete<Object> {
                 private final Class<?> expRespType;
 
-                OnFutureComplete(Class<?> expRespType) {
+                OnFutureComplete(final Class<?> expRespType) {
                     this.expRespType = expRespType;
                 }
 
                 @Override
-                public void onComplete(Throwable error, Object resp) {
+                public void onComplete(final Throwable error, final Object resp) {
                     if(error != null) {
                         caughtEx.set(new AssertionError(getClass().getSimpleName() + " failure", error));
                     } else {
@@ -676,7 +675,7 @@ public class ShardTest extends AbstractActorTest {
                     }
                 }
 
-                void onSuccess(Object resp) throws Exception {
+                void onSuccess(final Object resp) throws Exception {
                 }
             }
 
@@ -686,7 +685,7 @@ public class ShardTest extends AbstractActorTest {
                 }
 
                 @Override
-                public void onComplete(Throwable error, Object resp) {
+                public void onComplete(final Throwable error, final Object resp) {
                     super.onComplete(error, resp);
                     commitLatch.countDown();
                 }
@@ -695,13 +694,13 @@ public class ShardTest extends AbstractActorTest {
             class OnCanCommitFutureComplete extends OnFutureComplete {
                 private final String transactionID;
 
-                OnCanCommitFutureComplete(String transactionID) {
+                OnCanCommitFutureComplete(final String transactionID) {
                     super(CanCommitTransactionReply.SERIALIZABLE_CLASS);
                     this.transactionID = transactionID;
                 }
 
                 @Override
-                void onSuccess(Object resp) throws Exception {
+                void onSuccess(final Object resp) throws Exception {
                     CanCommitTransactionReply canCommitReply =
                             CanCommitTransactionReply.fromSerializable(resp);
                     assertEquals("Can commit", true, canCommitReply.getCanCommit());
@@ -828,7 +827,7 @@ public class ShardTest extends AbstractActorTest {
             final CountDownLatch latch = new CountDownLatch(1);
             canCommitFuture.onComplete(new OnComplete<Object>() {
                 @Override
-                public void onComplete(Throwable t, Object resp) {
+                public void onComplete(final Throwable t, final Object resp) {
                     latch.countDown();
                 }
             }, getSystem().dispatcher());
@@ -948,7 +947,7 @@ public class ShardTest extends AbstractActorTest {
                             new AbortTransaction(transactionID).toSerializable(), timeout);
                     abortFuture.onComplete(new OnComplete<Object>() {
                         @Override
-                        public void onComplete(Throwable e, Object resp) {
+                        public void onComplete(final Throwable e, final Object resp) {
                             abortComplete.countDown();
                         }
                     }, getSystem().dispatcher());
@@ -1195,7 +1194,7 @@ public class ShardTest extends AbstractActorTest {
             final CountDownLatch latch = new CountDownLatch(1);
             canCommitFuture.onComplete(new OnComplete<Object>() {
                 @Override
-                public void onComplete(Throwable t, Object resp) {
+                public void onComplete(final Throwable t, final Object resp) {
                     latch.countDown();
                 }
             }, getSystem().dispatcher());
@@ -1220,7 +1219,8 @@ public class ShardTest extends AbstractActorTest {
         testCreateSnapshot(false, "testCreateSnapshotWithNonPersistentData");
     }
 
-    public void testCreateSnapshot(boolean persistent, final String shardActorName) throws IOException, InterruptedException {
+    @SuppressWarnings("serial")
+    public void testCreateSnapshot(final boolean persistent, final String shardActorName) throws IOException, InterruptedException {
         final DatastoreContext dataStoreContext = DatastoreContext.newBuilder().
                 shardJournalRecoveryLogBatchSize(3).shardSnapshotBatchCount(5000).persistent(persistent).build();
 
@@ -1232,7 +1232,7 @@ public class ShardTest extends AbstractActorTest {
                     return new Shard(shardID, Collections.<ShardIdentifier,String>emptyMap(),
                             dataStoreContext, SCHEMA_CONTEXT) {
                         @Override
-                        protected void commitSnapshot(long sequenceNumber) {
+                        protected void commitSnapshot(final long sequenceNumber) {
                             super.commitSnapshot(sequenceNumber);
                             latch.get().countDown();
                         }
@@ -1275,7 +1275,7 @@ public class ShardTest extends AbstractActorTest {
         commitTransaction(putTransaction);
 
 
-        NormalizedNode expected = readStore(store);
+        NormalizedNode<?, ?> expected = readStore(store);
 
         DOMStoreWriteTransaction writeTransaction = store.newWriteOnlyTransaction();
 
@@ -1284,7 +1284,7 @@ public class ShardTest extends AbstractActorTest {
 
         commitTransaction(writeTransaction);
 
-        NormalizedNode actual = readStore(store);
+        NormalizedNode<?, ?> actual = readStore(store);
 
         assertEquals(expected, actual);
 
@@ -1325,7 +1325,7 @@ public class ShardTest extends AbstractActorTest {
     }
 
 
-    private NormalizedNode readStore(InMemoryDOMDataStore store) throws ReadFailedException {
+    private NormalizedNode<?, ?> readStore(final InMemoryDOMDataStore store) throws ReadFailedException {
         DOMStoreReadTransaction transaction = store.newReadOnlyTransaction();
         CheckedFuture<Optional<NormalizedNode<?, ?>>, ReadFailedException> read =
             transaction.read(YangInstanceIdentifier.builder().build());
@@ -1339,7 +1339,7 @@ public class ShardTest extends AbstractActorTest {
         return normalizedNode;
     }
 
-    private void commitTransaction(DOMStoreWriteTransaction transaction) {
+    private void commitTransaction(final DOMStoreWriteTransaction transaction) {
         DOMStoreThreePhaseCommitCohort commitCohort = transaction.ready();
         ListenableFuture<Void> future =
             commitCohort.preCommit();
@@ -1355,13 +1355,13 @@ public class ShardTest extends AbstractActorTest {
         return new AsyncDataChangeListener<YangInstanceIdentifier, NormalizedNode<?, ?>>() {
             @Override
             public void onDataChanged(
-                AsyncDataChangeEvent<YangInstanceIdentifier, NormalizedNode<?, ?>> change) {
+                final AsyncDataChangeEvent<YangInstanceIdentifier, NormalizedNode<?, ?>> change) {
 
             }
         };
     }
 
-    static NormalizedNode<?,?> readStore(TestActorRef<Shard> shard, YangInstanceIdentifier id)
+    static NormalizedNode<?,?> readStore(final TestActorRef<Shard> shard, final YangInstanceIdentifier id)
             throws ExecutionException, InterruptedException {
         DOMStoreReadTransaction transaction = shard.underlyingActor().getDataStore().newReadOnlyTransaction();
 
@@ -1376,7 +1376,7 @@ public class ShardTest extends AbstractActorTest {
         return node;
     }
 
-    private void writeToStore(TestActorRef<Shard> shard, YangInstanceIdentifier id, NormalizedNode<?,?> node)
+    private void writeToStore(final TestActorRef<Shard> shard, final YangInstanceIdentifier id, final NormalizedNode<?,?> node)
         throws ExecutionException, InterruptedException {
         DOMStoreWriteTransaction transaction = shard.underlyingActor().getDataStore().newWriteOnlyTransaction();
 
@@ -1387,10 +1387,11 @@ public class ShardTest extends AbstractActorTest {
         commitCohort.commit().get();
     }
 
+    @SuppressWarnings("serial")
     private static final class DelegatingShardCreator implements Creator<Shard> {
         private final Creator<Shard> delegate;
 
-        DelegatingShardCreator(Creator<Shard> delegate) {
+        DelegatingShardCreator(final Creator<Shard> delegate) {
             this.delegate = delegate;
         }
 
index 45b00f5f31b72c3d628be7957a09804c7e6b26be..5781c19b252717c24c1795d83131ea6c158bcf32 100644 (file)
 
 package org.opendaylight.controller.cluster.datastore;
 
+import akka.actor.ActorRef;
+import akka.actor.Props;
+import akka.pattern.AskTimeoutException;
+import akka.testkit.TestActorRef;
+import com.google.common.util.concurrent.ListeningExecutorService;
+import com.google.common.util.concurrent.MoreExecutors;
 import java.util.Collections;
 import java.util.concurrent.TimeUnit;
 import org.junit.BeforeClass;
@@ -29,12 +35,6 @@ import org.opendaylight.yangtools.yang.model.api.SchemaContext;
 import scala.concurrent.Await;
 import scala.concurrent.Future;
 import scala.concurrent.duration.Duration;
-import akka.actor.ActorRef;
-import akka.actor.Props;
-import akka.pattern.AskTimeoutException;
-import akka.testkit.TestActorRef;
-import com.google.common.util.concurrent.ListeningExecutorService;
-import com.google.common.util.concurrent.MoreExecutors;
 
 /**
  * Covers negative test cases
@@ -66,7 +66,7 @@ public class ShardTransactionFailureTest extends AbstractActorTest {
     }
 
     private ActorRef createShard(){
-        return getSystem().actorOf(Shard.props(SHARD_IDENTIFIER, Collections.EMPTY_MAP, datastoreContext,
+        return getSystem().actorOf(Shard.props(SHARD_IDENTIFIER, Collections.<ShardIdentifier, String>emptyMap(), datastoreContext,
                 TestModel.createTestContext()));
     }
 
index c869be82d24bcbbd0cedca4b5a6e2a9001c46fad..4ccc9430ace37605e002fbcf8800279b85fa4fcd 100644 (file)
@@ -4,6 +4,13 @@ import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
+import akka.actor.ActorRef;
+import akka.actor.Props;
+import akka.actor.Terminated;
+import akka.testkit.JavaTestKit;
+import akka.testkit.TestActorRef;
+import com.google.common.util.concurrent.ListeningExecutorService;
+import com.google.common.util.concurrent.MoreExecutors;
 import java.util.Collections;
 import java.util.concurrent.TimeUnit;
 import org.junit.BeforeClass;
@@ -39,13 +46,6 @@ import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes;
 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
 import scala.concurrent.duration.Duration;
-import akka.actor.ActorRef;
-import akka.actor.Props;
-import akka.actor.Terminated;
-import akka.testkit.JavaTestKit;
-import akka.testkit.TestActorRef;
-import com.google.common.util.concurrent.ListeningExecutorService;
-import com.google.common.util.concurrent.MoreExecutors;
 
 public class ShardTransactionTest extends AbstractActorTest {
     private static ListeningExecutorService storeExecutor =
@@ -71,7 +71,7 @@ public class ShardTransactionTest extends AbstractActorTest {
 
     private ActorRef createShard(){
         return getSystem().actorOf(Shard.props(SHARD_IDENTIFIER,
-            Collections.EMPTY_MAP, datastoreContext, TestModel.createTestContext()));
+            Collections.<ShardIdentifier, String>emptyMap(), datastoreContext, TestModel.createTestContext()));
     }
 
     @Test
index 3394cdc959757e167cb71988cf3d8e208fde041d..b895b75fcde1ee7421b324492319c59d0bfc6d93 100644 (file)
@@ -1,5 +1,6 @@
 package org.opendaylight.controller.cluster.datastore.shardstrategy;
 
+import static org.junit.Assert.assertEquals;
 import org.junit.BeforeClass;
 import org.junit.Rule;
 import org.junit.Test;
@@ -10,8 +11,6 @@ import org.opendaylight.controller.md.cluster.datastore.model.CarsModel;
 import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 
-import static junit.framework.Assert.assertEquals;
-
 public class ModuleShardStrategyTest {
     @Rule
     public ExpectedException expectedEx = ExpectedException.none();
index ab74ba811a6348c4969a2408644b0e48502af076..10e832780d26ca7e8603e14ef82fbeac0e57b16e 100644 (file)
@@ -1,5 +1,7 @@
 package org.opendaylight.controller.cluster.datastore.shardstrategy;
 
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
 import org.junit.BeforeClass;
 import org.junit.Rule;
 import org.junit.Test;
@@ -9,9 +11,6 @@ import org.opendaylight.controller.md.cluster.datastore.model.CarsModel;
 import org.opendaylight.controller.md.cluster.datastore.model.TestModel;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 
-import static junit.framework.Assert.assertNotNull;
-import static junit.framework.Assert.assertTrue;
-
 public class ShardStrategyFactoryTest {
 
     @Rule
index 06c5767bd030c1b5872969025902566a7cc3e27c..4ef7d65857b3c86a76d405eeca52c888f6f9fc55 100644 (file)
@@ -9,43 +9,42 @@
 package org.opendaylight.controller.cluster.datastore.utils;
 
 import com.google.common.base.Optional;
-import org.opendaylight.controller.cluster.datastore.Configuration;
-import org.opendaylight.controller.cluster.datastore.shardstrategy.ShardStrategy;
-
 import java.util.Arrays;
 import java.util.Collections;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
+import org.opendaylight.controller.cluster.datastore.Configuration;
+import org.opendaylight.controller.cluster.datastore.shardstrategy.ShardStrategy;
 
 public class MockConfiguration implements Configuration{
-    @Override public List<String> getMemberShardNames(String memberName) {
+    @Override public List<String> getMemberShardNames(final String memberName) {
         return Arrays.asList("default");
     }
 
     @Override public Optional<String> getModuleNameFromNameSpace(
-        String nameSpace) {
+        final String nameSpace) {
         return Optional.absent();
     }
 
     @Override
     public Map<String, ShardStrategy> getModuleNameToShardStrategyMap() {
-        return Collections.EMPTY_MAP;
+        return Collections.emptyMap();
     }
 
     @Override public List<String> getShardNamesFromModuleName(
-        String moduleName) {
-        return Collections.EMPTY_LIST;
+        final String moduleName) {
+        return Collections.emptyList();
     }
 
-    @Override public List<String> getMembersFromShardName(String shardName) {
+    @Override public List<String> getMembersFromShardName(final String shardName) {
         if("default".equals(shardName)) {
             return Arrays.asList("member-1", "member-2");
         } else if("astronauts".equals(shardName)){
             return Arrays.asList("member-2", "member-3");
         }
 
-        return Collections.EMPTY_LIST;
+        return Collections.emptyList();
     }
 
     @Override public Set<String> getAllShardNames() {
index 3bad4689506525bf683254534d44036ff8a61d7e..a2c44b063091fd45829624cde07230e325222336 100644 (file)
@@ -11,13 +11,12 @@ package org.opendaylight.controller.cluster.datastore.utils;
 import akka.actor.ActorRef;
 import akka.actor.ActorSystem;
 import akka.actor.Props;
-import junit.framework.Assert;
-
 import java.util.List;
+import org.junit.Assert;
 
 public class TestUtils {
 
-    public static void assertFirstSentMessage(ActorSystem actorSystem, ActorRef actorRef, Class clazz){
+    public static void assertFirstSentMessage(final ActorSystem actorSystem, final ActorRef actorRef, final Class<?> clazz){
         ActorContext testContext = new ActorContext(actorSystem, actorSystem.actorOf(
             Props.create(DoNothingActor.class)), new MockClusterWrapper(), new MockConfiguration());
         Object messages = testContext
@@ -27,7 +26,7 @@ public class TestUtils {
 
         Assert.assertTrue(messages instanceof List);
 
-        List<Object> listMessages = (List<Object>) messages;
+        List<?> listMessages = (List<?>) messages;
 
         Assert.assertEquals(1, listMessages.size());
 
index 6860872b75fddaf0c952af3943a8713f977531f5..93b552a6dabad014d698146981d83ce27a644117 100644 (file)
@@ -31,7 +31,7 @@ public class CarsModel {
     public static final QName CAR_PRICE_QNAME = QName.create(CAR_QNAME, "price");
 
 
-    public static NormalizedNode create(){
+    public static NormalizedNode<?, ?> create(){
 
         // Create a list builder
         CollectionNodeBuilder<MapEntryNode, MapNode> cars =
@@ -63,7 +63,7 @@ public class CarsModel {
 
     }
 
-    public static NormalizedNode emptyContainer(){
+    public static NormalizedNode<?, ?> emptyContainer(){
         return ImmutableContainerNodeBuilder.create()
             .withNodeIdentifier(new YangInstanceIdentifier.NodeIdentifier(BASE_QNAME))
             .build();
index e637920e7855c9859ee9cab249f31b20766e9ef2..a7cb14f0b3ac1964c16008f67e8c443e182b0bc4 100644 (file)
@@ -30,7 +30,7 @@ public class PeopleModel {
 
 
 
-    public static NormalizedNode create(){
+    public static NormalizedNode<?, ?> create(){
 
         // Create a list builder
         CollectionNodeBuilder<MapEntryNode, MapNode> cars =
@@ -62,7 +62,7 @@ public class PeopleModel {
 
     }
 
-    public static NormalizedNode emptyContainer(){
+    public static NormalizedNode<?, ?> emptyContainer(){
         return ImmutableContainerNodeBuilder.create()
             .withNodeIdentifier(
                 new YangInstanceIdentifier.NodeIdentifier(BASE_QNAME))
index 2300f9d130bcea6049326b3e42b2ac3084df6051..b814bc392e365f8d9f0503eae6c3f81128d35f22 100644 (file)
@@ -8,7 +8,7 @@
 
 package org.opendaylight.controller.md.cluster.datastore.model;
 
-import junit.framework.Assert;
+import org.junit.Assert;
 import org.junit.Test;
 import org.opendaylight.controller.cluster.datastore.node.NormalizedNodeToNodeCodec;
 import org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages;