use of com.google.cloud.firestore.FirestoreOptions in project spring-cloud-gcp by spring-cloud.
the class GcpFirestoreAutoConfigurationTests method testDatastoreOptionsCorrectlySet.
@Test
public void testDatastoreOptionsCorrectlySet() {
this.contextRunner.run((context) -> {
FirestoreOptions datastoreOptions = context.getBean(Firestore.class).getOptions();
assertThat(datastoreOptions.getProjectId()).isEqualTo("test-project");
});
}
use of com.google.cloud.firestore.FirestoreOptions 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();
});
}
use of com.google.cloud.firestore.FirestoreOptions 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");
});
}
use of com.google.cloud.firestore.FirestoreOptions in project java-docs-samples by GoogleCloudPlatform.
the class BaseIntegrationTest method baseSetup.
@BeforeClass
public static void baseSetup() throws Exception {
FirestoreOptions firestoreOptions = FirestoreOptions.getDefaultInstance().toBuilder().setProjectId(projectId).build();
db = firestoreOptions.getService();
deleteAllDocuments(db);
}
use of com.google.cloud.firestore.FirestoreOptions in project spring-cloud-gcp by spring-cloud.
the class GcpFirestoreEmulatorAutoConfigurationTests method testThatIfProjectIdIsGivenItWillBeUsed.
@Test
public void testThatIfProjectIdIsGivenItWillBeUsed() {
contextRunner.withPropertyValues("spring.cloud.gcp.firestore.project-id=demo", "spring.cloud.gcp.firestore.emulator.enabled=true", "spring.cloud.gcp.firestore.host-port=localhost:9000").run(context -> {
FirestoreOptions firestoreOptions = context.getBean(FirestoreOptions.class);
assertThat(firestoreOptions.getProjectId()).isEqualTo("demo");
});
}
Aggregations