use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.mdsal.test.binding.rev140701.two.level.list.TopLevelList in project genius by opendaylight.
the class RetryingManagedNewTransactionRunnerTest method testCallWithNewReadWriteTransactionOptimisticLockFailedException.
@Override
public void testCallWithNewReadWriteTransactionOptimisticLockFailedException() 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.callWithNewReadWriteTransactionAndSubmit(writeTx -> writeTx.put(LogicalDatastoreType.OPERATIONAL, TEST_PATH, data)).get();
assertEquals(data, singleTransactionDataBroker.syncRead(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 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.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.mdsal.test.binding.rev140701.two.level.list.TopLevelList 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.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.mdsal.test.binding.rev140701.two.level.list.TopLevelList 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));
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.mdsal.test.binding.rev140701.two.level.list.TopLevelList in project genius by opendaylight.
the class RetryingManagedNewTransactionRunnerTest method testApplyWithNewReadWriteTransactionReadFailedException.
@Test
public void testApplyWithNewReadWriteTransactionReadFailedException() throws Exception {
testableDataBroker.failReads(2, new ReadFailedException("bada boum bam!"));
TopLevelList data = newTestDataObject();
assertEquals(data, managedNewTransactionRunner.applyWithNewReadWriteTransactionAndSubmit(Datastore.OPERATIONAL, tx -> {
tx.put(TEST_PATH, data);
return tx.read(TEST_PATH).get().get();
}).get());
assertEquals(data, singleTransactionDataBroker.syncRead(OPERATIONAL, TEST_PATH));
}
Aggregations