X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-distributed-datastore%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fcluster%2Fdatastore%2FBasicIntegrationTest.java;h=7b826302f588ad76be85f54c9e17bcc1c8dff56a;hp=319451f8f00587d7328f5e4c20e4fcc1454051d2;hb=4c22825994c2519fb1c9d63f0050ebf35c4f8439;hpb=bc7b4edec3c868a14e0a0de3a3b8e1af2406448b diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/BasicIntegrationTest.java b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/BasicIntegrationTest.java index 319451f8f0..7b826302f5 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/BasicIntegrationTest.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/BasicIntegrationTest.java @@ -18,8 +18,6 @@ import org.junit.Test; import org.opendaylight.controller.cluster.datastore.identifiers.ShardIdentifier; import org.opendaylight.controller.cluster.datastore.messages.CommitTransaction; import org.opendaylight.controller.cluster.datastore.messages.CreateTransaction; -import org.opendaylight.controller.cluster.datastore.messages.CreateTransactionChain; -import org.opendaylight.controller.cluster.datastore.messages.CreateTransactionChainReply; import org.opendaylight.controller.cluster.datastore.messages.CreateTransactionReply; import org.opendaylight.controller.cluster.datastore.messages.PreCommitTransaction; import org.opendaylight.controller.cluster.datastore.messages.PreCommitTransactionReply; @@ -30,6 +28,7 @@ import org.opendaylight.controller.cluster.datastore.messages.WriteData; import org.opendaylight.controller.cluster.datastore.messages.WriteDataReply; import org.opendaylight.controller.md.cluster.datastore.model.TestModel; import org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes; +import org.opendaylight.yangtools.yang.model.api.SchemaContext; import scala.concurrent.Await; import scala.concurrent.Future; import scala.concurrent.duration.FiniteDuration; @@ -58,22 +57,23 @@ public class BasicIntegrationTest extends AbstractActorTest { ShardIdentifier.builder().memberName("member-1") .shardName("inventory").type("config").build(); - final Props props = Shard.props(identifier, Collections.EMPTY_MAP); + final SchemaContext schemaContext = TestModel.createTestContext(); + DatastoreContext datastoreContext = new DatastoreContext(); + + final Props props = Shard.props(identifier, Collections.EMPTY_MAP, datastoreContext, TestModel.createTestContext()); final ActorRef shard = getSystem().actorOf(props); - new Within(duration("5 seconds")) { + new Within(duration("10 seconds")) { + @Override protected void run() { - - - shard.tell( - new UpdateSchemaContext(TestModel.createTestContext()), - getRef()); + shard.tell(new UpdateSchemaContext(schemaContext), getRef()); // Wait for a specific log message to show up final boolean result = new JavaTestKit.EventFilter(Logging.Info.class ) { + @Override protected Boolean run() { return true; } @@ -83,33 +83,12 @@ public class BasicIntegrationTest extends AbstractActorTest { assertEquals(true, result); - // 1. Create a TransactionChain - shard.tell(new CreateTransactionChain().toSerializable(), getRef()); - - final ActorSelection transactionChain = - new ExpectMsg(duration("1 seconds"), "CreateTransactionChainReply") { - protected ActorSelection match(Object in) { - if (in.getClass().equals(CreateTransactionChainReply.SERIALIZABLE_CLASS)) { - ActorPath transactionChainPath = - CreateTransactionChainReply.fromSerializable(getSystem(),in) - .getTransactionChainPath(); - return getSystem() - .actorSelection(transactionChainPath); - } else { - throw noMatch(); - } - } - }.get(); // this extracts the received message - - assertNotNull(transactionChain); - - System.out.println("Successfully created transaction chain"); - - // 2. Create a Transaction on the TransactionChain - transactionChain.tell(new CreateTransaction("txn-1", TransactionProxy.TransactionType.WRITE_ONLY.ordinal() ).toSerializable(), getRef()); + // Create a transaction on the shard + shard.tell(new CreateTransaction("txn-1", TransactionProxy.TransactionType.WRITE_ONLY.ordinal() ).toSerializable(), getRef()); final ActorSelection transaction = - new ExpectMsg(duration("1 seconds"), "CreateTransactionReply") { + new ExpectMsg(duration("3 seconds"), "CreateTransactionReply") { + @Override protected ActorSelection match(Object in) { if (CreateTransactionReply.SERIALIZABLE_CLASS.equals(in.getClass())) { CreateTransactionReply reply = CreateTransactionReply.fromSerializable(in); @@ -128,10 +107,11 @@ public class BasicIntegrationTest extends AbstractActorTest { // 3. Write some data transaction.tell(new WriteData(TestModel.TEST_PATH, - ImmutableNodes.containerNode(TestModel.TEST_QNAME), TestModel.createTestContext()).toSerializable(), + ImmutableNodes.containerNode(TestModel.TEST_QNAME), schemaContext).toSerializable(), getRef()); - Boolean writeDone = new ExpectMsg(duration("1 seconds"), "WriteDataReply") { + Boolean writeDone = new ExpectMsg(duration("3 seconds"), "WriteDataReply") { + @Override protected Boolean match(Object in) { if (in.getClass().equals(WriteDataReply.SERIALIZABLE_CLASS)) { return true; @@ -150,7 +130,8 @@ public class BasicIntegrationTest extends AbstractActorTest { transaction.tell(new ReadyTransaction().toSerializable(), getRef()); final ActorSelection cohort = - new ExpectMsg(duration("1 seconds"), "ReadyTransactionReply") { + new ExpectMsg(duration("3 seconds"), "ReadyTransactionReply") { + @Override protected ActorSelection match(Object in) { if (in.getClass().equals(ReadyTransactionReply.SERIALIZABLE_CLASS)) { ActorPath cohortPath = @@ -173,7 +154,8 @@ public class BasicIntegrationTest extends AbstractActorTest { cohort.tell(new PreCommitTransaction().toSerializable(), getRef()); Boolean preCommitDone = - new ExpectMsg(duration("1 seconds"), "PreCommitTransactionReply") { + new ExpectMsg(duration("3 seconds"), "PreCommitTransactionReply") { + @Override protected Boolean match(Object in) { if (in.getClass().equals(PreCommitTransactionReply.SERIALIZABLE_CLASS)) { return true;