From 74cb85e76c5648644abf27b47623cab9ab078c0e Mon Sep 17 00:00:00 2001 From: ahmedabu98 Date: Fri, 22 Sep 2023 21:24:01 -0400 Subject: [PATCH] fix schematransform test --- ...igtableWriteSchemaTransformProviderIT.java | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/sdks/java/io/google-cloud-platform/src/test/java/org/apache/beam/sdk/io/gcp/bigtable/BigtableWriteSchemaTransformProviderIT.java b/sdks/java/io/google-cloud-platform/src/test/java/org/apache/beam/sdk/io/gcp/bigtable/BigtableWriteSchemaTransformProviderIT.java index 14bb04b0315d..e3519269cf62 100644 --- a/sdks/java/io/google-cloud-platform/src/test/java/org/apache/beam/sdk/io/gcp/bigtable/BigtableWriteSchemaTransformProviderIT.java +++ b/sdks/java/io/google-cloud-platform/src/test/java/org/apache/beam/sdk/io/gcp/bigtable/BigtableWriteSchemaTransformProviderIT.java @@ -36,7 +36,6 @@ import java.util.List; import java.util.Map; import java.util.stream.Collectors; -import org.apache.beam.sdk.extensions.gcp.options.GcpOptions; import org.apache.beam.sdk.io.gcp.bigtable.BigtableWriteSchemaTransformProvider.BigtableWriteSchemaTransformConfiguration; import org.apache.beam.sdk.schemas.Schema; import org.apache.beam.sdk.testing.TestPipeline; @@ -104,7 +103,7 @@ public void testInvalidConfigs() { public void setup() throws Exception { BigtableTestOptions options = TestPipeline.testingPipelineOptions().as(BigtableTestOptions.class); - projectId = options.as(GcpOptions.class).getProject(); + projectId = "google.com:clouddfe"; // options.as(GcpOptions.class).getProject(); instanceId = options.getInstanceId(); BigtableDataSettings settings = @@ -154,8 +153,8 @@ public void tearDown() { public void testSetMutationsExistingColumn() { RowMutation rowMutation = RowMutation.create(tableId, "key-1") - .setCell(COLUMN_FAMILY_NAME_1, "col_a", "val-1-a") - .setCell(COLUMN_FAMILY_NAME_2, "col_c", "val-1-c"); + .setCell(COLUMN_FAMILY_NAME_1, "col_a", 1000, "val-1-a") + .setCell(COLUMN_FAMILY_NAME_2, "col_c", 1000, "val-1-c"); dataClient.mutateRow(rowMutation); List> mutations = new ArrayList<>(); @@ -165,13 +164,15 @@ public void testSetMutationsExistingColumn() { "type", "SetCell".getBytes(StandardCharsets.UTF_8), "value", "new-val-1-a".getBytes(StandardCharsets.UTF_8), "column_qualifier", "col_a".getBytes(StandardCharsets.UTF_8), - "family_name", COLUMN_FAMILY_NAME_1.getBytes(StandardCharsets.UTF_8))); + "family_name", COLUMN_FAMILY_NAME_1.getBytes(StandardCharsets.UTF_8), + "timestamp_micros", Longs.toByteArray(2000))); mutations.add( ImmutableMap.of( "type", "SetCell".getBytes(StandardCharsets.UTF_8), "value", "new-val-1-c".getBytes(StandardCharsets.UTF_8), "column_qualifier", "col_c".getBytes(StandardCharsets.UTF_8), - "family_name", COLUMN_FAMILY_NAME_2.getBytes(StandardCharsets.UTF_8))); + "family_name", COLUMN_FAMILY_NAME_2.getBytes(StandardCharsets.UTF_8), + "timestamp_micros", Longs.toByteArray(2000))); Row mutationRow = Row.withSchema(SCHEMA) .withFieldValue("key", "key-1".getBytes(StandardCharsets.UTF_8)) @@ -202,10 +203,8 @@ public void testSetMutationsExistingColumn() { .collect(Collectors.toList()); assertEquals(2, cellsColA.size()); assertEquals(2, cellsColC.size()); - System.out.println(cellsColA); - System.out.println(cellsColC); - assertEquals("new-val-1-a", cellsColA.get(1).getValue().toStringUtf8()); - assertEquals("new-val-1-c", cellsColC.get(1).getValue().toStringUtf8()); + assertEquals("new-val-1-a", cellsColA.get(0).getValue().toStringUtf8()); + assertEquals("new-val-1-c", cellsColC.get(0).getValue().toStringUtf8()); } @Test