2 * Copyright (c) 2016 Brocade Communications Systems, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.controller.cluster.datastore.compat;
10 import static org.junit.Assert.assertTrue;
11 import akka.actor.ActorRef;
12 import org.junit.Test;
13 import org.opendaylight.controller.cluster.datastore.AbstractShardTest;
14 import org.opendaylight.controller.cluster.datastore.DataStoreVersions;
15 import org.opendaylight.controller.cluster.datastore.ShardTestKit;
16 import org.opendaylight.controller.cluster.datastore.TransactionType;
17 import org.opendaylight.controller.cluster.datastore.messages.CreateTransaction;
18 import org.opendaylight.controller.cluster.datastore.messages.CreateTransactionReply;
19 import org.opendaylight.controller.cluster.datastore.messages.UpdateSchemaContext;
20 import org.opendaylight.controller.md.cluster.datastore.model.TestModel;
21 import org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages;
24 * Shard unit tests for backwards compatibility with pre-Boron versions.
26 * @author Thomas Pantelis
28 public class PreBoronShardTest extends AbstractShardTest {
31 public void testCreateTransaction(){
32 new ShardTestKit(getSystem()) {{
33 final ActorRef shard = actorFactory.createActor(newShardProps(), "testCreateTransaction");
35 waitUntilLeader(shard);
37 shard.tell(new UpdateSchemaContext(TestModel.createTestContext()), getRef());
39 shard.tell(new CreateTransaction("txn-1", TransactionType.READ_ONLY.ordinal(), null,
40 DataStoreVersions.LITHIUM_VERSION).toSerializable(), getRef());
42 ShardTransactionMessages.CreateTransactionReply reply =
43 expectMsgClass(ShardTransactionMessages.CreateTransactionReply.class);
45 final String path = CreateTransactionReply.fromSerializable(reply).getTransactionPath().toString();
46 assertTrue("Unexpected transaction path " + path,
47 path.contains("akka://test/user/testCreateTransaction/shard-txn-1"));