use of org.opendaylight.mdsal.common.api.LogicalDatastoreType.OPERATIONAL in project genius by opendaylight.
the class RetryingManagedNewTransactionRunnerTest method testCallWithNewTypedReadWriteTransactionReadFailedException.
@Test
public void testCallWithNewTypedReadWriteTransactionReadFailedException() throws Exception {
testableDataBroker.failReads(2, new ReadFailedException("bada boum bam!"));
TopLevelList data = newTestDataObject();
managedNewTransactionRunner.callWithNewReadWriteTransactionAndSubmit(Datastore.OPERATIONAL, tx -> {
tx.put(TEST_PATH, data);
assertEquals(data, tx.read(TEST_PATH).get().get());
}).get();
assertEquals(data, singleTransactionDataBroker.syncRead(OPERATIONAL, TEST_PATH));
}
use of org.opendaylight.mdsal.common.api.LogicalDatastoreType.OPERATIONAL in project genius by opendaylight.
the class RetryingManagedNewTransactionRunnerTest method testCallWithNewWriteOnlyTransactionOptimisticLockFailedException.
@Override
public void testCallWithNewWriteOnlyTransactionOptimisticLockFailedException() throws Exception {
// contrary to the super() test implementation for (just) ManagedNewTransactionRunnerImpl, in the parent class
// here we expect the x2 OptimisticLockFailedException to be retried, and then eventually succeed:
testableDataBroker.failSubmits(2, new OptimisticLockFailedException("bada boum bam!"));
TopLevelList data = newTestDataObject();
managedNewTransactionRunner.callWithNewWriteOnlyTransactionAndSubmit(writeTx -> writeTx.put(LogicalDatastoreType.OPERATIONAL, TEST_PATH, data)).get();
assertEquals(data, singleTransactionDataBroker.syncRead(OPERATIONAL, TEST_PATH));
}
use of org.opendaylight.mdsal.common.api.LogicalDatastoreType.OPERATIONAL in project genius by opendaylight.
the class RetryingManagedNewTransactionRunnerTest method testCallWithNewTypedWriteOnlyTransactionOptimisticLockFailedException.
@Override
public void testCallWithNewTypedWriteOnlyTransactionOptimisticLockFailedException() throws Exception {
// contrary to the super() test implementation for (just) ManagedNewTransactionRunnerImpl, in the parent class
// here we expect the x2 OptimisticLockFailedException to be retried, and then eventually succeed:
testableDataBroker.failSubmits(2, new OptimisticLockFailedException("bada boum bam!"));
TopLevelList data = newTestDataObject();
managedNewTransactionRunner.callWithNewWriteOnlyTransactionAndSubmit(Datastore.OPERATIONAL, writeTx -> writeTx.put(TEST_PATH, data)).get();
assertEquals(data, singleTransactionDataBroker.syncRead(OPERATIONAL, TEST_PATH));
}
Aggregations