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());
}
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);
}
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);
}
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);
}
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);
}
Aggregations