1616
1717package com .google .cloud .spanner .jdbc .it ;
1818
19+ import static com .google .cloud .spanner .testing .EmulatorSpannerHelper .SPANNER_EMULATOR_HOST ;
20+ import static com .google .cloud .spanner .testing .EmulatorSpannerHelper .isUsingEmulator ;
1921import static org .junit .Assert .assertArrayEquals ;
2022import static org .junit .Assert .assertEquals ;
2123import static org .junit .Assert .assertFalse ;
3436import com .google .cloud .spanner .jdbc .ProtoMessageType ;
3537import com .google .cloud .spanner .jdbc .it .SingerProto .Genre ;
3638import com .google .cloud .spanner .jdbc .it .SingerProto .SingerInfo ;
37- import com .google .cloud .spanner .testing .EmulatorSpannerHelper ;
3839import com .google .cloud .spanner .testing .RemoteSpannerHelper ;
3940import java .io .InputStream ;
4041import java .sql .Connection ;
@@ -68,8 +69,6 @@ public static boolean isUsingGraalVm() {
6869
6970 @ BeforeClass
7071 public static void setup () throws Exception {
71- assumeFalse (
72- "Proto columns is not supported in the emulator" , EmulatorSpannerHelper .isUsingEmulator ());
7372 assumeFalse ("Skipping tests on GraalVM" , isUsingGraalVm ());
7473 RemoteSpannerHelper testHelper = env .getTestHelper ();
7574 final String projectId = testHelper .getInstanceId ().getProject ();
@@ -87,7 +86,12 @@ public static void setup() throws Exception {
8786 .setDialect (Dialect .GOOGLE_STANDARD_SQL )
8887 .setProtoDescriptors (in )
8988 .build ();
90- final String host = SpannerTestHost .getHost ();
89+ final String host ;
90+ if (isUsingEmulator ()) {
91+ host = System .getenv (SPANNER_EMULATOR_HOST );
92+ } else {
93+ host = SpannerTestHost .getHost ();
94+ }
9195
9296 database =
9397 databaseAdminClient
@@ -109,6 +113,9 @@ public static void setup() throws Exception {
109113
110114 in .close ();
111115 url = "jdbc:cloudspanner://" + host + "/" + database .getId ();
116+ if (isUsingEmulator ()) {
117+ url += "?autoConfigEmulator=true" ;
118+ }
112119 }
113120
114121 @ AfterClass
@@ -121,8 +128,6 @@ public static void teardown() {
121128
122129 @ Test
123130 public void testNonNullElements () throws Exception {
124- assumeFalse (
125- "Proto columns is not supported in the emulator" , EmulatorSpannerHelper .isUsingEmulator ());
126131 assumeFalse ("Skipping tests on GraalVM" , isUsingGraalVm ());
127132 SingerInfo singerInfo =
128133 SingerInfo .newBuilder ()
@@ -166,8 +171,6 @@ public void testNonNullElements() throws Exception {
166171
167172 @ Test
168173 public void testNullElements () throws Exception {
169- assumeFalse (
170- "Proto columns is not supported in the emulator" , EmulatorSpannerHelper .isUsingEmulator ());
171174 assumeFalse ("Skipping tests on GraalVM" , isUsingGraalVm ());
172175 try (Connection connection = DriverManager .getConnection (url );
173176 PreparedStatement ps =
@@ -201,8 +204,6 @@ public void testNullElements() throws Exception {
201204
202205 @ Test
203206 public void testUntypedNullElements () throws Exception {
204- assumeFalse (
205- "Proto columns is not supported in the emulator" , EmulatorSpannerHelper .isUsingEmulator ());
206207 assumeFalse ("Skipping tests on GraalVM" , isUsingGraalVm ());
207208 try (Connection connection = DriverManager .getConnection (url );
208209 PreparedStatement ps =
@@ -231,8 +232,6 @@ public void testUntypedNullElements() throws Exception {
231232
232233 @ Test
233234 public void testInterCompatibility () throws Exception {
234- assumeFalse (
235- "Proto columns is not supported in the emulator" , EmulatorSpannerHelper .isUsingEmulator ());
236235 assumeFalse ("Skipping tests on GraalVM" , isUsingGraalVm ());
237236 SingerInfo singerInfo =
238237 SingerInfo .newBuilder ()
0 commit comments