@Test public void testStartScanner() { presenter.setup(containerSpec, ruleConfig); final String interval = "1"; presenter.startScanner(interval, ContainerRulesConfigPresenter.MS); verify(view).disableActions(); verify(ruleCapabilitiesService).startScanner(eq(containerSpec), eq(Long.valueOf(interval))); verify(view).setStartScannerState(State.DISABLED); verify(view).setStopScannerState(State.ENABLED); verify(view).setScanNowState(State.DISABLED); verify(view).setUpgradeState(State.DISABLED); }
public void startScanner(final String interval, final String timeUnit) { if (interval.trim().isEmpty()) { view.errorOnInterval(); return; } Long actualInterval = calculateInterval(Long.valueOf(checkNotEmpty("interval", interval)), timeUnit); view.disableActions(); ruleCapabilitiesService.call(new RemoteCallback<Void>() { @Override public void callback(final Void response) { scannerStatus = KieScannerStatus.STARTED; setScannerStatus(); updateViewState(); } }, new ErrorCallback<Object>() { @Override public boolean error(final Object o, final Throwable throwable) { notification.fire(new NotificationEvent(view.getStartScannerErrorMessage(), NotificationEvent.NotificationType.ERROR)); updateViewState(); return false; } }).startScanner(containerSpec, actualInterval); }
ContainerRulesConfigPresenter { public void startScanner(final String interval, final String timeUnit) { if (interval.trim().isEmpty()) { view.errorOnInterval(); return; } Long actualInterval = calculateInterval(Long.valueOf(checkNotEmpty("interval", interval)), timeUnit); view.disableActions(); ruleCapabilitiesService.call(new RemoteCallback<Void>() { @Override public void callback(final Void response) { scannerStatus = KieScannerStatus.STARTED; setScannerStatus(); updateViewState(); } }, new ErrorCallback<Object>() { @Override public boolean error(final Object o, final Throwable throwable) { notification.fire(new NotificationEvent(view.getStartScannerErrorMessage(), NotificationEvent.NotificationType.ERROR)); updateViewState(); return false; } }).startScanner(containerSpec, actualInterval); } }
ContainerRulesConfigPresenter { public void startScanner(final String interval, final String timeUnit) { if (interval.trim().isEmpty()) { view.errorOnInterval(); return; } Long actualInterval = calculateInterval(Long.valueOf(checkNotEmpty("interval", interval)), timeUnit); view.disableActions(); ruleCapabilitiesService.call(new RemoteCallback<Void>() { @Override public void callback(final Void response) { scannerStatus = KieScannerStatus.STARTED; setScannerStatus(); updateViewState(); } }, new ErrorCallback<Object>() { @Override public boolean error(final Object o, final Throwable throwable) { notification.fire(new NotificationEvent(view.getStartScannerErrorMessage(), NotificationEvent.NotificationType.ERROR)); updateViewState(); return false; } }).startScanner(containerSpec, actualInterval); } @Inject  ContainerRulesConfigPresenter(final Logger logger,
                                         final View view,
                                         final Caller<RuleCapabilitiesService> ruleCapabilitiesService,
                                         final Event<NotificationEvent> notification); }
ContainerRulesConfigPresenter { public void startScanner(final String interval, final String timeUnit) { if (interval.trim().isEmpty()) { view.errorOnInterval(); return; } Long actualInterval = calculateInterval(Long.valueOf(checkNotEmpty("interval", interval)), timeUnit); view.disableActions(); ruleCapabilitiesService.call(new RemoteCallback<Void>() { @Override public void callback(final Void response) { scannerStatus = KieScannerStatus.STARTED; setScannerStatus(); updateViewState(); } }, new ErrorCallback<Object>() { @Override public boolean error(final Object o, final Throwable throwable) { notification.fire(new NotificationEvent(view.getStartScannerErrorMessage(), NotificationEvent.NotificationType.ERROR)); updateViewState(); return false; } }).startScanner(containerSpec, actualInterval); } @Inject  ContainerRulesConfigPresenter(final Logger logger,
                                         final View view,
                                         final Caller<RuleCapabilitiesService> ruleCapabilitiesService,
                                         final Event<NotificationEvent> notification); @PostConstruct void init(); View getView(); void setup(final ContainerSpec containerSpec,
                      final RuleConfig ruleConfig); void setVersion(final String version); void startScanner(final String interval,
                             final String timeUnit); void stopScanner(); void scanNow(); void upgrade(final String version); void onConfigUpdate(@Observes final RuleConfigUpdated configUpdated); void onRuleConfigUpdate(@Observes final RuleConfigUpdated configUpdate); }
ContainerRulesConfigPresenter { public void startScanner(final String interval, final String timeUnit) { if (interval.trim().isEmpty()) { view.errorOnInterval(); return; } Long actualInterval = calculateInterval(Long.valueOf(checkNotEmpty("interval", interval)), timeUnit); view.disableActions(); ruleCapabilitiesService.call(new RemoteCallback<Void>() { @Override public void callback(final Void response) { scannerStatus = KieScannerStatus.STARTED; setScannerStatus(); updateViewState(); } }, new ErrorCallback<Object>() { @Override public boolean error(final Object o, final Throwable throwable) { notification.fire(new NotificationEvent(view.getStartScannerErrorMessage(), NotificationEvent.NotificationType.ERROR)); updateViewState(); return false; } }).startScanner(containerSpec, actualInterval); } @Inject  ContainerRulesConfigPresenter(final Logger logger,
                                         final View view,
                                         final Caller<RuleCapabilitiesService> ruleCapabilitiesService,
                                         final Event<NotificationEvent> notification); @PostConstruct void init(); View getView(); void setup(final ContainerSpec containerSpec,
                      final RuleConfig ruleConfig); void setVersion(final String version); void startScanner(final String interval,
                             final String timeUnit); void stopScanner(); void scanNow(); void upgrade(final String version); void onConfigUpdate(@Observes final RuleConfigUpdated configUpdated); void onRuleConfigUpdate(@Observes final RuleConfigUpdated configUpdate);  }