Add UnsignedLongBitmap
[controller.git] / opendaylight / md-sal / sal-distributed-datastore / src / test / java / org / opendaylight / controller / cluster / datastore / DirectTransactionContextWrapperTest.java
1 /*
2  * Copyright (c) 2021 PANTHEON.tech, s.r.o. 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;
9
10 import static org.mockito.Mockito.doReturn;
11 import static org.mockito.Mockito.times;
12 import static org.mockito.Mockito.verify;
13
14 import org.junit.Before;
15 import org.junit.Test;
16 import org.junit.runner.RunWith;
17 import org.mockito.Mock;
18 import org.mockito.junit.MockitoJUnitRunner;
19 import org.opendaylight.controller.cluster.datastore.utils.ActorUtils;
20
21 @RunWith(MockitoJUnitRunner.StrictStubs.class)
22 public class DirectTransactionContextWrapperTest {
23     @Mock
24     private ActorUtils actorUtils;
25
26     @Mock
27     private TransactionContext transactionContext;
28
29     @Mock
30     private TransactionOperation transactionOperation;
31
32     private DirectTransactionContextWrapper contextWrapper;
33
34     @Before
35     public void setUp() {
36         doReturn(DatastoreContext.newBuilder().build()).when(actorUtils).getDatastoreContext();
37         contextWrapper = new DirectTransactionContextWrapper(MockIdentifiers.transactionIdentifier(
38                 DirectTransactionContextWrapperTest.class, "mock"), actorUtils, "mock",
39                 transactionContext);
40     }
41
42     @Test
43     public void testMaybeExecuteTransactionOperation() {
44         contextWrapper.maybeExecuteTransactionOperation(transactionOperation);
45         verify(transactionOperation, times(1)).invoke(transactionContext, null);
46     }
47 }