use of org.kie.kogito.uow.events.UnitOfWorkEndEvent in project kogito-runtimes by kiegroup.
the class AbstractTransactionManagerTest method test.
@Test
void test() throws InterruptedException, ExecutionException, TimeoutException {
ExecutorService service = Executors.newFixedThreadPool(TEST_THREADS);
List<Future<?>> results = new ArrayList<>();
for (int i = 0; i < TEST_THREADS; i++) {
results.add(service.submit(() -> {
manager.onBeforeStartEvent(new UnitOfWorkStartEvent(null));
manager.onAfterEndEvent(new UnitOfWorkEndEvent(null));
}));
}
for (Future<?> result : results) {
result.get(2L, TimeUnit.SECONDS);
}
verify(mongoClient, times(TEST_THREADS)).startSession();
verify(clientSession, times(TEST_THREADS)).startTransaction(any());
verify(clientSession, times(TEST_THREADS)).commitTransaction();
verify(clientSession, times(TEST_THREADS)).close();
}
Aggregations