Search in sources :

Example 6 with TreeMapService

use of services.TreeMapService in project helidon by oracle.

the class PojoServiceClientIT method startServer.

@BeforeAll
public static void startServer() throws Exception {
    LogConfig.configureRuntime();
    GrpcRouting routing = GrpcRouting.builder().register(new TreeMapService()).register(new StringService()).build();
    GrpcServerConfiguration serverConfig = GrpcServerConfiguration.builder().port(0).build();
    grpcServer = GrpcServer.create(serverConfig, routing).start().toCompletableFuture().get(10, TimeUnit.SECONDS);
    channel = ManagedChannelBuilder.forAddress("localhost", grpcServer.port()).usePlaintext().build();
}
Also used : GrpcServerConfiguration(io.helidon.grpc.server.GrpcServerConfiguration) TreeMapService(services.TreeMapService) StringService(services.StringService) GrpcRouting(io.helidon.grpc.server.GrpcRouting) BeforeAll(org.junit.jupiter.api.BeforeAll)

Example 7 with TreeMapService

use of services.TreeMapService in project helidon by oracle.

the class ProtoGrpcServiceClientIT method startServer.

@BeforeAll
public static void startServer() throws Exception {
    LogConfig.configureRuntime();
    GrpcRouting routing = GrpcRouting.builder().intercept(headerCheckingInterceptor).register(new TreeMapService()).register(new StringService()).build();
    GrpcServerConfiguration serverConfig = GrpcServerConfiguration.builder().port(0).build();
    grpcServer = GrpcServer.create(serverConfig, routing).start().toCompletableFuture().get(10, TimeUnit.SECONDS);
    ClientServiceDescriptor descriptor = ClientServiceDescriptor.builder(StringServiceGrpc.getServiceDescriptor()).intercept(mediumPriorityInterceptor).intercept("Upper", highPriorityInterceptor).intercept("Lower", lowPriorityInterceptor).callCredentials(serviceCred).callCredentials("Lower", lowerMethodCred).callCredentials("Join", joinMethodCred).build();
    Channel channel = ManagedChannelBuilder.forAddress("localhost", grpcServer.port()).usePlaintext().build();
    grpcClient = GrpcServiceClient.create(channel, descriptor);
}
Also used : GrpcServerConfiguration(io.helidon.grpc.server.GrpcServerConfiguration) TreeMapService(services.TreeMapService) Channel(io.grpc.Channel) StringService(services.StringService) GrpcRouting(io.helidon.grpc.server.GrpcRouting) BeforeAll(org.junit.jupiter.api.BeforeAll)

Aggregations

TreeMapService (services.TreeMapService)7 ClientInterceptor (io.grpc.ClientInterceptor)4 MethodDescriptor (io.grpc.MethodDescriptor)4 ServerMethodDefinition (io.grpc.ServerMethodDefinition)4 ServiceDescriptor (io.grpc.ServiceDescriptor)4 StringServiceGrpc (io.helidon.grpc.client.test.StringServiceGrpc)4 Collection (java.util.Collection)4 CoreMatchers.equalTo (org.hamcrest.CoreMatchers.equalTo)4 CoreMatchers.is (org.hamcrest.CoreMatchers.is)4 CoreMatchers.notNullValue (org.hamcrest.CoreMatchers.notNullValue)4 MatcherAssert.assertThat (org.hamcrest.MatcherAssert.assertThat)4 Matchers.containsInAnyOrder (org.hamcrest.Matchers.containsInAnyOrder)4 IsEmptyIterable.emptyIterable (org.hamcrest.collection.IsEmptyIterable.emptyIterable)4 IsIterableContainingInOrder.contains (org.hamcrest.collection.IsIterableContainingInOrder.contains)4 Assertions.assertThrows (org.junit.jupiter.api.Assertions.assertThrows)4 Test (org.junit.jupiter.api.Test)4 Mockito.mock (org.mockito.Mockito.mock)4 GrpcRouting (io.helidon.grpc.server.GrpcRouting)3 GrpcServerConfiguration (io.helidon.grpc.server.GrpcServerConfiguration)3 BeforeAll (org.junit.jupiter.api.BeforeAll)2