use of org.eclipse.che.api.machine.shared.dto.MachineConfigDto in project che by eclipse.
the class CheEnvironmentValidatorTest method shouldFailValidationIfMachineTypeIsNotDocker.
@Test(expectedExceptions = IllegalArgumentException.class, expectedExceptionsMessageRegExp = "Type 'compose' of machine '.*' is not supported. Supported values are: docker, ssh.")
public void shouldFailValidationIfMachineTypeIsNotDocker() throws Exception {
MachineConfigDto config = createMachineConfig();
config.withType("compose");
environmentValidator.validateMachine(config);
}
use of org.eclipse.che.api.machine.shared.dto.MachineConfigDto in project che by eclipse.
the class CheEnvironmentValidatorTest method shouldFailValidationIfEnvVarValueIsNull.
@Test(expectedExceptions = IllegalArgumentException.class, expectedExceptionsMessageRegExp = "Machine '.*' contains environment variable 'key' with null value")
public void shouldFailValidationIfEnvVarValueIsNull() throws Exception {
MachineConfigDto config = createMachineConfig();
config.getEnvVariables().put("key", null);
environmentValidator.validateMachine(config);
}
use of org.eclipse.che.api.machine.shared.dto.MachineConfigDto in project che by eclipse.
the class CheEnvironmentValidatorTest method shouldFailValidationIfMachineNameIsNull.
@Test(expectedExceptions = IllegalArgumentException.class, expectedExceptionsMessageRegExp = "Machine name is null or empty")
public void shouldFailValidationIfMachineNameIsNull() throws Exception {
MachineConfigDto config = createMachineConfig();
config.withName(null);
environmentValidator.validateMachine(config);
}
use of org.eclipse.che.api.machine.shared.dto.MachineConfigDto in project che by eclipse.
the class WorkspaceEventsHandlerTest method shouldSubscribesOnWsAgentOutputWhenWorkspaceIsStarting.
// @Test disabled because of GWT timer usage
public void shouldSubscribesOnWsAgentOutputWhenWorkspaceIsStarting() throws Exception {
WorkspaceRuntimeDto runtime = mock(WorkspaceRuntimeDto.class);
WorkspaceConfigDto workspaceConfig = mock(WorkspaceConfigDto.class);
when(workspaceStatusEvent.getEventType()).thenReturn(STARTING);
when(workspace.getRuntime()).thenReturn(runtime);
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.workspaceStatusSubscriptionHandler.onMessageReceived(workspaceStatusEvent);
verify(workspacePromise).then(workspaceCaptor.capture());
workspaceCaptor.getValue().apply(workspace);
verify(messageBus, times(2)).subscribe(eq(WS_AGENT_LOG_CHANNEL), (MessageHandler) anyObject());
}
use of org.eclipse.che.api.machine.shared.dto.MachineConfigDto 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());
}
Aggregations