use of org.eclipse.che.api.workspace.server.model.impl.ServerImpl in project che-server by eclipse-che.
the class RouteServerResolverTest method testResolvingServersWhenThereIsMatchedRouteForMachineAndServerPathIsNull.
@Test
public void testResolvingServersWhenThereIsMatchedRouteForMachineAndServerPathIsNull() {
Route route = createRoute("matched", "machine", singletonMap("http-server", new ServerConfigImpl("3054", "http", null, ATTRIBUTES_MAP)));
RouteServerResolver serverResolver = new RouteServerResolver(emptyList(), singletonList(route));
Map<String, ServerImpl> resolved = serverResolver.resolve("machine");
assertEquals(resolved.size(), 1);
assertEquals(resolved.get("http-server"), new ServerImpl().withUrl("http://localhost").withStatus(UNKNOWN).withAttributes(defaultAttributeAnd(Constants.SERVER_PORT_ATTRIBUTE, "3054", ServerConfig.ENDPOINT_ORIGIN, "/")));
}
use of org.eclipse.che.api.workspace.server.model.impl.ServerImpl in project che-server by eclipse-che.
the class RouteServerResolverTest method testResolvingInternalServersWithPortWithTransportProtocol.
@Test
public void testResolvingInternalServersWithPortWithTransportProtocol() {
Service service = createService("service11", "machine", CONTAINER_PORT, singletonMap("http-server", new ServerConfigImpl("3054/udp", "xxx", "api", ATTRIBUTES_MAP)));
Route route = createRoute("matched", "machine", null);
RouteServerResolver serverResolver = new RouteServerResolver(singletonList(service), singletonList(route));
Map<String, ServerImpl> resolved = serverResolver.resolve("machine");
assertEquals(resolved.size(), 1);
assertEquals(resolved.get("http-server"), new ServerImpl().withUrl("xxx://service11:3054/api").withStatus(UNKNOWN).withAttributes(defaultAttributeAnd(Constants.SERVER_PORT_ATTRIBUTE, "3054", ServerConfig.ENDPOINT_ORIGIN, "/")));
}
use of org.eclipse.che.api.workspace.server.model.impl.ServerImpl in project che-server by eclipse-che.
the class RouteServerResolverTest method testResolvingServersWhenThereIsMatchedRouteForMachineAndServerPathIsRelative.
@Test
public void testResolvingServersWhenThereIsMatchedRouteForMachineAndServerPathIsRelative() {
Route route = createRoute("matched", "machine", singletonMap("http-server", new ServerConfigImpl("3054", "http", "api", ATTRIBUTES_MAP)));
RouteServerResolver serverResolver = new RouteServerResolver(emptyList(), singletonList(route));
Map<String, ServerImpl> resolved = serverResolver.resolve("machine");
assertEquals(resolved.size(), 1);
assertEquals(resolved.get("http-server"), new ServerImpl().withUrl("http://localhost/api").withStatus(UNKNOWN).withAttributes(defaultAttributeAnd(Constants.SERVER_PORT_ATTRIBUTE, "3054", ServerConfig.ENDPOINT_ORIGIN, "/")));
}
use of org.eclipse.che.api.workspace.server.model.impl.ServerImpl in project che-server by eclipse-che.
the class RouteServerResolverTest method testResolvingServersWhenThereIsNoTheCorrespondingServiceAndRouteForTheSpecifiedMachine.
@Test
public void testResolvingServersWhenThereIsNoTheCorrespondingServiceAndRouteForTheSpecifiedMachine() {
// given
Service nonMatchedByPodService = createService("nonMatched", "foreignMachine", CONTAINER_PORT, null);
Route route = createRoute("nonMatched", "foreignMachine", ImmutableMap.of("http-server", new ServerConfigImpl("3054", "http", "/api", ATTRIBUTES_MAP)));
RouteServerResolver serverResolver = new RouteServerResolver(singletonList(nonMatchedByPodService), singletonList(route));
// when
Map<String, ServerImpl> resolved = serverResolver.resolve("machine");
// then
assertTrue(resolved.isEmpty());
}
use of org.eclipse.che.api.workspace.server.model.impl.ServerImpl in project che-server by eclipse-che.
the class RouteServerResolverTest method testResolvingServersWhenThereIsMatchedRouteForTheSpecifiedMachine.
@Test
public void testResolvingServersWhenThereIsMatchedRouteForTheSpecifiedMachine() {
Route route = createRoute("matched", "machine", ImmutableMap.of("http-server", new ServerConfigImpl("3054", "http", "/api", ATTRIBUTES_MAP)));
RouteServerResolver serverResolver = new RouteServerResolver(emptyList(), singletonList(route));
Map<String, ServerImpl> resolved = serverResolver.resolve("machine");
assertEquals(resolved.size(), 1);
assertEquals(resolved.get("http-server"), new ServerImpl().withUrl("http://localhost/api").withStatus(UNKNOWN).withAttributes(defaultAttributeAnd(Constants.SERVER_PORT_ATTRIBUTE, "3054", ServerConfig.ENDPOINT_ORIGIN, "/")));
}
Aggregations