Search in sources :

Example 6 with DiscoveryResponse

use of io.envoyproxy.envoy.service.discovery.v3.DiscoveryResponse in project grpc-java by grpc.

the class MessagePrinterTest method printRdsResponse_v3.

@Test
public void printRdsResponse_v3() {
    RouteConfiguration routeConfiguration = RouteConfiguration.newBuilder().setName("route-foo.googleapis.com").addVirtualHosts(VirtualHost.newBuilder().setName("virtualhost.googleapis.com").addDomains("foo.googleapis.com").addDomains("bar.googleapis.com").addRoutes(Route.newBuilder().setMatch(RouteMatch.newBuilder().setPath("foo.googleapis.com")).setRoute(RouteAction.newBuilder().setCluster("cluster.googleapis.com")))).build();
    DiscoveryResponse response = DiscoveryResponse.newBuilder().setTypeUrl("type.googleapis.com/envoy.config.route.v3.RouteConfiguration").setVersionInfo("0").addResources(Any.pack(routeConfiguration)).setNonce("0000").build();
    String expectedString = "{\n" + "  \"versionInfo\": \"0\",\n" + "  \"resources\": [{\n" + "    \"@type\": \"type.googleapis.com/envoy.config.route.v3.RouteConfiguration\",\n" + "    \"name\": \"route-foo.googleapis.com\",\n" + "    \"virtualHosts\": [{\n" + "      \"name\": \"virtualhost.googleapis.com\",\n" + "      \"domains\": [\"foo.googleapis.com\", \"bar.googleapis.com\"],\n" + "      \"routes\": [{\n" + "        \"match\": {\n" + "          \"path\": \"foo.googleapis.com\"\n" + "        },\n" + "        \"route\": {\n" + "          \"cluster\": \"cluster.googleapis.com\"\n" + "        }\n" + "      }]\n" + "    }]\n" + "  }],\n" + "  \"typeUrl\": \"type.googleapis.com/envoy.config.route.v3.RouteConfiguration\",\n" + "  \"nonce\": \"0000\"\n" + "}";
    String res = MessagePrinter.print(response);
    assertThat(res).isEqualTo(expectedString);
}
Also used : DiscoveryResponse(io.envoyproxy.envoy.service.discovery.v3.DiscoveryResponse) RouteConfiguration(io.envoyproxy.envoy.config.route.v3.RouteConfiguration) Test(org.junit.Test)

Aggregations

DiscoveryResponse (io.envoyproxy.envoy.service.discovery.v3.DiscoveryResponse)4 Test (org.junit.Test)4 Cluster (io.envoyproxy.envoy.config.cluster.v3.Cluster)1 ClusterLoadAssignment (io.envoyproxy.envoy.config.endpoint.v3.ClusterLoadAssignment)1 ApiListener (io.envoyproxy.envoy.config.listener.v3.ApiListener)1 Listener (io.envoyproxy.envoy.config.listener.v3.Listener)1 RouteConfiguration (io.envoyproxy.envoy.config.route.v3.RouteConfiguration)1 CertificateValidationContext (io.envoyproxy.envoy.extensions.transport_sockets.tls.v3.CertificateValidationContext)1 CommonTlsContext (io.envoyproxy.envoy.extensions.transport_sockets.tls.v3.CommonTlsContext)1 UpstreamTlsContext (io.envoyproxy.envoy.extensions.transport_sockets.tls.v3.UpstreamTlsContext)1 AggregatedDiscoveryServiceImplBase (io.envoyproxy.envoy.service.discovery.v3.AggregatedDiscoveryServiceGrpc.AggregatedDiscoveryServiceImplBase)1 DiscoveryRequest (io.envoyproxy.envoy.service.discovery.v3.DiscoveryRequest)1 Context (io.grpc.Context)1 CancellationListener (io.grpc.Context.CancellationListener)1 StreamObserver (io.grpc.stub.StreamObserver)1 URL (java.net.URL)1 CloseableHttpClient (org.apache.http.impl.client.CloseableHttpClient)1 HttpClient (org.mitre.taxii.client.HttpClient)1 CollectionInformationRequest (org.mitre.taxii.messages.xml11.CollectionInformationRequest)1 CollectionInformationResponse (org.mitre.taxii.messages.xml11.CollectionInformationResponse)1