File tree Expand file tree Collapse file tree 2 files changed +8
-6
lines changed
spark-bigquery-connector-common/src/test/java/com/google/cloud/spark/bigquery Expand file tree Collapse file tree 2 files changed +8
-6
lines changed Original file line number Diff line number Diff line change 1515 */
1616package com .google .cloud .spark .bigquery .acceptance ;
1717
18+ import com .google .cloud .ServiceOptions ;
1819import com .google .common .base .Preconditions ;
20+ import java .util .Optional ;
1921
2022public class AcceptanceTestConstants {
2123
2224 public static final String REGION = "us-west1" ;
2325 public static final String DATAPROC_ENDPOINT = REGION + "-dataproc.googleapis.com:443" ;
2426 public static final String PROJECT_ID =
25- Preconditions .checkNotNull (
26- System .getenv ("GOOGLE_CLOUD_PROJECT" ),
27- "Please set the 'GOOGLE_CLOUD_PROJECT' environment variable" );
27+ Optional .ofNullable (System .getenv ("GOOGLE_CLOUD_PROJECT" ))
28+ .orElse (ServiceOptions .getDefaultProjectId ());
2829 public static final String SERVERLESS_NETWORK_URI =
2930 Preconditions .checkNotNull (
3031 System .getenv ("SERVERLESS_NETWORK_URI" ),
Original file line number Diff line number Diff line change 3232import static org .apache .spark .sql .types .DataTypes .StringType ;
3333import static org .apache .spark .sql .types .DataTypes .TimestampType ;
3434
35+ import com .google .cloud .ServiceOptions ;
3536import com .google .cloud .spark .bigquery .integration .model .ColumnOrderTestClass ;
3637import com .google .cloud .spark .bigquery .integration .model .NumStruct ;
3738import com .google .cloud .spark .bigquery .integration .model .StringStruct ;
4344import java .sql .Timestamp ;
4445import java .util .Arrays ;
4546import java .util .List ;
47+ import java .util .Optional ;
4648import java .util .TimeZone ;
4749import java .util .stream .Collectors ;
4850import java .util .stream .Stream ;
@@ -73,9 +75,8 @@ public class TestConstants {
7375 "bigquery-public-data.wikipedia.pageviews_2021" ;
7476 static final long SHAKESPEARE_TABLE_NUM_ROWS = 164656L ;
7577 static final String PROJECT_ID =
76- Preconditions .checkNotNull (
77- System .getenv ("GOOGLE_CLOUD_PROJECT" ),
78- "Please set the GOOGLE_CLOUD_PROJECT env variable" );
78+ Optional .ofNullable (System .getenv ("GOOGLE_CLOUD_PROJECT" ))
79+ .orElse (ServiceOptions .getDefaultProjectId ());
7980 static final String TEMPORARY_GCS_BUCKET_ENV_VARIABLE = "TEMPORARY_GCS_BUCKET" ;
8081 static final String BIGLAKE_CONNECTION_ID_ENV_VARIABLE = "BIGLAKE_CONNECTION_ID" ;
8182 static final String TEMPORARY_GCS_BUCKET =
You can’t perform that action at this time.
0 commit comments