use of org.eclipse.che.workspace.infrastructure.kubernetes.Annotations.Deserializer in project che-server by eclipse-che.
the class OpenShiftExternalServerExposerTest method shouldAddRouteToEnvForExposingSpecifiedServer.
@Test
public void shouldAddRouteToEnvForExposingSpecifiedServer() {
// given
OpenShiftEnvironment osEnv = OpenShiftEnvironment.builder().build();
Map<String, ServerConfig> servers = new HashMap<>();
servers.put("server", new ServerConfigImpl());
// when
osExternalServerExposer.expose(osEnv, "machine123", "service123", null, new ServicePort(null, "servicePort", null, null, "TCP", null), servers);
// then
assertEquals(1, osEnv.getRoutes().size());
Route route = osEnv.getRoutes().values().iterator().next();
assertNotNull(route);
assertEquals(route.getSpec().getTo().getName(), "service123");
assertEquals(route.getSpec().getPort().getTargetPort().getStrVal(), "servicePort");
Deserializer annotations = Annotations.newDeserializer(route.getMetadata().getAnnotations());
assertEquals(annotations.machineName(), "machine123");
assertEquals(annotations.servers(), servers);
assertEquals(route.getMetadata().getLabels().get("foo"), "bar");
assertNull(route.getSpec().getHost());
}
use of org.eclipse.che.workspace.infrastructure.kubernetes.Annotations.Deserializer in project devspaces-images by redhat-developer.
the class OpenShiftExternalServerExposerTest method shouldAddRouteToEnvForExposingSpecifiedServer.
@Test
public void shouldAddRouteToEnvForExposingSpecifiedServer() {
// given
OpenShiftEnvironment osEnv = OpenShiftEnvironment.builder().build();
Map<String, ServerConfig> servers = new HashMap<>();
servers.put("server", new ServerConfigImpl());
// when
osExternalServerExposer.expose(osEnv, "machine123", "service123", null, new ServicePort(null, "servicePort", null, null, "TCP", null), servers);
// then
assertEquals(1, osEnv.getRoutes().size());
Route route = osEnv.getRoutes().values().iterator().next();
assertNotNull(route);
assertEquals(route.getSpec().getTo().getName(), "service123");
assertEquals(route.getSpec().getPort().getTargetPort().getStrVal(), "servicePort");
Deserializer annotations = Annotations.newDeserializer(route.getMetadata().getAnnotations());
assertEquals(annotations.machineName(), "machine123");
assertEquals(annotations.servers(), servers);
assertEquals(route.getMetadata().getLabels().get("foo"), "bar");
assertNull(route.getSpec().getHost());
}
Aggregations