Search in sources :

Example 31 with ServerConfig

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));
}
Also used : ServerConfig(org.eclipse.che.api.core.model.workspace.config.ServerConfig) HashMap(java.util.HashMap) EndpointImpl(org.eclipse.che.api.workspace.server.model.impl.devfile.EndpointImpl) Test(org.testng.annotations.Test)

Example 32 with ServerConfig

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);
}
Also used : ServerConfig(org.eclipse.che.api.core.model.workspace.config.ServerConfig) EndpointImpl(org.eclipse.che.api.workspace.server.model.impl.devfile.EndpointImpl) Test(org.testng.annotations.Test)

Example 33 with ServerConfig

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());
}
Also used : ServerConfig(org.eclipse.che.api.core.model.workspace.config.ServerConfig) EndpointImpl(org.eclipse.che.api.workspace.server.model.impl.devfile.EndpointImpl) Test(org.testng.annotations.Test)

Example 34 with ServerConfig

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());
}
Also used : ServerConfig(org.eclipse.che.api.core.model.workspace.config.ServerConfig) EndpointImpl(org.eclipse.che.api.workspace.server.model.impl.devfile.EndpointImpl) Test(org.testng.annotations.Test)

Example 35 with ServerConfig

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));
}
Also used : ServerConfig(org.eclipse.che.api.core.model.workspace.config.ServerConfig) HashMap(java.util.HashMap) ServerConfigImpl(org.eclipse.che.api.workspace.server.model.impl.ServerConfigImpl) Test(org.testng.annotations.Test)

Aggregations

ServerConfig (org.eclipse.che.api.core.model.workspace.config.ServerConfig)74 Test (org.testng.annotations.Test)54 ServerConfigImpl (org.eclipse.che.api.workspace.server.model.impl.ServerConfigImpl)42 ServicePort (io.fabric8.kubernetes.api.model.ServicePort)30 IntOrString (io.fabric8.kubernetes.api.model.IntOrString)28 EndpointImpl (org.eclipse.che.api.workspace.server.model.impl.devfile.EndpointImpl)20 ServicePortBuilder (io.fabric8.kubernetes.api.model.ServicePortBuilder)18 HashMap (java.util.HashMap)16 Annotations (org.eclipse.che.workspace.infrastructure.kubernetes.Annotations)16 Service (io.fabric8.kubernetes.api.model.Service)14 KubernetesEnvironment (org.eclipse.che.workspace.infrastructure.kubernetes.environment.KubernetesEnvironment)12 Map (java.util.Map)10 ImmutableMap (com.google.common.collect.ImmutableMap)8 InfrastructureException (org.eclipse.che.api.workspace.server.spi.InfrastructureException)8 Container (io.fabric8.kubernetes.api.model.Container)6 ContainerPortBuilder (io.fabric8.kubernetes.api.model.ContainerPortBuilder)6 Ingress (io.fabric8.kubernetes.api.model.networking.v1.Ingress)6 ArrayList (java.util.ArrayList)6 Collections.singletonMap (java.util.Collections.singletonMap)6 Optional (java.util.Optional)6