2 * Copyright (c) 2016 Cisco 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.mdsal.dom.spi.store;
10 import static org.junit.Assert.assertNotNull;
11 import static org.mockito.Mockito.doReturn;
12 import static org.mockito.Mockito.mock;
14 import org.junit.Test;
15 import org.opendaylight.mdsal.dom.spi.store.SnapshotBackedWriteTransaction.TransactionReadyPrototype;
16 import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeModification;
17 import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeSnapshot;
19 public class SnapshotBackedTransactionsTest {
21 public void basicTest() throws Exception {
22 final DataTreeSnapshot dataTreeSnapshot = mock(DataTreeSnapshot.class);
23 final DataTreeModification dataTreeModification = mock(DataTreeModification.class);
24 final TransactionReadyPrototype<Object> transactionReadyPrototype = mock(TransactionReadyPrototype.class);
25 doReturn(dataTreeModification).when(dataTreeSnapshot).newModification();
27 assertNotNull(SnapshotBackedTransactions.newReadTransaction(new Object(), false, dataTreeSnapshot));
28 assertNotNull(SnapshotBackedTransactions.newWriteTransaction(
29 new Object(), false, dataTreeSnapshot, transactionReadyPrototype));
30 assertNotNull(SnapshotBackedTransactions.newReadWriteTransaction(
31 new Object(), false, dataTreeSnapshot, transactionReadyPrototype));