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%2Fcompat%2FPreBoronShardTest.java;fp=opendaylight%2Fmd-sal%2Fsal-distributed-datastore%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fcluster%2Fdatastore%2Fcompat%2FPreBoronShardTest.java;h=0000000000000000000000000000000000000000;hb=24c074a4b32ac97980a652b78824b7c2f97ffb78;hp=4499043b14223739a1aab6920d2f2d215d3771a6;hpb=c796596b5c46b5203c30b143e6282662e66c5642;p=controller.git diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/compat/PreBoronShardTest.java b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/compat/PreBoronShardTest.java deleted file mode 100644 index 4499043b14..0000000000 --- a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/compat/PreBoronShardTest.java +++ /dev/null @@ -1,129 +0,0 @@ -/* - * Copyright (c) 2016 Brocade Communications Systems, Inc. and others. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ -package org.opendaylight.controller.cluster.datastore.compat; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; -import akka.actor.ActorRef; -import akka.dispatch.Dispatchers; -import akka.testkit.TestActorRef; -import org.junit.Test; -import org.opendaylight.controller.cluster.datastore.AbstractShardTest; -import org.opendaylight.controller.cluster.datastore.DataStoreVersions; -import org.opendaylight.controller.cluster.datastore.Shard; -import org.opendaylight.controller.cluster.datastore.ShardTestKit; -import org.opendaylight.controller.cluster.datastore.TransactionType; -import org.opendaylight.controller.cluster.datastore.messages.BatchedModifications; -import org.opendaylight.controller.cluster.datastore.messages.CanCommitTransaction; -import org.opendaylight.controller.cluster.datastore.messages.CanCommitTransactionReply; -import org.opendaylight.controller.cluster.datastore.messages.CommitTransaction; -import org.opendaylight.controller.cluster.datastore.messages.CreateTransaction; -import org.opendaylight.controller.cluster.datastore.messages.CreateTransactionReply; -import org.opendaylight.controller.cluster.datastore.messages.ReadyTransactionReply; -import org.opendaylight.controller.cluster.datastore.messages.UpdateSchemaContext; -import org.opendaylight.controller.cluster.datastore.modification.WriteModification; -import org.opendaylight.controller.md.cluster.datastore.model.TestModel; -import org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages; -import org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages; -import org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes; - -/** - * Shard unit tests for backwards compatibility with pre-Boron versions. - * - * @author Thomas Pantelis - */ -public class PreBoronShardTest extends AbstractShardTest { - - @Test - public void testCreateTransaction(){ - new ShardTestKit(getSystem()) {{ - final ActorRef shard = actorFactory.createActor(newShardProps(), "testCreateTransaction"); - - waitUntilLeader(shard); - - shard.tell(new UpdateSchemaContext(TestModel.createTestContext()), getRef()); - - shard.tell(new CreateTransaction("txn-1", TransactionType.READ_ONLY.ordinal(), null, - DataStoreVersions.LITHIUM_VERSION).toSerializable(), getRef()); - - ShardTransactionMessages.CreateTransactionReply reply = - expectMsgClass(ShardTransactionMessages.CreateTransactionReply.class); - - final String path = CreateTransactionReply.fromSerializable(reply).getTransactionPath().toString(); - assertTrue("Unexpected transaction path " + path, - path.contains("akka://test/user/testCreateTransaction/shard-txn-1")); - }}; - } - - @Test - public void testBatchedModificationsWithCommitOnReady() throws Throwable { - new ShardTestKit(getSystem()) {{ - final TestActorRef shard = actorFactory.createTestActor( - newShardProps().withDispatcher(Dispatchers.DefaultDispatcherId()), - "testBatchedModificationsWithCommitOnReady"); - - waitUntilLeader(shard); - - final String transactionID = "tx"; - - BatchedModifications batched = new BatchedModifications(transactionID, - DataStoreVersions.LITHIUM_VERSION, ""); - batched.addModification(new WriteModification(TestModel.TEST_PATH, - ImmutableNodes.containerNode(TestModel.TEST_QNAME))); - batched.setReady(true); - batched.setDoCommitOnReady(true); - batched.setTotalMessagesSent(1); - - shard.tell(batched, getRef()); - expectMsgClass(ThreePhaseCommitCohortMessages.CommitTransactionReply.class); - }}; - } - - @Test - public void testImmediateCommitWithForwardedReadyTransaction() throws Throwable { - new ShardTestKit(getSystem()) {{ - final TestActorRef shard = actorFactory.createTestActor( - newShardProps().withDispatcher(Dispatchers.DefaultDispatcherId()), - "testImmediateCommitWithForwardedReadyTransaction"); - - waitUntilLeader(shard); - - final String transactionID = "tx"; - - shard.tell(prepareForwardedReadyTransaction(mockShardDataTreeCohort(), transactionID, - DataStoreVersions.LITHIUM_VERSION, true), getRef()); - - expectMsgClass(ThreePhaseCommitCohortMessages.CommitTransactionReply.class); - }}; - } - - @Test - public void testThreePhaseCommitOnForwardedReadyTransaction() throws Throwable { - new ShardTestKit(getSystem()) {{ - final TestActorRef shard = actorFactory.createTestActor( - newShardProps().withDispatcher(Dispatchers.DefaultDispatcherId()), - "testThreePhaseCommitOnForwardedReadyTransaction"); - - waitUntilLeader(shard); - - final String transactionID = "tx"; - - shard.tell(prepareForwardedReadyTransaction(mockShardDataTreeCohort(), transactionID, - DataStoreVersions.LITHIUM_VERSION, false), getRef()); - expectMsgClass(ReadyTransactionReply.class); - - shard.tell(new CanCommitTransaction(transactionID, DataStoreVersions.LITHIUM_VERSION).toSerializable(), getRef()); - CanCommitTransactionReply canCommitReply = CanCommitTransactionReply.fromSerializable( - expectMsgClass(ThreePhaseCommitCohortMessages.CanCommitTransactionReply.class)); - assertEquals("Can commit", true, canCommitReply.getCanCommit()); - - shard.tell(new CommitTransaction(transactionID, DataStoreVersions.LITHIUM_VERSION).toSerializable(), getRef()); - expectMsgClass(ThreePhaseCommitCohortMessages.CommitTransactionReply.class); - }}; - } -}