Remove Helium ReadDataReply protobuff message
[controller.git] / opendaylight / md-sal / sal-distributed-datastore / src / test / java / org / opendaylight / controller / cluster / datastore / compat / PreBoronTransactionProxyTest.java
1 /*
2  * Copyright (c) 2016 Brocade Communications Systems, Inc. and others.  All rights reserved.
3  *
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
7  */
8 package org.opendaylight.controller.cluster.datastore.compat;
9
10 import static org.mockito.Matchers.eq;
11 import static org.mockito.Matchers.isA;
12 import static org.mockito.Mockito.doReturn;
13 import static org.mockito.Mockito.verify;
14 import static org.opendaylight.controller.cluster.datastore.TransactionType.READ_WRITE;
15 import akka.actor.ActorRef;
16 import org.junit.Test;
17 import org.opendaylight.controller.cluster.datastore.AbstractTransactionProxyTest;
18 import org.opendaylight.controller.cluster.datastore.DataStoreVersions;
19 import org.opendaylight.controller.cluster.datastore.TransactionProxy;
20 import org.opendaylight.controller.cluster.datastore.shardstrategy.DefaultShardStrategy;
21 import org.opendaylight.controller.md.cluster.datastore.model.TestModel;
22 import org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages;
23
24 /**
25  * TransactionProxy unit tests for backwards compatibility with pre-Boron versions.
26  *
27  * @author Thomas Pantelis
28  */
29 public class PreBoronTransactionProxyTest extends AbstractTransactionProxyTest {
30
31     @Test
32     public void testClose() throws Exception{
33         ActorRef actorRef = setupActorContextWithInitialCreateTransaction(getSystem(), READ_WRITE,
34                 DataStoreVersions.LITHIUM_VERSION, DefaultShardStrategy.DEFAULT_SHARD);
35
36         doReturn(readDataReply(null)).when(mockActorContext).executeOperationAsync(
37                 eq(actorSelection(actorRef)), eqSerializedReadData());
38
39         TransactionProxy transactionProxy = new TransactionProxy(mockComponentFactory, READ_WRITE);
40
41         transactionProxy.read(TestModel.TEST_PATH);
42
43         transactionProxy.close();
44
45         verify(mockActorContext).sendOperationAsync(
46                 eq(actorSelection(actorRef)), isA(ShardTransactionMessages.CloseTransaction.class));
47     }
48 }