16
16
17
17
package com .google .cloud .spanner .jdbc .it ;
18
18
19
+ import static com .google .cloud .spanner .testing .EmulatorSpannerHelper .SPANNER_EMULATOR_HOST ;
20
+ import static com .google .cloud .spanner .testing .EmulatorSpannerHelper .isUsingEmulator ;
19
21
import static org .junit .Assert .assertArrayEquals ;
20
22
import static org .junit .Assert .assertEquals ;
21
23
import static org .junit .Assert .assertFalse ;
34
36
import com .google .cloud .spanner .jdbc .ProtoMessageType ;
35
37
import com .google .cloud .spanner .jdbc .it .SingerProto .Genre ;
36
38
import com .google .cloud .spanner .jdbc .it .SingerProto .SingerInfo ;
37
- import com .google .cloud .spanner .testing .EmulatorSpannerHelper ;
38
39
import com .google .cloud .spanner .testing .RemoteSpannerHelper ;
39
40
import java .io .InputStream ;
40
41
import java .sql .Connection ;
@@ -68,8 +69,6 @@ public static boolean isUsingGraalVm() {
68
69
69
70
@ BeforeClass
70
71
public static void setup () throws Exception {
71
- assumeFalse (
72
- "Proto columns is not supported in the emulator" , EmulatorSpannerHelper .isUsingEmulator ());
73
72
assumeFalse ("Skipping tests on GraalVM" , isUsingGraalVm ());
74
73
RemoteSpannerHelper testHelper = env .getTestHelper ();
75
74
final String projectId = testHelper .getInstanceId ().getProject ();
@@ -87,7 +86,12 @@ public static void setup() throws Exception {
87
86
.setDialect (Dialect .GOOGLE_STANDARD_SQL )
88
87
.setProtoDescriptors (in )
89
88
.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
+ }
91
95
92
96
database =
93
97
databaseAdminClient
@@ -109,6 +113,9 @@ public static void setup() throws Exception {
109
113
110
114
in .close ();
111
115
url = "jdbc:cloudspanner://" + host + "/" + database .getId ();
116
+ if (isUsingEmulator ()) {
117
+ url += "?autoConfigEmulator=true" ;
118
+ }
112
119
}
113
120
114
121
@ AfterClass
@@ -121,8 +128,6 @@ public static void teardown() {
121
128
122
129
@ Test
123
130
public void testNonNullElements () throws Exception {
124
- assumeFalse (
125
- "Proto columns is not supported in the emulator" , EmulatorSpannerHelper .isUsingEmulator ());
126
131
assumeFalse ("Skipping tests on GraalVM" , isUsingGraalVm ());
127
132
SingerInfo singerInfo =
128
133
SingerInfo .newBuilder ()
@@ -166,8 +171,6 @@ public void testNonNullElements() throws Exception {
166
171
167
172
@ Test
168
173
public void testNullElements () throws Exception {
169
- assumeFalse (
170
- "Proto columns is not supported in the emulator" , EmulatorSpannerHelper .isUsingEmulator ());
171
174
assumeFalse ("Skipping tests on GraalVM" , isUsingGraalVm ());
172
175
try (Connection connection = DriverManager .getConnection (url );
173
176
PreparedStatement ps =
@@ -201,8 +204,6 @@ public void testNullElements() throws Exception {
201
204
202
205
@ Test
203
206
public void testUntypedNullElements () throws Exception {
204
- assumeFalse (
205
- "Proto columns is not supported in the emulator" , EmulatorSpannerHelper .isUsingEmulator ());
206
207
assumeFalse ("Skipping tests on GraalVM" , isUsingGraalVm ());
207
208
try (Connection connection = DriverManager .getConnection (url );
208
209
PreparedStatement ps =
@@ -231,8 +232,6 @@ public void testUntypedNullElements() throws Exception {
231
232
232
233
@ Test
233
234
public void testInterCompatibility () throws Exception {
234
- assumeFalse (
235
- "Proto columns is not supported in the emulator" , EmulatorSpannerHelper .isUsingEmulator ());
236
235
assumeFalse ("Skipping tests on GraalVM" , isUsingGraalVm ());
237
236
SingerInfo singerInfo =
238
237
SingerInfo .newBuilder ()
0 commit comments