@@ -775,6 +775,20 @@ public class ITBigQueryTest {
775
775
776
776
private static final Set <String > PUBLIC_DATASETS =
777
777
ImmutableSet .of ("github_repos" , "hacker_news" , "noaa_gsod" , "samples" , "usa_names" );
778
+ private static final Map <String , String > PUBLIC_DATASETS_LOCATION =
779
+ ImmutableMap .<String , String >builder ()
780
+ .put ("github_repos" , "US" )
781
+ .put ("hacker_news" , "US" )
782
+ .put ("noaa_gsod" , "US" )
783
+ .put ("samples" , "US" )
784
+ .put ("usa_names" , "US" )
785
+ // Dataset url:
786
+ // https://console.cloud.google.com/bigquery?project=bigquery-public-data&ws=!1m4!1m3!3m2!1sbigquery-public-data!2sgnomAD_asiane1
787
+ .put ("gnomAD_asiane1" , "asia-northeast1" )
788
+ // Dataset url:
789
+ // https://console.cloud.google.com/bigquery?project=bigquery-public-data&ws=!1m4!1m3!3m2!1sbigquery-public-data!2sgnomAD_eu
790
+ .put ("gnomAD_eu" , "EU" )
791
+ .build ();
778
792
779
793
private static final String PUBLIC_PROJECT = "bigquery-public-data" ;
780
794
private static final String PUBLIC_DATASET = "census_bureau_international" ;
@@ -1113,11 +1127,16 @@ public void testListDatasets() {
1113
1127
Page <Dataset > datasets = bigquery .listDatasets ("bigquery-public-data" );
1114
1128
Iterator <Dataset > iterator = datasets .iterateAll ().iterator ();
1115
1129
Set <String > datasetNames = new HashSet <>();
1130
+ Map <String , String > datasetLocation = new HashMap <>();
1116
1131
while (iterator .hasNext ()) {
1117
- datasetNames .add (iterator .next ().getDatasetId ().getDataset ());
1132
+ Dataset dataset = iterator .next ();
1133
+ String name = dataset .getDatasetId ().getDataset ();
1134
+ datasetNames .add (name );
1135
+ datasetLocation .put (name , dataset .getLocation ());
1118
1136
}
1119
1137
for (String type : PUBLIC_DATASETS ) {
1120
1138
assertTrue (datasetNames .contains (type ));
1139
+ assertEquals (PUBLIC_DATASETS_LOCATION .get (type ), datasetLocation .get (type ));
1121
1140
}
1122
1141
}
1123
1142
@@ -6759,11 +6778,16 @@ public void testUniverseDomainWithMatchingDomain() {
6759
6778
Page <Dataset > datasets = bigQuery .listDatasets ("bigquery-public-data" );
6760
6779
Iterator <Dataset > iterator = datasets .iterateAll ().iterator ();
6761
6780
Set <String > datasetNames = new HashSet <>();
6781
+ Map <String , String > datasetLocation = new HashMap <>();
6762
6782
while (iterator .hasNext ()) {
6763
- datasetNames .add (iterator .next ().getDatasetId ().getDataset ());
6783
+ Dataset dataset = iterator .next ();
6784
+ String name = dataset .getDatasetId ().getDataset ();
6785
+ datasetNames .add (name );
6786
+ datasetLocation .put (name , dataset .getLocation ());
6764
6787
}
6765
6788
for (String type : PUBLIC_DATASETS ) {
6766
6789
assertTrue (datasetNames .contains (type ));
6790
+ assertEquals (PUBLIC_DATASETS_LOCATION .get (type ), datasetLocation .get (type ));
6767
6791
}
6768
6792
}
6769
6793
0 commit comments