use of org.eclipse.che.api.core.model.workspace.config.ServerConfig in project che-server by eclipse-che.
the class ServerConfigImplTest method testCreateFromEndpointMinimalEndpointShouldTranslateToNullPath.
@Test
public void testCreateFromEndpointMinimalEndpointShouldTranslateToNullPath() {
ServerConfig serverConfig = ServerConfigImpl.createFromEndpoint(new EndpointImpl("name", 123, emptyMap()));
assertNull(serverConfig.getPath());
}
use of org.eclipse.che.api.core.model.workspace.config.ServerConfig in project che-server by eclipse-che.
the class ServerConfigImplTest method testCreateFromEndpointMinimalEndpointShouldTranslateToHttpProtocol.
@Test
public void testCreateFromEndpointMinimalEndpointShouldTranslateToHttpProtocol() {
ServerConfig serverConfig = ServerConfigImpl.createFromEndpoint(new EndpointImpl("name", 123, emptyMap()));
assertEquals(serverConfig.getProtocol(), "http");
}
use of org.eclipse.che.api.core.model.workspace.config.ServerConfig in project che-server by eclipse-che.
the class ServerConfigImplTest method testCreateFromEndpointCustomAttributesShouldPreserveInAttributes.
@Test
public void testCreateFromEndpointCustomAttributesShouldPreserveInAttributes() {
Map<String, String> customAttributes = ImmutableMap.of("k1", "v1", "k2", "v2");
ServerConfig serverConfig = ServerConfigImpl.createFromEndpoint(new EndpointImpl("name", 123, customAttributes));
assertEquals(serverConfig.getAttributes().get("k1"), "v1");
assertEquals(serverConfig.getAttributes().get("k2"), "v2");
assertEquals(serverConfig.getAttributes().size(), 3);
}
use of org.eclipse.che.api.core.model.workspace.config.ServerConfig in project che-server by eclipse-che.
the class InternalEnvironmentFactoryTest method shouldUseNormalizedServersWhileInternalEnvironmentCreation.
@Test
public void shouldUseNormalizedServersWhileInternalEnvironmentCreation() throws Exception {
// given
ServerConfigImpl server = new ServerConfigImpl("8080", "http", "/api", singletonMap("key", "value"));
Map<String, ServerConfig> normalizedServers = ImmutableMap.of("server", mock(ServerConfig.class));
doReturn(normalizedServers).when(environmentFactory).normalizeServers(any());
ImmutableMap<String, ServerConfigImpl> sourceServers = ImmutableMap.of("server", server);
MachineConfigImpl machineConfig = new MachineConfigImpl(sourceServers, null, null, null);
EnvironmentImpl env = new EnvironmentImpl(null, ImmutableMap.of("machine", machineConfig));
// when
environmentFactory.create(env);
// then
verify(environmentFactory).normalizeServers(sourceServers);
verify(environmentFactory).doCreate(any(), machinesCaptor.capture(), any());
Map<String, InternalMachineConfig> internalMachines = machinesCaptor.getValue();
assertEquals(internalMachines.get("machine").getServers(), normalizedServers);
}
use of org.eclipse.che.api.core.model.workspace.config.ServerConfig in project che-server by eclipse-che.
the class ServerConfigImplTest method testCreateFromEndpointTranslatePath.
@Test
public void testCreateFromEndpointTranslatePath() {
ServerConfig serverConfig = ServerConfigImpl.createFromEndpoint(new EndpointImpl("name", 123, singletonMap("path", "hello")));
assertEquals(serverConfig.getPath(), "hello");
}
Aggregations