Search in sources :

Example 1 with InstantiatingGrpcChannelProvider

use of com.google.api.gax.grpc.InstantiatingGrpcChannelProvider in project spring-cloud-gcp by spring-cloud.

the class GcpFirestoreEmulatorAutoConfigurationTests method testAutoConfigurationDisabled.

@Test
public void testAutoConfigurationDisabled() {
    contextRunner.run(context -> {
        FirestoreOptions firestoreOptions = context.getBean(FirestoreOptions.class);
        String endpoint = ((InstantiatingGrpcChannelProvider) firestoreOptions.getTransportChannelProvider()).getEndpoint();
        assertThat(endpoint).isEqualTo("firestore.googleapis.com:443");
        FirestoreTemplate firestoreTemplate = context.getBean(FirestoreTemplate.class);
        assertThat(firestoreTemplate.isUsingStreamTokens()).isTrue();
    });
}
Also used : InstantiatingGrpcChannelProvider(com.google.api.gax.grpc.InstantiatingGrpcChannelProvider) FirestoreOptions(com.google.cloud.firestore.FirestoreOptions) FirestoreTemplate(org.springframework.cloud.gcp.data.firestore.FirestoreTemplate) Test(org.junit.Test)

Example 2 with InstantiatingGrpcChannelProvider

use of com.google.api.gax.grpc.InstantiatingGrpcChannelProvider in project spring-cloud-gcp by spring-cloud.

the class GcpFirestoreEmulatorAutoConfigurationTests method testAutoConfigurationEnabled.

@Test
public void testAutoConfigurationEnabled() {
    contextRunner.withPropertyValues("spring.cloud.gcp.firestore.emulator.enabled=true", "spring.cloud.gcp.firestore.host-port=localhost:9000").run(context -> {
        FirestoreOptions firestoreOptions = context.getBean(FirestoreOptions.class);
        String endpoint = ((InstantiatingGrpcChannelProvider) firestoreOptions.getTransportChannelProvider()).getEndpoint();
        assertThat(endpoint).isEqualTo("localhost:9000");
        FirestoreTemplate firestoreTemplate = context.getBean(FirestoreTemplate.class);
        assertThat(firestoreTemplate.isUsingStreamTokens()).isFalse();
        assertThat(firestoreOptions.getProjectId()).isEqualTo("unused");
    });
}
Also used : InstantiatingGrpcChannelProvider(com.google.api.gax.grpc.InstantiatingGrpcChannelProvider) FirestoreOptions(com.google.cloud.firestore.FirestoreOptions) FirestoreTemplate(org.springframework.cloud.gcp.data.firestore.FirestoreTemplate) Test(org.junit.Test)

Aggregations

InstantiatingGrpcChannelProvider (com.google.api.gax.grpc.InstantiatingGrpcChannelProvider)2 FirestoreOptions (com.google.cloud.firestore.FirestoreOptions)2 Test (org.junit.Test)2 FirestoreTemplate (org.springframework.cloud.gcp.data.firestore.FirestoreTemplate)2