Skip to content

Commit

Permalink
Use PersistServiceFacade instead of ShardingSphereSchemaDataAlteredEv…
Browse files Browse the repository at this point in the history
…ent and remove ShardingSphereSchemaDataRegistrySubscriber
  • Loading branch information
menghaoranss committed May 26, 2024
1 parent 7425f6a commit 052bffd
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ private void compareUpdateAndSendEventForTable(final String databaseName, final
}

private ShardingSphereSchemaDataAlteredPOJO getShardingSphereSchemaDataAlteredPOJO(final String databaseName, final String schemaName, final ShardingSphereTableData tableData,
final ShardingSphereTableData changedTableData, final ShardingSphereTable table) {
final ShardingSphereTableData changedTableData, final ShardingSphereTable table) {
ShardingSphereSchemaDataAlteredPOJO result = new ShardingSphereSchemaDataAlteredPOJO(databaseName, schemaName, tableData.getName());
Map<String, ShardingSphereRowData> tableDataMap = tableData.getRows().stream().collect(Collectors.toMap(ShardingSphereRowData::getUniqueKey, Function.identity()));
Map<String, ShardingSphereRowData> changedTableDataMap = changedTableData.getRows().stream().collect(Collectors.toMap(ShardingSphereRowData::getUniqueKey, Function.identity()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import org.apache.shardingsphere.infra.metadata.statistics.ShardingSphereStatistics;
import org.apache.shardingsphere.infra.metadata.statistics.ShardingSphereTableData;
import org.apache.shardingsphere.mode.manager.ContextManager;
import org.apache.shardingsphere.mode.service.pojo.ShardingSphereSchemaDataAlteredPOJO;
import org.apache.shardingsphere.test.util.PropertiesBuilder;
import org.apache.shardingsphere.test.util.PropertiesBuilder.Property;
import org.junit.jupiter.api.Test;
Expand All @@ -40,6 +41,7 @@
import java.util.LinkedList;
import java.util.Properties;

import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.RETURNS_DEEP_STUBS;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
Expand All @@ -58,7 +60,7 @@ void assertCollect() {
when(contextManager.getMetaDataContexts().getMetaData().getTemporaryProps()).thenReturn(new TemporaryConfigurationProperties(
PropertiesBuilder.build(new Property(TemporaryConfigurationPropertyKey.PROXY_META_DATA_COLLECTOR_ENABLED.getKey(), Boolean.TRUE.toString()))));
new StatisticsCollectJob(contextManager).execute(null);
verify(contextManager).getComputeNodeInstanceContext();
verify(contextManager.getPersistServiceFacade()).persist(any(ShardingSphereSchemaDataAlteredPOJO.class));
}

private ShardingSphereStatistics mockStatistics() {
Expand Down

0 comments on commit 052bffd

Please sign in to comment.