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");
}
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");
}
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");
}
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);
}
Aggregations