operStore.onGlobalContextUpdated(schemaContext);
configStore.onGlobalContextUpdated(schemaContext);
- final ImmutableMap<LogicalDatastoreType, DOMStore> stores = ImmutableMap.<LogicalDatastoreType, DOMStore> builder()
+ final ImmutableMap<LogicalDatastoreType, DOMStore> stores =
+ ImmutableMap.<LogicalDatastoreType, DOMStore>builder()
.put(CONFIGURATION, configStore)
.put(OPERATIONAL, operStore)
.build();
@After
public void tearDown() {
- if( executor != null ) {
+ if (executor != null ) {
executor.shutdownNow();
}
- if(futureExecutor != null) {
+ if (futureExecutor != null) {
futureExecutor.shutdownNow();
}
}
- @Test(timeout=10000)
+ @Test(timeout = 10000)
public void testTransactionIsolation() throws InterruptedException, ExecutionException {
assertNotNull(domBroker);
assertNotNull(writeTx);
/**
- *
- * Writes /test in writeTx
+ * Writes /test in writeTx.
*
*/
writeTx.put(OPERATIONAL, TestModel.TEST_PATH, ImmutableNodes.containerNode(TestModel.TEST_QNAME));
/**
- *
* Reads /test from readTx Read should return Absent.
*
*/
assertFalse(readTxContainer.get().isPresent());
}
- @Test(timeout=10000)
+ @Test(timeout = 10000)
public void testTransactionCommit() throws InterruptedException, ExecutionException {
final DOMDataTreeWriteTransaction writeTx = domBroker.newWriteOnlyTransaction();
assertNotNull(writeTx);
/**
- *
* Writes /test in writeTx
*
*/
assertTrue(afterCommitRead.isPresent());
}
- @Test(expected=TransactionCommitFailedException.class)
+ @Test(expected = TransactionCommitFailedException.class)
public void testRejectedCommit() throws Exception {
commitExecutor.delegate = Mockito.mock( ExecutorService.class );
Mockito.doThrow( new RejectedExecutionException( "mock" ) )
writeTx.submit().checkedGet( 5, TimeUnit.SECONDS );
}
+ @SuppressWarnings("checkstyle:IllegalCatch")
AtomicReference<Throwable> submitTxAsync( final DOMDataTreeWriteTransaction writeTx ) {
final AtomicReference<Throwable> caughtEx = new AtomicReference<>();
new Thread() {
try {
writeTx.submit();
- } catch( final Throwable e ) {
+ } catch ( final Throwable e ) {
caughtEx.set( e );
}
}
readRx.read(OPERATIONAL, TestModel.TEST_PATH).checkedGet();
}
+ @SuppressWarnings({"checkstyle:IllegalThrows", "checkstyle:IllegalCatch"})
@Test
public void closeTest() throws Exception {
- final String TEST_EXCEPTION = "TestException";
+ final String testException = "TestException";
+
+ domBroker.setCloseable(() -> {
+ throw new Exception(testException);
+ });
- domBroker.setCloseable(() -> { throw new Exception(TEST_EXCEPTION); });
- try{
+ try {
domBroker.close();
- }catch(final Exception e){
- assertTrue(e.getMessage().contains(TEST_EXCEPTION));
+ } catch (final Exception e) {
+ assertTrue(e.getMessage().contains(testException));
}
}
ExecutorService delegate;
- public CommitExecutorService( final ExecutorService delegate ) {
+ CommitExecutorService( final ExecutorService delegate ) {
this.delegate = delegate;
}