Search in sources :

Example 21 with EndpointImpl

use of org.eclipse.che.api.workspace.server.model.impl.devfile.EndpointImpl 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 22 with EndpointImpl

use of org.eclipse.che.api.workspace.server.model.impl.devfile.EndpointImpl 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 23 with EndpointImpl

use of org.eclipse.che.api.workspace.server.model.impl.devfile.EndpointImpl 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 24 with EndpointImpl

use of org.eclipse.che.api.workspace.server.model.impl.devfile.EndpointImpl 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 25 with EndpointImpl

use of org.eclipse.che.api.workspace.server.model.impl.devfile.EndpointImpl in project devspaces-images by redhat-developer.

the class DevfileIntegrityValidatorTest method shouldThrowExceptionOnDuplicateEndpointName.

@Test(expectedExceptions = DevfileFormatException.class, expectedExceptionsMessageRegExp = "Duplicated endpoint name 'e1' found in 'dockerimage:latest' component")
public void shouldThrowExceptionOnDuplicateEndpointName() throws Exception {
    DevfileImpl broken = new DevfileImpl(initialDevfile);
    ComponentImpl component = new ComponentImpl();
    component.setType(DOCKERIMAGE_COMPONENT_TYPE);
    component.setImage("dockerimage:latest");
    component.setEndpoints(ImmutableList.of(new EndpointImpl("e1", 8080, Collections.emptyMap()), new EndpointImpl("e1", 8082, Collections.emptyMap())));
    broken.getComponents().add(component);
    // when
    integrityValidator.validateDevfile(broken);
}
Also used : DevfileImpl(org.eclipse.che.api.workspace.server.model.impl.devfile.DevfileImpl) EndpointImpl(org.eclipse.che.api.workspace.server.model.impl.devfile.EndpointImpl) ComponentImpl(org.eclipse.che.api.workspace.server.model.impl.devfile.ComponentImpl) Test(org.testng.annotations.Test)

Aggregations

EndpointImpl (org.eclipse.che.api.workspace.server.model.impl.devfile.EndpointImpl)60 Test (org.testng.annotations.Test)52 ComponentImpl (org.eclipse.che.api.workspace.server.model.impl.devfile.ComponentImpl)36 ServerConfig (org.eclipse.che.api.core.model.workspace.config.ServerConfig)20 MachineConfigImpl (org.eclipse.che.api.workspace.server.model.impl.MachineConfigImpl)20 Collections.emptyMap (java.util.Collections.emptyMap)12 Map (java.util.Map)12 ActionImpl (org.eclipse.che.api.workspace.server.model.impl.devfile.ActionImpl)12 DevfileImpl (org.eclipse.che.api.workspace.server.model.impl.devfile.DevfileImpl)12 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)12 EntrypointImpl (org.eclipse.che.api.workspace.server.model.impl.devfile.EntrypointImpl)10 EnvImpl (org.eclipse.che.api.workspace.server.model.impl.devfile.EnvImpl)10 ProjectImpl (org.eclipse.che.api.workspace.server.model.impl.devfile.ProjectImpl)10 SourceImpl (org.eclipse.che.api.workspace.server.model.impl.devfile.SourceImpl)10 ImmutableMap (com.google.common.collect.ImmutableMap)8 Collections.singletonMap (java.util.Collections.singletonMap)8 ServerConfigImpl (org.eclipse.che.api.workspace.server.model.impl.ServerConfigImpl)8 CommandImpl (org.eclipse.che.api.workspace.server.model.impl.devfile.CommandImpl)8 MetadataImpl (org.eclipse.che.api.workspace.server.model.impl.devfile.MetadataImpl)8 ArgumentMatchers.anyMap (org.mockito.ArgumentMatchers.anyMap)8