Search in sources :

Example 71 with ServerConfig

use of org.eclipse.che.api.core.model.workspace.config.ServerConfig in project devspaces-images by redhat-developer.

the class ServerConfigImplTest method testStoreEndpointNameIntoAttributes.

@Test
public void testStoreEndpointNameIntoAttributes() {
    ServerConfig serverConfig = ServerConfigImpl.createFromEndpoint(new EndpointImpl("blabol", 123, emptyMap()));
    assertEquals(serverConfig.getAttributes().get(SERVER_NAME_ATTRIBUTE), "blabol");
}
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 72 with ServerConfig

use of org.eclipse.che.api.core.model.workspace.config.ServerConfig in project devspaces-images by redhat-developer.

the class ServerConfigImplTest method testCreateFromEndpointTranslateProtocol.

@Test
public void testCreateFromEndpointTranslateProtocol() {
    ServerConfig serverConfig = ServerConfigImpl.createFromEndpoint(new EndpointImpl("name", 123, singletonMap("protocol", "hello")));
    assertEquals(serverConfig.getProtocol(), "hello");
}
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 73 with ServerConfig

use of org.eclipse.che.api.core.model.workspace.config.ServerConfig in project devspaces-images by redhat-developer.

the class ServerConfigImplTest method testCreateFromEndpointTranslatePath.

@Test
public void testCreateFromEndpointTranslatePath() {
    ServerConfig serverConfig = ServerConfigImpl.createFromEndpoint(new EndpointImpl("name", 123, singletonMap("path", "hello")));
    assertEquals(serverConfig.getPath(), "hello");
}
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 74 with ServerConfig

use of org.eclipse.che.api.core.model.workspace.config.ServerConfig in project devspaces-images by redhat-developer.

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);
}
Also used : ServerConfig(org.eclipse.che.api.core.model.workspace.config.ServerConfig) MachineConfigImpl(org.eclipse.che.api.workspace.server.model.impl.MachineConfigImpl) ServerConfigImpl(org.eclipse.che.api.workspace.server.model.impl.ServerConfigImpl) EnvironmentImpl(org.eclipse.che.api.workspace.server.model.impl.EnvironmentImpl) 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