Search in sources :

Example 1 with AggregatedDiscoveryServiceImplBase

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

the class ClientXdsClientV2Test method createAdsService.

@Override
protected BindableService createAdsService() {
    return new AggregatedDiscoveryServiceImplBase() {

        @Override
        public StreamObserver<DiscoveryRequest> streamAggregatedResources(final StreamObserver<DiscoveryResponse> responseObserver) {
            // ensure previous call was ended
            assertThat(adsEnded.get()).isTrue();
            adsEnded.set(false);
            @SuppressWarnings("unchecked") StreamObserver<DiscoveryRequest> requestObserver = mock(StreamObserver.class);
            DiscoveryRpcCall call = new DiscoveryRpcCallV2(requestObserver, responseObserver);
            resourceDiscoveryCalls.offer(call);
            Context.current().addListener(new CancellationListener() {

                @Override
                public void cancelled(Context context) {
                    adsEnded.set(true);
                }
            }, MoreExecutors.directExecutor());
            return requestObserver;
        }
    };
}
Also used : StreamObserver(io.grpc.stub.StreamObserver) Context(io.grpc.Context) CommonTlsContext(io.envoyproxy.envoy.api.v2.auth.CommonTlsContext) UpstreamTlsContext(io.envoyproxy.envoy.api.v2.auth.UpstreamTlsContext) CancellationListener(io.grpc.Context.CancellationListener) DiscoveryRequest(io.envoyproxy.envoy.api.v2.DiscoveryRequest) AggregatedDiscoveryServiceImplBase(io.envoyproxy.envoy.service.discovery.v2.AggregatedDiscoveryServiceGrpc.AggregatedDiscoveryServiceImplBase)

Example 2 with AggregatedDiscoveryServiceImplBase

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

the class ClientXdsClientV3Test method createAdsService.

@Override
protected BindableService createAdsService() {
    return new AggregatedDiscoveryServiceImplBase() {

        @Override
        public StreamObserver<DiscoveryRequest> streamAggregatedResources(final StreamObserver<DiscoveryResponse> responseObserver) {
            // ensure previous call was ended
            assertThat(adsEnded.get()).isTrue();
            adsEnded.set(false);
            @SuppressWarnings("unchecked") StreamObserver<DiscoveryRequest> requestObserver = mock(StreamObserver.class);
            DiscoveryRpcCall call = new DiscoveryRpcCallV3(requestObserver, responseObserver);
            resourceDiscoveryCalls.offer(call);
            Context.current().addListener(new CancellationListener() {

                @Override
                public void cancelled(Context context) {
                    adsEnded.set(true);
                }
            }, MoreExecutors.directExecutor());
            return requestObserver;
        }
    };
}
Also used : StreamObserver(io.grpc.stub.StreamObserver) Context(io.grpc.Context) UpstreamTlsContext(io.envoyproxy.envoy.extensions.transport_sockets.tls.v3.UpstreamTlsContext) CertificateValidationContext(io.envoyproxy.envoy.extensions.transport_sockets.tls.v3.CertificateValidationContext) CommonTlsContext(io.envoyproxy.envoy.extensions.transport_sockets.tls.v3.CommonTlsContext) CancellationListener(io.grpc.Context.CancellationListener) DiscoveryRequest(io.envoyproxy.envoy.service.discovery.v3.DiscoveryRequest) AggregatedDiscoveryServiceImplBase(io.envoyproxy.envoy.service.discovery.v3.AggregatedDiscoveryServiceGrpc.AggregatedDiscoveryServiceImplBase)

Aggregations

Context (io.grpc.Context)2 CancellationListener (io.grpc.Context.CancellationListener)2 StreamObserver (io.grpc.stub.StreamObserver)2 DiscoveryRequest (io.envoyproxy.envoy.api.v2.DiscoveryRequest)1 CommonTlsContext (io.envoyproxy.envoy.api.v2.auth.CommonTlsContext)1 UpstreamTlsContext (io.envoyproxy.envoy.api.v2.auth.UpstreamTlsContext)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.v2.AggregatedDiscoveryServiceGrpc.AggregatedDiscoveryServiceImplBase)1 AggregatedDiscoveryServiceImplBase (io.envoyproxy.envoy.service.discovery.v3.AggregatedDiscoveryServiceGrpc.AggregatedDiscoveryServiceImplBase)1 DiscoveryRequest (io.envoyproxy.envoy.service.discovery.v3.DiscoveryRequest)1