@Override public void stopRuntime(final RuntimeKey runtimeKey) { checkNotNull("runtimeKey", runtimeKey); runtimeProvisioningService.stopRuntime(runtimeKey.getId()); runtimeChangeEvent.fire(new RuntimeChangeEvent(RuntimeChange.STOPPED, runtimeKey)); }
@Override public void startRuntime(final RuntimeKey runtimeKey) { checkNotNull("runtimeKey", runtimeKey); runtimeProvisioningService.startRuntime(runtimeKey.getId()); runtimeChangeEvent.fire(new RuntimeChangeEvent(RuntimeChange.STARTED, runtimeKey)); }
@Override public void deleteRuntime(final RuntimeKey runtimeKey, final boolean forced) { checkNotNull("runtimeKey", runtimeKey); runtimeProvisioningService.destroyRuntime(runtimeKey.getId(), forced); runtimeChangeEvent.fire(new RuntimeChangeEvent(RuntimeChange.DELETED, runtimeKey)); }
@Override public RuntimeListItem getRuntimeItem(final RuntimeKey runtimeKey) { checkNotNull("runtimeKey", runtimeKey); final RuntimeQuery query = RuntimeQueryBuilder.newInstance() .withRuntimeId(runtimeKey.getId()) .build(); return buildRuntimeQueryResult(runtimeProvisioningService.executeQuery(query)).stream() .findFirst() .orElse(null); }
private RemoteCallback<Void> getDeleteRuntimeSuccessCallback() { return aVoid -> { popupHelper.hideBusyIndicator(); notification.fire(new NotificationEvent(translationService.format(RuntimePresenter_RuntimeDeleteSuccessMessage, item.getRuntime().getKey().getId()), NotificationEvent.NotificationType.SUCCESS)); }; }
private RemoteCallback<Void> getStartRuntimeSuccessCallback() { return aVoid -> { popupHelper.hideBusyIndicator(); notification.fire(new NotificationEvent(translationService.format(RuntimePresenter_RuntimeStartSuccessMessage, item.getRuntime().getKey().getId()), NotificationEvent.NotificationType.SUCCESS)); }; }
protected RemoteCallback<Void> getStopRuntimeSuccessCallback() { return aVoid -> { popupHelper.hideBusyIndicator(); notification.fire(new NotificationEvent(translationService.format(RuntimePresenter_RuntimeStopSuccessMessage, item.getRuntime().getKey().getId()), NotificationEvent.NotificationType.SUCCESS)); }; }
private RemoteCallback<Void> getStartRuntimeSuccessCallback() { return aVoid -> { popupHelper.hideBusyIndicator(); notification.fire(new NotificationEvent(translationService.format(RuntimePresenter_RuntimeStartSuccessMessage, item.getRuntime().getKey().getId()), NotificationEvent.NotificationType.SUCCESS)); }; }
protected RemoteCallback<Void> getStopRuntimeSuccessCallback() { return aVoid -> { popupHelper.hideBusyIndicator(); notification.fire(new NotificationEvent(translationService.format(RuntimePresenter_RuntimeStopSuccessMessage, item.getRuntime().getKey().getId()), NotificationEvent.NotificationType.SUCCESS)); }; }
private RemoteCallback<Void> getDeleteRuntimeSuccessCallback() { return aVoid -> { popupHelper.hideBusyIndicator(); notification.fire(new NotificationEvent(translationService.format(RuntimePresenter_RuntimeDeleteSuccessMessage, item.getRuntime().getKey().getId()), NotificationEvent.NotificationType.SUCCESS)); }; }
@Test public void testStartRuntimeSuccessful() { prepareRuntime(); RuntimeKey currentKey = runtime.getKey(); when(translationService.format(RuntimePresenter_RuntimeStartSuccessMessage, currentKey.getId())).thenReturn(SUCCESS_MESSAGE); when(translationService.getTranslation(RuntimePresenter_RuntimeStartingMessage)).thenReturn(BUSY_POPUP_MESSAGE); presenter.startRuntime(); verify(popupHelper, times(1)).showBusyIndicator(BUSY_POPUP_MESSAGE); verify(popupHelper, times(1)).hideBusyIndicator(); verify(notificationEvent, times(1)).fire(new NotificationEvent(SUCCESS_MESSAGE, NotificationEvent.NotificationType.SUCCESS)); }
@Test public void testStartRuntimeSuccessful() { prepareRuntime(); RuntimeKey currentKey = runtime.getKey(); when(translationService.format(RuntimePresenter_RuntimeStartSuccessMessage, currentKey.getId())).thenReturn(SUCCESS_MESSAGE); when(translationService.getTranslation(RuntimePresenter_RuntimeStartingMessage)).thenReturn(BUSY_POPUP_MESSAGE); presenter.startRuntime(); verify(popupHelper, times(1)).showBusyIndicator(BUSY_POPUP_MESSAGE); verify(popupHelper, times(1)).hideBusyIndicator(); verify(notificationEvent, times(1)).fire(new NotificationEvent(SUCCESS_MESSAGE, NotificationEvent.NotificationType.SUCCESS)); }
@Test public void testDeleteRuntimeConfirmYesAndSuccessful() { prepareRuntimeDelete(); RuntimeKey currentKey = runtime.getKey(); when(translationService.format(RuntimePresenter_RuntimeDeleteSuccessMessage, item.getRuntime().getKey().getId())).thenReturn(SUCCESS_MESSAGE); when(translationService.getTranslation(RuntimePresenter_RuntimeDeletingMessage)).thenReturn(BUSY_POPUP_MESSAGE); yesCommandCaptor.getValue().execute(); verify(runtimeService, times(1)).deleteRuntime(currentKey, false); verify(popupHelper, times(1)).showBusyIndicator(BUSY_POPUP_MESSAGE); verify(popupHelper, times(1)).hideBusyIndicator(); verify(notificationEvent, times(1)).fire(new NotificationEvent(SUCCESS_MESSAGE, NotificationEvent.NotificationType.SUCCESS)); }
@Test public void testStopRuntimeConfirmYesAndSuccessful() { prepareRuntimeStop(); RuntimeKey currentKey = runtime.getKey(); when(translationService.format(RuntimePresenter_RuntimeStopSuccessMessage, item.getRuntime().getKey().getId())).thenReturn(SUCCESS_MESSAGE); when(translationService.getTranslation(RuntimePresenter_RuntimeStoppingMessage)).thenReturn(BUSY_POPUP_MESSAGE); yesCommandCaptor.getValue().execute(); verify(runtimeService, times(1)).stopRuntime(currentKey); verify(popupHelper, times(1)).showBusyIndicator(BUSY_POPUP_MESSAGE); verify(popupHelper, times(1)).hideBusyIndicator(); verify(notificationEvent, times(1)).fire(new NotificationEvent(SUCCESS_MESSAGE, NotificationEvent.NotificationType.SUCCESS)); }
@Test public void testStopRuntimeConfirmYesAndSuccessful() { prepareRuntimeStop(); RuntimeKey currentKey = runtime.getKey(); when(translationService.format(RuntimePresenter_RuntimeStopSuccessMessage, item.getRuntime().getKey().getId())).thenReturn(SUCCESS_MESSAGE); when(translationService.getTranslation(RuntimePresenter_RuntimeStoppingMessage)).thenReturn(BUSY_POPUP_MESSAGE); yesCommandCaptor.getValue().execute(); verify(runtimeService, times(1)).stopRuntime(currentKey); verify(popupHelper, times(1)).showBusyIndicator(BUSY_POPUP_MESSAGE); verify(popupHelper, times(1)).hideBusyIndicator(); verify(notificationEvent, times(1)).fire(new NotificationEvent(SUCCESS_MESSAGE, NotificationEvent.NotificationType.SUCCESS)); }
@Test public void testDeleteRuntimeConfirmYesAndSuccessful() { prepareRuntimeDelete(); RuntimeKey currentKey = runtime.getKey(); when(translationService.format(RuntimePresenter_RuntimeDeleteSuccessMessage, item.getRuntime().getKey().getId())).thenReturn(SUCCESS_MESSAGE); when(translationService.getTranslation(RuntimePresenter_RuntimeDeletingMessage)).thenReturn(BUSY_POPUP_MESSAGE); yesCommandCaptor.getValue().execute(); verify(runtimeService, times(1)).deleteRuntime(currentKey, false); verify(popupHelper, times(1)).showBusyIndicator(BUSY_POPUP_MESSAGE); verify(popupHelper, times(1)).hideBusyIndicator(); verify(notificationEvent, times(1)).fire(new NotificationEvent(SUCCESS_MESSAGE, NotificationEvent.NotificationType.SUCCESS)); }
@Test public void testForceDeleteRuntimeConfirmYesAndSuccessful() { prepareRuntimeForceDelete(); RuntimeKey currentKey = runtime.getKey(); when(translationService.format(RuntimePresenter_RuntimeDeleteSuccessMessage, item.getRuntime().getKey().getId())).thenReturn(SUCCESS_MESSAGE); when(translationService.getTranslation(RuntimePresenter_RuntimeDeletingForcedMessage)).thenReturn(BUSY_POPUP_MESSAGE); yesCommandCaptor.getValue().execute(); verify(runtimeService, times(1)).deleteRuntime(currentKey, true); verify(notificationEvent, times(1)).fire(new NotificationEvent(SUCCESS_MESSAGE, NotificationEvent.NotificationType.SUCCESS)); verify(popupHelper, times(1)).showBusyIndicator(BUSY_POPUP_MESSAGE); verify(popupHelper, times(1)).hideBusyIndicator(); }
@Test public void testForceDeleteRuntimeConfirmYesAndSuccessful() { prepareRuntimeForceDelete(); RuntimeKey currentKey = runtime.getKey(); when(translationService.format(RuntimePresenter_RuntimeDeleteSuccessMessage, item.getRuntime().getKey().getId())).thenReturn(SUCCESS_MESSAGE); when(translationService.getTranslation(RuntimePresenter_RuntimeDeletingForcedMessage)).thenReturn(BUSY_POPUP_MESSAGE); yesCommandCaptor.getValue().execute(); verify(runtimeService, times(1)).deleteRuntime(currentKey, true); verify(notificationEvent, times(1)).fire(new NotificationEvent(SUCCESS_MESSAGE, NotificationEvent.NotificationType.SUCCESS)); verify(popupHelper, times(1)).showBusyIndicator(BUSY_POPUP_MESSAGE); verify(popupHelper, times(1)).hideBusyIndicator(); }
private void assertRuntime(Runtime runtime) { assertEquals(RUNTIME_ID, runtime.getKey().getId()); assertEquals(PROVIDER_NAME, runtime.getKey().getProviderKey().getProviderTypeKey().getId()); assertEquals(PROVIDER_VERSION, runtime.getKey().getProviderKey().getProviderTypeKey().getVersion()); assertEquals(PROVIDER_NAME, runtime.getKey().getProviderKey().getProviderTypeKey().getId()); assertEquals(PROVIDER_ID, runtime.getKey().getProviderKey().getId()); assertEquals(RUNTIME_ENDPOINT, runtime.getEndpoint()); assertEquals(RUNTIME_STARTED_AT, runtime.getCreatedDate()); assertEquals(RUNTIME_STATUS, runtime.getStatus()); }
private void assertRuntime(Runtime runtime) { assertEquals(RUNTIME_ID, runtime.getKey().getId()); assertEquals(PROVIDER_NAME, runtime.getKey().getProviderKey().getProviderTypeKey().getId()); assertEquals(PROVIDER_VERSION, runtime.getKey().getProviderKey().getProviderTypeKey().getVersion()); assertEquals(PROVIDER_NAME, runtime.getKey().getProviderKey().getProviderTypeKey().getId()); assertEquals(PROVIDER_ID, runtime.getKey().getProviderKey().getId()); assertEquals(RUNTIME_ENDPOINT, runtime.getEndpoint()); assertEquals(RUNTIME_STARTED_AT, runtime.getCreatedDate()); assertEquals(RUNTIME_STATUS, runtime.getStatus()); }