- @Test(expected=NotInitializedException.class)
- public void testTransactionCommitFailureWithShardNotInitialized() throws Throwable{
- new IntegrationTestKit(getSystem(), datastoreContextBuilder) {{
- String testName = "testTransactionCommitFailureWithShardNotInitialized";
- String shardName = "test-1";
-
- // Set the shard initialization timeout low for the test.
-
- datastoreContextBuilder.shardInitializationTimeout(300, TimeUnit.MILLISECONDS);
-
- // Setup the InMemoryJournal to block shard recovery indefinitely.
-
- String persistentID = String.format("member-1-shard-%s-%s", shardName, testName);
- CountDownLatch blockRecoveryLatch = new CountDownLatch(1);
- InMemoryJournal.addBlockReadMessagesLatch(persistentID, blockRecoveryLatch);
-
- InMemoryJournal.addEntry(persistentID, 1, "Dummy data so akka will read from persistence");
-
- DistributedDataStore dataStore = setupDistributedDataStore(testName, false, shardName);
-
- // Create the write Tx
-
- final DOMStoreWriteTransaction writeTx = dataStore.newWriteOnlyTransaction();
- assertNotNull("newReadWriteTransaction returned null", writeTx);
-
- // Do some modifications and ready the Tx on a separate thread.
-
- final AtomicReference<DOMStoreThreePhaseCommitCohort> txCohort = new AtomicReference<>();
- final AtomicReference<Exception> caughtEx = new AtomicReference<>();
- final CountDownLatch txReady = new CountDownLatch(1);
- Thread txThread = new Thread() {
- @Override
- public void run() {
- try {
- writeTx.write(TestModel.TEST_PATH,
- ImmutableNodes.containerNode(TestModel.TEST_QNAME));
-
- txCohort.set(writeTx.ready());
- } catch(Exception e) {
- caughtEx.set(e);
- return;
- } finally {
- txReady.countDown();
- }
- }
- };
+ @Test(expected = NotInitializedException.class)
+ @SuppressWarnings("checkstyle:IllegalCatch")
+ public void testTransactionCommitFailureWithShardNotInitialized() throws Exception {
+ final IntegrationTestKit testKit = new IntegrationTestKit(getSystem(), datastoreContextBuilder);
+ final String testName = "testTransactionCommitFailureWithShardNotInitialized";
+ final String shardName = "test-1";