Search in sources :

Example 11 with MachineConfigDto

use of org.eclipse.che.api.machine.shared.dto.MachineConfigDto 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());
}
Also used : WorkspaceRuntimeDto(org.eclipse.che.api.workspace.shared.dto.WorkspaceRuntimeDto) MachineDto(org.eclipse.che.api.machine.shared.dto.MachineDto) HashMap(java.util.HashMap) EnvironmentDto(org.eclipse.che.api.workspace.shared.dto.EnvironmentDto) WorkspaceConfigDto(org.eclipse.che.api.workspace.shared.dto.WorkspaceConfigDto) MachineConfigDto(org.eclipse.che.api.machine.shared.dto.MachineConfigDto) Matchers.anyString(org.mockito.Matchers.anyString) Test(org.junit.Test)

Example 12 with MachineConfigDto

use of org.eclipse.che.api.machine.shared.dto.MachineConfigDto in project che by eclipse.

the class CheEnvironmentValidatorTest method shouldFailValidationIfMachineSourceIsNull.

@Test(expectedExceptions = IllegalArgumentException.class, expectedExceptionsMessageRegExp = "Machine '.*' doesn't have source")
public void shouldFailValidationIfMachineSourceIsNull() throws Exception {
    MachineConfigDto config = createMachineConfig();
    config.withSource(null);
    environmentValidator.validateMachine(config);
}
Also used : MachineConfigDto(org.eclipse.che.api.machine.shared.dto.MachineConfigDto) Test(org.testng.annotations.Test)

Example 13 with MachineConfigDto

use of org.eclipse.che.api.machine.shared.dto.MachineConfigDto in project che by eclipse.

the class CheEnvironmentValidatorTest method shouldFailValidationIfLocationIsInvalidUrl.

@Test(expectedExceptions = IllegalArgumentException.class, expectedExceptionsMessageRegExp = "Machine '.*' has invalid source location: 'localhost'")
public void shouldFailValidationIfLocationIsInvalidUrl() throws Exception {
    MachineConfigDto config = createMachineConfig();
    config.withSource(newDto(MachineSourceDto.class).withType("dockerfile").withLocation("localhost"));
    environmentValidator.validateMachine(config);
}
Also used : MachineConfigDto(org.eclipse.che.api.machine.shared.dto.MachineConfigDto) MachineSourceDto(org.eclipse.che.api.machine.shared.dto.MachineSourceDto) Test(org.testng.annotations.Test)

Example 14 with MachineConfigDto

use of org.eclipse.che.api.machine.shared.dto.MachineConfigDto in project che by eclipse.

the class CheEnvironmentValidatorTest method shouldFailValidationIfEnvVarNameIsEmpty.

@Test(expectedExceptions = IllegalArgumentException.class, expectedExceptionsMessageRegExp = "Machine '.*' contains environment variable with null or empty name")
public void shouldFailValidationIfEnvVarNameIsEmpty() throws Exception {
    MachineConfigDto config = createMachineConfig();
    config.getEnvVariables().put("", "value");
    environmentValidator.validateMachine(config);
}
Also used : MachineConfigDto(org.eclipse.che.api.machine.shared.dto.MachineConfigDto) Test(org.testng.annotations.Test)

Example 15 with MachineConfigDto

use of org.eclipse.che.api.machine.shared.dto.MachineConfigDto in project che by eclipse.

the class CheEnvironmentValidatorTest method shouldFailValidationIfMachineNameIsEmpty.

@Test(expectedExceptions = IllegalArgumentException.class, expectedExceptionsMessageRegExp = "Machine name is null or empty")
public void shouldFailValidationIfMachineNameIsEmpty() throws Exception {
    MachineConfigDto config = createMachineConfig();
    config.withName("");
    environmentValidator.validateMachine(config);
}
Also used : MachineConfigDto(org.eclipse.che.api.machine.shared.dto.MachineConfigDto) Test(org.testng.annotations.Test)

Aggregations

MachineConfigDto (org.eclipse.che.api.machine.shared.dto.MachineConfigDto)23 Test (org.testng.annotations.Test)13 Test (org.junit.Test)7 MachineDto (org.eclipse.che.api.machine.shared.dto.MachineDto)5 MachineEntity (org.eclipse.che.ide.api.machine.MachineEntity)5 IsWidget (com.google.gwt.user.client.ui.IsWidget)4 ArrayList (java.util.ArrayList)4 Matchers.anyString (org.mockito.Matchers.anyString)4 HashMap (java.util.HashMap)3 MachineSourceDto (org.eclipse.che.api.machine.shared.dto.MachineSourceDto)3 EnvironmentDto (org.eclipse.che.api.workspace.shared.dto.EnvironmentDto)3 WorkspaceConfigDto (org.eclipse.che.api.workspace.shared.dto.WorkspaceConfigDto)3 WorkspaceRuntimeDto (org.eclipse.che.api.workspace.shared.dto.WorkspaceRuntimeDto)3 ProcessTreeNode (org.eclipse.che.ide.extension.machine.client.processes.ProcessTreeNode)3 CommandOutputConsole (org.eclipse.che.ide.extension.machine.client.outputspanel.console.CommandOutputConsole)2 TerminalPresenter (org.eclipse.che.ide.extension.machine.client.perspective.terminal.TerminalPresenter)2 List (java.util.List)1 MachineLimitsDto (org.eclipse.che.api.machine.shared.dto.MachineLimitsDto)1 MachineProcessDto (org.eclipse.che.api.machine.shared.dto.MachineProcessDto)1 ServerConfDto (org.eclipse.che.api.machine.shared.dto.ServerConfDto)1