Search in sources :

Example 31 with Machine

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

the class ProcessesPanelPresenter method onDownloadWorkspaceOutput.

@Override
public void onDownloadWorkspaceOutput(DownloadWorkspaceOutputEvent event) {
    Machine devMachine = null;
    for (ProcessTreeNode machineNode : machineNodes.values()) {
        if (!(machineNode.getData() instanceof Machine)) {
            continue;
        }
        Machine machine = (Machine) machineNode.getData();
        if (!machine.getConfig().isDev()) {
            continue;
        }
        devMachine = machine;
        break;
    }
    if (devMachine == null) {
        return;
    }
    String fileName = appContext.getWorkspace().getNamespace() + "-" + appContext.getWorkspace().getConfig().getName() + " " + DateTimeFormat.getFormat("yyyy-MM-dd HH:mm:ss").format(new Date()) + ".log";
    download(fileName, getText(devMachine.getId()));
}
Also used : ProcessTreeNode(org.eclipse.che.ide.extension.machine.client.processes.ProcessTreeNode) ExtendedMachine(org.eclipse.che.api.core.model.workspace.ExtendedMachine) Machine(org.eclipse.che.api.core.model.machine.Machine) Date(java.util.Date)

Example 32 with Machine

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

the class RunCommandActionTest method actionShouldBePerformed.

@Test
public void actionShouldBePerformed() {
    when(event.getParameters()).thenReturn(Collections.singletonMap(NAME_PROPERTY, "MCI"));
    final DevMachine devMachine = mock(DevMachine.class);
    final Machine machine = mock(Machine.class);
    when(devMachine.getDescriptor()).thenReturn(machine);
    when(appContext.getDevMachine()).thenReturn(devMachine);
    action.actionPerformed(event);
    verify(commandManager).executeCommand(eq(command), any(Machine.class));
}
Also used : DevMachine(org.eclipse.che.ide.api.machine.DevMachine) DevMachine(org.eclipse.che.ide.api.machine.DevMachine) Machine(org.eclipse.che.api.core.model.machine.Machine) Test(org.junit.Test)

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