This is an automated email from the ASF dual-hosted git repository.
yhu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/beam.git
The following commit(s) were added to refs/heads/master by this push:
new 94327fdac52 Fix sync it (#28588)
94327fdac52 is described below
commit 94327fdac529903a8e0fae59172ca7ccee739b1a
Author: Yi Hu <[email protected]>
AuthorDate: Thu Sep 21 13:28:22 2023 -0400
Fix sync it (#28588)
---
.../apache/beam/it/gcp/bigtable/BigtableResourceManager.java | 10 +++++-----
.../beam/it/gcp/bigtable/BigtableResourceManagerUtils.java | 5 +++--
.../beam/it/gcp/bigtable/BigtableResourceManagerTest.java | 3 ++-
3 files changed, 10 insertions(+), 8 deletions(-)
diff --git
a/it/google-cloud-platform/src/main/java/org/apache/beam/it/gcp/bigtable/BigtableResourceManager.java
b/it/google-cloud-platform/src/main/java/org/apache/beam/it/gcp/bigtable/BigtableResourceManager.java
index 71388022928..311ce9575c2 100644
---
a/it/google-cloud-platform/src/main/java/org/apache/beam/it/gcp/bigtable/BigtableResourceManager.java
+++
b/it/google-cloud-platform/src/main/java/org/apache/beam/it/gcp/bigtable/BigtableResourceManager.java
@@ -96,7 +96,7 @@ public class BigtableResourceManager implements
ResourceManager {
private final Set<String> cdcEnabledTables;
private boolean hasInstance;
- private Iterable<BigtableResourceManagerCluster> clusters;
+ private List<BigtableResourceManagerCluster> clusters;
private final boolean usingStaticInstance;
@@ -195,12 +195,12 @@ public class BigtableResourceManager implements
ResourceManager {
/**
* Creates a Bigtable instance in which all clusters, nodes and tables will
exist.
*
- * @param clusters Collection of BigtableResourceManagerCluster objects to
associate with the
- * given Bigtable instance.
+ * @param clusters List of BigtableResourceManagerCluster objects to
associate with the given
+ * Bigtable instance.
* @throws BigtableResourceManagerException if there is an error creating
the instance in
* Bigtable.
*/
- public synchronized void
createInstance(Iterable<BigtableResourceManagerCluster> clusters)
+ public synchronized void createInstance(List<BigtableResourceManagerCluster>
clusters)
throws BigtableResourceManagerException {
// Check to see if instance already exists, and throw error if it does
@@ -559,7 +559,7 @@ public class BigtableResourceManager implements
ResourceManager {
}
private Iterable<BigtableResourceManagerCluster> getClusters() {
- if (usingStaticInstance && this.clusters == null) {
+ if (usingStaticInstance && this.clusters.isEmpty()) {
try (BigtableInstanceAdminClient instanceAdminClient =
bigtableResourceManagerClientFactory.bigtableInstanceAdminClient()) {
List<BigtableResourceManagerCluster> managedClusters = new
ArrayList<>();
diff --git
a/it/google-cloud-platform/src/main/java/org/apache/beam/it/gcp/bigtable/BigtableResourceManagerUtils.java
b/it/google-cloud-platform/src/main/java/org/apache/beam/it/gcp/bigtable/BigtableResourceManagerUtils.java
index a893493d766..28f1f5bf60c 100644
---
a/it/google-cloud-platform/src/main/java/org/apache/beam/it/gcp/bigtable/BigtableResourceManagerUtils.java
+++
b/it/google-cloud-platform/src/main/java/org/apache/beam/it/gcp/bigtable/BigtableResourceManagerUtils.java
@@ -21,6 +21,7 @@ import static
org.apache.beam.it.common.utils.ResourceManagerUtils.generateResou
import com.google.cloud.bigtable.admin.v2.models.StorageType;
import java.time.format.DateTimeFormatter;
+import java.util.List;
import java.util.regex.Pattern;
import
org.apache.beam.vendor.guava.v32_1_2_jre.com.google.common.collect.ImmutableList;
@@ -51,9 +52,9 @@ public final class BigtableResourceManagerUtils {
* @param zone the zone/region that the cluster will be deployed to.
* @param numNodes the number of nodes that the cluster will contain.
* @param storageType the type of storage to configure the cluster with (SSD
or HDD).
- * @return Collection containing a single BigtableResourceManagerCluster
object.
+ * @return List containing a single BigtableResourceManagerCluster object.
*/
- static Iterable<BigtableResourceManagerCluster> generateDefaultClusters(
+ static List<BigtableResourceManagerCluster> generateDefaultClusters(
String baseString, String zone, int numNodes, StorageType storageType) {
String clusterId =
diff --git
a/it/google-cloud-platform/src/test/java/org/apache/beam/it/gcp/bigtable/BigtableResourceManagerTest.java
b/it/google-cloud-platform/src/test/java/org/apache/beam/it/gcp/bigtable/BigtableResourceManagerTest.java
index f8673ed696c..74b25e84c69 100644
---
a/it/google-cloud-platform/src/test/java/org/apache/beam/it/gcp/bigtable/BigtableResourceManagerTest.java
+++
b/it/google-cloud-platform/src/test/java/org/apache/beam/it/gcp/bigtable/BigtableResourceManagerTest.java
@@ -40,6 +40,7 @@ import com.google.cloud.bigtable.data.v2.models.RowMutation;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
+import java.util.List;
import java.util.Map;
import
org.apache.beam.vendor.guava.v32_1_2_jre.com.google.common.collect.ImmutableList;
import org.junit.Before;
@@ -73,7 +74,7 @@ public class BigtableResourceManagerTest {
private static final StorageType CLUSTER_STORAGE_TYPE = StorageType.SSD;
private BigtableResourceManager testManager;
- private Iterable<BigtableResourceManagerCluster> cluster;
+ private List<BigtableResourceManagerCluster> cluster;
@Before
public void setUp() throws IOException {