Search in sources :

Example 6 with RuntimeChangeEvent

use of org.guvnor.ala.ui.events.RuntimeChangeEvent 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 7 with RuntimeChangeEvent

use of org.guvnor.ala.ui.events.RuntimeChangeEvent 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)

Example 8 with RuntimeChangeEvent

use of org.guvnor.ala.ui.events.RuntimeChangeEvent in project kie-wb-common by kiegroup.

the class RuntimePresenterActionsTest method testOnCurrentRuntimeStopped.

@Test
public void testOnCurrentRuntimeStopped() {
    prepareRuntime();
    RuntimeKey currentKey = runtime.getKey();
    presenter.onRuntimeChangeEvent(new RuntimeChangeEvent(RuntimeChange.STOPPED, currentKey));
    verify(presenter, times(1)).refresh(currentKey);
}
Also used : RuntimeKey(org.guvnor.ala.ui.model.RuntimeKey) RuntimeChangeEvent(org.guvnor.ala.ui.events.RuntimeChangeEvent) Test(org.junit.Test)

Example 9 with RuntimeChangeEvent

use of org.guvnor.ala.ui.events.RuntimeChangeEvent in project kie-wb-common by kiegroup.

the class RuntimePresenterActionsTest method testOnCurrentRuntimeStarted.

@Test
public void testOnCurrentRuntimeStarted() {
    prepareRuntime();
    RuntimeKey currentKey = runtime.getKey();
    presenter.onRuntimeChangeEvent(new RuntimeChangeEvent(RuntimeChange.STARTED, currentKey));
    verify(presenter, times(1)).refresh(currentKey);
}
Also used : RuntimeKey(org.guvnor.ala.ui.model.RuntimeKey) RuntimeChangeEvent(org.guvnor.ala.ui.events.RuntimeChangeEvent) Test(org.junit.Test)

Example 10 with RuntimeChangeEvent

use of org.guvnor.ala.ui.events.RuntimeChangeEvent in project kie-wb-common by kiegroup.

the class RuntimeServiceImpl method stopRuntime.

@Override
public void stopRuntime(final RuntimeKey runtimeKey) {
    checkNotNull("runtimeKey", runtimeKey);
    runtimeProvisioningService.stopRuntime(runtimeKey.getId());
    runtimeChangeEvent.fire(new RuntimeChangeEvent(RuntimeChange.STOPPED, runtimeKey));
}
Also used : RuntimeChangeEvent(org.guvnor.ala.ui.events.RuntimeChangeEvent)

Aggregations

RuntimeChangeEvent (org.guvnor.ala.ui.events.RuntimeChangeEvent)12 RuntimeKey (org.guvnor.ala.ui.model.RuntimeKey)9 Test (org.junit.Test)8 ProviderKey (org.guvnor.ala.ui.model.ProviderKey)3 ProviderSelectedEvent (org.guvnor.ala.ui.client.events.ProviderSelectedEvent)2