.withDatabaseId("test-database") .withServiceFactory(serviceFactory) .withBatchSizeBytes(0) .withFailureMode(SpannerIO.FailureMode.REPORT_FAILURES) .grouped());
@Test public void displayData() throws Exception { SpannerIO.Write write = SpannerIO.write() .withProjectId("test-project") .withInstanceId("test-instance") .withDatabaseId("test-database") .withBatchSizeBytes(123); DisplayData data = DisplayData.from(write); assertThat(data.items(), hasSize(4)); assertThat(data, hasDisplayItem("projectId", "test-project")); assertThat(data, hasDisplayItem("instanceId", "test-instance")); assertThat(data, hasDisplayItem("databaseId", "test-database")); assertThat(data, hasDisplayItem("batchSizeBytes", 123)); }
@Test @Category(NeedsRunner.class) public void noBatching() throws Exception { PCollection<MutationGroup> mutations = pipeline.apply(Create.of(g(m(1L)), g(m(2L)))); mutations.apply( SpannerIO.write() .withProjectId("test-project") .withInstanceId("test-instance") .withDatabaseId("test-database") .withServiceFactory(serviceFactory) .withBatchSizeBytes(1) .grouped()); pipeline.run(); verifyBatches(batch(m(1L)), batch(m(2L))); }