@SuppressWarnings("AutoBoxing") @Test public void pollStatusAlreadyLoadedTest() throws InterruptedException { final TraceDbLoadStatus status = mock(TraceDbLoadStatus.class); when(status.isReady()).thenReturn(true); when(traceDb.getLoadStatus()).thenReturn(status); presenter.pollStatus(); verifyZeroInteractions(view); }
@VisibleForTesting @OnBackgroundThread void pollStatus() throws InterruptedException { final TraceDbLoadStatus status = traceDb.getLoadStatus(); if (status.isReady()) return; final ParseInfo info = traceDb.getParseInfo(); final int total = info.getNrMatchers() + info.getNrNodes(); taskRunner.executeFront(view::showLoadToolbar); while (!status.isReady()) { pause(); final int current = status.getLoadedMatchers() + status.getLoadedNodes(); taskRunner.executeFront(() -> view.reportStatus(total, current)); } taskRunner.executeFront(view::showLoadComplete); }
TracePresenter extends BasePresenter<TraceView> { @VisibleForTesting @OnBackgroundThread void pollStatus() throws InterruptedException { final TraceDbLoadStatus status = traceDb.getLoadStatus(); if (status.isReady()) return; final ParseInfo info = traceDb.getParseInfo(); final int total = info.getNrMatchers() + info.getNrNodes(); taskRunner.executeFront(view::showLoadToolbar); while (!status.isReady()) { pause(); final int current = status.getLoadedMatchers() + status.getLoadedNodes(); taskRunner.executeFront(() -> view.reportStatus(total, current)); } taskRunner.executeFront(view::showLoadComplete); } }
TracePresenter extends BasePresenter<TraceView> { @VisibleForTesting @OnBackgroundThread void pollStatus() throws InterruptedException { final TraceDbLoadStatus status = traceDb.getLoadStatus(); if (status.isReady()) return; final ParseInfo info = traceDb.getParseInfo(); final int total = info.getNrMatchers() + info.getNrNodes(); taskRunner.executeFront(view::showLoadToolbar); while (!status.isReady()) { pause(); final int current = status.getLoadedMatchers() + status.getLoadedNodes(); taskRunner.executeFront(() -> view.reportStatus(total, current)); } taskRunner.executeFront(view::showLoadComplete); } TracePresenter(final MainWindowView mainView,
        final GuiTaskRunner taskRunner, final TraceDb traceDb); }
TracePresenter extends BasePresenter<TraceView> { @VisibleForTesting @OnBackgroundThread void pollStatus() throws InterruptedException { final TraceDbLoadStatus status = traceDb.getLoadStatus(); if (status.isReady()) return; final ParseInfo info = traceDb.getParseInfo(); final int total = info.getNrMatchers() + info.getNrNodes(); taskRunner.executeFront(view::showLoadToolbar); while (!status.isReady()) { pause(); final int current = status.getLoadedMatchers() + status.getLoadedNodes(); taskRunner.executeFront(() -> view.reportStatus(total, current)); } taskRunner.executeFront(view::showLoadComplete); } TracePresenter(final MainWindowView mainView,
        final GuiTaskRunner taskRunner, final TraceDb traceDb); @Override void load(); void loadRulesTab(); @OnUiThread @VisibleForTesting RulesTabPresenter createRulesTabPresenter(); void loadTreeDepthTab(); void handleTabsRefreshEvent(); void close(); @Override @Nonnull String toString(); }
TracePresenter extends BasePresenter<TraceView> { @VisibleForTesting @OnBackgroundThread void pollStatus() throws InterruptedException { final TraceDbLoadStatus status = traceDb.getLoadStatus(); if (status.isReady()) return; final ParseInfo info = traceDb.getParseInfo(); final int total = info.getNrMatchers() + info.getNrNodes(); taskRunner.executeFront(view::showLoadToolbar); while (!status.isReady()) { pause(); final int current = status.getLoadedMatchers() + status.getLoadedNodes(); taskRunner.executeFront(() -> view.reportStatus(total, current)); } taskRunner.executeFront(view::showLoadComplete); } TracePresenter(final MainWindowView mainView,
        final GuiTaskRunner taskRunner, final TraceDb traceDb); @Override void load(); void loadRulesTab(); @OnUiThread @VisibleForTesting RulesTabPresenter createRulesTabPresenter(); void loadTreeDepthTab(); void handleTabsRefreshEvent(); void close(); @Override @Nonnull String toString();  }