use of org.eclipse.che.api.machine.shared.dto.MachineProcessDto in project che by eclipse.
the class ProcessesPanelPresenterTest method commandShouldBeRestoredWhenWsAgentIsStarted.
@Test
public void commandShouldBeRestoredWhenWsAgentIsStarted() throws Exception {
WsAgentStateEvent event = mock(WsAgentStateEvent.class);
MachineEntity machineEntity = mock(MachineEntity.class);
MachineDto machine = mock(MachineDto.class);
when(machineEntity.getId()).thenReturn(MACHINE_ID);
when(machineEntity.getWorkspaceId()).thenReturn(WORKSPACE_ID);
when(entityFactory.createMachine(machine)).thenReturn(machineEntity);
MachineConfigDto machineConfigDto = mock(MachineConfigDto.class);
when(machine.getConfig()).thenReturn(machineConfigDto);
when(machineConfigDto.isDev()).thenReturn(true);
when(machine.getStatus()).thenReturn(MachineStatus.RUNNING);
List<MachineDto> machines = new ArrayList<>(2);
machines.add(machine);
when(workspaceRuntime.getMachines()).thenReturn(machines);
MachineProcessDto machineProcessDto = mock(MachineProcessDto.class);
when(machineProcessDto.getOutputChannel()).thenReturn(OUTPUT_CHANNEL);
when(machineProcessDto.getPid()).thenReturn(PID);
List<MachineProcessDto> processes = new ArrayList<>(1);
processes.add(machineProcessDto);
CommandOutputConsole outputConsole = mock(CommandOutputConsole.class);
CommandType commandType = mock(CommandType.class);
when(commandTypeRegistry.getCommandTypeById(anyString())).thenReturn(commandType);
when(commandConsoleFactory.create(anyObject(), any(org.eclipse.che.api.core.model.machine.Machine.class))).thenReturn(outputConsole);
presenter.onWsAgentStarted(event);
}
Aggregations