@Test @RunWithCustomExecutor public void runDiffAsyncShouldStartDiff() throws Exception { CountDownLatch countDownLatch = new CountDownLatch(1); OfferDiffProcess offerDiffProcess = mock(OfferDiffProcess.class); doAnswer((args) -> { countDownLatch.countDown(); return null; }).when(offerDiffProcess).run(); OfferDiffService instance = new OfferDiffService(distribution); instance.runDiffAsync(offerDiffProcess); countDownLatch.await(1, TimeUnit.MINUTES); verify(offerDiffProcess).run(); }
void runDiffAsync(OfferDiffProcess offerDiffProcess) { int tenantId = VitamThreadUtils.getVitamSession().getTenantId(); String requestId = VitamThreadUtils.getVitamSession().getRequestId(); VitamThreadPoolExecutor.getDefaultExecutor().execute( () -> { try { VitamThreadUtils.getVitamSession().setTenantId(tenantId); VitamThreadUtils.getVitamSession().setRequestId(requestId); offerDiffProcess.run(); } catch (Exception e) { LOGGER.error("An error occurred during offer diff process execution", e); } } ); }
OfferDiffService { void runDiffAsync(OfferDiffProcess offerDiffProcess) { int tenantId = VitamThreadUtils.getVitamSession().getTenantId(); String requestId = VitamThreadUtils.getVitamSession().getRequestId(); VitamThreadPoolExecutor.getDefaultExecutor().execute( () -> { try { VitamThreadUtils.getVitamSession().setTenantId(tenantId); VitamThreadUtils.getVitamSession().setRequestId(requestId); offerDiffProcess.run(); } catch (Exception e) { LOGGER.error("An error occurred during offer diff process execution", e); } } ); } }
OfferDiffService { void runDiffAsync(OfferDiffProcess offerDiffProcess) { int tenantId = VitamThreadUtils.getVitamSession().getTenantId(); String requestId = VitamThreadUtils.getVitamSession().getRequestId(); VitamThreadPoolExecutor.getDefaultExecutor().execute( () -> { try { VitamThreadUtils.getVitamSession().setTenantId(tenantId); VitamThreadUtils.getVitamSession().setRequestId(requestId); offerDiffProcess.run(); } catch (Exception e) { LOGGER.error("An error occurred during offer diff process execution", e); } } ); } OfferDiffService(StorageDistribution distribution); }
OfferDiffService { void runDiffAsync(OfferDiffProcess offerDiffProcess) { int tenantId = VitamThreadUtils.getVitamSession().getTenantId(); String requestId = VitamThreadUtils.getVitamSession().getRequestId(); VitamThreadPoolExecutor.getDefaultExecutor().execute( () -> { try { VitamThreadUtils.getVitamSession().setTenantId(tenantId); VitamThreadUtils.getVitamSession().setRequestId(requestId); offerDiffProcess.run(); } catch (Exception e) { LOGGER.error("An error occurred during offer diff process execution", e); } } ); } OfferDiffService(StorageDistribution distribution); boolean startOfferDiff(String offer1, String offer2, DataCategory dataCategory); boolean isRunning(); OfferDiffStatus getLastOfferDiffStatus(); }
OfferDiffService { void runDiffAsync(OfferDiffProcess offerDiffProcess) { int tenantId = VitamThreadUtils.getVitamSession().getTenantId(); String requestId = VitamThreadUtils.getVitamSession().getRequestId(); VitamThreadPoolExecutor.getDefaultExecutor().execute( () -> { try { VitamThreadUtils.getVitamSession().setTenantId(tenantId); VitamThreadUtils.getVitamSession().setRequestId(requestId); offerDiffProcess.run(); } catch (Exception e) { LOGGER.error("An error occurred during offer diff process execution", e); } } ); } OfferDiffService(StorageDistribution distribution); boolean startOfferDiff(String offer1, String offer2, DataCategory dataCategory); boolean isRunning(); OfferDiffStatus getLastOfferDiffStatus();  }