Search in sources :

Example 6 with RuntimeKey

use of org.guvnor.ala.ui.model.RuntimeKey in project kie-wb-common by kiegroup.

the class RuntimePresenterTest method mockRuntime.

protected Runtime mockRuntime() {
    ProviderTypeKey providerTypeKey = mockProviderTypeKey("1");
    ProviderKey providerKey = mockProviderKey(providerTypeKey, "1");
    RuntimeKey runtimeKey = new RuntimeKey(providerKey, RUNTIME_ID);
    Runtime runtime = new Runtime(runtimeKey, RUNTIME_NAME, null, RUNTIME_STATUS, ENDPOINT, CREATED_DATE);
    return runtime;
}
Also used : Runtime(org.guvnor.ala.ui.model.Runtime) ProviderKey(org.guvnor.ala.ui.model.ProviderKey) ProvisioningManagementTestCommons.mockProviderKey(org.guvnor.ala.ui.ProvisioningManagementTestCommons.mockProviderKey) RuntimeKey(org.guvnor.ala.ui.model.RuntimeKey) ProviderTypeKey(org.guvnor.ala.ui.model.ProviderTypeKey) ProvisioningManagementTestCommons.mockProviderTypeKey(org.guvnor.ala.ui.ProvisioningManagementTestCommons.mockProviderTypeKey)

Example 7 with RuntimeKey

use of org.guvnor.ala.ui.model.RuntimeKey in project kie-wb-common by kiegroup.

the class RuntimeServiceImplTest method testStopRuntime.

@Test
public void testStopRuntime() {
    ProviderKey providerKey = mock(ProviderKey.class);
    RuntimeKey runtimeKey = new RuntimeKey(providerKey, RUNTIME_ID);
    service.stopRuntime(runtimeKey);
    verify(runtimeProvisioningService, times(1)).stopRuntime(RUNTIME_ID);
    verify(runtimeChangeEvent, times(1)).fire(new RuntimeChangeEvent(RuntimeChange.STOPPED, runtimeKey));
}
Also used : ProviderKey(org.guvnor.ala.ui.model.ProviderKey) RuntimeKey(org.guvnor.ala.ui.model.RuntimeKey) RuntimeChangeEvent(org.guvnor.ala.ui.events.RuntimeChangeEvent) Test(org.junit.Test)

Example 8 with RuntimeKey

use of org.guvnor.ala.ui.model.RuntimeKey in project kie-wb-common by kiegroup.

the class RuntimeServiceImplTest method testStartRuntime.

@Test
public void testStartRuntime() {
    ProviderKey providerKey = mock(ProviderKey.class);
    RuntimeKey runtimeKey = new RuntimeKey(providerKey, RUNTIME_ID);
    service.startRuntime(runtimeKey);
    verify(runtimeProvisioningService, times(1)).startRuntime(RUNTIME_ID);
    verify(runtimeChangeEvent, times(1)).fire(new RuntimeChangeEvent(RuntimeChange.STARTED, runtimeKey));
}
Also used : ProviderKey(org.guvnor.ala.ui.model.ProviderKey) RuntimeKey(org.guvnor.ala.ui.model.RuntimeKey) RuntimeChangeEvent(org.guvnor.ala.ui.events.RuntimeChangeEvent) Test(org.junit.Test)

Example 9 with RuntimeKey

use of org.guvnor.ala.ui.model.RuntimeKey in project kie-wb-common by kiegroup.

the class ProviderPresenterTest method testOnRuntimeDeletedRefreshRequired.

@Test
public void testOnRuntimeDeletedRefreshRequired() {
    // load the presenter.
    prepareRuntimesInfo();
    when(runtimeItems.isEmpty()).thenReturn(true);
    presenter.onProviderSelected(new ProviderSelectedEvent(providerKey));
    RuntimeKey runtimeKey = mock(RuntimeKey.class);
    when(runtimeKey.getProviderKey()).thenReturn(providerKey);
    when(providerStatusPresenter.removeItem(runtimeKey)).thenReturn(true);
    // the provider status presenter is empty after the removal.
    when(providerStatusPresenter.isEmpty()).thenReturn(true);
    presenter.onRuntimeChange(new RuntimeChangeEvent(RuntimeChange.DELETED, runtimeKey));
    verify(providerStatusPresenter, times(1)).removeItem(runtimeKey);
    verify(presenter, times(1)).refresh();
}
Also used : ProviderSelectedEvent(org.guvnor.ala.ui.client.events.ProviderSelectedEvent) RuntimeKey(org.guvnor.ala.ui.model.RuntimeKey) RuntimeChangeEvent(org.guvnor.ala.ui.events.RuntimeChangeEvent) Test(org.junit.Test)

Example 10 with RuntimeKey

use of org.guvnor.ala.ui.model.RuntimeKey in project kie-wb-common by kiegroup.

the class ProviderPresenterTest method testOnRuntimeDeleted.

@Test
public void testOnRuntimeDeleted() {
    // load the presenter.
    prepareRuntimesInfo();
    when(runtimeItems.isEmpty()).thenReturn(true);
    presenter.onProviderSelected(new ProviderSelectedEvent(providerKey));
    RuntimeKey runtimeKey = mock(RuntimeKey.class);
    when(runtimeKey.getProviderKey()).thenReturn(providerKey);
    when(providerStatusPresenter.removeItem(runtimeKey)).thenReturn(true);
    // the provider status presenter is not empty after the removal.
    when(providerStatusPresenter.isEmpty()).thenReturn(false);
    presenter.onRuntimeChange(new RuntimeChangeEvent(RuntimeChange.DELETED, runtimeKey));
    verify(providerStatusPresenter, times(1)).removeItem(runtimeKey);
}
Also used : ProviderSelectedEvent(org.guvnor.ala.ui.client.events.ProviderSelectedEvent) RuntimeKey(org.guvnor.ala.ui.model.RuntimeKey) RuntimeChangeEvent(org.guvnor.ala.ui.events.RuntimeChangeEvent) Test(org.junit.Test)

Aggregations

RuntimeKey (org.guvnor.ala.ui.model.RuntimeKey)24 Test (org.junit.Test)21 RuntimeChangeEvent (org.guvnor.ala.ui.events.RuntimeChangeEvent)9 ProviderKey (org.guvnor.ala.ui.model.ProviderKey)7 RuntimeListItem (org.guvnor.ala.ui.model.RuntimeListItem)5 NotificationEvent (org.uberfire.workbench.events.NotificationEvent)5 RuntimePresenter_PipelineExecutionAlreadyStoppedMessage (org.guvnor.ala.ui.client.resources.i18n.GuvnorAlaUIConstants.RuntimePresenter_PipelineExecutionAlreadyStoppedMessage)3 RuntimePresenter_PipelineExecutionConfirmDeleteMessage (org.guvnor.ala.ui.client.resources.i18n.GuvnorAlaUIConstants.RuntimePresenter_PipelineExecutionConfirmDeleteMessage)3 RuntimePresenter_PipelineExecutionConfirmStopMessage (org.guvnor.ala.ui.client.resources.i18n.GuvnorAlaUIConstants.RuntimePresenter_PipelineExecutionConfirmStopMessage)3 RuntimePresenter_PipelineExecutionDeleteSuccessMessage (org.guvnor.ala.ui.client.resources.i18n.GuvnorAlaUIConstants.RuntimePresenter_PipelineExecutionDeleteSuccessMessage)3 RuntimePresenter_PipelineExecutionStopSuccessMessage (org.guvnor.ala.ui.client.resources.i18n.GuvnorAlaUIConstants.RuntimePresenter_PipelineExecutionStopSuccessMessage)3 RuntimePresenter_RuntimeConfirmDeleteMessage (org.guvnor.ala.ui.client.resources.i18n.GuvnorAlaUIConstants.RuntimePresenter_RuntimeConfirmDeleteMessage)3 RuntimePresenter_RuntimeConfirmForcedDeleteMessage (org.guvnor.ala.ui.client.resources.i18n.GuvnorAlaUIConstants.RuntimePresenter_RuntimeConfirmForcedDeleteMessage)3 RuntimePresenter_RuntimeConfirmStopMessage (org.guvnor.ala.ui.client.resources.i18n.GuvnorAlaUIConstants.RuntimePresenter_RuntimeConfirmStopMessage)3 RuntimePresenter_RuntimeDeleteFailedMessage (org.guvnor.ala.ui.client.resources.i18n.GuvnorAlaUIConstants.RuntimePresenter_RuntimeDeleteFailedMessage)3 RuntimePresenter_RuntimeDeleteSuccessMessage (org.guvnor.ala.ui.client.resources.i18n.GuvnorAlaUIConstants.RuntimePresenter_RuntimeDeleteSuccessMessage)3 RuntimePresenter_RuntimeDeletingForcedMessage (org.guvnor.ala.ui.client.resources.i18n.GuvnorAlaUIConstants.RuntimePresenter_RuntimeDeletingForcedMessage)3 RuntimePresenter_RuntimeDeletingMessage (org.guvnor.ala.ui.client.resources.i18n.GuvnorAlaUIConstants.RuntimePresenter_RuntimeDeletingMessage)3 RuntimePresenter_RuntimeStartSuccessMessage (org.guvnor.ala.ui.client.resources.i18n.GuvnorAlaUIConstants.RuntimePresenter_RuntimeStartSuccessMessage)3 RuntimePresenter_RuntimeStartingMessage (org.guvnor.ala.ui.client.resources.i18n.GuvnorAlaUIConstants.RuntimePresenter_RuntimeStartingMessage)3