@Test public void testStopContainer() { presenter.loadContainers(containerSpecData); presenter.stopContainer(); verify(view, times(2)).setContainerStartState(State.DISABLED); verify(view, times(2)).setContainerStopState(State.ENABLED); verify(view, times(2)).enableRemoveButton(); final String errorMessage = "ERROR"; when(view.getStopContainerErrorMessage()).thenReturn(errorMessage); doThrow(new RuntimeException()).when(specManagementService).stopContainer(containerSpecData.getContainerSpec()); presenter.stopContainer(); verify(notification).fire(new NotificationEvent(errorMessage, NotificationEvent.NotificationType.ERROR)); verify(view).setContainerStartState(State.ENABLED); verify(view).setContainerStopState(State.DISABLED); verify(view).disableRemoveButton(); }
public void stopContainer() { specManagementService.call(new RemoteCallback<Void>() { @Override public void callback(final Void response) { updateStatus(KieContainerStatus.STOPPED); } }, new ErrorCallback<Object>() { @Override public boolean error(final Object o, final Throwable throwable) { notification.fire(new NotificationEvent(view.getStopContainerErrorMessage(), NotificationEvent.NotificationType.ERROR)); updateStatus(KieContainerStatus.STARTED); return false; } }).stopContainer(containerSpec); }
ContainerPresenter { public void stopContainer() { specManagementService.call(new RemoteCallback<Void>() { @Override public void callback(final Void response) { updateStatus(KieContainerStatus.STOPPED); } }, new ErrorCallback<Object>() { @Override public boolean error(final Object o, final Throwable throwable) { notification.fire(new NotificationEvent(view.getStopContainerErrorMessage(), NotificationEvent.NotificationType.ERROR)); updateStatus(KieContainerStatus.STARTED); return false; } }).stopContainer(containerSpec); } }
ContainerPresenter { public void stopContainer() { specManagementService.call(new RemoteCallback<Void>() { @Override public void callback(final Void response) { updateStatus(KieContainerStatus.STOPPED); } }, new ErrorCallback<Object>() { @Override public boolean error(final Object o, final Throwable throwable) { notification.fire(new NotificationEvent(view.getStopContainerErrorMessage(), NotificationEvent.NotificationType.ERROR)); updateStatus(KieContainerStatus.STARTED); return false; } }).stopContainer(containerSpec); } @Inject  ContainerPresenter(final Logger logger,
                              final View view,
                              final ContainerRemoteStatusPresenter containerRemoteStatusPresenter,
                              final ContainerStatusEmptyPresenter containerStatusEmptyPresenter,
                              final ContainerProcessConfigPresenter containerProcessConfigPresenter,
                              final ContainerRulesConfigPresenter containerRulesConfigPresenter,
                              final Caller<RuntimeManagementService> runtimeManagementService,
                              final Caller<SpecManagementService> specManagementService,
                              final Event<ServerTemplateSelected> serverTemplateSelectedEvent,
                              final Event<NotificationEvent> notification); }
ContainerPresenter { public void stopContainer() { specManagementService.call(new RemoteCallback<Void>() { @Override public void callback(final Void response) { updateStatus(KieContainerStatus.STOPPED); } }, new ErrorCallback<Object>() { @Override public boolean error(final Object o, final Throwable throwable) { notification.fire(new NotificationEvent(view.getStopContainerErrorMessage(), NotificationEvent.NotificationType.ERROR)); updateStatus(KieContainerStatus.STARTED); return false; } }).stopContainer(containerSpec); } @Inject  ContainerPresenter(final Logger logger,
                              final View view,
                              final ContainerRemoteStatusPresenter containerRemoteStatusPresenter,
                              final ContainerStatusEmptyPresenter containerStatusEmptyPresenter,
                              final ContainerProcessConfigPresenter containerProcessConfigPresenter,
                              final ContainerRulesConfigPresenter containerRulesConfigPresenter,
                              final Caller<RuntimeManagementService> runtimeManagementService,
                              final Caller<SpecManagementService> specManagementService,
                              final Event<ServerTemplateSelected> serverTemplateSelectedEvent,
                              final Event<NotificationEvent> notification); @PostConstruct void init(); View getView(); void onRefresh(@Observes final RefreshRemoteServers refresh); void load(@Observes final ContainerSpecSelected containerSpecSelected); void onInstanceUpdated(@Observes ServerInstanceUpdated instanceUpdated); void loadContainers(@Observes final ContainerSpecData content); void refreshOnContainerUpdateEvent(@Observes final ContainerUpdateEvent updateEvent); void refresh(); void load(final ContainerSpecKey containerSpecKey); void removeContainer(); void stopContainer(); void startContainer(); void toggleActivationContainer(); }
ContainerPresenter { public void stopContainer() { specManagementService.call(new RemoteCallback<Void>() { @Override public void callback(final Void response) { updateStatus(KieContainerStatus.STOPPED); } }, new ErrorCallback<Object>() { @Override public boolean error(final Object o, final Throwable throwable) { notification.fire(new NotificationEvent(view.getStopContainerErrorMessage(), NotificationEvent.NotificationType.ERROR)); updateStatus(KieContainerStatus.STARTED); return false; } }).stopContainer(containerSpec); } @Inject  ContainerPresenter(final Logger logger,
                              final View view,
                              final ContainerRemoteStatusPresenter containerRemoteStatusPresenter,
                              final ContainerStatusEmptyPresenter containerStatusEmptyPresenter,
                              final ContainerProcessConfigPresenter containerProcessConfigPresenter,
                              final ContainerRulesConfigPresenter containerRulesConfigPresenter,
                              final Caller<RuntimeManagementService> runtimeManagementService,
                              final Caller<SpecManagementService> specManagementService,
                              final Event<ServerTemplateSelected> serverTemplateSelectedEvent,
                              final Event<NotificationEvent> notification); @PostConstruct void init(); View getView(); void onRefresh(@Observes final RefreshRemoteServers refresh); void load(@Observes final ContainerSpecSelected containerSpecSelected); void onInstanceUpdated(@Observes ServerInstanceUpdated instanceUpdated); void loadContainers(@Observes final ContainerSpecData content); void refreshOnContainerUpdateEvent(@Observes final ContainerUpdateEvent updateEvent); void refresh(); void load(final ContainerSpecKey containerSpecKey); void removeContainer(); void stopContainer(); void startContainer(); void toggleActivationContainer();  }