tonytanger commented on code in PR #29127:
URL: https://github.com/apache/beam/pull/29127#discussion_r1372033146


##########
sdks/java/io/google-cloud-platform/src/test/java/org/apache/beam/sdk/io/gcp/bigtable/changestreams/it/BigtableChangeStreamIT.java:
##########
@@ -0,0 +1,361 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.beam.sdk.io.gcp.bigtable.changestreams.it;
+
+import com.google.api.gax.batching.Batcher;
+import com.google.bigtable.v2.MutateRowsRequest;
+import com.google.cloud.bigtable.admin.v2.BigtableTableAdminClient;
+import com.google.cloud.bigtable.admin.v2.BigtableTableAdminSettings;
+import com.google.cloud.bigtable.admin.v2.models.CreateTableRequest;
+import com.google.cloud.bigtable.admin.v2.models.UpdateTableRequest;
+import com.google.cloud.bigtable.data.v2.BigtableDataClient;
+import com.google.cloud.bigtable.data.v2.BigtableDataSettings;
+import com.google.cloud.bigtable.data.v2.models.ChangeStreamMutation;
+import com.google.cloud.bigtable.data.v2.models.Range;
+import com.google.cloud.bigtable.data.v2.models.RowMutationEntry;
+import com.google.cloud.bigtable.data.v2.stub.EnhancedBigtableStubSettings;
+import com.google.protobuf.ByteString;
+import java.io.IOException;
+import java.util.Arrays;
+import java.util.stream.Collectors;
+import org.apache.beam.sdk.extensions.gcp.options.GcpOptions;
+import org.apache.beam.sdk.io.common.IOITHelper;
+import org.apache.beam.sdk.io.gcp.bigtable.BigtableTestOptions;
+import org.apache.beam.sdk.io.gcp.bigtable.BigtableTestUtils;
+import org.apache.beam.sdk.testing.PAssert;
+import org.apache.beam.sdk.testing.TestPipeline;
+import org.apache.beam.sdk.transforms.DoFn;
+import org.apache.beam.sdk.transforms.ParDo;
+import org.apache.beam.sdk.values.KV;
+import org.apache.beam.sdk.values.PCollection;
+import 
org.apache.beam.vendor.guava.v32_1_2_jre.com.google.common.collect.ImmutableList;
+import org.joda.time.Duration;
+import org.joda.time.Instant;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.JUnit4;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/** End-to-end tests of Bigtable Change Stream. */
+@SuppressWarnings("FutureReturnValueIgnored")
+@RunWith(JUnit4.class)
+public class BigtableChangeStreamIT {
+  private static final Logger LOG = 
LoggerFactory.getLogger(BigtableChangeStreamIT.class);
+  private static final String COLUMN_FAMILY1 = "CF";
+  private static final String COLUMN_FAMILY2 = "CF2";
+  private static final String COLUMN_QUALIFIER = "CQ";
+  private static String projectId;
+  private static String instanceId;
+  private static String tableId;
+  private static String appProfileId;
+  private static String metadataTableId;
+  private static BigtableTableAdminClient adminClient;
+  private static BigtableDataClient dataClient;
+  private static BigtableClientIntegrationTestOverride bigtableClientOverride;
+  private static Batcher<RowMutationEntry, Void> mutationBatcher;
+  private static BigtableTestOptions options;
+  private transient TestPipeline pipeline;
+
+  @BeforeClass
+  public static void beforeClass() throws IOException {
+    options = IOITHelper.readIOTestPipelineOptions(BigtableTestOptions.class);
+    LOG.info("Pipeline options: {}", options);
+    projectId = options.as(GcpOptions.class).getProject();
+    instanceId = options.getInstanceId();
+
+    long randomId = Instant.now().getMillis();
+    tableId = "beam-change-stream-test-" + randomId;
+    metadataTableId = "beam-change-stream-test-md-" + randomId;
+    appProfileId = "default";
+
+    bigtableClientOverride = new BigtableClientIntegrationTestOverride();
+    LOG.info(bigtableClientOverride.toString());
+
+    BigtableDataSettings.Builder dataSettingsBuilder = 
BigtableDataSettings.newBuilder();
+    BigtableTableAdminSettings.Builder tableAdminSettingsBuilder =
+        BigtableTableAdminSettings.newBuilder();
+    dataSettingsBuilder.setProjectId(projectId);
+    tableAdminSettingsBuilder.setProjectId(projectId);
+    dataSettingsBuilder.setInstanceId(instanceId);
+    tableAdminSettingsBuilder.setInstanceId(instanceId);
+    dataSettingsBuilder.setAppProfileId(appProfileId);
+    // TODO: Remove this later. But for now, disable direct path.

Review Comment:
   We still disable direct path in `BigtableChangeStreamAccessor`. So it would 
make sense to keep it disabled when we write/read from bigtable.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to