Search in sources :

Example 51 with Route

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");
    }
}
Also used : MalformedURLException(java.net.MalformedURLException) RouteBuilder(io.fabric8.knative.serving.v1.RouteBuilder) Endpoint(org.kie.kogito.addons.k8s.Endpoint) RouteStatus(io.fabric8.knative.serving.v1.RouteStatus) KnativeRouteEndpointDiscovery(org.kie.kogito.addons.k8s.KnativeRouteEndpointDiscovery) Route(io.fabric8.knative.serving.v1.Route) URL(java.net.URL) Test(org.junit.jupiter.api.Test)

Aggregations

Route (okhttp3.Route)30 Response (okhttp3.Response)16 Authenticator (okhttp3.Authenticator)14 Request (okhttp3.Request)12 IOException (java.io.IOException)10 OkHttpClient (okhttp3.OkHttpClient)10 InetSocketAddress (java.net.InetSocketAddress)9 Route (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.Route)9 Proxy (java.net.Proxy)7 Route (io.fabric8.knative.serving.v1.Route)6 RouteBuilder (io.fabric8.knative.serving.v1.RouteBuilder)6 Test (org.junit.Test)6 Test (org.junit.jupiter.api.Test)6 InstanceIdentifier (org.opendaylight.yangtools.yang.binding.InstanceIdentifier)6 KeyedInstanceIdentifier (org.opendaylight.yangtools.yang.binding.KeyedInstanceIdentifier)6 Address (okhttp3.Address)5 Connection (okhttp3.Connection)5 RIBSupport (org.opendaylight.protocol.bgp.rib.spi.RIBSupport)5 Identifier (org.opendaylight.yangtools.yang.binding.Identifier)5 Builder (okhttp3.OkHttpClient.Builder)4