use of com.google.cloud.compute.v1.Route in project kogito-runtimes by kiegroup.
the class KnativeRouteEndpointDiscoveryTest method testBaseCase.
@Test
public void testBaseCase() {
final KnativeRouteEndpointDiscovery endpointDiscovery = new KnativeRouteEndpointDiscovery(null);
endpointDiscovery.setKnativeClient(knativeClient);
// configure mock
final RouteStatus status = new RouteStatus();
status.setUrl("http://192.168.2.32");
final Route route = new RouteBuilder().withNewMetadata().withName("ksvc1").withNamespace("test").and().withStatus(status).build();
knativeClient.routes().create(route);
final Optional<Endpoint> endpoint = endpointDiscovery.findEndpoint("test", "ksvc1");
assertTrue(endpoint.isPresent());
try {
new URL(endpoint.get().getUrl());
} catch (MalformedURLException e) {
// verbose
fail("The generated URL " + endpoint.get().getUrl() + " is invalid");
}
}
Aggregations