use of org.opendaylight.controller.sal.core.spi.data.DOMStoreReadTransaction in project controller by opendaylight.
the class AbstractModificationTest method readData.
protected Optional<NormalizedNode<?, ?>> readData(final YangInstanceIdentifier path) throws Exception {
DOMStoreReadTransaction transaction = store.newReadOnlyTransaction();
ListenableFuture<Optional<NormalizedNode<?, ?>>> future = transaction.read(path);
return future.get();
}
use of org.opendaylight.controller.sal.core.spi.data.DOMStoreReadTransaction in project controller by opendaylight.
the class InMemoryDataStoreTest method testReadWithReadWriteTransactionClosed.
@Test(expected = ReadFailedException.class)
public void testReadWithReadWriteTransactionClosed() throws Exception {
DOMStoreReadTransaction readTx = domStore.newReadWriteTransaction();
assertNotNull(readTx);
readTx.close();
doReadAndThrowEx(readTx);
}
use of org.opendaylight.controller.sal.core.spi.data.DOMStoreReadTransaction in project controller by opendaylight.
the class InMemoryDataStoreTest method testExistsThrowsReadFailedException.
@Test(expected = ReadFailedException.class)
public void testExistsThrowsReadFailedException() throws Exception {
DOMStoreReadTransaction readTx = domStore.newReadOnlyTransaction();
assertNotNull(readTx);
readTx.close();
readTx.exists(TestModel.TEST_PATH).checkedGet();
}
use of org.opendaylight.controller.sal.core.spi.data.DOMStoreReadTransaction in project controller by opendaylight.
the class InMemoryDataStoreTest method testReadWithReadOnlyTransactionClosed.
@Test(expected = ReadFailedException.class)
public void testReadWithReadOnlyTransactionClosed() throws Exception {
DOMStoreReadTransaction readTx = domStore.newReadOnlyTransaction();
assertNotNull(readTx);
readTx.close();
doReadAndThrowEx(readTx);
}
use of org.opendaylight.controller.sal.core.spi.data.DOMStoreReadTransaction in project controller by opendaylight.
the class InMemoryDataStoreTest method testReadWithReadOnlyTransactionFailure.
@Test(expected = ReadFailedException.class)
public void testReadWithReadOnlyTransactionFailure() throws Exception {
DataTreeSnapshot mockSnapshot = Mockito.mock(DataTreeSnapshot.class);
Mockito.doThrow(new RuntimeException("mock ex")).when(mockSnapshot).readNode(Mockito.any(YangInstanceIdentifier.class));
DOMStoreReadTransaction readTx = SnapshotBackedTransactions.newReadTransaction("1", true, mockSnapshot);
doReadAndThrowEx(readTx);
}
Aggregations