From c90f9113c6b1bb3f7da8355add835add460b34cc Mon Sep 17 00:00:00 2001 From: Cindy Peng <148148319+cindy-peng@users.noreply.github.com> Date: Mon, 20 Jan 2025 14:10:04 -0800 Subject: [PATCH] formatting --- .cloudbuild/samples_build.yaml | 2 -- .github/workflows/ci.yaml | 8 +---- .kokoro/build.sh | 17 ++-------- .kokoro/common.sh | 3 -- .../testing/LocalDatastoreHelper.java | 34 ++----------------- 5 files changed, 6 insertions(+), 58 deletions(-) diff --git a/.cloudbuild/samples_build.yaml b/.cloudbuild/samples_build.yaml index 11dd29a41..dbdd7efef 100644 --- a/.cloudbuild/samples_build.yaml +++ b/.cloudbuild/samples_build.yaml @@ -22,9 +22,7 @@ steps: - 'JOB_TYPE=samples' - 'GOOGLE_CLOUD_PROJECT=cloud-java-ci-sample' - 'KOKORO_GITHUB_PULL_REQUEST_NUMBER=$_PR_NUMBER' - - 'JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64' - 'JAVA=/usr/lib/jvm/java-11-openjdk-amd64/bin/java' - - 'SUREFIRE_JVM_OPT=-Djvm=/usr/lib/jvm/java-11-openjdk-amd64/bin/java' - name: gcr.io/cloud-devrel-public-resources/java8 entrypoint: echo args: [ diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index dada39532..941f2f3b4 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -59,7 +59,7 @@ jobs: env: JOB_TYPE: test windows: - # Building using Java 8 and run the tests with Java 11 runtime + # Building using Java 11 and run the tests with Java 8 runtime runs-on: windows-latest steps: - name: Support longpaths @@ -69,12 +69,6 @@ jobs: with: java-version: 8 distribution: temurin -# - name: "Set Java system property environment variable for surefire plugin (unit tests)" -# # Maven surefire plugin (unit tests) allows us to specify JVM to run the tests. -# # https://maven.apache.org/surefire/maven-surefire-plugin/test-mojo.html#jvm -## run: echo "SUREFIRE_JVM_OPT=-Djvm=${JAVA_HOME}/bin/java" >> $GITHUB_ENV -# run: echo "JAVA=${JAVA_HOME}\bin\java" >> $GITHUB_ENV -# shell: bash - name: "Set jvm system property environment variable for surefire plugin (unit tests)" run: echo "SUREFIRE_JVM_OPT=-Djvm=${JAVA_HOME}\bin\java" >> $GITHUB_ENV shell: bash diff --git a/.kokoro/build.sh b/.kokoro/build.sh index b78bcc0ca..9bc929e8c 100755 --- a/.kokoro/build.sh +++ b/.kokoro/build.sh @@ -23,14 +23,12 @@ cd ${scriptDir}/.. # include common functions source ${scriptDir}/common.sh -# Kokoro integration test uses both JDK 11 and JDK 8. GraalVM dependencies -# require JDK 11 to compile the classes touching GraalVM classes. -if [ -n "${JAVA11_HOME}" ]; then +# Kokoro integration test uses both JDK 11 and JDK 8. Integration +# tests require JDK 11 to compile the classes. +if [ -n "${JAVA11_HOME}" && ! -z "${JAVA8_HOME}"]; then setJava "${JAVA11_HOME}" - echo "Java: ${JAVA}" fi - # Print out Maven & Java version mvn -version echo ${JOB_TYPE} @@ -68,11 +66,6 @@ javadoc) RETURN_CODE=$? ;; integration) - echo "SUREFIRE_JVM_OPT: ${SUREFIRE_JVM_OPT}" - echo "Java 11: ${JAVA11_HOME}" - echo "JAVA_HOME: ${JAVA_HOME}" - echo "Java: ${JAVA}" - echo "INTEGRATION_TEST_ARGS: ${INTEGRATION_TEST_ARGS}" java -version mvn -B ${INTEGRATION_TEST_ARGS} \ -ntp \ @@ -81,7 +74,6 @@ integration) -Dclirr.skip=true \ -Denforcer.skip=true \ -fae \ - ${SUREFIRE_JVM_OPT} \ verify RETURN_CODE=$? ;; @@ -97,8 +89,6 @@ graalvm17) ;; samples) SAMPLES_DIR=samples - echo "SUREFIRE_JVM_OPT: ${SUREFIRE_JVM_OPT}" - echo "Java 11: ${JAVA11_HOME}" # only run ITs in snapshot/ on presubmit PRs. run ITs in all 3 samples/ subdirectories otherwise. if [[ ! -z ${KOKORO_GITHUB_PULL_REQUEST_NUMBER} ]] then @@ -119,7 +109,6 @@ samples) -Dclirr.skip=true \ -Denforcer.skip=true \ -fae \ - ${SUREFIRE_JVM_OPT} \ verify RETURN_CODE=$? popd diff --git a/.kokoro/common.sh b/.kokoro/common.sh index 3c12376d4..61e12aeb2 100644 --- a/.kokoro/common.sh +++ b/.kokoro/common.sh @@ -58,9 +58,6 @@ function msg() { println "$*" >&2; } function println() { printf '%s\n' "$(now) $*"; } function setJava() { export JAVA=$1/bin/java - export JAVA_HOME=$1 - export SUREFIRE_JVM_OPT=-Djvm=${JAVA_HOME}/bin/java - export PATH=${JAVA_HOME}/bin:$PATH } ## Helper comment to trigger updated repo dependency release \ No newline at end of file diff --git a/google-cloud-datastore/src/main/java/com/google/cloud/datastore/testing/LocalDatastoreHelper.java b/google-cloud-datastore/src/main/java/com/google/cloud/datastore/testing/LocalDatastoreHelper.java index f982689d5..b4d4c56c0 100644 --- a/google-cloud-datastore/src/main/java/com/google/cloud/datastore/testing/LocalDatastoreHelper.java +++ b/google-cloud-datastore/src/main/java/com/google/cloud/datastore/testing/LocalDatastoreHelper.java @@ -26,9 +26,7 @@ import com.google.cloud.datastore.DatastoreOptions; import com.google.cloud.testing.BaseEmulatorHelper; import com.google.common.collect.ImmutableList; -import java.io.BufferedReader; import java.io.IOException; -import java.io.InputStreamReader; import java.net.MalformedURLException; import java.net.URL; import java.nio.file.FileVisitResult; @@ -192,8 +190,8 @@ private LocalDatastoreHelper(Builder builder) { if (builder.firestoreInDatastoreMode) { binCommand.add("--firestore_in_datastore_mode"); } else { - // At most one of --consistency | --use-firestore-in-datastore-mode can be specified. - // --consistency will be ignored with --use-firestore-in-datastore-mode. + // At most one of --consistency | --firestore_in_datastore_mode can be specified. + // --consistency will be ignored with --firestore_in_datastore_mode. binCommand.add(CONSISTENCY_FLAG + getConsistency()); } binCommand.add(BIN_CMD_PORT_FLAG + getPort()); @@ -325,34 +323,6 @@ public static LocalDatastoreHelper create() { */ @Override public void start() throws IOException, InterruptedException { - try { - // Run the gcloud --version command - Process process = Runtime.getRuntime().exec("gcloud --version"); - BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream())); - - String line; - StringBuilder output = new StringBuilder(); - while ((line = reader.readLine()) != null) { - output.append(line).append("\n"); - } - - // Check the exit code to see if the command was successful - int exitCode = process.waitFor(); - if (exitCode == 0) { - System.out.println("gcloud is installed.\nVersion information:\n" + output); - LOGGER.info("gcloud is installed.\nVersion information:\n" + output); - } else { - System.err.println("gcloud is not installed or not in the PATH."); - LOGGER.severe("gcloud is not installed or not in the PATH."); - } - - } catch (IOException | InterruptedException e) { - System.err.println("Error checking gcloud installation: " + e.getMessage()); - LOGGER.severe("Error checking gcloud installation: " + e.getMessage()); - } - - String Java_version = System.getenv("JAVA"); - LOGGER.info("java_evn Java: " + Java_version); String blockUntilOutput = "Dev App Server is now running"; startProcess(blockUntilOutput); }