use of org.eclipse.che.api.machine.shared.dto.MachineDto in project che by eclipse.
the class WorkspaceEventsHandlerTest method onWsAgentOutputEventReceivedTest.
@Test
public void onWsAgentOutputEventReceivedTest() throws Exception {
WorkspaceRuntimeDto runtime = mock(WorkspaceRuntimeDto.class);
WorkspaceConfigDto workspaceConfig = mock(WorkspaceConfigDto.class);
when(workspace.getRuntime()).thenReturn(runtime);
MachineDto devMachine = mock(MachineDto.class);
when(devMachine.getWorkspaceId()).thenReturn(WORKSPACE_ID);
when(devMachine.getId()).thenReturn(MACHINE_NAME);
when(runtime.getDevMachine()).thenReturn(devMachine);
when(runtime.getActiveEnv()).thenReturn(ACTIVE_ENV);
when(workspace.getConfig()).thenReturn(workspaceConfig);
Map<String, EnvironmentDto> environments = new HashMap<>(3);
EnvironmentDto environment = mock(EnvironmentDto.class);
environments.put(ACTIVE_ENV, environment);
when(workspaceConfig.getEnvironments()).thenReturn(environments);
MachineConfigDto devMachineConfig = mock(MachineConfigDto.class);
when(devMachineConfig.getName()).thenReturn(MACHINE_NAME);
workspaceEventsHandler.trackWorkspaceEvents(workspace, callback);
workspaceEventsHandler.wsAgentLogSubscriptionHandler.onMessageReceived("");
verify(eventBus).fireEvent(Matchers.<EnvironmentOutputEvent>anyObject());
}
use of org.eclipse.che.api.machine.shared.dto.MachineDto in project che by eclipse.
the class SelectCommandComboBox method getMachines.
private List<MachineEntity> getMachines(Workspace workspace) {
WorkspaceRuntime workspaceRuntime = workspace.getRuntime();
if (workspaceRuntime == null) {
return emptyList();
}
List<? extends Machine> runtimeMachines = workspaceRuntime.getMachines();
List<MachineEntity> machines = new ArrayList<>(runtimeMachines.size());
for (Machine machine : runtimeMachines) {
if (machine instanceof MachineDto) {
MachineEntity machineEntity = entityFactory.createMachine((MachineDto) machine);
machines.add(machineEntity);
}
}
return machines;
}
use of org.eclipse.che.api.machine.shared.dto.MachineDto in project che by eclipse.
the class MachinePanelPresenter method getMachines.
private List<MachineEntity> getMachines(Workspace workspace) {
WorkspaceRuntime workspaceRuntime = workspace.getRuntime();
if (workspaceRuntime == null) {
return emptyList();
}
List<? extends Machine> runtimeMachines = workspaceRuntime.getMachines();
List<MachineEntity> machines = new ArrayList<>(runtimeMachines.size());
for (Machine machine : runtimeMachines) {
if (machine instanceof MachineDto) {
MachineEntity machineEntity = entityFactory.createMachine((MachineDto) machine);
machines.add(machineEntity);
}
}
return machines;
}
use of org.eclipse.che.api.machine.shared.dto.MachineDto in project che by eclipse.
the class WorkspaceEventsHandlerTest method shouldSubscribeOnWsAgentOutputWhenWorkspaceIsRunningAfterRefreshPage.
@Test
public void shouldSubscribeOnWsAgentOutputWhenWorkspaceIsRunningAfterRefreshPage() throws Exception {
WorkspaceRuntimeDto runtime = mock(WorkspaceRuntimeDto.class);
WorkspaceConfigDto workspaceConfig = mock(WorkspaceConfigDto.class);
when(workspace.getRuntime()).thenReturn(runtime);
MachineDto devMachine = mock(MachineDto.class);
when(devMachine.getWorkspaceId()).thenReturn(WORKSPACE_ID);
when(devMachine.getId()).thenReturn(MACHINE_NAME);
when(runtime.getDevMachine()).thenReturn(devMachine);
when(runtime.getActiveEnv()).thenReturn(ACTIVE_ENV);
when(workspace.getConfig()).thenReturn(workspaceConfig);
Map<String, EnvironmentDto> environments = new HashMap<>(3);
EnvironmentDto environment = mock(EnvironmentDto.class);
environments.put(ACTIVE_ENV, environment);
when(workspaceConfig.getEnvironments()).thenReturn(environments);
MachineConfigDto devMachineConfig = mock(MachineConfigDto.class);
when(devMachineConfig.getName()).thenReturn(MACHINE_NAME);
workspaceEventsHandler.trackWorkspaceEvents(workspace, callback);
verify(messageBus).subscribe(eq(WS_AGENT_LOG_CHANNEL), (MessageHandler) anyObject());
}
use of org.eclipse.che.api.machine.shared.dto.MachineDto in project che by eclipse.
the class GdbConfigurationPagePresenter method getMachines.
private List<Machine> getMachines() {
Workspace workspace = appContext.getWorkspace();
if (workspace == null || workspace.getRuntime() == null) {
return emptyList();
}
List<? extends Machine> runtimeMachines = workspace.getRuntime().getMachines();
List<Machine> machines = new ArrayList<>(runtimeMachines.size());
for (Machine currentMachine : runtimeMachines) {
if (currentMachine instanceof MachineDto) {
Machine machine = entityFactory.createMachine((MachineDto) currentMachine);
machines.add(machine);
}
}
return machines;
}
Aggregations