Migrate from JavaTestKit to javadsl.TestKit
[controller.git] / opendaylight / md-sal / sal-distributed-datastore / src / test / java / org / opendaylight / controller / cluster / datastore / DataTreeCohortIntegrationTest.java
index c9a30677a663a57dfe3a0bfae84fbb545e9314c1..5a131cd8ad578e9f94674d14d0b1e0c684181a84 100644 (file)
@@ -23,7 +23,7 @@ import akka.actor.ActorSystem;
 import akka.actor.Address;
 import akka.actor.AddressFromURIString;
 import akka.cluster.Cluster;
-import akka.testkit.JavaTestKit;
+import akka.testkit.javadsl.TestKit;
 import com.google.common.base.Optional;
 import com.google.common.base.Throwables;
 import com.google.common.util.concurrent.CheckedFuture;
@@ -84,7 +84,7 @@ public class DataTreeCohortIntegrationTest {
 
     @AfterClass
     public static void tearDownClass() throws IOException {
-        JavaTestKit.shutdownActorSystem(system);
+        TestKit.shutdownActorSystem(system);
         system = null;
     }
 
@@ -101,8 +101,8 @@ public class DataTreeCohortIntegrationTest {
         ArgumentCaptor<Collection> candidateCapt = ArgumentCaptor.forClass(Collection.class);
         IntegrationTestKit kit = new IntegrationTestKit(getSystem(), datastoreContextBuilder);
 
-        try (AbstractDataStore dataStore = kit.setupDistributedDataStore("testSuccessfulCanCommitWithNoopPostStep",
-                "test-1")) {
+        try (AbstractDataStore dataStore = kit.setupAbstractDataStore(
+                DistributedDataStore.class, "testSuccessfulCanCommitWithNoopPostStep", "test-1")) {
             final ObjectRegistration<DOMDataTreeCommitCohort> cohortReg = dataStore.registerCommitCohort(TEST_ID,
                     cohort);
             assertNotNull(cohortReg);
@@ -144,7 +144,8 @@ public class DataTreeCohortIntegrationTest {
                 any(Collection.class), any(SchemaContext.class));
 
         IntegrationTestKit kit = new IntegrationTestKit(getSystem(), datastoreContextBuilder);
-        try (AbstractDataStore dataStore = kit.setupDistributedDataStore("testFailedCanCommit", "test-1")) {
+        try (AbstractDataStore dataStore = kit.setupAbstractDataStore(
+                DistributedDataStore.class, "testFailedCanCommit", "test-1")) {
             dataStore.registerCommitCohort(TEST_ID, failedCohort);
 
             IntegrationTestKit.verifyShardState(dataStore, "test-1",
@@ -170,8 +171,8 @@ public class DataTreeCohortIntegrationTest {
                 any(Collection.class), any(SchemaContext.class));
         IntegrationTestKit kit = new IntegrationTestKit(getSystem(), datastoreContextBuilder);
 
-        try (AbstractDataStore dataStore = kit.setupDistributedDataStore("testCanCommitWithMultipleListEntries",
-                "cars-1")) {
+        try (AbstractDataStore dataStore = kit.setupAbstractDataStore(
+                DistributedDataStore.class, "testCanCommitWithMultipleListEntries", "cars-1")) {
             final ObjectRegistration<DOMDataTreeCommitCohort> cohortReg = dataStore.registerCommitCohort(
                     new DOMDataTreeIdentifier(LogicalDatastoreType.CONFIGURATION, CarsModel.CAR_LIST_PATH
                             .node(CarsModel.CAR_QNAME)), cohort);
@@ -258,8 +259,8 @@ public class DataTreeCohortIntegrationTest {
     }
 
     @SuppressWarnings("rawtypes")
-    private static DOMDataTreeCandidate findCandidate(ArgumentCaptor<Collection> candidateCapture,
-            YangInstanceIdentifier rootPath) {
+    private static DOMDataTreeCandidate findCandidate(final ArgumentCaptor<Collection> candidateCapture,
+            final YangInstanceIdentifier rootPath) {
         for (Object obj: candidateCapture.getValue()) {
             DOMDataTreeCandidate candidate = (DOMDataTreeCandidate)obj;
             if (rootPath.equals(candidate.getRootPath().getRootIdentifier())) {
@@ -287,8 +288,8 @@ public class DataTreeCohortIntegrationTest {
                 any(Collection.class), any(SchemaContext.class));
 
         IntegrationTestKit kit = new IntegrationTestKit(getSystem(), datastoreContextBuilder);
-        try (AbstractDataStore dataStore = kit.setupDistributedDataStore("testAbortAfterCanCommit",
-                "test-1", "cars-1")) {
+        try (AbstractDataStore dataStore = kit.setupAbstractDataStore(
+                DistributedDataStore.class, "testAbortAfterCanCommit", "test-1", "cars-1")) {
             dataStore.registerCommitCohort(TEST_ID, cohortToAbort);
 
             IntegrationTestKit.verifyShardState(dataStore, "test-1",
@@ -306,9 +307,9 @@ public class DataTreeCohortIntegrationTest {
         }
     }
 
-    private static void assertDataTreeCandidate(DOMDataTreeCandidate candidate, DOMDataTreeIdentifier expTreeId,
-            ModificationType expType, Optional<NormalizedNode<?, ?>> expDataAfter,
-            Optional<NormalizedNode<?, ?>> expDataBefore) {
+    private static void assertDataTreeCandidate(final DOMDataTreeCandidate candidate,
+            final DOMDataTreeIdentifier expTreeId, final ModificationType expType,
+            final Optional<NormalizedNode<?, ?>> expDataAfter, final Optional<NormalizedNode<?, ?>> expDataBefore) {
         assertNotNull("Expected candidate for path " + expTreeId.getRootIdentifier(), candidate);
         assertEquals("rootPath", expTreeId, candidate.getRootPath());
         assertEquals("modificationType", expType, candidate.getRootNode().getModificationType());