From 44ab540bbf19e21287224e3566640987039287da Mon Sep 17 00:00:00 2001 From: Yi Hu Date: Mon, 30 Oct 2023 14:07:46 -0400 Subject: [PATCH 1/2] Rename --host to --fireStoreHost --- sdks/java/io/google-cloud-platform/build.gradle | 8 ++++---- .../beam/sdk/io/gcp/firestore/FirestoreOptions.java | 4 ++-- .../gcp/firestore/FirestoreStatefulComponentFactory.java | 2 +- .../sdk/io/gcp/firestore/it/FirestoreTestingHelper.java | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/sdks/java/io/google-cloud-platform/build.gradle b/sdks/java/io/google-cloud-platform/build.gradle index c4a508680186..d66122e4d107 100644 --- a/sdks/java/io/google-cloud-platform/build.gradle +++ b/sdks/java/io/google-cloud-platform/build.gradle @@ -186,13 +186,13 @@ task integrationTest(type: Test, dependsOn: processTestResources) { def gcpProject = project.findProperty('gcpProject') ?: 'apache-beam-testing' def gcpTempRoot = project.findProperty('gcpTempRoot') ?: 'gs://temp-storage-for-end-to-end-tests' def firestoreDb = project.findProperty('firestoreDb') ?: 'firestoredb' - def host = project.findProperty('host') ?: 'batch-firestore.googleapis.com:443' + def firestoreHost = project.findProperty('firestoreHost') ?: 'batch-firestore.googleapis.com:443' systemProperty "beamTestPipelineOptions", JsonOutput.toJson([ "--runner=DirectRunner", "--project=${gcpProject}", "--tempRoot=${gcpTempRoot}", "--firestoreDb=${firestoreDb}", - "--host=${host}", + "--firestoreHost=${firestoreHost}", ]) // Disable Gradle cache: these ITs interact with live service that should always be considered "out of date" @@ -220,14 +220,14 @@ task integrationTestKms(type: Test) { def gcpTempRoot = project.findProperty('gcpTempRootKms') ?: 'gs://temp-storage-for-end-to-end-tests-cmek' def dataflowKmsKey = project.findProperty('dataflowKmsKey') ?: "projects/apache-beam-testing/locations/global/keyRings/beam-it/cryptoKeys/test" def firestoreDb = project.findProperty('firestoreDb') ?: 'firestoredb' - def host = project.findProperty('host') ?: 'batch-firestore.googleapis.com:443' + def firestoreHost = project.findProperty('firestoreHost') ?: 'batch-firestore.googleapis.com:443' systemProperty "beamTestPipelineOptions", JsonOutput.toJson([ "--runner=DirectRunner", "--project=${gcpProject}", "--tempRoot=${gcpTempRoot}", "--dataflowKmsKey=${dataflowKmsKey}", "--firestoreDb=${firestoreDb}", - "--host=${host}", + "--firestoreHost=${firestoreHost}", ]) // Disable Gradle cache: these ITs interact with live service that should always be considered "out of date" diff --git a/sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/firestore/FirestoreOptions.java b/sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/firestore/FirestoreOptions.java index 1be6568372d9..a292a106e51f 100644 --- a/sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/firestore/FirestoreOptions.java +++ b/sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/firestore/FirestoreOptions.java @@ -66,7 +66,7 @@ public interface FirestoreOptions extends PipelineOptions { */ @Description("Firestore endpoint (host and port)") @Default.String("batch-firestore.googleapis.com:443") - String getHost(); + String getFirestoreHost(); /** * Define a host port pair to allow connecting to a Cloud Firestore instead of the default live @@ -74,5 +74,5 @@ public interface FirestoreOptions extends PipelineOptions { * * @param host the host and port to connect to */ - void setHost(String host); + void setFirestoreHost(String host); } diff --git a/sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/firestore/FirestoreStatefulComponentFactory.java b/sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/firestore/FirestoreStatefulComponentFactory.java index 21c29c485d1e..4e8c11f7072c 100644 --- a/sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/firestore/FirestoreStatefulComponentFactory.java +++ b/sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/firestore/FirestoreStatefulComponentFactory.java @@ -93,7 +93,7 @@ FirestoreStub getFirestoreStub(PipelineOptions options) { GcpOptions gcpOptions = options.as(GcpOptions.class); builder .setCredentialsProvider(FixedCredentialsProvider.create(gcpOptions.getGcpCredential())) - .setEndpoint(firestoreOptions.getHost()); + .setEndpoint(firestoreOptions.getFirestoreHost()); headers.put( "x-goog-request-params", "project_id=" diff --git a/sdks/java/io/google-cloud-platform/src/test/java/org/apache/beam/sdk/io/gcp/firestore/it/FirestoreTestingHelper.java b/sdks/java/io/google-cloud-platform/src/test/java/org/apache/beam/sdk/io/gcp/firestore/it/FirestoreTestingHelper.java index d8c55d44f3c8..a57dd688d4af 100644 --- a/sdks/java/io/google-cloud-platform/src/test/java/org/apache/beam/sdk/io/gcp/firestore/it/FirestoreTestingHelper.java +++ b/sdks/java/io/google-cloud-platform/src/test/java/org/apache/beam/sdk/io/gcp/firestore/it/FirestoreTestingHelper.java @@ -134,7 +134,7 @@ public FirestoreTestingHelper(CleanupMode cleanupMode) { .setCredentials(gcpOptions.getGcpCredential()) .setProjectId(gcpOptions.getProject()) .setDatabaseId(firestoreBeamOptions.getFirestoreDb()) - .setHost(firestoreBeamOptions.getHost()) + .setHost(firestoreBeamOptions.getFirestoreHost()) .build(); fs = firestoreOptions.getService(); rpc = (FirestoreRpc) firestoreOptions.getRpc(); From f0a10f23379caeb59527b7f1baf39534b3c093a6 Mon Sep 17 00:00:00 2001 From: Yi Hu Date: Mon, 30 Oct 2023 18:41:02 -0400 Subject: [PATCH 2/2] Add CHANGES.md --- CHANGES.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGES.md b/CHANGES.md index 6561cc2b56df..f34ffef79722 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -82,6 +82,7 @@ should handle this. ([#25252](https://github.com/apache/beam/issues/25252)). classes finally moved to `extensions/avro`. In case if it's still required to use `AvroCoder` for `CounterMark`, then, as a workaround, a copy of "old" `CountingSource` class should be placed into a project code and used directly ([#25252](https://github.com/apache/beam/issues/25252)). +* Renamed `host` to `firestoreHost` in `FirestoreOptions` to avoid potential conflict of command line arguments (Java) ([#29201](https://github.com/apache/beam/pull/29201)). ## Deprecations