+ commit.get(5, TimeUnit.SECONDS);
+ }
+
+
+ @Test
+ public void integrationTestWithMultiShardConfiguration()
+ throws ExecutionException, InterruptedException, TimeoutException {
+ Configuration configuration = new ConfigurationImpl("module-shards.conf", "modules.conf");
+
+ ShardStrategyFactory.setConfiguration(configuration);
+ DistributedDataStore distributedDataStore =
+ new DistributedDataStore(getSystem(), "config", new MockClusterWrapper(), configuration);
+
+
+ distributedDataStore.onGlobalContextUpdated(SchemaContextHelper.full());
+
+ // This sleep is fragile - test can fail intermittently if all Shards aren't updated with
+ // the SchemaContext in time. Is there any way we can make this deterministic?
+ Thread.sleep(2000);
+
+ DOMStoreReadWriteTransaction transaction =
+ distributedDataStore.newReadWriteTransaction();
+
+ transaction.write(CarsModel.BASE_PATH, CarsModel.emptyContainer());
+ transaction.write(PeopleModel.BASE_PATH, PeopleModel.emptyContainer());
+
+ DOMStoreThreePhaseCommitCohort ready = transaction.ready();
+
+ ListenableFuture<Boolean> canCommit = ready.canCommit();
+
+ assertTrue(canCommit.get(5, TimeUnit.SECONDS));
+
+ ListenableFuture<Void> preCommit = ready.preCommit();
+
+ preCommit.get(5, TimeUnit.SECONDS);
+
+ ListenableFuture<Void> commit = ready.commit();