X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-distributed-datastore%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fcluster%2Fdatastore%2FShardTransactionTest.java;h=0caad94840d4224e17cc4d98777496130301229a;hb=93c9708f8a9a225fa4d814ac98c15aea41fb26ac;hp=cc3bb55e8571dee26cb57ef0fd145c8df9110fae;hpb=3def254d3e8d2f24038ddfb7d1b1749ca2135fe2;p=controller.git diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/ShardTransactionTest.java b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/ShardTransactionTest.java index cc3bb55e85..0caad94840 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/ShardTransactionTest.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/ShardTransactionTest.java @@ -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.emptyMap(), datastoreContext, TestModel.createTestContext())); } @Test @@ -80,13 +80,13 @@ public class ShardTransactionTest extends AbstractActorTest { final ActorRef shard = createShard(); Props props = ShardTransaction.props(store.newReadOnlyTransaction(), shard, testSchemaContext, datastoreContext, shardStats, "txn", - CreateTransaction.CURRENT_CLIENT_VERSION); + CreateTransaction.CURRENT_VERSION); testOnReceiveReadData(getSystem().actorOf(props, "testReadDataRO")); props = ShardTransaction.props(store.newReadWriteTransaction(), shard, testSchemaContext, datastoreContext, shardStats, "txn", - CreateTransaction.CURRENT_CLIENT_VERSION); + CreateTransaction.CURRENT_VERSION); testOnReceiveReadData(getSystem().actorOf(props, "testReadDataRW")); } @@ -118,14 +118,14 @@ public class ShardTransactionTest extends AbstractActorTest { final ActorRef shard = createShard(); Props props = ShardTransaction.props( store.newReadOnlyTransaction(), shard, testSchemaContext, datastoreContext, shardStats, "txn", - CreateTransaction.CURRENT_CLIENT_VERSION); + CreateTransaction.CURRENT_VERSION); testOnReceiveReadDataWhenDataNotFound(getSystem().actorOf( props, "testReadDataWhenDataNotFoundRO")); props = ShardTransaction.props( store.newReadWriteTransaction(), shard, testSchemaContext, datastoreContext, shardStats, "txn", - CreateTransaction.CURRENT_CLIENT_VERSION); + CreateTransaction.CURRENT_VERSION); testOnReceiveReadDataWhenDataNotFound(getSystem().actorOf( props, "testReadDataWhenDataNotFoundRW")); @@ -156,13 +156,13 @@ public class ShardTransactionTest extends AbstractActorTest { final ActorRef shard = createShard(); Props props = ShardTransaction.props(store.newReadOnlyTransaction(), shard, testSchemaContext, datastoreContext, shardStats, "txn", - CreateTransaction.CURRENT_CLIENT_VERSION); + CreateTransaction.CURRENT_VERSION); testOnReceiveDataExistsPositive(getSystem().actorOf(props, "testDataExistsPositiveRO")); props = ShardTransaction.props(store.newReadWriteTransaction(), shard, testSchemaContext, datastoreContext, shardStats, "txn", - CreateTransaction.CURRENT_CLIENT_VERSION); + CreateTransaction.CURRENT_VERSION); testOnReceiveDataExistsPositive(getSystem().actorOf(props, "testDataExistsPositiveRW")); } @@ -191,13 +191,13 @@ public class ShardTransactionTest extends AbstractActorTest { final ActorRef shard = createShard(); Props props = ShardTransaction.props(store.newReadOnlyTransaction(), shard, testSchemaContext, datastoreContext, shardStats, "txn", - CreateTransaction.CURRENT_CLIENT_VERSION); + CreateTransaction.CURRENT_VERSION); testOnReceiveDataExistsNegative(getSystem().actorOf(props, "testDataExistsNegativeRO")); props = ShardTransaction.props(store.newReadWriteTransaction(), shard, testSchemaContext, datastoreContext, shardStats, "txn", - CreateTransaction.CURRENT_CLIENT_VERSION); + CreateTransaction.CURRENT_VERSION); testOnReceiveDataExistsNegative(getSystem().actorOf(props, "testDataExistsNegativeRW")); } @@ -238,7 +238,7 @@ public class ShardTransactionTest extends AbstractActorTest { final ActorRef shard = createShard(); final Props props = ShardTransaction.props(store.newWriteOnlyTransaction(), shard, testSchemaContext, datastoreContext, shardStats, "txn", - CreateTransaction.CURRENT_CLIENT_VERSION); + CreateTransaction.CURRENT_VERSION); final ActorRef transaction = getSystem().actorOf(props, "testWriteData"); transaction.tell(new WriteData(TestModel.TEST_PATH, @@ -265,7 +265,7 @@ public class ShardTransactionTest extends AbstractActorTest { final ActorRef shard = createShard(); final Props props = ShardTransaction.props(store.newReadWriteTransaction(), shard, testSchemaContext, datastoreContext, shardStats, "txn", - CreateTransaction.CURRENT_CLIENT_VERSION); + CreateTransaction.CURRENT_VERSION); final ActorRef transaction = getSystem().actorOf(props, "testMergeData"); transaction.tell(new MergeData(TestModel.TEST_PATH, @@ -291,7 +291,7 @@ public class ShardTransactionTest extends AbstractActorTest { final ActorRef shard = createShard(); final Props props = ShardTransaction.props( store.newWriteOnlyTransaction(), shard, testSchemaContext, datastoreContext, shardStats, "txn", - CreateTransaction.CURRENT_CLIENT_VERSION); + CreateTransaction.CURRENT_VERSION); final ActorRef transaction = getSystem().actorOf(props, "testDeleteData"); transaction.tell(new DeleteData(TestModel.TEST_PATH).toSerializable(), getRef()); @@ -314,7 +314,7 @@ public class ShardTransactionTest extends AbstractActorTest { final ActorRef shard = createShard(); final Props props = ShardTransaction.props( store.newReadWriteTransaction(), shard, testSchemaContext, datastoreContext, shardStats, "txn", - CreateTransaction.CURRENT_CLIENT_VERSION); + CreateTransaction.CURRENT_VERSION); final ActorRef transaction = getSystem().actorOf(props, "testReadyTransaction"); watch(transaction); @@ -332,7 +332,7 @@ public class ShardTransactionTest extends AbstractActorTest { final ActorRef shard = createShard(); final Props props = ShardTransaction.props( store.newReadWriteTransaction(), shard, testSchemaContext, datastoreContext, shardStats, "txn", - CreateTransaction.CURRENT_CLIENT_VERSION); + CreateTransaction.CURRENT_VERSION); final ActorRef transaction = getSystem().actorOf(props, "testReadyTransaction2"); watch(transaction); @@ -347,14 +347,13 @@ public class ShardTransactionTest extends AbstractActorTest { } - @SuppressWarnings("unchecked") @Test public void testOnReceiveCloseTransaction() throws Exception { new JavaTestKit(getSystem()) {{ final ActorRef shard = createShard(); final Props props = ShardTransaction.props(store.newReadWriteTransaction(), shard, testSchemaContext, datastoreContext, shardStats, "txn", - CreateTransaction.CURRENT_CLIENT_VERSION); + CreateTransaction.CURRENT_VERSION); final ActorRef transaction = getSystem().actorOf(props, "testCloseTransaction"); watch(transaction); @@ -371,7 +370,7 @@ public class ShardTransactionTest extends AbstractActorTest { final ActorRef shard = createShard(); final Props props = ShardTransaction.props(store.newReadOnlyTransaction(), shard, testSchemaContext, datastoreContext, shardStats, "txn", - CreateTransaction.CURRENT_CLIENT_VERSION); + CreateTransaction.CURRENT_VERSION); final TestActorRef transaction = TestActorRef.apply(props,getSystem()); transaction.receive(new DeleteData(TestModel.TEST_PATH).toSerializable(), ActorRef.noSender()); @@ -387,7 +386,7 @@ public class ShardTransactionTest extends AbstractActorTest { final ActorRef shard = createShard(); final Props props = ShardTransaction.props(store.newReadWriteTransaction(), shard, testSchemaContext, datastoreContext, shardStats, "txn", - CreateTransaction.CURRENT_CLIENT_VERSION); + CreateTransaction.CURRENT_VERSION); final ActorRef transaction = getSystem().actorOf(props, "testShardTransactionInactivity");