ShardingSphereDatabaseMetaDataTest.java 43.8 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
/*
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

18
package org.apache.shardingsphere.driver.jdbc.core.datasource.metadata;
19 20

import com.google.common.collect.LinkedHashMultimap;
21 22
import org.apache.shardingsphere.driver.jdbc.core.connection.ShardingSphereConnection;
import org.apache.shardingsphere.driver.jdbc.core.resultset.DatabaseMetaDataResultSet;
L
Liang Zhang 已提交
23
import org.apache.shardingsphere.infra.context.metadata.MetaDataContexts;
L
Liang Zhang 已提交
24
import org.apache.shardingsphere.infra.database.type.DatabaseType;
25
import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData;
26
import org.apache.shardingsphere.infra.metadata.resource.CachedDatabaseMetaData;
27
import org.apache.shardingsphere.sharding.api.config.ShardingRuleConfiguration;
28
import org.apache.shardingsphere.sharding.api.config.rule.ShardingTableRuleConfiguration;
29
import org.apache.shardingsphere.sharding.rule.ShardingRule;
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner;

import javax.sql.DataSource;
import java.sql.Connection;
import java.sql.DatabaseMetaData;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.SQLException;
import java.sql.Types;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;

import static org.hamcrest.CoreMatchers.instanceOf;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;
import static org.mockito.ArgumentMatchers.anyString;
52
import static org.mockito.Mockito.RETURNS_DEEP_STUBS;
53 54 55 56
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;

@RunWith(MockitoJUnitRunner.class)
57
public final class ShardingSphereDatabaseMetaDataTest {
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75
    
    private static final String DATA_SOURCE_NAME = "ds";
    
    private static final String TABLE_NAME = "table";
    
    @Mock
    private DataSource dataSource;
    
    @Mock
    private Connection connection;
    
    @Mock
    private DatabaseMetaData databaseMetaData;
    
    @Mock
    private ResultSet resultSet;
    
    @Mock
76
    private ShardingSphereConnection shardingSphereConnection;
77 78
    
    @Mock
L
Liang Zhang 已提交
79
    private MetaDataContexts metaDataContexts;
80
    
T
terrymanu 已提交
81
    private final Map<String, DataSource> dataSourceMap = new HashMap<>(1, 1);
82
    
83
    private ShardingSphereDatabaseMetaData shardingSphereDatabaseMetaData;
84 85 86 87 88 89 90 91
    
    @Before
    public void setUp() throws SQLException {
        dataSourceMap.put(DATA_SOURCE_NAME, dataSource);
        when(dataSource.getConnection()).thenReturn(connection);
        when(connection.getMetaData()).thenReturn(databaseMetaData);
        when(resultSet.getMetaData()).thenReturn(mock(ResultSetMetaData.class));
        CachedDatabaseMetaData cachedDatabaseMetaData = new CachedDatabaseMetaData(databaseMetaData);
92 93 94
        when(shardingSphereConnection.getCachedConnections()).thenReturn(LinkedHashMultimap.create());
        when(shardingSphereConnection.getConnection(anyString())).thenReturn(connection);
        when(shardingSphereConnection.getDataSourceMap()).thenReturn(dataSourceMap);
L
Liang Zhang 已提交
95
        when(shardingSphereConnection.getMetaDataContexts()).thenReturn(metaDataContexts);
96
        ShardingSphereMetaData metaData = mock(ShardingSphereMetaData.class, RETURNS_DEEP_STUBS);
L
Liang Zhang 已提交
97
        when(metaDataContexts.getDefaultMetaData()).thenReturn(metaData);
98
        when(metaData.getResource().getCachedDatabaseMetaData()).thenReturn(cachedDatabaseMetaData);
99 100
        ShardingRule shardingRule = mockShardingRule();
        when(metaData.getRuleMetaData().getRules()).thenReturn(Collections.singleton(shardingRule));
101
        shardingSphereDatabaseMetaData = new ShardingSphereDatabaseMetaData(shardingSphereConnection);
102 103 104 105
    }
    
    private ShardingRule mockShardingRule() {
        ShardingRuleConfiguration ruleConfig = new ShardingRuleConfiguration();
106 107
        ShardingTableRuleConfiguration shardingTableRuleConfig = new ShardingTableRuleConfiguration(TABLE_NAME, DATA_SOURCE_NAME + "." + TABLE_NAME);
        ruleConfig.setTables(Collections.singletonList(shardingTableRuleConfig));
108
        return new ShardingRule(ruleConfig, mock(DatabaseType.class), Collections.singletonMap(DATA_SOURCE_NAME, mock(DataSource.class, RETURNS_DEEP_STUBS)));
109 110 111 112
    }
    
    @Test
    public void assertGetURL() throws SQLException {
113
        assertThat(shardingSphereDatabaseMetaData.getURL(), is(databaseMetaData.getURL()));
114 115 116 117
    }
    
    @Test
    public void assertGetUserName() throws SQLException {
118
        assertThat(shardingSphereDatabaseMetaData.getUserName(), is(databaseMetaData.getUserName()));
119 120 121 122
    }
    
    @Test
    public void assertGetDatabaseProductName() throws SQLException {
123
        assertThat(shardingSphereDatabaseMetaData.getDatabaseProductName(), is(databaseMetaData.getDatabaseProductName()));
124 125 126 127
    }
    
    @Test
    public void assertGetDatabaseProductVersion() throws SQLException {
128
        assertThat(shardingSphereDatabaseMetaData.getDatabaseProductVersion(), is(databaseMetaData.getDatabaseProductVersion()));
129 130 131 132
    }
    
    @Test
    public void assertGetDriverName() throws SQLException {
133
        assertThat(shardingSphereDatabaseMetaData.getDriverName(), is(databaseMetaData.getDriverName()));
134 135 136 137
    }
    
    @Test
    public void assertGetDriverVersion() throws SQLException {
138
        assertThat(shardingSphereDatabaseMetaData.getDriverVersion(), is(databaseMetaData.getDriverVersion()));
139 140 141 142
    }
    
    @Test
    public void assertGetDriverMajorVersion() {
143
        assertThat(shardingSphereDatabaseMetaData.getDriverMajorVersion(), is(databaseMetaData.getDriverMajorVersion()));
144 145 146 147
    }
    
    @Test
    public void assertGetDriverMinorVersion() {
148
        assertThat(shardingSphereDatabaseMetaData.getDriverMinorVersion(), is(databaseMetaData.getDriverMinorVersion()));
149 150 151 152
    }
    
    @Test
    public void assertGetDatabaseMajorVersion() throws SQLException {
153
        assertThat(shardingSphereDatabaseMetaData.getDatabaseMajorVersion(), is(databaseMetaData.getDatabaseMajorVersion()));
154 155 156 157
    }
    
    @Test
    public void assertGetDatabaseMinorVersion() throws SQLException {
158
        assertThat(shardingSphereDatabaseMetaData.getDatabaseMinorVersion(), is(databaseMetaData.getDatabaseMinorVersion()));
159 160 161 162
    }
    
    @Test
    public void assertGetJDBCMajorVersion() throws SQLException {
163
        assertThat(shardingSphereDatabaseMetaData.getJDBCMajorVersion(), is(databaseMetaData.getJDBCMajorVersion()));
164 165 166 167
    }
    
    @Test
    public void assertGetJDBCMinorVersion() throws SQLException {
168
        assertThat(shardingSphereDatabaseMetaData.getJDBCMinorVersion(), is(databaseMetaData.getJDBCMinorVersion()));
169 170 171 172
    }
    
    @Test
    public void assertAssertIsReadOnly() throws SQLException {
173
        assertThat(shardingSphereDatabaseMetaData.isReadOnly(), is(databaseMetaData.isReadOnly()));
174 175 176 177
    }
    
    @Test
    public void assertAllProceduresAreCallable() throws SQLException {
178
        assertThat(shardingSphereDatabaseMetaData.allProceduresAreCallable(), is(databaseMetaData.allProceduresAreCallable()));
179 180 181 182
    }
    
    @Test
    public void assertAllTablesAreSelectable() throws SQLException {
183
        assertThat(shardingSphereDatabaseMetaData.allTablesAreSelectable(), is(databaseMetaData.allTablesAreSelectable()));
184 185 186 187
    }
    
    @Test
    public void assertNullsAreSortedHigh() throws SQLException {
188
        assertThat(shardingSphereDatabaseMetaData.nullsAreSortedHigh(), is(databaseMetaData.nullsAreSortedHigh()));
189 190 191 192
    }
    
    @Test
    public void assertNullsAreSortedLow() throws SQLException {
193
        assertThat(shardingSphereDatabaseMetaData.nullsAreSortedLow(), is(databaseMetaData.nullsAreSortedLow()));
194 195 196 197
    }
    
    @Test
    public void assertNullsAreSortedAtStart() throws SQLException {
198
        assertThat(shardingSphereDatabaseMetaData.nullsAreSortedAtStart(), is(databaseMetaData.nullsAreSortedAtStart()));
199 200 201 202
    }
    
    @Test
    public void assertNullsAreSortedAtEnd() throws SQLException {
203
        assertThat(shardingSphereDatabaseMetaData.nullsAreSortedAtEnd(), is(databaseMetaData.nullsAreSortedAtEnd()));
204 205 206 207
    }
    
    @Test
    public void assertUsesLocalFiles() throws SQLException {
208
        assertThat(shardingSphereDatabaseMetaData.usesLocalFiles(), is(databaseMetaData.usesLocalFiles()));
209 210 211 212
    }
    
    @Test
    public void assertUsesLocalFilePerTable() throws SQLException {
213
        assertThat(shardingSphereDatabaseMetaData.usesLocalFilePerTable(), is(databaseMetaData.usesLocalFilePerTable()));
214 215 216 217
    }
    
    @Test
    public void assertSupportsMixedCaseIdentifiers() throws SQLException {
218
        assertThat(shardingSphereDatabaseMetaData.supportsMixedCaseIdentifiers(), is(databaseMetaData.supportsMixedCaseIdentifiers()));
219 220 221 222
    }
    
    @Test
    public void assertStoresUpperCaseIdentifiers() throws SQLException {
223
        assertThat(shardingSphereDatabaseMetaData.storesUpperCaseIdentifiers(), is(databaseMetaData.storesUpperCaseIdentifiers()));
224 225 226 227
    }
    
    @Test
    public void assertStoresLowerCaseIdentifiers() throws SQLException {
228
        assertThat(shardingSphereDatabaseMetaData.storesLowerCaseIdentifiers(), is(databaseMetaData.storesLowerCaseIdentifiers()));
229 230 231 232
    }
    
    @Test
    public void assertStoresMixedCaseIdentifiers() throws SQLException {
233
        assertThat(shardingSphereDatabaseMetaData.storesMixedCaseIdentifiers(), is(databaseMetaData.storesMixedCaseIdentifiers()));
234 235 236 237
    }
    
    @Test
    public void assertSupportsMixedCaseQuotedIdentifiers() throws SQLException {
238
        assertThat(shardingSphereDatabaseMetaData.supportsMixedCaseQuotedIdentifiers(), is(databaseMetaData.supportsMixedCaseQuotedIdentifiers()));
239 240 241 242
    }
    
    @Test
    public void assertStoresUpperCaseQuotedIdentifiers() throws SQLException {
243
        assertThat(shardingSphereDatabaseMetaData.storesUpperCaseQuotedIdentifiers(), is(databaseMetaData.storesUpperCaseQuotedIdentifiers()));
244 245 246 247
    }
    
    @Test
    public void assertStoresLowerCaseQuotedIdentifiers() throws SQLException {
248
        assertThat(shardingSphereDatabaseMetaData.storesLowerCaseQuotedIdentifiers(), is(databaseMetaData.storesLowerCaseQuotedIdentifiers()));
249 250 251 252
    }
    
    @Test
    public void assertStoresMixedCaseQuotedIdentifiers() throws SQLException {
253
        assertThat(shardingSphereDatabaseMetaData.storesMixedCaseQuotedIdentifiers(), is(databaseMetaData.storesMixedCaseQuotedIdentifiers()));
254 255 256 257
    }
    
    @Test
    public void assertGetIdentifierQuoteString() throws SQLException {
258
        assertThat(shardingSphereDatabaseMetaData.getIdentifierQuoteString(), is(databaseMetaData.getIdentifierQuoteString()));
259 260 261 262
    }
    
    @Test
    public void assertGetSQLKeywords() throws SQLException {
263
        assertThat(shardingSphereDatabaseMetaData.getSQLKeywords(), is(databaseMetaData.getSQLKeywords()));
264 265 266 267
    }
    
    @Test
    public void assertGetNumericFunctions() throws SQLException {
268
        assertThat(shardingSphereDatabaseMetaData.getNumericFunctions(), is(databaseMetaData.getNumericFunctions()));
269 270 271 272
    }
    
    @Test
    public void assertGetStringFunctions() throws SQLException {
273
        assertThat(shardingSphereDatabaseMetaData.getNumericFunctions(), is(databaseMetaData.getNumericFunctions()));
274 275 276 277
    }
    
    @Test
    public void assertGetSystemFunctions() throws SQLException {
278
        assertThat(shardingSphereDatabaseMetaData.getSystemFunctions(), is(databaseMetaData.getSystemFunctions()));
279 280 281 282
    }
    
    @Test
    public void assertGetTimeDateFunctions() throws SQLException {
283
        assertThat(shardingSphereDatabaseMetaData.getTimeDateFunctions(), is(databaseMetaData.getTimeDateFunctions()));
284 285 286 287
    }
    
    @Test
    public void assertGetSearchStringEscape() throws SQLException {
288
        assertThat(shardingSphereDatabaseMetaData.getSearchStringEscape(), is(databaseMetaData.getSearchStringEscape()));
289 290 291 292
    }
    
    @Test
    public void assertGetExtraNameCharacters() throws SQLException {
293
        assertThat(shardingSphereDatabaseMetaData.getExtraNameCharacters(), is(databaseMetaData.getExtraNameCharacters()));
294 295 296 297
    }
    
    @Test
    public void assertSupportsAlterTableWithAddColumn() throws SQLException {
298
        assertThat(shardingSphereDatabaseMetaData.supportsAlterTableWithAddColumn(), is(databaseMetaData.supportsAlterTableWithAddColumn()));
299 300 301 302
    }
    
    @Test
    public void assertSupportsAlterTableWithDropColumn() throws SQLException {
303
        assertThat(shardingSphereDatabaseMetaData.supportsAlterTableWithDropColumn(), is(databaseMetaData.supportsAlterTableWithDropColumn()));
304 305 306 307
    }
    
    @Test
    public void assertSupportsColumnAliasing() throws SQLException {
308
        assertThat(shardingSphereDatabaseMetaData.supportsColumnAliasing(), is(databaseMetaData.supportsColumnAliasing()));
309 310 311 312
    }
    
    @Test
    public void assertNullPlusNonNullIsNull() throws SQLException {
313
        assertThat(shardingSphereDatabaseMetaData.nullPlusNonNullIsNull(), is(databaseMetaData.nullPlusNonNullIsNull()));
314 315 316 317
    }
    
    @Test
    public void assertSupportsConvert() throws SQLException {
318 319
        assertThat(shardingSphereDatabaseMetaData.supportsConvert(), is(databaseMetaData.supportsConvert()));
        assertThat(shardingSphereDatabaseMetaData.supportsConvert(Types.INTEGER, Types.FLOAT), is(databaseMetaData.supportsConvert()));
320 321 322 323
    }
    
    @Test
    public void assertSupportsTableCorrelationNames() throws SQLException {
324
        assertThat(shardingSphereDatabaseMetaData.supportsTableCorrelationNames(), is(databaseMetaData.supportsTableCorrelationNames()));
325 326 327 328
    }
    
    @Test
    public void assertSupportsDifferentTableCorrelationNames() throws SQLException {
329
        assertThat(shardingSphereDatabaseMetaData.supportsDifferentTableCorrelationNames(), is(databaseMetaData.supportsDifferentTableCorrelationNames()));
330 331 332 333
    }
    
    @Test
    public void assertSupportsExpressionsInOrderBy() throws SQLException {
334
        assertThat(shardingSphereDatabaseMetaData.supportsExpressionsInOrderBy(), is(databaseMetaData.supportsExpressionsInOrderBy()));
335 336 337 338
    }
    
    @Test
    public void assertSupportsOrderByUnrelated() throws SQLException {
339
        assertThat(shardingSphereDatabaseMetaData.supportsOrderByUnrelated(), is(databaseMetaData.supportsOrderByUnrelated()));
340 341 342 343
    }
    
    @Test
    public void assertSupportsGroupBy() throws SQLException {
344
        assertThat(shardingSphereDatabaseMetaData.supportsGroupBy(), is(databaseMetaData.supportsGroupBy()));
345 346 347 348
    }
    
    @Test
    public void assertSupportsGroupByUnrelated() throws SQLException {
349
        assertThat(shardingSphereDatabaseMetaData.supportsGroupByUnrelated(), is(databaseMetaData.supportsGroupByUnrelated()));
350 351 352 353
    }
    
    @Test
    public void assertSupportsGroupByBeyondSelect() throws SQLException {
354
        assertThat(shardingSphereDatabaseMetaData.supportsGroupByBeyondSelect(), is(databaseMetaData.supportsGroupByBeyondSelect()));
355 356 357 358
    }
    
    @Test
    public void assertSupportsLikeEscapeClause() throws SQLException {
359
        assertThat(shardingSphereDatabaseMetaData.supportsLikeEscapeClause(), is(databaseMetaData.supportsLikeEscapeClause()));
360 361 362 363
    }
    
    @Test
    public void assertSupportsMultipleResultSets() throws SQLException {
364
        assertThat(shardingSphereDatabaseMetaData.supportsMultipleResultSets(), is(databaseMetaData.supportsMultipleResultSets()));
365 366 367 368
    }
    
    @Test
    public void assertSupportsMultipleTransactions() throws SQLException {
369
        assertThat(shardingSphereDatabaseMetaData.supportsMultipleTransactions(), is(databaseMetaData.supportsMultipleTransactions()));
370 371 372 373
    }
    
    @Test
    public void assertSupportsNonNullableColumns() throws SQLException {
374
        assertThat(shardingSphereDatabaseMetaData.supportsNonNullableColumns(), is(databaseMetaData.supportsNonNullableColumns()));
375 376 377 378
    }
    
    @Test
    public void assertSupportsMinimumSQLGrammar() throws SQLException {
379
        assertThat(shardingSphereDatabaseMetaData.supportsMinimumSQLGrammar(), is(databaseMetaData.supportsMinimumSQLGrammar()));
380 381 382 383
    }
    
    @Test
    public void assertSupportsCoreSQLGrammar() throws SQLException {
384
        assertThat(shardingSphereDatabaseMetaData.supportsCoreSQLGrammar(), is(databaseMetaData.supportsCoreSQLGrammar()));
385 386 387 388
    }
    
    @Test
    public void assertSupportsExtendedSQLGrammar() throws SQLException {
389
        assertThat(shardingSphereDatabaseMetaData.supportsExtendedSQLGrammar(), is(databaseMetaData.supportsExtendedSQLGrammar()));
390 391 392 393
    }
    
    @Test
    public void assertSupportsANSI92EntryLevelSQL() throws SQLException {
394
        assertThat(shardingSphereDatabaseMetaData.supportsANSI92EntryLevelSQL(), is(databaseMetaData.supportsANSI92EntryLevelSQL()));
395 396 397 398
    }
    
    @Test
    public void assertSupportsANSI92IntermediateSQL() throws SQLException {
399
        assertThat(shardingSphereDatabaseMetaData.supportsANSI92IntermediateSQL(), is(databaseMetaData.supportsANSI92IntermediateSQL()));
400 401 402 403
    }
    
    @Test
    public void assertSupportsANSI92FullSQL() throws SQLException {
404
        assertThat(shardingSphereDatabaseMetaData.supportsANSI92FullSQL(), is(databaseMetaData.supportsANSI92FullSQL()));
405 406 407 408
    }
    
    @Test
    public void assertSupportsIntegrityEnhancementFacility() throws SQLException {
409
        assertThat(shardingSphereDatabaseMetaData.supportsIntegrityEnhancementFacility(), is(databaseMetaData.supportsIntegrityEnhancementFacility()));
410 411 412 413
    }
    
    @Test
    public void assertSupportsOuterJoins() throws SQLException {
414
        assertThat(shardingSphereDatabaseMetaData.supportsOuterJoins(), is(databaseMetaData.supportsOuterJoins()));
415 416 417 418
    }
    
    @Test
    public void assertSupportsFullOuterJoins() throws SQLException {
419
        assertThat(shardingSphereDatabaseMetaData.supportsFullOuterJoins(), is(databaseMetaData.supportsFullOuterJoins()));
420 421 422 423
    }
    
    @Test
    public void assertSupportsLimitedOuterJoins() throws SQLException {
424
        assertThat(shardingSphereDatabaseMetaData.supportsLimitedOuterJoins(), is(databaseMetaData.supportsLimitedOuterJoins()));
425 426 427 428
    }
    
    @Test
    public void assertGetSchemaTerm() throws SQLException {
429
        assertThat(shardingSphereDatabaseMetaData.getSchemaTerm(), is(databaseMetaData.getSchemaTerm()));
430 431 432 433
    }
    
    @Test
    public void assertGetProcedureTerm() throws SQLException {
434
        assertThat(shardingSphereDatabaseMetaData.getProcedureTerm(), is(databaseMetaData.getProcedureTerm()));
435 436 437 438
    }
    
    @Test
    public void assertGetCatalogTerm() throws SQLException {
439
        assertThat(shardingSphereDatabaseMetaData.getCatalogTerm(), is(databaseMetaData.getCatalogTerm()));
440 441 442 443
    }
    
    @Test
    public void assertAssertIsCatalogAtStart() throws SQLException {
444
        assertThat(shardingSphereDatabaseMetaData.isCatalogAtStart(), is(databaseMetaData.isCatalogAtStart()));
445 446 447 448
    }
    
    @Test
    public void assertGetCatalogSeparator() throws SQLException {
449
        assertThat(shardingSphereDatabaseMetaData.getCatalogSeparator(), is(databaseMetaData.getCatalogSeparator()));
450 451 452 453
    }
    
    @Test
    public void assertSupportsSchemasInDataManipulation() throws SQLException {
454
        assertThat(shardingSphereDatabaseMetaData.supportsSchemasInDataManipulation(), is(databaseMetaData.supportsSchemasInDataManipulation()));
455 456 457 458
    }
    
    @Test
    public void assertSupportsSchemasInProcedureCalls() throws SQLException {
459
        assertThat(shardingSphereDatabaseMetaData.supportsSchemasInProcedureCalls(), is(databaseMetaData.supportsSchemasInProcedureCalls()));
460 461 462 463
    }
    
    @Test
    public void assertSupportsSchemasInTableDefinitions() throws SQLException {
464
        assertThat(shardingSphereDatabaseMetaData.supportsSchemasInTableDefinitions(), is(databaseMetaData.supportsSchemasInTableDefinitions()));
465 466 467 468
    }
    
    @Test
    public void assertSupportsSchemasInIndexDefinitions() throws SQLException {
469
        assertThat(shardingSphereDatabaseMetaData.supportsSchemasInIndexDefinitions(), is(databaseMetaData.supportsSchemasInIndexDefinitions()));
470 471 472 473
    }
    
    @Test
    public void assertSupportsSchemasInPrivilegeDefinitions() throws SQLException {
474
        assertThat(shardingSphereDatabaseMetaData.supportsSchemasInPrivilegeDefinitions(), is(databaseMetaData.supportsSchemasInPrivilegeDefinitions()));
475 476 477 478
    }
    
    @Test
    public void assertSupportsCatalogsInDataManipulation() throws SQLException {
479
        assertThat(shardingSphereDatabaseMetaData.supportsCatalogsInDataManipulation(), is(databaseMetaData.supportsCatalogsInDataManipulation()));
480 481 482 483
    }
    
    @Test
    public void assertSupportsCatalogsInProcedureCalls() throws SQLException {
484
        assertThat(shardingSphereDatabaseMetaData.supportsCatalogsInProcedureCalls(), is(databaseMetaData.supportsCatalogsInProcedureCalls()));
485 486 487 488
    }
    
    @Test
    public void assertSupportsCatalogsInTableDefinitions() throws SQLException {
489
        assertThat(shardingSphereDatabaseMetaData.supportsCatalogsInTableDefinitions(), is(databaseMetaData.supportsCatalogsInTableDefinitions()));
490 491 492 493
    }
    
    @Test
    public void assertSupportsCatalogsInIndexDefinitions() throws SQLException {
494
        assertThat(shardingSphereDatabaseMetaData.supportsCatalogsInIndexDefinitions(), is(databaseMetaData.supportsCatalogsInIndexDefinitions()));
495 496 497 498
    }
    
    @Test
    public void assertSupportsCatalogsInPrivilegeDefinitions() throws SQLException {
499
        assertThat(shardingSphereDatabaseMetaData.supportsCatalogsInPrivilegeDefinitions(), is(databaseMetaData.supportsCatalogsInPrivilegeDefinitions()));
500 501 502 503
    }
    
    @Test
    public void assertSupportsPositionedDelete() throws SQLException {
504
        assertThat(shardingSphereDatabaseMetaData.supportsPositionedDelete(), is(databaseMetaData.supportsPositionedDelete()));
505 506 507 508
    }
    
    @Test
    public void assertSupportsPositionedUpdate() throws SQLException {
509
        assertThat(shardingSphereDatabaseMetaData.supportsPositionedUpdate(), is(databaseMetaData.supportsPositionedUpdate()));
510 511 512 513
    }
    
    @Test
    public void assertSupportsSelectForUpdate() throws SQLException {
514
        assertThat(shardingSphereDatabaseMetaData.supportsSelectForUpdate(), is(databaseMetaData.supportsSelectForUpdate()));
515 516 517 518
    }
    
    @Test
    public void assertSupportsStoredProcedures() throws SQLException {
519
        assertThat(shardingSphereDatabaseMetaData.supportsStoredProcedures(), is(databaseMetaData.supportsStoredProcedures()));
520 521 522 523
    }
    
    @Test
    public void assertSupportsSubqueriesInComparisons() throws SQLException {
524
        assertThat(shardingSphereDatabaseMetaData.supportsSubqueriesInComparisons(), is(databaseMetaData.supportsSubqueriesInComparisons()));
525 526 527 528
    }
    
    @Test
    public void assertSupportsSubqueriesInExists() throws SQLException {
529
        assertThat(shardingSphereDatabaseMetaData.supportsSubqueriesInExists(), is(databaseMetaData.supportsSubqueriesInExists()));
530 531 532 533
    }
    
    @Test
    public void assertSupportsSubqueriesInIns() throws SQLException {
534
        assertThat(shardingSphereDatabaseMetaData.supportsSubqueriesInIns(), is(databaseMetaData.supportsSubqueriesInIns()));
535 536 537 538
    }
    
    @Test
    public void assertSupportsSubqueriesInQuantifieds() throws SQLException {
539
        assertThat(shardingSphereDatabaseMetaData.supportsSubqueriesInQuantifieds(), is(databaseMetaData.supportsSubqueriesInQuantifieds()));
540 541 542 543
    }
    
    @Test
    public void assertSupportsCorrelatedSubqueries() throws SQLException {
544
        assertThat(shardingSphereDatabaseMetaData.supportsCorrelatedSubqueries(), is(databaseMetaData.supportsCorrelatedSubqueries()));
545 546 547 548
    }
    
    @Test
    public void assertSupportsUnion() throws SQLException {
549
        assertThat(shardingSphereDatabaseMetaData.supportsUnion(), is(databaseMetaData.supportsUnion()));
550 551 552 553
    }
    
    @Test
    public void assertSupportsUnionAll() throws SQLException {
554
        assertThat(shardingSphereDatabaseMetaData.supportsUnionAll(), is(databaseMetaData.supportsUnionAll()));
555 556 557 558
    }
    
    @Test
    public void assertSupportsOpenCursorsAcrossCommit() throws SQLException {
559
        assertThat(shardingSphereDatabaseMetaData.supportsOpenCursorsAcrossCommit(), is(databaseMetaData.supportsOpenCursorsAcrossCommit()));
560 561 562 563
    }
    
    @Test
    public void assertSupportsOpenCursorsAcrossRollback() throws SQLException {
564
        assertThat(shardingSphereDatabaseMetaData.supportsOpenCursorsAcrossRollback(), is(databaseMetaData.supportsOpenCursorsAcrossRollback()));
565 566 567 568
    }
    
    @Test
    public void assertSupportsOpenStatementsAcrossCommit() throws SQLException {
569
        assertThat(shardingSphereDatabaseMetaData.supportsOpenStatementsAcrossCommit(), is(databaseMetaData.supportsOpenStatementsAcrossCommit()));
570 571 572 573
    }
    
    @Test
    public void assertSupportsOpenStatementsAcrossRollback() throws SQLException {
574
        assertThat(shardingSphereDatabaseMetaData.supportsOpenStatementsAcrossRollback(), is(databaseMetaData.supportsOpenStatementsAcrossRollback()));
575 576 577 578
    }
    
    @Test
    public void assertGetMaxBinaryLiteralLength() throws SQLException {
579
        assertThat(shardingSphereDatabaseMetaData.getMaxBinaryLiteralLength(), is(databaseMetaData.getMaxBinaryLiteralLength()));
580 581 582 583
    }
    
    @Test
    public void assertGetMaxCharLiteralLength() throws SQLException {
584
        assertThat(shardingSphereDatabaseMetaData.getMaxCharLiteralLength(), is(databaseMetaData.getMaxCharLiteralLength()));
585 586 587 588
    }
    
    @Test
    public void assertGetMaxColumnNameLength() throws SQLException {
589
        assertThat(shardingSphereDatabaseMetaData.getMaxColumnNameLength(), is(databaseMetaData.getMaxColumnNameLength()));
590 591 592 593
    }
    
    @Test
    public void assertGetMaxColumnsInGroupBy() throws SQLException {
594
        assertThat(shardingSphereDatabaseMetaData.getMaxColumnsInGroupBy(), is(databaseMetaData.getMaxColumnsInGroupBy()));
595 596 597 598
    }
    
    @Test
    public void assertGetMaxColumnsInIndex() throws SQLException {
599
        assertThat(shardingSphereDatabaseMetaData.getMaxColumnsInIndex(), is(databaseMetaData.getMaxColumnsInIndex()));
600 601 602 603
    }
    
    @Test
    public void assertGetMaxColumnsInOrderBy() throws SQLException {
604
        assertThat(shardingSphereDatabaseMetaData.getMaxColumnsInOrderBy(), is(databaseMetaData.getMaxColumnsInOrderBy()));
605 606 607 608
    }
    
    @Test
    public void assertGetMaxColumnsInSelect() throws SQLException {
609
        assertThat(shardingSphereDatabaseMetaData.getMaxColumnsInSelect(), is(databaseMetaData.getMaxColumnsInSelect()));
610 611 612 613
    }
    
    @Test
    public void assertGetMaxColumnsInTable() throws SQLException {
614
        assertThat(shardingSphereDatabaseMetaData.getMaxColumnsInTable(), is(databaseMetaData.getMaxColumnsInTable()));
615 616 617 618
    }
    
    @Test
    public void assertGetMaxConnections() throws SQLException {
619
        assertThat(shardingSphereDatabaseMetaData.getMaxConnections(), is(databaseMetaData.getMaxConnections()));
620 621 622 623
    }
    
    @Test
    public void assertGetMaxCursorNameLength() throws SQLException {
624
        assertThat(shardingSphereDatabaseMetaData.getMaxCursorNameLength(), is(databaseMetaData.getMaxCursorNameLength()));
625 626 627 628
    }
    
    @Test
    public void assertGetMaxIndexLength() throws SQLException {
629
        assertThat(shardingSphereDatabaseMetaData.getMaxIndexLength(), is(databaseMetaData.getMaxIndexLength()));
630 631 632 633
    }
    
    @Test
    public void assertGetMaxSchemaNameLength() throws SQLException {
634
        assertThat(shardingSphereDatabaseMetaData.getMaxSchemaNameLength(), is(databaseMetaData.getMaxSchemaNameLength()));
635 636 637 638
    }
    
    @Test
    public void assertGetMaxProcedureNameLength() throws SQLException {
639
        assertThat(shardingSphereDatabaseMetaData.getMaxProcedureNameLength(), is(databaseMetaData.getMaxProcedureNameLength()));
640 641 642 643
    }
    
    @Test
    public void assertGetMaxCatalogNameLength() throws SQLException {
644
        assertThat(shardingSphereDatabaseMetaData.getMaxCatalogNameLength(), is(databaseMetaData.getMaxCatalogNameLength()));
645 646 647 648
    }
    
    @Test
    public void assertGetMaxRowSize() throws SQLException {
649
        assertThat(shardingSphereDatabaseMetaData.getMaxRowSize(), is(databaseMetaData.getMaxRowSize()));
650 651 652 653
    }
    
    @Test
    public void assertDoesMaxRowSizeIncludeBlobs() throws SQLException {
654
        assertThat(shardingSphereDatabaseMetaData.doesMaxRowSizeIncludeBlobs(), is(databaseMetaData.doesMaxRowSizeIncludeBlobs()));
655 656 657 658
    }
    
    @Test
    public void assertGetMaxStatementLength() throws SQLException {
659
        assertThat(shardingSphereDatabaseMetaData.getMaxStatementLength(), is(databaseMetaData.getMaxStatementLength()));
660 661 662 663
    }
    
    @Test
    public void assertGetMaxStatements() throws SQLException {
664
        assertThat(shardingSphereDatabaseMetaData.getMaxStatements(), is(databaseMetaData.getMaxStatements()));
665 666 667 668
    }
    
    @Test
    public void assertGetMaxTableNameLength() throws SQLException {
669
        assertThat(shardingSphereDatabaseMetaData.getMaxTableNameLength(), is(databaseMetaData.getMaxTableNameLength()));
670 671 672 673
    }
    
    @Test
    public void assertGetMaxTablesInSelect() throws SQLException {
674
        assertThat(shardingSphereDatabaseMetaData.getMaxTablesInSelect(), is(databaseMetaData.getMaxTablesInSelect()));
675 676 677 678
    }
    
    @Test
    public void assertGetMaxUserNameLength() throws SQLException {
679
        assertThat(shardingSphereDatabaseMetaData.getMaxUserNameLength(), is(databaseMetaData.getMaxUserNameLength()));
680 681 682 683
    }
    
    @Test
    public void assertGetDefaultTransactionIsolation() throws SQLException {
684
        assertThat(shardingSphereDatabaseMetaData.getDefaultTransactionIsolation(), is(databaseMetaData.getDefaultTransactionIsolation()));
685 686 687 688
    }
    
    @Test
    public void assertSupportsTransactions() throws SQLException {
689
        assertThat(shardingSphereDatabaseMetaData.supportsTransactions(), is(databaseMetaData.supportsTransactions()));
690 691 692 693
    }
    
    @Test
    public void assertSupportsDataDefinitionAndDataManipulationTransactions() throws SQLException {
694
        assertThat(shardingSphereDatabaseMetaData.supportsDataDefinitionAndDataManipulationTransactions(), is(databaseMetaData.supportsDataDefinitionAndDataManipulationTransactions()));
695 696 697 698
    }
    
    @Test
    public void assertSupportsDataManipulationTransactionsOnly() throws SQLException {
699
        assertThat(shardingSphereDatabaseMetaData.supportsDataManipulationTransactionsOnly(), is(databaseMetaData.supportsDataManipulationTransactionsOnly()));
700 701 702 703
    }
    
    @Test
    public void assertDataDefinitionCausesTransactionCommit() throws SQLException {
704
        assertThat(shardingSphereDatabaseMetaData.dataDefinitionCausesTransactionCommit(), is(databaseMetaData.dataDefinitionCausesTransactionCommit()));
705 706 707 708
    }
    
    @Test
    public void assertDataDefinitionIgnoredInTransactions() throws SQLException {
709
        assertThat(shardingSphereDatabaseMetaData.dataDefinitionIgnoredInTransactions(), is(databaseMetaData.dataDefinitionIgnoredInTransactions()));
710 711 712 713
    }
    
    @Test
    public void assertSupportsBatchUpdates() throws SQLException {
714
        assertThat(shardingSphereDatabaseMetaData.supportsBatchUpdates(), is(databaseMetaData.supportsBatchUpdates()));
715 716 717 718
    }
    
    @Test
    public void assertSupportsSavepoints() throws SQLException {
719
        assertThat(shardingSphereDatabaseMetaData.supportsSavepoints(), is(databaseMetaData.supportsSavepoints()));
720 721 722 723
    }
    
    @Test
    public void assertSupportsNamedParameters() throws SQLException {
724
        assertThat(shardingSphereDatabaseMetaData.supportsNamedParameters(), is(databaseMetaData.supportsNamedParameters()));
725 726 727 728
    }
    
    @Test
    public void assertSupportsMultipleOpenResults() throws SQLException {
729
        assertThat(shardingSphereDatabaseMetaData.supportsMultipleOpenResults(), is(databaseMetaData.supportsMultipleOpenResults()));
730 731 732 733
    }
    
    @Test
    public void assertSupportsGetGeneratedKeys() throws SQLException {
734
        assertThat(shardingSphereDatabaseMetaData.supportsGetGeneratedKeys(), is(databaseMetaData.supportsGetGeneratedKeys()));
735 736 737 738
    }
    
    @Test
    public void assertGetResultSetHoldability() throws SQLException {
739
        assertThat(shardingSphereDatabaseMetaData.getResultSetHoldability(), is(databaseMetaData.getResultSetHoldability()));
740 741 742 743
    }
    
    @Test
    public void assertGetSQLStateType() throws SQLException {
744
        assertThat(shardingSphereDatabaseMetaData.getSQLStateType(), is(databaseMetaData.getSQLStateType()));
745 746 747 748
    }
    
    @Test
    public void assertLocatorsUpdateCopy() throws SQLException {
749
        assertThat(shardingSphereDatabaseMetaData.locatorsUpdateCopy(), is(databaseMetaData.locatorsUpdateCopy()));
750 751 752 753
    }
    
    @Test
    public void assertSupportsStatementPooling() throws SQLException {
754
        assertThat(shardingSphereDatabaseMetaData.supportsStatementPooling(), is(databaseMetaData.supportsStatementPooling()));
755 756 757 758
    }
    
    @Test
    public void assertSupportsStoredFunctionsUsingCallSyntax() throws SQLException {
759
        assertThat(shardingSphereDatabaseMetaData.supportsStoredFunctionsUsingCallSyntax(), is(databaseMetaData.supportsStoredFunctionsUsingCallSyntax()));
760 761 762 763
    }
    
    @Test
    public void assertAutoCommitFailureClosesAllResultSets() throws SQLException {
764
        assertThat(shardingSphereDatabaseMetaData.autoCommitFailureClosesAllResultSets(), is(databaseMetaData.autoCommitFailureClosesAllResultSets()));
765 766 767 768
    }
    
    @Test
    public void assertGetRowIdLifetime() throws SQLException {
769
        assertThat(shardingSphereDatabaseMetaData.getRowIdLifetime(), is(databaseMetaData.getRowIdLifetime()));
770 771 772 773
    }
    
    @Test
    public void assertGeneratedKeyAlwaysReturned() throws SQLException {
774
        assertThat(shardingSphereDatabaseMetaData.generatedKeyAlwaysReturned(), is(databaseMetaData.generatedKeyAlwaysReturned()));
775 776 777 778
    }
    
    @Test
    public void assertOwnInsertsAreVisible() {
779
        assertTrue(shardingSphereDatabaseMetaData.ownInsertsAreVisible(ResultSet.TYPE_FORWARD_ONLY));
780 781 782 783
    }
    
    @Test
    public void assertOwnUpdatesAreVisible() {
784
        assertTrue(shardingSphereDatabaseMetaData.ownUpdatesAreVisible(ResultSet.TYPE_FORWARD_ONLY));
785 786 787 788
    }
    
    @Test
    public void assertOwnDeletesAreVisible() {
789
        assertTrue(shardingSphereDatabaseMetaData.ownDeletesAreVisible(ResultSet.TYPE_FORWARD_ONLY));
790 791 792 793
    }
    
    @Test
    public void assertOthersInsertsAreVisible() {
794
        assertTrue(shardingSphereDatabaseMetaData.othersInsertsAreVisible(ResultSet.TYPE_FORWARD_ONLY));
795 796 797 798
    }
    
    @Test
    public void assertOthersUpdatesAreVisible() {
799
        assertTrue(shardingSphereDatabaseMetaData.othersUpdatesAreVisible(ResultSet.TYPE_FORWARD_ONLY));
800 801 802 803
    }
    
    @Test
    public void assertOthersDeletesAreVisible() {
804
        assertTrue(shardingSphereDatabaseMetaData.othersDeletesAreVisible(ResultSet.TYPE_FORWARD_ONLY));
805 806 807 808
    }
    
    @Test
    public void assertInsertsAreDetected() {
809
        assertTrue(shardingSphereDatabaseMetaData.insertsAreDetected(ResultSet.TYPE_FORWARD_ONLY));
810 811 812 813
    }
    
    @Test
    public void assertUpdatesAreDetected() {
814
        assertTrue(shardingSphereDatabaseMetaData.updatesAreDetected(ResultSet.TYPE_FORWARD_ONLY));
815 816 817 818
    }
    
    @Test
    public void assertDeletesAreDetected() {
819
        assertTrue(shardingSphereDatabaseMetaData.deletesAreDetected(ResultSet.TYPE_FORWARD_ONLY));
820 821 822 823
    }
    
    @Test
    public void assertSupportsResultSetType() {
824
        assertTrue(shardingSphereDatabaseMetaData.supportsResultSetType(ResultSet.TYPE_FORWARD_ONLY));
825 826 827 828
    }
    
    @Test
    public void assertSupportsResultSetConcurrency() {
829
        assertTrue(shardingSphereDatabaseMetaData.supportsResultSetConcurrency(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY));
830 831 832 833
    }
    
    @Test
    public void assertSupportsResultSetHoldability() {
834
        assertTrue(shardingSphereDatabaseMetaData.supportsResultSetHoldability(ResultSet.HOLD_CURSORS_OVER_COMMIT));
835 836 837 838
    }
    
    @Test
    public void assertSupportsTransactionIsolationLevel() {
839
        assertTrue(shardingSphereDatabaseMetaData.supportsTransactionIsolationLevel(Connection.TRANSACTION_NONE));
840 841 842 843
    }
    
    @Test
    public void assertGetConnection() throws SQLException {
844
        assertThat(shardingSphereDatabaseMetaData.getConnection(), is(dataSource.getConnection()));
845 846 847 848 849
    }
    
    @Test
    public void assertGetSuperTypes() throws SQLException {
        when(databaseMetaData.getSuperTypes("test", null, null)).thenReturn(resultSet);
850
        assertThat(shardingSphereDatabaseMetaData.getSuperTypes("test", null, null), instanceOf(DatabaseMetaDataResultSet.class));
851 852 853 854 855
    }
    
    @Test
    public void assertGetSuperTables() throws SQLException {
        when(databaseMetaData.getSuperTables("test", null, null)).thenReturn(resultSet);
856
        assertThat(shardingSphereDatabaseMetaData.getSuperTables("test", null, null), instanceOf(DatabaseMetaDataResultSet.class));
857 858 859 860 861
    }
    
    @Test
    public void assertGetAttributes() throws SQLException {
        when(databaseMetaData.getAttributes("test", null, null, null)).thenReturn(resultSet);
862
        assertThat(shardingSphereDatabaseMetaData.getAttributes("test", null, null, null), instanceOf(DatabaseMetaDataResultSet.class));
863 864 865 866 867
    }
    
    @Test
    public void assertGetProcedures() throws SQLException {
        when(databaseMetaData.getProcedures("test", null, null)).thenReturn(resultSet);
868
        assertThat(shardingSphereDatabaseMetaData.getProcedures("test", null, null), instanceOf(DatabaseMetaDataResultSet.class));
869 870 871 872 873
    }
    
    @Test
    public void assertGetProcedureColumns() throws SQLException {
        when(databaseMetaData.getProcedureColumns("test", null, null, null)).thenReturn(resultSet);
874
        assertThat(shardingSphereDatabaseMetaData.getProcedureColumns("test", null, null, null), instanceOf(DatabaseMetaDataResultSet.class));
875 876 877 878 879
    }
    
    @Test
    public void assertGetTables() throws SQLException {
        when(databaseMetaData.getTables("test", null, "%" + TABLE_NAME + "%", null)).thenReturn(resultSet);
880
        assertThat(shardingSphereDatabaseMetaData.getTables("test", null, TABLE_NAME, null), instanceOf(DatabaseMetaDataResultSet.class));
881 882 883 884 885
    }
    
    @Test
    public void assertGetSchemas() throws SQLException {
        when(databaseMetaData.getSchemas()).thenReturn(resultSet);
886
        assertThat(shardingSphereDatabaseMetaData.getSchemas(), instanceOf(DatabaseMetaDataResultSet.class));
887 888 889 890 891
    }
    
    @Test
    public void assertGetSchemasForCatalogAndSchemaPattern() throws SQLException {
        when(databaseMetaData.getSchemas("test", null)).thenReturn(resultSet);
892
        assertThat(shardingSphereDatabaseMetaData.getSchemas("test", null), instanceOf(DatabaseMetaDataResultSet.class));
893 894 895 896 897
    }
    
    @Test
    public void assertGetCatalogs() throws SQLException {
        when(databaseMetaData.getCatalogs()).thenReturn(resultSet);
898
        assertThat(shardingSphereDatabaseMetaData.getCatalogs(), instanceOf(DatabaseMetaDataResultSet.class));
899 900 901 902 903
    }
    
    @Test
    public void assertGetTableTypes() throws SQLException {
        when(databaseMetaData.getTableTypes()).thenReturn(resultSet);
904
        assertThat(shardingSphereDatabaseMetaData.getTableTypes(), instanceOf(DatabaseMetaDataResultSet.class));
905 906 907 908 909
    }
    
    @Test
    public void assertGetColumns() throws SQLException {
        when(databaseMetaData.getColumns("test", null, null, null)).thenReturn(resultSet);
910
        assertThat(shardingSphereDatabaseMetaData.getColumns("test", null, null, null), instanceOf(DatabaseMetaDataResultSet.class));
911 912 913 914 915
    }
    
    @Test
    public void assertGetColumnPrivileges() throws SQLException {
        when(databaseMetaData.getColumnPrivileges("test", null, null, null)).thenReturn(resultSet);
916
        assertThat(shardingSphereDatabaseMetaData.getColumnPrivileges("test", null, null, null), instanceOf(DatabaseMetaDataResultSet.class));
917 918 919 920 921
    }
    
    @Test
    public void assertGetTablePrivileges() throws SQLException {
        when(databaseMetaData.getTablePrivileges("test", null, null)).thenReturn(resultSet);
922
        assertThat(shardingSphereDatabaseMetaData.getTablePrivileges("test", null, null), instanceOf(DatabaseMetaDataResultSet.class));
923 924 925 926 927
    }
    
    @Test
    public void assertGetBestRowIdentifier() throws SQLException {
        when(databaseMetaData.getBestRowIdentifier("test", null, null, 1, true)).thenReturn(resultSet);
928
        assertThat(shardingSphereDatabaseMetaData.getBestRowIdentifier("test", null, null, 1, true), instanceOf(DatabaseMetaDataResultSet.class));
929 930 931 932 933
    }
    
    @Test
    public void assertGetVersionColumns() throws SQLException {
        when(databaseMetaData.getVersionColumns("test", null, null)).thenReturn(resultSet);
934
        assertThat(shardingSphereDatabaseMetaData.getVersionColumns("test", null, null), instanceOf(DatabaseMetaDataResultSet.class));
935 936 937 938 939
    }
    
    @Test
    public void assertGetPrimaryKeys() throws SQLException {
        when(databaseMetaData.getPrimaryKeys("test", null, null)).thenReturn(resultSet);
940
        assertThat(shardingSphereDatabaseMetaData.getPrimaryKeys("test", null, null), instanceOf(DatabaseMetaDataResultSet.class));
941 942 943 944 945
    }
    
    @Test
    public void assertGetImportedKeys() throws SQLException {
        when(databaseMetaData.getImportedKeys("test", null, null)).thenReturn(resultSet);
946
        assertThat(shardingSphereDatabaseMetaData.getImportedKeys("test", null, null), instanceOf(DatabaseMetaDataResultSet.class));
947 948 949 950 951
    }
    
    @Test
    public void assertGetExportedKeys() throws SQLException {
        when(databaseMetaData.getExportedKeys("test", null, null)).thenReturn(resultSet);
952
        assertThat(shardingSphereDatabaseMetaData.getExportedKeys("test", null, null), instanceOf(DatabaseMetaDataResultSet.class));
953 954 955 956 957
    }
    
    @Test
    public void assertGetCrossReference() throws SQLException {
        when(databaseMetaData.getCrossReference("test", null, null, null, null, null)).thenReturn(resultSet);
958
        assertThat(shardingSphereDatabaseMetaData.getCrossReference("test", null, null, null, null, null), instanceOf(DatabaseMetaDataResultSet.class));
959 960 961 962 963
    }
    
    @Test
    public void assertGetTypeInfo() throws SQLException {
        when(databaseMetaData.getTypeInfo()).thenReturn(resultSet);
964
        assertThat(shardingSphereDatabaseMetaData.getTypeInfo(), instanceOf(DatabaseMetaDataResultSet.class));
965 966 967 968 969
    }
    
    @Test
    public void assertGetIndexInfo() throws SQLException {
        when(databaseMetaData.getIndexInfo("test", null, TABLE_NAME, true, true)).thenReturn(resultSet);
970
        assertThat(shardingSphereDatabaseMetaData.getIndexInfo("test", null, TABLE_NAME, true, true), instanceOf(DatabaseMetaDataResultSet.class));
971 972 973 974 975
    }
    
    @Test
    public void assertGetUDTs() throws SQLException {
        when(databaseMetaData.getUDTs("test", null, null, null)).thenReturn(resultSet);
976
        assertThat(shardingSphereDatabaseMetaData.getUDTs("test", null, null, null), instanceOf(DatabaseMetaDataResultSet.class));
977 978 979 980 981
    }
    
    @Test
    public void assertGetClientInfoProperties() throws SQLException {
        when(databaseMetaData.getClientInfoProperties()).thenReturn(resultSet);
982
        assertThat(shardingSphereDatabaseMetaData.getClientInfoProperties(), instanceOf(DatabaseMetaDataResultSet.class));
983 984 985 986 987
    }
    
    @Test
    public void assertGetFunctions() throws SQLException {
        when(databaseMetaData.getFunctions("test", null, null)).thenReturn(resultSet);
988
        assertThat(shardingSphereDatabaseMetaData.getFunctions("test", null, null), instanceOf(DatabaseMetaDataResultSet.class));
989 990 991 992 993
    }
    
    @Test
    public void assertGetFunctionColumns() throws SQLException {
        when(databaseMetaData.getFunctionColumns("test", null, null, null)).thenReturn(resultSet);
994
        assertThat(shardingSphereDatabaseMetaData.getFunctionColumns("test", null, null, null), instanceOf(DatabaseMetaDataResultSet.class));
995 996 997 998 999
    }
    
    @Test
    public void assertGetPseudoColumns() throws SQLException {
        when(databaseMetaData.getPseudoColumns("test", null, null, null)).thenReturn(resultSet);
1000
        assertThat(shardingSphereDatabaseMetaData.getPseudoColumns("test", null, null, null), instanceOf(DatabaseMetaDataResultSet.class));
1001 1002
    }
}