2525
2626import com .google .cloud .spanner .IntegrationTest ;
2727import com .google .cloud .spanner .jdbc .ITAbstractJdbcTest ;
28+ import com .google .cloud .spanner .testing .EmulatorSpannerHelper ;
2829import java .sql .Connection ;
2930import java .sql .DatabaseMetaData ;
3031import java .sql .ResultSet ;
@@ -53,7 +54,8 @@ public class ITJdbcDatabaseMetaDataTest extends ITAbstractJdbcTest {
5354
5455 @ BeforeClass
5556 public static void skipOnEmulator () {
56- assumeFalse ("foreign keys are not supported on the emulator" , env .getTestHelper ().isEmulator ());
57+ assumeFalse (
58+ "foreign keys are not supported on the emulator" , EmulatorSpannerHelper .isUsingEmulator ());
5759 }
5860
5961 @ Override
@@ -70,6 +72,7 @@ private static final class Column {
7072 private final Integer radix ;
7173 private final boolean nullable ;
7274 private final Integer charOctetLength ;
75+ private final boolean computed ;
7376
7477 private Column (
7578 String name ,
@@ -80,6 +83,19 @@ private Column(
8083 Integer radix ,
8184 boolean nullable ,
8285 Integer charOctetLength ) {
86+ this (name , type , typeName , colSize , decimalDigits , radix , nullable , charOctetLength , false );
87+ }
88+
89+ private Column (
90+ String name ,
91+ int type ,
92+ String typeName ,
93+ Integer colSize ,
94+ Integer decimalDigits ,
95+ Integer radix ,
96+ boolean nullable ,
97+ Integer charOctetLength ,
98+ boolean computed ) {
8399 this .name = name ;
84100 this .type = type ;
85101 this .typeName = typeName ;
@@ -88,6 +104,7 @@ private Column(
88104 this .radix = radix ;
89105 this .nullable = nullable ;
90106 this .charOctetLength = charOctetLength ;
107+ this .computed = computed ;
91108 }
92109 }
93110
@@ -133,7 +150,17 @@ private Column(
133150 new Column ("ColDateArray" , Types .ARRAY , "ARRAY<DATE>" , 10 , null , null , true , null ),
134151 new Column (
135152 "ColTimestampArray" , Types .ARRAY , "ARRAY<TIMESTAMP>" , 35 , null , null , true , null ),
136- new Column ("ColNumericArray" , Types .ARRAY , "ARRAY<NUMERIC>" , 15 , null , 10 , true , null ));
153+ new Column ("ColNumericArray" , Types .ARRAY , "ARRAY<NUMERIC>" , 15 , null , 10 , true , null ),
154+ new Column (
155+ "ColComputed" ,
156+ Types .NVARCHAR ,
157+ "STRING(MAX)" ,
158+ 2621440 ,
159+ null ,
160+ null ,
161+ true ,
162+ 2621440 ,
163+ true ));
137164
138165 @ Test
139166 public void testGetColumns () throws SQLException {
@@ -195,7 +222,7 @@ public void testGetColumns() throws SQLException {
195222 assertThat (rs .getShort ("SOURCE_DATA_TYPE" ), is (equalTo ((short ) 0 )));
196223 assertThat (rs .wasNull (), is (true ));
197224 assertThat (rs .getString ("IS_AUTOINCREMENT" ), is (equalTo ("NO" )));
198- assertThat (rs .getString ("IS_GENERATEDCOLUMN" ), is (equalTo ("NO" )));
225+ assertThat (rs .getString ("IS_GENERATEDCOLUMN" ), is (equalTo (col . computed ? "YES" : "NO" )));
199226 assertThat (rs .getMetaData ().getColumnCount (), is (equalTo (24 )));
200227
201228 pos ++;
0 commit comments