use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.mdsal.test.binding.rev140701.two.level.list.TopLevelList in project mdsal by opendaylight.
the class RetryingManagedNewTransactionRunnerTest method testCallWithNewTypedReadWriteTransactionOptimisticLockFailedException.
@Override
public void testCallWithNewTypedReadWriteTransactionOptimisticLockFailedException() 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.failCommits(2, new OptimisticLockFailedException("bada boum bam!"));
TopLevelList data = newTestDataObject();
managedNewTransactionRunner.callWithNewReadWriteTransactionAndSubmit(OPERATIONAL, writeTx -> writeTx.put(TEST_PATH, data)).get();
assertEquals(data, syncRead(LogicalDatastoreType.OPERATIONAL, TEST_PATH));
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.mdsal.test.binding.rev140701.two.level.list.TopLevelList in project mdsal by opendaylight.
the class RetryingManagedNewTransactionRunnerTest method testApplyWithNewReadWriteTransactionOptimisticLockFailedException.
@Override
public void testApplyWithNewReadWriteTransactionOptimisticLockFailedException() 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.failCommits(2, new OptimisticLockFailedException("bada boum bam!"));
TopLevelList data = newTestDataObject();
assertEquals(1, (long) managedNewTransactionRunner.applyWithNewReadWriteTransactionAndSubmit(OPERATIONAL, writeTx -> {
writeTx.put(TEST_PATH, data);
return 1;
}).get());
assertEquals(data, syncRead(LogicalDatastoreType.OPERATIONAL, TEST_PATH));
}
Aggregations