Skip to content

Commit

Permalink
Fix compile error
Browse files Browse the repository at this point in the history
  • Loading branch information
terrymanu committed Sep 27, 2023
1 parent 4cc0691 commit d9611ec
Show file tree
Hide file tree
Showing 9 changed files with 13 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ class ShardingRuleStatementCheckerTest {

private final ShardingRuleConfiguration shardingRuleConfig = createShardingRuleConfiguration();

private final ResourceMetaData resourceMetaData = new ResourceMetaData("sharding_db", createDataSource());
private final ResourceMetaData resourceMetaData = new ResourceMetaData(createDataSource());

@BeforeEach
void before() {
Expand All @@ -84,7 +84,7 @@ void before() {
}

@Test
void assertCheckCreatSuccess() {
void assertCheckCreateSuccess() {
Collection<AbstractTableRuleSegment> rules = new LinkedList<>();
rules.add(createCompleteAutoTableRule());
rules.add(createCompleteTableRule());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ void assertExecuteWithPreparedStatement() throws SQLException {

private ShardingSphereDatabase createDatabase(final Map<String, String> expectedResultSetMap) throws SQLException {
return new ShardingSphereDatabase("auth_db", TypedSPILoader.getService(DatabaseType.class, "FIXTURE"),
new ResourceMetaData("sharding_db", Collections.singletonMap("foo_ds", new MockedDataSource(mockConnection(expectedResultSetMap)))),
new ResourceMetaData(Collections.singletonMap("foo_ds", new MockedDataSource(mockConnection(expectedResultSetMap)))),
mock(RuleMetaData.class), Collections.emptyMap());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ private ShardingSphereDatabase mockDatabase() {
RuleMetaData ruleMetaData = new RuleMetaData(
Arrays.asList(mockShardingRule(), mockReadwriteSplittingRule(), mockEncryptRule(), mockShadowRule(), mockMaskRule()));
when(result.getRuleMetaData()).thenReturn(ruleMetaData);
ResourceMetaData resourceMetaData = new ResourceMetaData("sharding_db", Collections.singletonMap("foo_ds", new MockedDataSource()));
ResourceMetaData resourceMetaData = new ResourceMetaData(Collections.singletonMap("foo_ds", new MockedDataSource()));
when(result.getResourceMetaData()).thenReturn(resourceMetaData);
return result;
}
Expand Down Expand Up @@ -154,7 +154,7 @@ void assertGetEmptyRowData() {
private ShardingSphereDatabase mockEmptyDatabase() {
ShardingSphereDatabase result = mock(ShardingSphereDatabase.class);
when(result.getRuleMetaData()).thenReturn(new RuleMetaData(Collections.emptyList()));
ResourceMetaData resourceMetaData = new ResourceMetaData("sharding_db", Collections.singletonMap("empty_ds", new MockedDataSource()));
ResourceMetaData resourceMetaData = new ResourceMetaData(Collections.singletonMap("empty_ds", new MockedDataSource()));
when(result.getResourceMetaData()).thenReturn(resourceMetaData);
return result;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class ShowStorageUnitExecutorTest {

@BeforeEach
void before() {
ResourceMetaData resourceMetaData = new ResourceMetaData("sharding_db", createDataSources());
ResourceMetaData resourceMetaData = new ResourceMetaData(createDataSources());
RuleMetaData metaData = new RuleMetaData(Collections.singleton(createShardingRule()));
when(database.getResourceMetaData()).thenReturn(resourceMetaData);
when(database.getRuleMetaData()).thenReturn(metaData);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ void assertCreateWithOtherSelectStatementForNoResource() {

@Test
void assertCreateWithOtherSelectStatementForDatabaseName() {
ResourceMetaData resourceMetaData = new ResourceMetaData("sharding_db", Collections.singletonMap("ds", new MockedDataSource()));
ResourceMetaData resourceMetaData = new ResourceMetaData(Collections.singletonMap("ds", new MockedDataSource()));
ShardingSphereDatabase database = new ShardingSphereDatabase("db_0", databaseType, resourceMetaData, mock(RuleMetaData.class), Collections.emptyMap());
Map<String, ShardingSphereDatabase> result = Collections.singletonMap("db_0", database);
initProxyContext(result);
Expand All @@ -282,7 +282,7 @@ void assertCreateWithOtherSelectStatementForDatabaseName() {

@Test
void assertCreateWithOtherSelectStatementForNullDatabaseName() {
ResourceMetaData resourceMetaData = new ResourceMetaData("sharding_db", Collections.singletonMap("ds_0", new MockedDataSource()));
ResourceMetaData resourceMetaData = new ResourceMetaData(Collections.singletonMap("ds_0", new MockedDataSource()));
ShardingSphereDatabase database = new ShardingSphereDatabase("db_0", databaseType, resourceMetaData, mock(RuleMetaData.class), Collections.emptyMap());
Map<String, ShardingSphereDatabase> result = Collections.singletonMap("db_0", database);
initProxyContext(result);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,11 +163,11 @@ private ShardingSphereDatabase createDatabase(final String databaseName, final R
}

private ShardingSphereDatabase createDatabase(final String databaseName) {
return createDatabase(databaseName, new ResourceMetaData(databaseName, Collections.emptyMap()));
return createDatabase(databaseName, new ResourceMetaData(Collections.emptyMap()));
}

private ShardingSphereDatabase createDatabase(final Map<String, String> expectedResultSetMap) throws SQLException {
return createDatabase("auth_db", new ResourceMetaData("auth_db", Collections.singletonMap("foo_ds", new MockedDataSource(mockConnection(expectedResultSetMap)))));
return createDatabase("auth_db", new ResourceMetaData(Collections.singletonMap("foo_ds", new MockedDataSource(mockConnection(expectedResultSetMap)))));
}

private Connection mockConnection(final Map<String, String> expectedResultSetMap) throws SQLException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ private ContextManager mockContextManager() {
ShardingSphereSchema schema = new ShardingSphereSchema();
schema.getTables().put("user", table);
ShardingSphereDatabase database = new ShardingSphereDatabase("foo_db", TypedSPILoader.getService(DatabaseType.class, "MySQL"),
new ResourceMetaData("foo_db", Collections.emptyMap()), new RuleMetaData(Collections.emptyList()), Collections.singletonMap("foo_db", schema));
new ResourceMetaData(Collections.emptyMap()), new RuleMetaData(Collections.emptyList()), Collections.singletonMap("foo_db", schema));
when(result.getMetaDataContexts().getMetaData().getDatabase("foo_db")).thenReturn(database);
when(result.getMetaDataContexts().getMetaData().containsDatabase("foo_db")).thenReturn(true);
return result;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ private MetaDataContexts mockMetaDataContexts() {
ShardingSphereSchema schema = new ShardingSphereSchema();
schema.getTables().put("t", table);
ShardingSphereDatabase database = new ShardingSphereDatabase("foo_db", TypedSPILoader.getService(DatabaseType.class, "MySQL"),
new ResourceMetaData("foo_db", Collections.emptyMap()), new RuleMetaData(Collections.emptyList()), Collections.singletonMap("foo_db", schema));
new ResourceMetaData(Collections.emptyMap()), new RuleMetaData(Collections.emptyList()), Collections.singletonMap("foo_db", schema));
when(result.getMetaData().getDatabase("foo_db")).thenReturn(database);
when(result.getMetaData().containsDatabase("foo_db")).thenReturn(true);
return result;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ private ContextManager mockContextManager() {
schema.getTables().put("t_test", testTable);
schema.getTables().put("sbtest1", sbTestTable);
ShardingSphereDatabase database = new ShardingSphereDatabase("foo_db", TypedSPILoader.getService(DatabaseType.class, "PostgreSQL"),
new ResourceMetaData("foo_db", Collections.emptyMap()), new RuleMetaData(Collections.emptyList()), Collections.singletonMap("public", schema));
new ResourceMetaData(Collections.emptyMap()), new RuleMetaData(Collections.emptyList()), Collections.singletonMap("public", schema));
when(result.getMetaDataContexts().getMetaData().getDatabase("foo_db")).thenReturn(database);
when(result.getMetaDataContexts().getMetaData().containsDatabase("foo_db")).thenReturn(true);
return result;
Expand Down

0 comments on commit d9611ec

Please sign in to comment.