use of org.eclipse.che.api.core.model.workspace.config.ServerConfig in project devspaces-images by redhat-developer.
the class ServerConfigImplTest method testCreateFromEndpointDevfileEndpointAttributeNotSetWhenDefault.
@Test
public void testCreateFromEndpointDevfileEndpointAttributeNotSetWhenDefault() {
ServerConfig serverConfig = ServerConfigImpl.createFromEndpoint(new EndpointImpl("name", 123, new HashMap<>()));
assertFalse(serverConfig.getAttributes().containsKey(REQUIRE_SUBDOMAIN));
}
use of org.eclipse.che.api.core.model.workspace.config.ServerConfig in project devspaces-images by redhat-developer.
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 devspaces-images by redhat-developer.
the class ServerConfigImplTest method testCreateFromEndpointTranslatePublicWhatever.
@Test
public void testCreateFromEndpointTranslatePublicWhatever() {
ServerConfig serverConfig = ServerConfigImpl.createFromEndpoint(new EndpointImpl("name", 123, singletonMap("public", "whatever")));
assertFalse(serverConfig.isInternal());
}
use of org.eclipse.che.api.core.model.workspace.config.ServerConfig in project devspaces-images by redhat-developer.
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 devspaces-images by redhat-developer.
the class InternalEnvironmentFactoryTest method normalizeServersProtocols.
@Test
public void normalizeServersProtocols() throws InfrastructureException {
ServerConfigImpl serverWithoutProtocol = new ServerConfigImpl("8080", "http", "/api", singletonMap("key", "value"));
ServerConfigImpl udpServer = new ServerConfigImpl("8080/udp", "http", "/api", singletonMap("key", "value"));
ServerConfigImpl normalizedServer = new ServerConfigImpl("8080/tcp", "http", "/api", singletonMap("key", "value"));
Map<String, ServerConfig> servers = new HashMap<>();
servers.put("serverWithoutProtocol", serverWithoutProtocol);
servers.put("udpServer", udpServer);
Map<String, ServerConfig> normalizedServers = environmentFactory.normalizeServers(servers);
assertEquals(normalizedServers, ImmutableMap.of("serverWithoutProtocol", normalizedServer, "udpServer", udpServer));
}
Aggregations