Search in sources :

Example 16 with Machine

use of org.eclipse.che.api.core.model.machine.Machine in project che by eclipse.

the class SshMachineInstanceProviderTest method shouldThrowExceptionOnDevMachineCreationFromRecipe.

@Test(expectedExceptions = MachineException.class, expectedExceptionsMessageRegExp = "Dev machine is not supported for Ssh machine implementation")
public void shouldThrowExceptionOnDevMachineCreationFromRecipe() throws Exception {
    Machine machine = createMachine(true);
    provider.createInstance(machine, LineConsumer.DEV_NULL);
}
Also used : Machine(org.eclipse.che.api.core.model.machine.Machine) Test(org.testng.annotations.Test)

Example 17 with Machine

use of org.eclipse.che.api.core.model.machine.Machine in project che by eclipse.

the class ServerPortProvider method registerProviders.

private void registerProviders() {
    Machine devMachine = appContext.getDevMachine();
    if (devMachine != null) {
        providers = getProviders(devMachine);
        commandPropertyRegistry.register(providers);
    }
}
Also used : Machine(org.eclipse.che.api.core.model.machine.Machine)

Example 18 with Machine

use of org.eclipse.che.api.core.model.machine.Machine in project che by eclipse.

the class ExecuteSelectedCommandAction method actionPerformed.

@Override
public void actionPerformed(ActionEvent e) {
    CommandImpl command = selectCommandAction.getSelectedCommand();
    Machine machine = selectCommandAction.getSelectedMachine();
    if (command != null && machine != null) {
        commandManager.executeCommand(command, machine);
    }
}
Also used : CommandImpl(org.eclipse.che.ide.api.command.CommandImpl) Machine(org.eclipse.che.api.core.model.machine.Machine)

Example 19 with Machine

use of org.eclipse.che.api.core.model.machine.Machine 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;
}
Also used : MachineEntity(org.eclipse.che.ide.api.machine.MachineEntity) MachineDto(org.eclipse.che.api.machine.shared.dto.MachineDto) WorkspaceRuntime(org.eclipse.che.api.core.model.workspace.WorkspaceRuntime) ArrayList(java.util.ArrayList) Machine(org.eclipse.che.api.core.model.machine.Machine)

Example 20 with Machine

use of org.eclipse.che.api.core.model.machine.Machine 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;
}
Also used : MachineEntity(org.eclipse.che.ide.api.machine.MachineEntity) MachineDto(org.eclipse.che.api.machine.shared.dto.MachineDto) WorkspaceRuntime(org.eclipse.che.api.core.model.workspace.WorkspaceRuntime) ArrayList(java.util.ArrayList) Machine(org.eclipse.che.api.core.model.machine.Machine)

Aggregations

Machine (org.eclipse.che.api.core.model.machine.Machine)32 ArrayList (java.util.ArrayList)15 ExtendedMachine (org.eclipse.che.api.core.model.workspace.ExtendedMachine)13 LineConsumer (org.eclipse.che.api.core.util.LineConsumer)12 CheServiceImpl (org.eclipse.che.api.environment.server.model.CheServiceImpl)12 Matchers.anyString (org.mockito.Matchers.anyString)11 Test (org.testng.annotations.Test)11 Map (java.util.Map)9 Instance (org.eclipse.che.api.machine.server.spi.Instance)9 HashMap (java.util.HashMap)8 List (java.util.List)8 ServerConfImpl (org.eclipse.che.api.machine.server.model.impl.ServerConfImpl)8 ServerException (org.eclipse.che.api.core.ServerException)7 CheServicesEnvironmentImpl (org.eclipse.che.api.environment.server.model.CheServicesEnvironmentImpl)7 EnvironmentContext (org.eclipse.che.commons.env.EnvironmentContext)7 Arrays.asList (java.util.Arrays.asList)6 Collections (java.util.Collections)6 Collections.singletonMap (java.util.Collections.singletonMap)6 NotFoundException (org.eclipse.che.api.core.NotFoundException)6 MachineConfig (org.eclipse.che.api.core.model.machine.MachineConfig)6