use of org.guvnor.ala.ui.client.events.ProviderSelectedEvent 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();
}
use of org.guvnor.ala.ui.client.events.ProviderSelectedEvent in project kie-wb-common by kiegroup.
the class ProviderPresenterTest method prepareRefreshWithItems.
/**
* Prepares the refresh action. The refresh action only takes place if the provider has been loaded first.
*/
private void prepareRefreshWithItems() {
prepareRuntimesInfo();
// emulate that there are runtimes.
when(runtimeItems.isEmpty()).thenReturn(false);
// emulate that the presenter was initially loaded. If not the refresh button is not available.
presenter.onProviderSelected(new ProviderSelectedEvent(providerKey));
}
use of org.guvnor.ala.ui.client.events.ProviderSelectedEvent in project kie-wb-common by kiegroup.
the class ProviderPresenterTest method testOnRemoveProviderWithNoRuntimesSuccessful.
@Test
public void testOnRemoveProviderWithNoRuntimesSuccessful() {
// emulate that the provider was previously loaded.
prepareRuntimesInfo();
presenter.onProviderSelected(new ProviderSelectedEvent(providerKey));
when(provisioningScreensService.hasRuntimes(providerKey)).thenReturn(false);
presenter.onRemoveProvider();
verify(view, never()).showProviderCantBeDeleted();
verify(view, times(1)).confirmRemove(any(Command.class));
}
use of org.guvnor.ala.ui.client.events.ProviderSelectedEvent in project kie-wb-common by kiegroup.
the class ProviderPresenterTest method testPipelineExecutionDeleted.
@Test
public void testPipelineExecutionDeleted() {
// load the presenter.
prepareRuntimesInfo();
when(runtimeItems.isEmpty()).thenReturn(true);
presenter.onProviderSelected(new ProviderSelectedEvent(providerKey));
PipelineExecutionTraceKey pipelineExecutionTraceKey = mock(PipelineExecutionTraceKey.class);
when(providerStatusPresenter.removeItem(pipelineExecutionTraceKey)).thenReturn(true);
// the provider status presenter is not empty after the removal.
when(providerStatusPresenter.isEmpty()).thenReturn(false);
presenter.onPipelineExecutionChange(new PipelineExecutionChangeEvent(PipelineExecutionChange.DELETED, pipelineExecutionTraceKey));
verify(providerStatusPresenter, times(1)).removeItem(pipelineExecutionTraceKey);
}
use of org.guvnor.ala.ui.client.events.ProviderSelectedEvent 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);
}
Aggregations