use of org.apache.tephra.persist.TransactionStateStorage in project cdap by caskdata.
the class HiveExploreServiceStopTest method testServiceStop.
@Test
public void testServiceStop() throws Exception {
ExploreService exploreService = injector.getInstance(ExploreService.class);
Set<Long> beforeTxns = transactionManager.getCurrentState().getInProgress().keySet();
exploreService.execute(NAMESPACE_ID, "show tables");
Set<Long> queryTxns = Sets.difference(transactionManager.getCurrentState().getInProgress().keySet(), beforeTxns);
Assert.assertFalse(queryTxns.isEmpty());
// Stop all services so that explore service gets stopped.
stopServices();
// Make sure that the transaction got closed
TransactionStateStorage transactionStateStorage = injector.getInstance(TransactionStateStorage.class);
TransactionSnapshot latestSnapshot = transactionStateStorage.getLatestSnapshot();
Assert.assertEquals(ImmutableSet.<Long>of(), Sets.intersection(queryTxns, latestSnapshot.getInProgress().keySet()).immutableCopy());
}
Aggregations