Search in sources :

Example 6 with FakeServiceHelper

use of com.google.cloud.bigtable.data.v2.FakeServiceHelper in project java-bigtable by googleapis.

the class StatsHeadersCallableTest method setUp.

@Before
public void setUp() throws Exception {
    metadataInterceptor = new MetadataInterceptor();
    serviceHelper = new FakeServiceHelper(metadataInterceptor, fakeService);
    serviceHelper.start();
    EnhancedBigtableStubSettings settings = BigtableDataSettings.newBuilderForEmulator(serviceHelper.getPort()).setProjectId(PROJECT_ID).setInstanceId(INSTANCE_ID).setAppProfileId(APP_PROFILE_ID).build().getStubSettings();
    stub = EnhancedBigtableStub.create(settings);
}
Also used : EnhancedBigtableStubSettings(com.google.cloud.bigtable.data.v2.stub.EnhancedBigtableStubSettings) FakeServiceHelper(com.google.cloud.bigtable.data.v2.FakeServiceHelper) Before(org.junit.Before)

Example 7 with FakeServiceHelper

use of com.google.cloud.bigtable.data.v2.FakeServiceHelper in project java-bigtable by googleapis.

the class EnhancedBigtableStubCloseRetryTest method setUp.

@Before
public void setUp() throws Exception {
    testExecutor = Executors.newCachedThreadPool();
    requests = new ArrayBlockingQueue<>(10);
    numRequests = new AtomicInteger();
    serviceHelper = new FakeServiceHelper(new FakeBigtable());
    serviceHelper.start();
    BigtableDataSettings.Builder settingBuilder = BigtableDataSettings.newBuilderForEmulator(serviceHelper.getPort()).setProjectId(PROJECT_ID).setInstanceId(INSTANCE_ID).setCredentialsProvider(NoCredentialsProvider.create()).setRefreshingChannel(false);
    stub = EnhancedBigtableStub.create(settingBuilder.build().getStubSettings());
}
Also used : AtomicInteger(java.util.concurrent.atomic.AtomicInteger) FakeServiceHelper(com.google.cloud.bigtable.data.v2.FakeServiceHelper) BigtableDataSettings(com.google.cloud.bigtable.data.v2.BigtableDataSettings) Before(org.junit.Before)

Example 8 with FakeServiceHelper

use of com.google.cloud.bigtable.data.v2.FakeServiceHelper in project java-bigtable by googleapis.

the class BigtableChannelPrimerTest method setup.

@Before
public void setup() throws IOException {
    fakeService = new FakeService();
    metadataInterceptor = new MetadataInterceptor();
    serviceHelper = new FakeServiceHelper(metadataInterceptor, fakeService);
    serviceHelper.start();
    primer = BigtableChannelPrimer.create(OAuth2Credentials.create(new AccessToken(TOKEN_VALUE, null)), "fake-project", "fake-instance", "fake-app-profile", ImmutableList.of("table1", "table2"));
    channel = ManagedChannelBuilder.forAddress("localhost", serviceHelper.getPort()).usePlaintext().build();
    logHandler = new LogHandler();
    Logger.getLogger(BigtableChannelPrimer.class.toString()).addHandler(logHandler);
}
Also used : FakeServiceHelper(com.google.cloud.bigtable.data.v2.FakeServiceHelper) AccessToken(com.google.auth.oauth2.AccessToken) Before(org.junit.Before)

Aggregations

FakeServiceHelper (com.google.cloud.bigtable.data.v2.FakeServiceHelper)8 Before (org.junit.Before)8 BigtableDataSettings (com.google.cloud.bigtable.data.v2.BigtableDataSettings)3 EnhancedBigtableStubSettings (com.google.cloud.bigtable.data.v2.stub.EnhancedBigtableStubSettings)3 EnhancedBigtableStub (com.google.cloud.bigtable.data.v2.stub.EnhancedBigtableStub)2 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)2 FixedHeaderProvider (com.google.api.gax.rpc.FixedHeaderProvider)1 HeaderProvider (com.google.api.gax.rpc.HeaderProvider)1 AccessToken (com.google.auth.oauth2.AccessToken)1 BindableService (io.grpc.BindableService)1 SimpleForwardingServerCall (io.grpc.ForwardingServerCall.SimpleForwardingServerCall)1 Metadata (io.grpc.Metadata)1 ServerCall (io.grpc.ServerCall)1 ServerCallHandler (io.grpc.ServerCallHandler)1 ServerInterceptor (io.grpc.ServerInterceptor)1 Random (java.util.Random)1