diff --git a/infra/common/src/test/java/org/apache/shardingsphere/infra/metadata/database/schema/builder/GenericSchemaBuilderMaterialTest.java b/infra/common/src/test/java/org/apache/shardingsphere/infra/metadata/database/schema/builder/GenericSchemaBuilderMaterialTest.java index 65546d0dffaaa..d7cfd74d98647 100644 --- a/infra/common/src/test/java/org/apache/shardingsphere/infra/metadata/database/schema/builder/GenericSchemaBuilderMaterialTest.java +++ b/infra/common/src/test/java/org/apache/shardingsphere/infra/metadata/database/schema/builder/GenericSchemaBuilderMaterialTest.java @@ -31,16 +31,17 @@ class GenericSchemaBuilderMaterialTest { + private final DatabaseType databaseType = TypedSPILoader.getService(DatabaseType.class, "FIXTURE"); + @Test void assertIsSameProtocolAndStorageTypes() { - GenericSchemaBuilderMaterial material = new GenericSchemaBuilderMaterial(TypedSPILoader.getService(DatabaseType.class, "FIXTURE"), - Collections.emptyMap(), Collections.emptyList(), new ConfigurationProperties(new Properties()), ""); + GenericSchemaBuilderMaterial material = new GenericSchemaBuilderMaterial(databaseType, Collections.emptyMap(), Collections.emptyList(), new ConfigurationProperties(new Properties()), ""); assertTrue(material.isSameProtocolAndStorageTypes()); } @Test void assertIsDifferentProtocolAndStorageTypes() { - GenericSchemaBuilderMaterial material = new GenericSchemaBuilderMaterial(TypedSPILoader.getService(DatabaseType.class, "FIXTURE"), + GenericSchemaBuilderMaterial material = new GenericSchemaBuilderMaterial(databaseType, Collections.singletonMap("foo", mock()), Collections.emptyList(), new ConfigurationProperties(new Properties()), ""); assertFalse(material.isSameProtocolAndStorageTypes()); } diff --git a/infra/common/src/test/java/org/apache/shardingsphere/infra/metadata/database/schema/builder/GenericSchemaBuilderTest.java b/infra/common/src/test/java/org/apache/shardingsphere/infra/metadata/database/schema/builder/GenericSchemaBuilderTest.java index deb2a7fb5ba3d..b09e2640086e7 100644 --- a/infra/common/src/test/java/org/apache/shardingsphere/infra/metadata/database/schema/builder/GenericSchemaBuilderTest.java +++ b/infra/common/src/test/java/org/apache/shardingsphere/infra/metadata/database/schema/builder/GenericSchemaBuilderTest.java @@ -69,21 +69,21 @@ void setUp() { when(storageUnit.getStorageType()).thenReturn(databaseType); when(storageUnit.getDataSource()).thenReturn(new MockedDataSource()); material = new GenericSchemaBuilderMaterial( - databaseType, Collections.singletonMap("foo_db", storageUnit), Collections.singleton(rule), new ConfigurationProperties(new Properties()), "foo_db"); + databaseType, Collections.singletonMap("foo_schema", storageUnit), Collections.singleton(rule), new ConfigurationProperties(new Properties()), "foo_schema"); } @Test void assertLoadWithExistedTableName() throws SQLException { Collection tableNames = Collections.singletonList("data_node_routed_table1"); when(MetaDataLoader.load(any())).thenReturn(createSchemaMetaDataMap(tableNames, material)); - assertFalse(GenericSchemaBuilder.build(tableNames, material).get("foo_db").getAllTables().isEmpty()); + assertFalse(GenericSchemaBuilder.build(tableNames, material).get("foo_schema").getAllTables().isEmpty()); } @Test void assertLoadWithNotExistedTableName() throws SQLException { Collection tableNames = Collections.singletonList("invalid_table"); when(MetaDataLoader.load(any())).thenReturn(createSchemaMetaDataMap(tableNames, material)); - assertTrue(GenericSchemaBuilder.build(tableNames, material).get("foo_db").getAllTables().isEmpty()); + assertTrue(GenericSchemaBuilder.build(tableNames, material).get("foo_schema").getAllTables().isEmpty()); } @Test @@ -92,7 +92,7 @@ void assertLoadAllTables() throws SQLException { when(MetaDataLoader.load(any())).thenReturn(createSchemaMetaDataMap(tableNames, material)); Map actual = GenericSchemaBuilder.build(tableNames, material); assertThat(actual.size(), is(1)); - assertTables(new ShardingSphereSchema("foo_db", actual.values().iterator().next().getAllTables(), Collections.emptyList())); + assertTables(new ShardingSphereSchema("foo_schema", actual.values().iterator().next().getAllTables(), Collections.emptyList())); } private Map createSchemaMetaDataMap(final Collection tableNames, final GenericSchemaBuilderMaterial material) {