Make private methods static 26/28726/5
authorRobert Varga <rovarga@cisco.com>
Fri, 23 Oct 2015 10:34:58 +0000 (12:34 +0200)
committerRobert Varga <rovarga@cisco.com>
Mon, 26 Oct 2015 17:23:36 +0000 (18:23 +0100)
These methods do not reference object state and therefore can be made
static.

Change-Id: I416e415b90647b4f700b7893fe4f64f479271fab
Signed-off-by: Robert Varga <rovarga@cisco.com>
36 files changed:
opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/FollowerLogInformationImplTest.java
opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/RaftActorServerConfigurationSupportTest.java
opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/ReplicatedLogImplEntryTest.java
opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/SnapshotTest.java
opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/behaviors/FollowerTest.java
opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/behaviors/SnapshotTrackerTest.java
opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/messages/AppendEntriesTest.java
opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/common/actor/MeteredBoundedMailbox.java
opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/NormalizedNodePrinter.java
opendaylight/md-sal/sal-clustering-commons/src/test/java/org/opendaylight/controller/cluster/datastore/node/NormalizedNodeToNodeCodecTest.java
opendaylight/md-sal/sal-clustering-commons/src/test/java/org/opendaylight/controller/cluster/datastore/node/utils/PathUtilsTest.java
opendaylight/md-sal/sal-clustering-commons/src/test/java/org/opendaylight/controller/cluster/datastore/node/utils/stream/NormalizedNodeStreamReaderWriterTest.java
opendaylight/md-sal/sal-clustering-commons/src/test/java/org/opendaylight/controller/cluster/datastore/node/utils/transformer/NormalizedNodePrunerTest.java
opendaylight/md-sal/sal-clustering-commons/src/test/java/org/opendaylight/controller/cluster/datastore/util/InstanceIdentifierUtilsTest.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/AbstractTransactionContextFactory.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/DatastoreContextIntrospector.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ShardManager.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/config/FileModuleShardConfigProvider.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/entityownership/CandidateListChangeListener.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/entityownership/EntityOwnerChangeListener.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/utils/TransactionRateLimiter.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/ConcurrentDOMDataBrokerTest.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/DataChangeListenerRegistrationTest.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/DatastoreContextTest.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/DistributedDataStoreRemotingIntegrationTest.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/IntegrationTestKit.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/ShardDataTreeTest.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/ThreePhaseCommitCohortProxyTest.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/TransactionProxyTest.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/compat/PreLithiumShardTest.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/compat/PreLithiumTransactionProxyTest.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/entityownership/DistributedEntityOwnershipIntegrationTest.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/entityownership/DistributedEntityOwnershipServiceTest.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/entityownership/EntityOwnershipShardTest.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/utils/ActorContextTest.java

index e2204a9..75496f9 100644 (file)
@@ -55,7 +55,7 @@ public class FollowerLogInformationImplTest {
     // we cannot rely comfortably that the sleep will indeed sleep for the desired time
     // hence getting the actual elapsed time and do a match.
     // if the sleep has spilled over, then return the test gracefully
-    private long sleepWithElaspsedTimeReturned(long millis) {
+    private static long sleepWithElaspsedTimeReturned(long millis) {
         Stopwatch stopwatch = Stopwatch.createStarted();
         Uninterruptibles.sleepUninterruptibly(millis, TimeUnit.MILLISECONDS);
         stopwatch.stop();
index 1b717f1..bc73a41 100644 (file)
@@ -96,7 +96,7 @@ public class RaftActorServerConfigurationSupportTest extends AbstractActorTest {
         }
     }
 
-    private DefaultConfigParamsImpl newFollowerConfigParams() {
+    private static DefaultConfigParamsImpl newFollowerConfigParams() {
         DefaultConfigParamsImpl configParams = new DefaultConfigParamsImpl();
         configParams.setHeartBeatInterval(new FiniteDuration(100, TimeUnit.MILLISECONDS));
         configParams.setElectionTimeoutFactor(100000);
@@ -401,14 +401,14 @@ public class RaftActorServerConfigurationSupportTest extends AbstractActorTest {
         expectFirstMatching(leaderActor, AddServer.class);
     }
 
-    private void verifyServerConfigurationPayloadEntry(ReplicatedLog log, String... cNew) {
+    private static void verifyServerConfigurationPayloadEntry(ReplicatedLog log, String... cNew) {
         ReplicatedLogEntry logEntry = log.get(log.lastIndex());
         assertEquals("Last log entry payload class", ServerConfigurationPayload.class, logEntry.getData().getClass());
         ServerConfigurationPayload payload = (ServerConfigurationPayload)logEntry.getData();
         assertEquals("getNewServerConfig", Sets.newHashSet(cNew), Sets.newHashSet(payload.getNewServerConfig()));
     }
 
-    private RaftActorContext newFollowerContext(String id, TestActorRef<? extends UntypedActor> actor) {
+    private static RaftActorContext newFollowerContext(String id, TestActorRef<? extends UntypedActor> actor) {
         DefaultConfigParamsImpl configParams = new DefaultConfigParamsImpl();
         configParams.setHeartBeatInterval(new FiniteDuration(100, TimeUnit.MILLISECONDS));
         configParams.setElectionTimeoutFactor(100000);
index 1fe22bc..9ede214 100644 (file)
@@ -46,7 +46,7 @@ public class ReplicatedLogImplEntryTest {
      * Use this method to generate a file with a serialized ReplicatedLogImplEntry instance to be
      * used in tests that verify backwards compatible de-serialization.
      */
-    private void generateSerializedFile() throws IOException {
+    private static void generateSerializedFile() throws IOException {
         String expPayloadData = "This is a test";
         int expIndex = 1;
         int expTerm = 2;
index 9302b6d..a0b9cd5 100644 (file)
@@ -46,7 +46,7 @@ public class SnapshotTest {
         }
     }
 
-    private Snapshot newLithiumSnapshot() {
+    private static Snapshot newLithiumSnapshot() {
         byte[] state = {1, 2, 3, 4, 5};
         List<ReplicatedLogEntry> entries = new ArrayList<>();
         entries.add(new ReplicatedLogImplEntry(6, 2, new MockPayload("payload")));
@@ -62,7 +62,7 @@ public class SnapshotTest {
      * Use this method to generate a file with a serialized Snapshot instance to be
      * used in tests that verify backwards compatible de-serialization.
      */
-    private void generateSerializedFile(Snapshot snapshot, String fileName) throws IOException {
+    private static void generateSerializedFile(Snapshot snapshot, String fileName) throws IOException {
         FileOutputStream fos = new FileOutputStream("src/test/resources/" + fileName);
         ObjectOutputStream oos = new ObjectOutputStream(fos);
         oos.writeObject(snapshot);
index 51818d1..1b15ecb 100644 (file)
@@ -87,7 +87,7 @@ public class FollowerTest extends AbstractRaftActorBehaviorTest {
         return context;
     }
 
-    private int getElectionTimeoutCount(RaftActorBehavior follower){
+    private static int getElectionTimeoutCount(RaftActorBehavior follower){
         if(follower instanceof TestFollower){
             return ((TestFollower) follower).getElectionTimeoutCount();
         }
@@ -1019,7 +1019,7 @@ public class FollowerTest extends AbstractRaftActorBehaviorTest {
     }
 
 
-    private ReplicatedLogEntry newReplicatedLogEntry(long term, long index, String data) {
+    private static ReplicatedLogEntry newReplicatedLogEntry(long term, long index, String data) {
         return new MockRaftActorContext.MockReplicatedLogEntry(term, index,
                 new MockRaftActorContext.MockPayload(data));
     }
index 4492dc2..8034826 100644 (file)
@@ -162,7 +162,7 @@ public class SnapshotTrackerTest {
         return bs.substring(start, start + size);
     }
 
-    private ByteString toByteString(Map<String, String> state) {
+    private static ByteString toByteString(Map<String, String> state) {
         ByteArrayOutputStream b = null;
         ObjectOutputStream o = null;
         try {
index 286cd3c..aceed9e 100644 (file)
@@ -67,7 +67,7 @@ public class AppendEntriesTest {
         verifyAppendEntries(entries, entries2);
     }
 
-    private void verifyAppendEntries(AppendEntries expected, AppendEntries actual) {
+    private static void verifyAppendEntries(AppendEntries expected, AppendEntries actual) {
         assertEquals("getLeaderId", expected.getLeaderId(), actual.getLeaderId());
         assertEquals("getTerm", expected.getTerm(), actual.getTerm());
         assertEquals("getLeaderCommit", expected.getLeaderCommit(), actual.getLeaderCommit());
@@ -83,7 +83,7 @@ public class AppendEntriesTest {
         }
     }
 
-    private void verifyReplicatedLogEntry(ReplicatedLogEntry expected, ReplicatedLogEntry actual) {
+    private static void verifyReplicatedLogEntry(ReplicatedLogEntry expected, ReplicatedLogEntry actual) {
         assertEquals("getIndex", expected.getIndex(), actual.getIndex());
         assertEquals("getTerm", expected.getTerm(), actual.getTerm());
         assertEquals("getData", expected.getData().toString(), actual.getData().toString());
index 2a6aac4..7f3e135 100644 (file)
@@ -75,7 +75,7 @@ public class MeteredBoundedMailbox implements MailboxType, ProducesMessageQueue<
         }
     }
 
-    private Gauge<Integer> getQueueSizeGuage(final MeteredMessageQueue monitoredQueue ){
+    private static Gauge<Integer> getQueueSizeGuage(final MeteredMessageQueue monitoredQueue ){
         return new Gauge<Integer>() {
             @Override
             public Integer getValue() {
index 9367118..23f314e 100644 (file)
@@ -14,7 +14,7 @@ import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
 
 public class NormalizedNodePrinter implements NormalizedNodeVisitor {
 
-    private String spaces(int n){
+    private static String spaces(int n){
         StringBuilder builder = new StringBuilder();
         for(int i=0;i<n;i++){
             builder.append(' ');
index 8ee9451..0260ffb 100644 (file)
@@ -29,9 +29,6 @@ import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
 
 public class NormalizedNodeToNodeCodecTest {
-
-
-
   private SchemaContext schemaContext;
 
   @Before
@@ -40,7 +37,7 @@ public class NormalizedNodeToNodeCodecTest {
     assertNotNull("Schema context must not be null.", schemaContext);
   }
 
-  private YangInstanceIdentifier instanceIdentifierFromString(String s) {
+  private static YangInstanceIdentifier instanceIdentifierFromString(String s) {
       return PathUtils.toYangInstanceIdentifier(s);
   }
 
index b7a3c5e..9010f6e 100644 (file)
@@ -93,21 +93,21 @@ public class PathUtilsTest {
 
     }
 
-    private YangInstanceIdentifier.NodeIdentifier nodeIdentifier(){
+    private static YangInstanceIdentifier.NodeIdentifier nodeIdentifier(){
         return new YangInstanceIdentifier.NodeIdentifier(TestModel.TEST_QNAME);
     }
 
-    private YangInstanceIdentifier.AugmentationIdentifier augmentationIdentifier(){
+    private static YangInstanceIdentifier.AugmentationIdentifier augmentationIdentifier(){
         Set<QName> childNames = ImmutableSet.of(QNameFactory.create("(urn:opendaylight:flow:table:statistics?revision=2013-12-15)flow-table-statistics"));
 
         return new YangInstanceIdentifier.AugmentationIdentifier(childNames);
     }
 
-    private YangInstanceIdentifier.NodeWithValue nodeWithValue(){
+    private static YangInstanceIdentifier.NodeWithValue nodeWithValue(){
         return new YangInstanceIdentifier.NodeWithValue(TestModel.TEST_QNAME, Integer.valueOf(100));
     }
 
-    private YangInstanceIdentifier.NodeIdentifierWithPredicates nodeIdentifierWithPredicates(){
+    private static YangInstanceIdentifier.NodeIdentifierWithPredicates nodeIdentifierWithPredicates(){
         Map<QName, Object> keys = new HashMap<>();
 
         keys.put(TestModel.ID_QNAME, Integer.valueOf(100));
index 3c7ade0..f468264 100644 (file)
@@ -64,7 +64,7 @@ public class NormalizedNodeStreamReaderWriterTest {
         writer.close();
     }
 
-    private NormalizedNode<?, ?> createTestContainer() {
+    private static NormalizedNode<?, ?> createTestContainer() {
         byte[] bytes1 = {1,2,3};
         LeafSetEntryNode<Object> entry1 = ImmutableLeafSetEntryNodeBuilder.create().withNodeIdentifier(
                 new YangInstanceIdentifier.NodeWithValue(TestModel.BINARY_LEAF_LIST_QNAME, bytes1)).
index cb82adc..26c7348 100644 (file)
@@ -148,7 +148,7 @@ public class NormalizedNodePrunerTest {
     }
 
 
-    private int countNodes(NormalizedNode<?,?> normalizedNode, final String namespaceFilter){
+    private static int countNodes(NormalizedNode<?,?> normalizedNode, final String namespaceFilter){
         if(normalizedNode == null){
             return 0;
         }
@@ -380,7 +380,7 @@ public class NormalizedNodePrunerTest {
         verify(normalizedNodeContainerBuilder).addChild(any(NormalizedNode.class));
     }
 
-    private NormalizedNode<?, ?> createTestContainer() {
+    private static NormalizedNode<?, ?> createTestContainer() {
         byte[] bytes1 = {1,2,3};
         LeafSetEntryNode<Object> entry1 = ImmutableLeafSetEntryNodeBuilder.create().withNodeIdentifier(
                 new YangInstanceIdentifier.NodeWithValue(TestModel.BINARY_LEAF_LIST_QNAME, bytes1)).
index af96b32..8557dda 100644 (file)
@@ -60,7 +60,7 @@ public class InstanceIdentifierUtilsTest {
 
     }
 
-    private void withValue(Object value) {
+    private static void withValue(Object value) {
         YangInstanceIdentifier.PathArgument p1 = new YangInstanceIdentifier.NodeIdentifier(TEST_QNAME);
 
         YangInstanceIdentifier.PathArgument p2 =
@@ -91,7 +91,7 @@ public class InstanceIdentifierUtilsTest {
 
     }
 
-    private void withPredicates(Object value) {
+    private static void withPredicates(Object value) {
         YangInstanceIdentifier.PathArgument p1 = new YangInstanceIdentifier.NodeIdentifier(TEST_QNAME);
 
         YangInstanceIdentifier.PathArgument p2 = new YangInstanceIdentifier.NodeIdentifierWithPredicates(
index 5f9cc4a..df32f8f 100644 (file)
@@ -80,7 +80,7 @@ abstract class AbstractTransactionContextFactory<F extends LocalTransactionFacto
         }
     }
 
-    private void onFindPrimaryShardFailure(Throwable failure, TransactionProxy parent,
+    private static void onFindPrimaryShardFailure(Throwable failure, TransactionProxy parent,
             String shardName, TransactionContextWrapper transactionContextWrapper) {
         LOG.debug("Tx {}: Find primary for shard {} failed", parent.getIdentifier(), shardName, failure);
 
index 0bbeefd..6a4d0a6 100644 (file)
@@ -257,7 +257,7 @@ public class DatastoreContextIntrospector {
         return updated;
     }
 
-    private String convertToCamelCase(String inString) {
+    private static String convertToCamelCase(String inString) {
         String str = inString.trim();
         if(StringUtils.contains(str, '-') || StringUtils.contains(str, ' ')) {
             str = inString.replace('-', ' ');
index eb39a34..2d79315 100644 (file)
@@ -465,11 +465,11 @@ public class ShardManager extends AbstractUntypedPersistentActorWithMetering {
         getSender().tell(messageSupplier.get(), getSelf());
     }
 
-    private NoShardLeaderException createNoShardLeaderException(ShardIdentifier shardId) {
+    private static NoShardLeaderException createNoShardLeaderException(ShardIdentifier shardId) {
         return new NoShardLeaderException(null, shardId.toString());
     }
 
-    private NotInitializedException createNotInitializedException(ShardIdentifier shardId) {
+    private static NotInitializedException createNotInitializedException(ShardIdentifier shardId) {
         return new NotInitializedException(String.format(
                 "Found primary shard %s but it's not initialized yet. Please try again later", shardId));
     }
index 9ceac95..2651744 100644 (file)
@@ -64,7 +64,7 @@ public class FileModuleShardConfigProvider implements ModuleShardConfigProvider
         return moduleConfigMap;
     }
 
-    private void readModulesConfig(final Config modulesConfig, Map<String, ModuleConfig> moduleConfigMap,
+    private static void readModulesConfig(final Config modulesConfig, Map<String, ModuleConfig> moduleConfigMap,
             Configuration configuration) {
         List<? extends ConfigObject> modulesConfigObjectList = modulesConfig.getObjectList("modules");
 
index 1ee6b6c..833ca30 100644 (file)
@@ -112,7 +112,7 @@ class CandidateListChangeListener implements DOMDataTreeChangeListener {
         return Collections.emptyList();
     }
 
-    private YangInstanceIdentifier extractEntityPath(YangInstanceIdentifier candidatePath) {
+    private static YangInstanceIdentifier extractEntityPath(YangInstanceIdentifier candidatePath) {
         List<PathArgument> newPathArgs = new ArrayList<>();
         for(PathArgument pathArg: candidatePath.getPathArguments()) {
             newPathArgs.add(pathArg);
index cc0b8a3..bea0caa 100644 (file)
@@ -79,7 +79,7 @@ class EntityOwnerChangeListener implements DOMDataTreeChangeListener {
         }
     }
 
-    private String extractOwner(LeafNode<?> ownerLeaf) {
+    private static String extractOwner(LeafNode<?> ownerLeaf) {
         Object value = ownerLeaf.getValue();
         return value != null ? value.toString() : null;
     }
index d7cbce7..b83b51c 100644 (file)
@@ -83,7 +83,7 @@ public class TransactionRateLimiter {
         return -1.0D;
     }
 
-    private double calculateNewRateLimit(Timer commitTimer, long commitTimeoutInSeconds) {
+    private static double calculateNewRateLimit(Timer commitTimer, long commitTimeoutInSeconds) {
         if(commitTimer == null) {
             // This can happen in unit tests.
             return 0;
index 44cd790..b1587bb 100644 (file)
@@ -188,7 +188,7 @@ public class ConcurrentDOMDataBrokerTest {
         assertFailure(future, null, mockCohort1, mockCohort2, mockCohort3);
     }
 
-    private void assertFailure(final CheckedFuture<Void, TransactionCommitFailedException> future,
+    private static void assertFailure(final CheckedFuture<Void, TransactionCommitFailedException> future,
             final Exception expCause, final DOMStoreThreePhaseCommitCohort... mockCohorts)
                     throws Exception {
         try {
index ff80136..1048ee1 100644 (file)
@@ -68,7 +68,7 @@ public class DataChangeListenerRegistrationTest extends AbstractActorTest {
     }};
   }
 
-  private  AsyncDataChangeListener<YangInstanceIdentifier, NormalizedNode<?, ?>> noOpDataChangeListener(){
+  private static AsyncDataChangeListener<YangInstanceIdentifier, NormalizedNode<?, ?>> noOpDataChangeListener(){
     return new AsyncDataChangeListener<YangInstanceIdentifier, NormalizedNode<?, ?>>() {
       @Override
       public void onDataChanged(final AsyncDataChangeEvent<YangInstanceIdentifier, NormalizedNode<?, ?>> change) {
index eee46ae..6d4c5cc 100644 (file)
@@ -113,7 +113,7 @@ public class DatastoreContextTest {
         Assert.assertNotSame(context, newContext);
     }
 
-    private void verifyCustomSettings(DatastoreContext context) {
+    private static void verifyCustomSettings(DatastoreContext context) {
         assertEquals(DEFAULT_SHARD_TRANSACTION_IDLE_TIMEOUT.toMillis() + 1,
                 context.getShardTransactionIdleTimeout().toMillis());
         assertEquals(TimeUnit.MILLISECONDS.toSeconds(DEFAULT_OPERATION_TIMEOUT_IN_MS) + 1,
index c29cc4e..c48105e 100644 (file)
@@ -133,7 +133,7 @@ public class DistributedDataStoreRemotingIntegrationTest {
         leaderTestKit.waitUntilLeader(leaderDistributedDataStore.getActorContext(), SHARD_NAMES);
     }
 
-    private void verifyCars(DOMStoreReadTransaction readTx, MapEntryNode... entries) throws Exception {
+    private static void verifyCars(DOMStoreReadTransaction readTx, MapEntryNode... entries) throws Exception {
         Optional<NormalizedNode<?, ?>> optional = readTx.read(CarsModel.CAR_LIST_PATH).get(5, TimeUnit.SECONDS);
         assertEquals("isPresent", true, optional.isPresent());
 
@@ -145,14 +145,14 @@ public class DistributedDataStoreRemotingIntegrationTest {
         assertEquals("Car list node", listBuilder.build(), optional.get());
     }
 
-    private void verifyNode(DOMStoreReadTransaction readTx, YangInstanceIdentifier path, NormalizedNode<?, ?> expNode)
+    private static void verifyNode(DOMStoreReadTransaction readTx, YangInstanceIdentifier path, NormalizedNode<?, ?> expNode)
             throws Exception {
         Optional<NormalizedNode<?, ?>> optional = readTx.read(path).get(5, TimeUnit.SECONDS);
         assertEquals("isPresent", true, optional.isPresent());
         assertEquals("Data node", expNode, optional.get());
     }
 
-    private void verifyExists(DOMStoreReadTransaction readTx, YangInstanceIdentifier path) throws Exception {
+    private static void verifyExists(DOMStoreReadTransaction readTx, YangInstanceIdentifier path) throws Exception {
         Boolean exists = readTx.exists(path).get(5, TimeUnit.SECONDS);
         assertEquals("exists", true, exists);
     }
index 0eedc78..1a7bbb2 100644 (file)
@@ -95,7 +95,7 @@ public class IntegrationTestKit extends ShardTestKit {
         }
     }
 
-    private ActorRef findLocalShard(ActorContext actorContext, String shardName) {
+    private static ActorRef findLocalShard(ActorContext actorContext, String shardName) {
         ActorRef shard = null;
         for(int i = 0; i < 20 * 5 && shard == null; i++) {
             Uninterruptibles.sleepUninterruptibly(50, TimeUnit.MILLISECONDS);
index 26787f6..4064dd0 100644 (file)
@@ -121,7 +121,7 @@ public class ShardDataTreeTest {
         assertEquals(expected, actual);
     }
 
-    private NormalizedNode<?, ?> getCars(ShardDataTree shardDataTree) {
+    private static NormalizedNode<?, ?> getCars(ShardDataTree shardDataTree) {
         ReadOnlyShardDataTreeTransaction readOnlyShardDataTreeTransaction = shardDataTree.newReadOnlyTransaction("txn-2", null);
         DataTreeSnapshot snapshot1 = readOnlyShardDataTreeTransaction.getSnapshot();
 
@@ -134,7 +134,7 @@ public class ShardDataTreeTest {
         return optional.get();
     }
 
-    private DataTreeCandidateTip addCar(ShardDataTree shardDataTree) throws ExecutionException, InterruptedException {
+    private static DataTreeCandidateTip addCar(ShardDataTree shardDataTree) throws ExecutionException, InterruptedException {
         return doTransaction(shardDataTree, new DataTreeOperation() {
             @Override
             public void execute(DataTreeModification snapshot) {
@@ -145,7 +145,7 @@ public class ShardDataTreeTest {
         });
     }
 
-    private DataTreeCandidateTip removeCar(ShardDataTree shardDataTree) throws ExecutionException, InterruptedException {
+    private static DataTreeCandidateTip removeCar(ShardDataTree shardDataTree) throws ExecutionException, InterruptedException {
         return doTransaction(shardDataTree, new DataTreeOperation() {
             @Override
             public void execute(DataTreeModification snapshot) {
@@ -158,7 +158,7 @@ public class ShardDataTreeTest {
         public abstract void execute(DataTreeModification snapshot);
     }
 
-    private DataTreeCandidateTip doTransaction(ShardDataTree shardDataTree, DataTreeOperation operation)
+    private static DataTreeCandidateTip doTransaction(ShardDataTree shardDataTree, DataTreeOperation operation)
             throws ExecutionException, InterruptedException {
         ReadWriteShardDataTreeTransaction transaction = shardDataTree.newReadWriteTransaction("txn-1", null);
         DataTreeModification snapshot = transaction.getSnapshot();
@@ -173,7 +173,7 @@ public class ShardDataTreeTest {
         return candidate;
     }
 
-    private DataTreeCandidateTip applyCandidates(ShardDataTree shardDataTree, List<DataTreeCandidateTip> candidates)
+    private static DataTreeCandidateTip applyCandidates(ShardDataTree shardDataTree, List<DataTreeCandidateTip> candidates)
             throws ExecutionException, InterruptedException {
         ReadWriteShardDataTreeTransaction transaction = shardDataTree.newReadWriteTransaction("txn-1", null);
         DataTreeModification snapshot = transaction.getSnapshot();
index 0b205ac..8fa72b0 100644 (file)
@@ -207,7 +207,7 @@ public class ShardTransactionFailureTest extends AbstractActorTest {
         Await.result(future, Duration.create(3, TimeUnit.SECONDS));
     }
 
-    private NormalizedNodeMessages.Node buildNormalizedNode() {
+    private static NormalizedNodeMessages.Node buildNormalizedNode() {
         return NormalizedNodeSerializer
             .serialize(Builders.containerBuilder().withNodeIdentifier(new YangInstanceIdentifier.NodeIdentifier(TestModel.TEST_QNAME)).build());
     }
index 7c10148..8b56652 100644 (file)
@@ -133,7 +133,7 @@ public class ThreePhaseCommitCohortProxyTest extends AbstractActorTest {
                 any(ActorSelection.class), isA(requestType), any(Timeout.class));
     }
 
-    private void propagateExecutionExceptionCause(ListenableFuture<?> future) throws Throwable {
+    private static void propagateExecutionExceptionCause(ListenableFuture<?> future) throws Throwable {
 
         try {
             future.get(5, TimeUnit.SECONDS);
index ea88dfa..fdb3683 100644 (file)
@@ -939,7 +939,7 @@ public class TransactionProxyTest extends AbstractTransactionProxyTest {
                 expected, (end-start)), (end - start) <= expected);
     }
 
-    private Optional<DataTree> createDataTree(){
+    private static Optional<DataTree> createDataTree(){
         DataTree dataTree = mock(DataTree.class);
         Optional<DataTree> dataTreeOptional = Optional.of(dataTree);
         DataTreeSnapshot dataTreeSnapshot = mock(DataTreeSnapshot.class);
@@ -951,7 +951,7 @@ public class TransactionProxyTest extends AbstractTransactionProxyTest {
         return dataTreeOptional;
     }
 
-    private Optional<DataTree> createDataTree(NormalizedNode readResponse){
+    private static Optional<DataTree> createDataTree(NormalizedNode readResponse){
         DataTree dataTree = mock(DataTree.class);
         Optional<DataTree> dataTreeOptional = Optional.of(dataTree);
         DataTreeSnapshot dataTreeSnapshot = mock(DataTreeSnapshot.class);
index f5de8a1..b86c7d1 100644 (file)
@@ -75,7 +75,7 @@ import scala.concurrent.duration.FiniteDuration;
  */
 public class PreLithiumShardTest extends AbstractShardTest {
 
-    private CompositeModificationPayload newLegacyPayload(final Modification... mods) {
+    private static CompositeModificationPayload newLegacyPayload(final Modification... mods) {
         MutableCompositeModification compMod = new MutableCompositeModification();
         for(Modification mod: mods) {
             compMod.addModification(mod);
@@ -84,7 +84,7 @@ public class PreLithiumShardTest extends AbstractShardTest {
         return new CompositeModificationPayload(compMod.toSerializable());
     }
 
-    private CompositeModificationByteStringPayload newLegacyByteStringPayload(final Modification... mods) {
+    private static CompositeModificationByteStringPayload newLegacyByteStringPayload(final Modification... mods) {
         MutableCompositeModification compMod = new MutableCompositeModification();
         for(Modification mod: mods) {
             compMod.addModification(mod);
@@ -93,7 +93,7 @@ public class PreLithiumShardTest extends AbstractShardTest {
         return new CompositeModificationByteStringPayload(compMod.toSerializable());
     }
 
-    private ModificationPayload newModificationPayload(final Modification... mods) throws IOException {
+    private static ModificationPayload newModificationPayload(final Modification... mods) throws IOException {
         MutableCompositeModification compMod = new MutableCompositeModification();
         for(Modification mod: mods) {
             compMod.addModification(mod);
index cb7c780..6ca1783 100644 (file)
@@ -59,7 +59,7 @@ import scala.concurrent.Future;
  */
 public class PreLithiumTransactionProxyTest extends AbstractTransactionProxyTest {
 
-    private WriteData eqLegacyWriteData(final NormalizedNode<?, ?> nodeToWrite) {
+    private static WriteData eqLegacyWriteData(final NormalizedNode<?, ?> nodeToWrite) {
         ArgumentMatcher<WriteData> matcher = new ArgumentMatcher<WriteData>() {
             @Override
             public boolean matches(Object argument) {
@@ -75,7 +75,7 @@ public class PreLithiumTransactionProxyTest extends AbstractTransactionProxyTest
         return argThat(matcher);
     }
 
-    private MergeData eqLegacyMergeData(final NormalizedNode<?, ?> nodeToWrite) {
+    private static MergeData eqLegacyMergeData(final NormalizedNode<?, ?> nodeToWrite) {
         ArgumentMatcher<MergeData> matcher = new ArgumentMatcher<MergeData>() {
             @Override
             public boolean matches(Object argument) {
@@ -91,7 +91,7 @@ public class PreLithiumTransactionProxyTest extends AbstractTransactionProxyTest
         return argThat(matcher);
     }
 
-    private DeleteData eqLegacyDeleteData(final YangInstanceIdentifier expPath) {
+    private static DeleteData eqLegacyDeleteData(final YangInstanceIdentifier expPath) {
         ArgumentMatcher<DeleteData> matcher = new ArgumentMatcher<DeleteData>() {
             @Override
             public boolean matches(Object argument) {
@@ -103,7 +103,7 @@ public class PreLithiumTransactionProxyTest extends AbstractTransactionProxyTest
         return argThat(matcher);
     }
 
-    private CanCommitTransaction eqCanCommitTransaction(final String transactionID) {
+    private static CanCommitTransaction eqCanCommitTransaction(final String transactionID) {
         ArgumentMatcher<CanCommitTransaction> matcher = new ArgumentMatcher<CanCommitTransaction>() {
             @Override
             public boolean matches(Object argument) {
@@ -115,7 +115,7 @@ public class PreLithiumTransactionProxyTest extends AbstractTransactionProxyTest
         return argThat(matcher);
     }
 
-    private CommitTransaction eqCommitTransaction(final String transactionID) {
+    private static CommitTransaction eqCommitTransaction(final String transactionID) {
         ArgumentMatcher<CommitTransaction> matcher = new ArgumentMatcher<CommitTransaction>() {
             @Override
             public boolean matches(Object argument) {
@@ -127,7 +127,7 @@ public class PreLithiumTransactionProxyTest extends AbstractTransactionProxyTest
         return argThat(matcher);
     }
 
-    private Future<Object> readySerializedTxReply(String path, short version) {
+    private static Future<Object> readySerializedTxReply(String path, short version) {
         return Futures.successful(new ReadyTransactionReply(path, version).toSerializable());
     }
 
index 1bb5798..6025e01 100644 (file)
@@ -259,7 +259,7 @@ public class DistributedEntityOwnershipIntegrationTest {
         verify(follower1MockListener, timeout(5000)).ownershipChanged(ownershipChange(ENTITY2, false, false, false));
     }
 
-    private void verifyGetOwnershipState(DistributedEntityOwnershipService service, Entity entity,
+    private static void verifyGetOwnershipState(DistributedEntityOwnershipService service, Entity entity,
             boolean isOwner, boolean hasOwner) {
         Optional<EntityOwnershipState> state = service.getOwnershipState(entity);
         assertEquals("getOwnershipState present", true, state.isPresent());
@@ -267,7 +267,7 @@ public class DistributedEntityOwnershipIntegrationTest {
         assertEquals("hasOwner", hasOwner, state.get().hasOwner());
     }
 
-    private void verifyCandidates(DistributedDataStore dataStore, Entity entity, String... expCandidates) throws Exception {
+    private static void verifyCandidates(DistributedDataStore dataStore, Entity entity, String... expCandidates) throws Exception {
         AssertionError lastError = null;
         Stopwatch sw = Stopwatch.createStarted();
         while(sw.elapsed(TimeUnit.MILLISECONDS) <= 5000) {
@@ -291,7 +291,7 @@ public class DistributedEntityOwnershipIntegrationTest {
         throw lastError;
     }
 
-    private void verifyOwner(final DistributedDataStore dataStore, Entity entity, String expOwner) throws Exception {
+    private static void verifyOwner(final DistributedDataStore dataStore, Entity entity, String expOwner) {
         AbstractEntityOwnershipTest.verifyOwner(expOwner, entity.getType(), entity.getId(),
                 new Function<YangInstanceIdentifier, NormalizedNode<?,?>>() {
                     @Override
index 5591772..ce2ef2d 100644 (file)
@@ -280,7 +280,7 @@ public class DistributedEntityOwnershipServiceTest extends AbstractEntityOwnersh
         service.close();
     }
 
-    private void verifyGetOwnershipState(DistributedEntityOwnershipService service, Entity entity,
+    private static void verifyGetOwnershipState(DistributedEntityOwnershipService service, Entity entity,
             boolean isOwner, boolean hasOwner) {
         Optional<EntityOwnershipState> state = service.getOwnershipState(entity);
         assertEquals("getOwnershipState present", true, state.isPresent());
@@ -303,12 +303,12 @@ public class DistributedEntityOwnershipServiceTest extends AbstractEntityOwnersh
                 });
     }
 
-    private void verifyRegisterCandidateLocal(final TestShardPropsCreator shardPropsCreator, Entity entity) {
+    private static void verifyRegisterCandidateLocal(final TestShardPropsCreator shardPropsCreator, Entity entity) {
         RegisterCandidateLocal regCandidate = shardPropsCreator.waitForShardMessage();
         assertEquals("getEntity", entity, regCandidate.getEntity());
     }
 
-    private void verifyEntityOwnershipCandidateRegistration(Entity entity, EntityOwnershipCandidateRegistration reg) {
+    private static void verifyEntityOwnershipCandidateRegistration(Entity entity, EntityOwnershipCandidateRegistration reg) {
         assertNotNull("EntityOwnershipCandidateRegistration null", reg);
         assertEquals("getInstance", entity, reg.getInstance());
     }
index e78be76..77d8119 100644 (file)
@@ -711,7 +711,7 @@ public class EntityOwnershipShardTest extends AbstractEntityOwnershipTest {
         verify(listener, never()).ownershipChanged(ownershipChange(entity1));
     }
 
-    private void commitModification(TestActorRef<EntityOwnershipShard> shard, NormalizedNode<?, ?> node,
+    private static void commitModification(TestActorRef<EntityOwnershipShard> shard, NormalizedNode<?, ?> node,
             JavaTestKit sender) {
         BatchedModifications modifications = newBatchedModifications();
         modifications.addModification(new MergeModification(ENTITY_OWNERS_PATH, node));
@@ -720,7 +720,7 @@ public class EntityOwnershipShardTest extends AbstractEntityOwnershipTest {
         sender.expectMsgClass(CommitTransactionReply.SERIALIZABLE_CLASS);
     }
 
-    private BatchedModifications newBatchedModifications() {
+    private static BatchedModifications newBatchedModifications() {
         BatchedModifications modifications = new BatchedModifications("tnx", DataStoreVersions.CURRENT_VERSION, "");
         modifications.setDoCommitOnReady(true);
         modifications.setReady(true);
@@ -784,8 +784,8 @@ public class EntityOwnershipShardTest extends AbstractEntityOwnershipTest {
                 entityId, candidateName, true);
     }
 
-    private void verifyOwner(final TestActorRef<EntityOwnershipShard> shard, String entityType, YangInstanceIdentifier entityId,
-            String localMemberName) {
+    private static void verifyOwner(final TestActorRef<EntityOwnershipShard> shard, String entityType,
+            YangInstanceIdentifier entityId, String localMemberName) {
         verifyOwner(localMemberName, entityType, entityId, new Function<YangInstanceIdentifier, NormalizedNode<?,?>>() {
             @Override
             public NormalizedNode<?, ?> apply(YangInstanceIdentifier path) {
@@ -811,7 +811,7 @@ public class EntityOwnershipShardTest extends AbstractEntityOwnershipTest {
                 SCHEMA_CONTEXT, memberName);
     }
 
-    private ShardIdentifier newShardId(String memberName) {
+    private static ShardIdentifier newShardId(String memberName) {
         return ShardIdentifier.builder().memberName(memberName).shardName("entity-ownership").
                 type("operational" + NEXT_SHARD_NUM.getAndIncrement()).build();
     }
index efe73d3..6a5d6ef 100644 (file)
@@ -542,10 +542,11 @@ public class ActorContextTest extends AbstractActorTest{
         }};
     }
 
-    private <T> T expectFirstMatching(ActorRef actor, Class<T> clazz) {
+    private static <T> T expectFirstMatching(ActorRef actor, Class<T> clazz) {
         int count = 5000 / 50;
         for(int i = 0; i < count; i++) {
             try {
+                @SuppressWarnings("unchecked")
                 T message = (T) MessageCollectorActor.getFirstMatching(actor, clazz);
                 if(message != null) {
                     return message;

©2013 OpenDaylight, A Linux Foundation Collaborative Project. All Rights Reserved.
OpenDaylight is a registered trademark of The OpenDaylight Project, Inc.
Linux Foundation and OpenDaylight are registered trademarks of the Linux Foundation.
Linux is a registered trademark of Linus Torvalds.