Search in sources :

Example 71 with MockServiceHelper

use of com.google.api.gax.grpc.testing.MockServiceHelper in project java-bigquerystorage by googleapis.

the class BigQueryReadClientTest method startStaticServer.

@BeforeClass
public static void startStaticServer() {
    mockBigQueryRead = new MockBigQueryRead();
    serviceHelper = new MockServiceHelper(UUID.randomUUID().toString(), Arrays.<MockGrpcService>asList(mockBigQueryRead));
    serviceHelper.start();
}
Also used : MockGrpcService(com.google.api.gax.grpc.testing.MockGrpcService) MockServiceHelper(com.google.api.gax.grpc.testing.MockServiceHelper) BeforeClass(org.junit.BeforeClass)

Example 72 with MockServiceHelper

use of com.google.api.gax.grpc.testing.MockServiceHelper in project java-bigquerystorage by googleapis.

the class JsonStreamWriterTest method setUp.

@Before
public void setUp() throws Exception {
    testBigQueryWrite = new FakeBigQueryWrite();
    serviceHelper = new MockServiceHelper(UUID.randomUUID().toString(), Arrays.<MockGrpcService>asList(testBigQueryWrite));
    serviceHelper.start();
    channelProvider = serviceHelper.createChannelProvider();
    fakeExecutor = new FakeScheduledExecutorService();
    testBigQueryWrite.setExecutor(fakeExecutor);
    Instant time = Instant.now();
    Timestamp timestamp = Timestamp.newBuilder().setSeconds(time.getEpochSecond()).setNanos(time.getNano()).build();
    // Add enough GetWriteStream response.
    for (int i = 0; i < 4; i++) {
        testBigQueryWrite.addResponse(WriteStream.newBuilder().setName(TEST_STREAM).setCreateTime(timestamp).build());
    }
}
Also used : MockGrpcService(com.google.api.gax.grpc.testing.MockGrpcService) Instant(org.threeten.bp.Instant) MockServiceHelper(com.google.api.gax.grpc.testing.MockServiceHelper) Timestamp(com.google.protobuf.Timestamp) Before(org.junit.Before)

Example 73 with MockServiceHelper

use of com.google.api.gax.grpc.testing.MockServiceHelper in project java-bigquerystorage by googleapis.

the class BigQueryWriteClientTest method startStaticServer.

@BeforeClass
public static void startStaticServer() {
    mockBigQueryWrite = new MockBigQueryWrite();
    mockServiceHelper = new MockServiceHelper(UUID.randomUUID().toString(), Arrays.<MockGrpcService>asList(mockBigQueryWrite));
    mockServiceHelper.start();
}
Also used : MockGrpcService(com.google.api.gax.grpc.testing.MockGrpcService) MockServiceHelper(com.google.api.gax.grpc.testing.MockServiceHelper) BeforeClass(org.junit.BeforeClass)

Example 74 with MockServiceHelper

use of com.google.api.gax.grpc.testing.MockServiceHelper in project beam by apache.

the class SpannerChangeStreamErrorTest method setUp.

@Before
public void setUp() throws Exception {
    mockSpannerService = new MockSpannerServiceImpl();
    serviceHelper = new MockServiceHelper(SPANNER_HOST, Collections.singletonList(mockSpannerService));
    serviceHelper.start();
    serviceHelper.reset();
}
Also used : MockServiceHelper(com.google.api.gax.grpc.testing.MockServiceHelper) MockSpannerServiceImpl(com.google.cloud.spanner.MockSpannerServiceImpl) Before(org.junit.Before)

Example 75 with MockServiceHelper

use of com.google.api.gax.grpc.testing.MockServiceHelper in project java-datastream by googleapis.

the class DatastreamClientTest method startStaticServer.

@BeforeClass
public static void startStaticServer() {
    mockDatastream = new MockDatastream();
    mockLocations = new MockLocations();
    mockServiceHelper = new MockServiceHelper(UUID.randomUUID().toString(), Arrays.<MockGrpcService>asList(mockDatastream, mockLocations));
    mockServiceHelper.start();
}
Also used : MockGrpcService(com.google.api.gax.grpc.testing.MockGrpcService) MockServiceHelper(com.google.api.gax.grpc.testing.MockServiceHelper) MockLocations(com.google.cloud.location.MockLocations) BeforeClass(org.junit.BeforeClass)

Aggregations

MockServiceHelper (com.google.api.gax.grpc.testing.MockServiceHelper)335 MockGrpcService (com.google.api.gax.grpc.testing.MockGrpcService)332 BeforeClass (org.junit.BeforeClass)329 Before (org.junit.Before)5 MockIAMPolicy (com.google.iam.v1.MockIAMPolicy)4 MockLocations (com.google.cloud.location.MockLocations)3 Timestamp (com.google.protobuf.Timestamp)2 Instant (org.threeten.bp.Instant)2 GaxGrpcProperties (com.google.api.gax.grpc.GaxGrpcProperties)1 LocalChannelProvider (com.google.api.gax.grpc.testing.LocalChannelProvider)1 MockStreamObserver (com.google.api.gax.grpc.testing.MockStreamObserver)1 StatusCode (com.google.api.gax.rpc.StatusCode)1 AnnotationNode (com.google.api.generator.engine.ast.AnnotationNode)1 AssignmentExpr (com.google.api.generator.engine.ast.AssignmentExpr)1 CastExpr (com.google.api.generator.engine.ast.CastExpr)1 ConcreteReference (com.google.api.generator.engine.ast.ConcreteReference)1 EnumRefExpr (com.google.api.generator.engine.ast.EnumRefExpr)1 Expr (com.google.api.generator.engine.ast.Expr)1 ExprStatement (com.google.api.generator.engine.ast.ExprStatement)1 InstanceofExpr (com.google.api.generator.engine.ast.InstanceofExpr)1