@@ -29,6 +29,7 @@ final class SpannerFeature implements Feature {
29
29
30
30
private static final String SPANNER_CLASS = "com.google.spanner.v1.SpannerGrpc" ;
31
31
private static final String SPANNER_TEST_CLASS = "com.google.cloud.spanner.GceTestEnvConfig" ;
32
+ private static final String MOCK_CLASS = "com.google.cloud.spanner.MockDatabaseAdminServiceImpl" ;
32
33
private static final String CLIENT_SIDE_IMPL_CLASS =
33
34
"com.google.cloud.spanner.connection.ClientSideStatementImpl" ;
34
35
private static final String CLIENT_SIDE_VALUE_CONVERTER =
@@ -50,10 +51,7 @@ final class SpannerFeature implements Feature {
50
51
51
52
@ Override
52
53
public void beforeAnalysis (BeforeAnalysisAccess access ) {
53
- Class <?> spannerTestClass = access .findClassByName (SPANNER_TEST_CLASS );
54
- if (spannerTestClass != null ) {
55
- NativeImageUtils .registerConstructorsForReflection (access , SPANNER_TEST_CLASS );
56
- }
54
+ registerSpannerTestClasses (access );
57
55
if (access .findClassByName (CLIENT_SIDE_IMPL_CLASS ) != null ) {
58
56
NativeImageUtils .registerClassHierarchyForReflection (access , CLIENT_SIDE_IMPL_CLASS );
59
57
}
@@ -103,4 +101,16 @@ public void beforeAnalysis(BeforeAnalysisAccess access) {
103
101
"\\ Qcom/google/cloud/spanner/connection/ITSqlScriptTest_TestQueryOptions.sql\\ E" );
104
102
}
105
103
}
104
+
105
+ private void registerSpannerTestClasses (BeforeAnalysisAccess access ) {
106
+ Class <?> spannerTestClass = access .findClassByName (SPANNER_TEST_CLASS );
107
+ if (spannerTestClass != null ) {
108
+ NativeImageUtils .registerConstructorsForReflection (access , SPANNER_TEST_CLASS );
109
+ }
110
+ Class <?> mockClass = access .findClassByName (MOCK_CLASS );
111
+ if (mockClass != null ) {
112
+ NativeImageUtils .registerClassForReflection (
113
+ access , "com.google.cloud.spanner.MockDatabaseAdminServiceImpl$MockBackup" );
114
+ }
115
+ }
106
116
}
0 commit comments