use of org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeSnapshot in project controller by opendaylight.
the class ShardRecoveryCoordinatorTest method createCar.
private DataTreeCandidate createCar() {
final DataTree dataTree = new InMemoryDataTreeFactory().create(DataTreeConfiguration.DEFAULT_OPERATIONAL, carsSchemaContext);
final DataTreeSnapshot snapshot = dataTree.takeSnapshot();
final DataTreeModification modification = snapshot.newModification();
modification.merge(CarsModel.BASE_PATH, CarsModel.create());
modification.ready();
return dataTree.prepare(modification);
}
use of org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeSnapshot in project controller by opendaylight.
the class TransactionProxyTest method createDataTree.
private static DataTree createDataTree() {
DataTree dataTree = mock(DataTree.class);
DataTreeSnapshot dataTreeSnapshot = mock(DataTreeSnapshot.class);
DataTreeModification dataTreeModification = mock(DataTreeModification.class);
doReturn(dataTreeSnapshot).when(dataTree).takeSnapshot();
doReturn(dataTreeModification).when(dataTreeSnapshot).newModification();
return dataTree;
}
use of org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeSnapshot in project controller by opendaylight.
the class InMemoryDataStoreTest method testReadWithReadWriteTransactionFailure.
@Test(expected = ReadFailedException.class)
public void testReadWithReadWriteTransactionFailure() throws Exception {
DataTreeSnapshot mockSnapshot = Mockito.mock(DataTreeSnapshot.class);
DataTreeModification mockModification = Mockito.mock(DataTreeModification.class);
Mockito.doThrow(new RuntimeException("mock ex")).when(mockModification).readNode(Mockito.any(YangInstanceIdentifier.class));
Mockito.doReturn(mockModification).when(mockSnapshot).newModification();
@SuppressWarnings("unchecked") TransactionReadyPrototype<String> mockReady = Mockito.mock(TransactionReadyPrototype.class);
DOMStoreReadTransaction readTx = SnapshotBackedTransactions.newReadWriteTransaction("1", false, mockSnapshot, mockReady);
doReadAndThrowEx(readTx);
}
Aggregations