Migrate Props.create() call sites 71/85371/3
authorRobert Varga <robert.varga@pantheon.tech>
Thu, 24 Oct 2019 10:58:27 +0000 (12:58 +0200)
committerRobert Varga <robert.varga@pantheon.tech>
Thu, 24 Oct 2019 15:52:01 +0000 (17:52 +0200)
Props.create() now takes a class identifying the class being
instantiated. Fix callsites to do that.

Change-Id: I4a0169663465b0c1ba62fc87ca13423cf5a4464f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ShardTransaction.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/entityownership/EntityOwnershipListenerActor.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/AbstractShardTest.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/shardmanager/ShardManagerTest.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/utils/ActorUtilsTest.java

index 9742640..9e50f17 100644 (file)
@@ -46,7 +46,8 @@ public abstract class ShardTransaction extends AbstractUntypedActorWithMetering
 
     public static Props props(final TransactionType type, final AbstractShardDataTreeTransaction<?> transaction,
             final ActorRef shardActor, final DatastoreContext datastoreContext, final ShardStats shardStats) {
-        return Props.create(new ShardTransactionCreator(type, transaction, shardActor, datastoreContext, shardStats));
+        return Props.create(ShardTransaction.class,
+            new ShardTransactionCreator(type, transaction, shardActor, datastoreContext, shardStats));
     }
 
     protected abstract AbstractShardDataTreeTransaction<?> getDOMStoreTransaction();
index 0a1bb92..037f6b6 100644 (file)
@@ -49,7 +49,7 @@ final class EntityOwnershipListenerActor extends AbstractUntypedActor {
     }
 
     static Props props(final DOMEntityOwnershipListener listener) {
-        return Props.create(new EntityOwnershipListenerCreator(listener));
+        return Props.create(EntityOwnershipListenerActor.class, new EntityOwnershipListenerCreator(listener));
     }
 
     private static final class EntityOwnershipListenerCreator implements Creator<EntityOwnershipListenerActor> {
index bf29c61..d93b96e 100644 (file)
@@ -151,9 +151,8 @@ public abstract class AbstractShardTest extends AbstractActorTest {
             }
         };
 
-        final TestActorRef<Shard> shard = TestActorRef.create(getSystem(),
-                Props.create(new DelegatingShardCreator(creator)).withDispatcher(Dispatchers.DefaultDispatcherId()),
-                "testRecovery");
+        final TestActorRef<Shard> shard = TestActorRef.create(getSystem(), Props.create(Shard.class,
+                new DelegatingShardCreator(creator)).withDispatcher(Dispatchers.DefaultDispatcherId()), "testRecovery");
 
         assertTrue("Recovery complete", recoveryComplete.await(5, TimeUnit.SECONDS));
 
index 6e3782b..6429307 100644 (file)
@@ -169,7 +169,7 @@ public class ShardTest extends AbstractShardTest {
     public void testDataTreeChangeListenerNotifiedWhenNotTheLeaderOnRegistration() throws Exception {
         final CountDownLatch onFirstElectionTimeout = new CountDownLatch(1);
         final CountDownLatch onChangeListenerRegistered = new CountDownLatch(1);
-        final Creator<Shard> creator = new Creator<Shard>() {
+        final Creator<Shard> creator = new Creator<>() {
             boolean firstElectionTimeout = true;
 
             @Override
@@ -202,8 +202,8 @@ public class ShardTest extends AbstractShardTest {
         final ActorRef dclActor = actorFactory.createActor(DataTreeChangeListenerActor.props(listener, path),
                 "testDataTreeChangeListenerNotifiedWhenNotTheLeaderOnRegistration-DataChangeListener");
 
-        final TestActorRef<Shard> shard = actorFactory.createTestActor(
-                Props.create(new DelegatingShardCreator(creator)).withDispatcher(Dispatchers.DefaultDispatcherId()),
+        final TestActorRef<Shard> shard = actorFactory.createTestActor(Props.create(Shard.class,
+                new DelegatingShardCreator(creator)).withDispatcher(Dispatchers.DefaultDispatcherId()),
                 "testDataTreeChangeListenerNotifiedWhenNotTheLeaderOnRegistration");
 
         final ShardTestKit testKit = new ShardTestKit(getSystem());
@@ -757,7 +757,7 @@ public class ShardTest extends AbstractShardTest {
     public void testOnBatchedModificationsWhenNotLeader() {
         final AtomicBoolean overrideLeaderCalls = new AtomicBoolean();
         final ShardTestKit testKit = new ShardTestKit(getSystem());
-        final Creator<Shard> creator = new Creator<Shard>() {
+        final Creator<Shard> creator = new Creator<>() {
             private static final long serialVersionUID = 1L;
 
             @Override
@@ -777,8 +777,8 @@ public class ShardTest extends AbstractShardTest {
             }
         };
 
-        final TestActorRef<Shard> shard = actorFactory.createTestActor(Props
-            .create(new DelegatingShardCreator(creator)).withDispatcher(Dispatchers.DefaultDispatcherId()),
+        final TestActorRef<Shard> shard = actorFactory.createTestActor(Props.create(Shard.class,
+            new DelegatingShardCreator(creator)).withDispatcher(Dispatchers.DefaultDispatcherId()),
             "testOnBatchedModificationsWhenNotLeader");
 
         ShardTestKit.waitUntilLeader(shard);
@@ -1084,7 +1084,7 @@ public class ShardTest extends AbstractShardTest {
         // Wait for the 2nd Tx to complete the canCommit phase.
 
         final CountDownLatch latch = new CountDownLatch(1);
-        canCommitFuture.onComplete(new OnComplete<Object>() {
+        canCommitFuture.onComplete(new OnComplete<>() {
             @Override
             public void onComplete(final Throwable failure, final Object resp) {
                 latch.countDown();
@@ -1154,7 +1154,7 @@ public class ShardTest extends AbstractShardTest {
         // Wait for the 2nd Tx to complete the canCommit phase.
 
         final CountDownLatch latch = new CountDownLatch(1);
-        canCommitFuture.onComplete(new OnComplete<Object>() {
+        canCommitFuture.onComplete(new OnComplete<>() {
             @Override
             public void onComplete(final Throwable failure, final Object resp) {
                 latch.countDown();
@@ -1272,8 +1272,8 @@ public class ShardTest extends AbstractShardTest {
             }
         };
 
-        final TestActorRef<Shard> shard = actorFactory.createTestActor(Props
-            .create(new DelegatingShardCreator(creator)).withDispatcher(Dispatchers.DefaultDispatcherId()),
+        final TestActorRef<Shard> shard = actorFactory.createTestActor(Props.create(Shard.class,
+            new DelegatingShardCreator(creator)).withDispatcher(Dispatchers.DefaultDispatcherId()),
             "testAbortWithCommitPending");
 
         ShardTestKit.waitUntilLeader(shard);
@@ -1730,9 +1730,8 @@ public class ShardTest extends AbstractShardTest {
 
         final Creator<Shard> creator = () -> new TestShard(newShardBuilder());
 
-        final TestActorRef<Shard> shard = actorFactory.createTestActor(Props
-            .create(new DelegatingShardCreator(creator)).withDispatcher(Dispatchers.DefaultDispatcherId()),
-            shardActorName);
+        final TestActorRef<Shard> shard = actorFactory.createTestActor(Props.create(Shard.class,
+            new DelegatingShardCreator(creator)).withDispatcher(Dispatchers.DefaultDispatcherId()), shardActorName);
 
         ShardTestKit.waitUntilLeader(shard);
         writeToStore(shard, TestModel.TEST_PATH, ImmutableNodes.containerNode(TestModel.TEST_QNAME));
index 9a02347..7329b6a 100644 (file)
@@ -298,7 +298,7 @@ public class ShardManagerTest extends AbstractShardManagerTest {
             }
         }
 
-        final Creator<ShardManager> creator = new Creator<ShardManager>() {
+        final Creator<ShardManager> creator = new Creator<>() {
             private static final long serialVersionUID = 1L;
             @Override
             public ShardManager create() {
@@ -310,7 +310,7 @@ public class ShardManagerTest extends AbstractShardManagerTest {
 
         final TestKit kit = new TestKit(getSystem());
 
-        final ActorRef shardManager = actorFactory.createActor(Props.create(
+        final ActorRef shardManager = actorFactory.createActor(Props.create(ShardManager.class,
                 new DelegatingShardManagerCreator(creator)).withDispatcher(Dispatchers.DefaultDispatcherId()));
 
         shardManager.tell(new UpdateSchemaContext(TEST_SCHEMA_CONTEXT), kit.getRef());
index 1f60cdf..a60597e 100644 (file)
@@ -109,11 +109,11 @@ public class ActorUtilsTest extends AbstractActorTest {
         }
 
         private static Props props(final boolean found, final ActorRef actorRef) {
-            return Props.create(new MockShardManagerCreator(found, actorRef));
+            return Props.create(MockShardManager.class, new MockShardManagerCreator(found, actorRef));
         }
 
         private static Props props() {
-            return Props.create(new MockShardManagerCreator());
+            return Props.create(MockShardManager.class, new MockShardManagerCreator());
         }
 
         @SuppressWarnings("serial")

©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.