Search in sources :

Example 6 with MachineStateEvent

use of org.eclipse.che.ide.api.machine.events.MachineStateEvent in project che by eclipse.

the class MachinePanelPresenterTest method machineShouldBeRemovedFromTreeWhenItIsDestroyed.

@Test
public void machineShouldBeRemovedFromTreeWhenItIsDestroyed() {
    when(machine1.getId()).thenReturn("machine1");
    MachineStateEvent stateEvent = mock(MachineStateEvent.class);
    when(stateEvent.getMachineId()).thenReturn("machine1");
    when(stateEvent.getMachine()).thenReturn(machine1);
    presenter.onMachineCreating(stateEvent);
    reset(view);
    presenter.onMachineRunning(stateEvent);
    verify(view).selectNode(machineNode1);
    reset(view);
    presenter.onMachineDestroyed(stateEvent);
    verify(view).setData(rootNode);
    verify(view, never()).selectNode(machineNode1);
}
Also used : MachineStateEvent(org.eclipse.che.ide.api.machine.events.MachineStateEvent) Test(org.junit.Test)

Example 7 with MachineStateEvent

use of org.eclipse.che.ide.api.machine.events.MachineStateEvent in project che by eclipse.

the class MachinePanelPresenterTest method machineShouldBeAddedToTreeWhenItIsJustCreated.

@Test
public void machineShouldBeAddedToTreeWhenItIsJustCreated() {
    when(machine1.getId()).thenReturn("machine1");
    MachineStateEvent stateEvent = mock(MachineStateEvent.class);
    when(stateEvent.getMachine()).thenReturn(machine1);
    presenter.onMachineCreating(stateEvent);
    verify(view).setData(rootNode);
    verify(view).selectNode(machineNode1);
    assertThat(presenter.isMachineRunning(), is(false));
}
Also used : MachineStateEvent(org.eclipse.che.ide.api.machine.events.MachineStateEvent) Test(org.junit.Test)

Aggregations

MachineStateEvent (org.eclipse.che.ide.api.machine.events.MachineStateEvent)7 Test (org.junit.Test)4 MachineEntity (org.eclipse.che.ide.api.machine.MachineEntity)3 IsWidget (com.google.gwt.user.client.ui.IsWidget)1 MachineConfigDto (org.eclipse.che.api.machine.shared.dto.MachineConfigDto)1 OutputConsole (org.eclipse.che.ide.api.outputconsole.OutputConsole)1 CommandOutputConsole (org.eclipse.che.ide.extension.machine.client.outputspanel.console.CommandOutputConsole)1