diff --git a/features/readwrite-splitting/core/src/main/java/org/apache/shardingsphere/readwritesplitting/rule/attribute/ReadwriteSplittingStaticDataSourceRuleAttribute.java b/features/readwrite-splitting/core/src/main/java/org/apache/shardingsphere/readwritesplitting/rule/attribute/ReadwriteSplittingStaticDataSourceRuleAttribute.java index 5ecbd89d1bf4d..f010866034869 100644 --- a/features/readwrite-splitting/core/src/main/java/org/apache/shardingsphere/readwritesplitting/rule/attribute/ReadwriteSplittingStaticDataSourceRuleAttribute.java +++ b/features/readwrite-splitting/core/src/main/java/org/apache/shardingsphere/readwritesplitting/rule/attribute/ReadwriteSplittingStaticDataSourceRuleAttribute.java @@ -23,7 +23,7 @@ import org.apache.shardingsphere.infra.metadata.database.schema.QualifiedDataSource; import org.apache.shardingsphere.infra.rule.attribute.datasource.StaticDataSourceRuleAttribute; import org.apache.shardingsphere.infra.state.datasource.DataSourceState; -import org.apache.shardingsphere.readwritesplitting.subscriber.QualifiedDataSourceDeletedEvent; +import org.apache.shardingsphere.readwritesplitting.subscriber.ReadwriteSplittingQualifiedDataSourceDeletedEvent; import org.apache.shardingsphere.readwritesplitting.exception.logic.ReadwriteSplittingDataSourceRuleNotFoundException; import org.apache.shardingsphere.readwritesplitting.rule.ReadwriteSplittingDataSourceGroupRule; @@ -69,6 +69,7 @@ public void cleanStorageNodeDataSources() { private void deleteStorageNodeDataSources(final ReadwriteSplittingDataSourceGroupRule rule) { rule.getReadwriteSplittingGroup().getReadDataSources() - .forEach(each -> computeNodeInstanceContext.getEventBusContext().post(new QualifiedDataSourceDeletedEvent(new QualifiedDataSource(databaseName, rule.getName(), each)))); + .forEach(each -> computeNodeInstanceContext.getEventBusContext() + .post(new ReadwriteSplittingQualifiedDataSourceDeletedEvent(new QualifiedDataSource(databaseName, rule.getName(), each)))); } } diff --git a/features/readwrite-splitting/core/src/main/java/org/apache/shardingsphere/readwritesplitting/subscriber/QualifiedDataSourceDeletedEvent.java b/features/readwrite-splitting/core/src/main/java/org/apache/shardingsphere/readwritesplitting/subscriber/ReadwriteSplittingQualifiedDataSourceDeletedEvent.java similarity index 88% rename from features/readwrite-splitting/core/src/main/java/org/apache/shardingsphere/readwritesplitting/subscriber/QualifiedDataSourceDeletedEvent.java rename to features/readwrite-splitting/core/src/main/java/org/apache/shardingsphere/readwritesplitting/subscriber/ReadwriteSplittingQualifiedDataSourceDeletedEvent.java index f21213b004d5b..391a6830fb4d3 100644 --- a/features/readwrite-splitting/core/src/main/java/org/apache/shardingsphere/readwritesplitting/subscriber/QualifiedDataSourceDeletedEvent.java +++ b/features/readwrite-splitting/core/src/main/java/org/apache/shardingsphere/readwritesplitting/subscriber/ReadwriteSplittingQualifiedDataSourceDeletedEvent.java @@ -23,11 +23,11 @@ import org.apache.shardingsphere.infra.util.event.DeliverEvent; /** - * Qualified data source deleted event. + * Readwrite-splitting qualified data source deleted event. */ @RequiredArgsConstructor @Getter -public final class QualifiedDataSourceDeletedEvent implements DeliverEvent { +public final class ReadwriteSplittingQualifiedDataSourceDeletedEvent implements DeliverEvent { private final QualifiedDataSource qualifiedDataSource; } diff --git a/features/readwrite-splitting/core/src/main/java/org/apache/shardingsphere/readwritesplitting/subscriber/QualifiedDataSourceDeletedSubscriber.java b/features/readwrite-splitting/core/src/main/java/org/apache/shardingsphere/readwritesplitting/subscriber/ReadwriteSplittingQualifiedDataSourceDeletedSubscriber.java similarity index 85% rename from features/readwrite-splitting/core/src/main/java/org/apache/shardingsphere/readwritesplitting/subscriber/QualifiedDataSourceDeletedSubscriber.java rename to features/readwrite-splitting/core/src/main/java/org/apache/shardingsphere/readwritesplitting/subscriber/ReadwriteSplittingQualifiedDataSourceDeletedSubscriber.java index 878be851d6374..6add89d0c9c4a 100644 --- a/features/readwrite-splitting/core/src/main/java/org/apache/shardingsphere/readwritesplitting/subscriber/QualifiedDataSourceDeletedSubscriber.java +++ b/features/readwrite-splitting/core/src/main/java/org/apache/shardingsphere/readwritesplitting/subscriber/ReadwriteSplittingQualifiedDataSourceDeletedSubscriber.java @@ -24,10 +24,10 @@ import org.apache.shardingsphere.mode.spi.PersistRepository; /** - * Qualified data source deleted subscriber. + * Readwrite-splitting qualified data source deleted subscriber. */ @RequiredArgsConstructor -public final class QualifiedDataSourceDeletedSubscriber implements EventSubscriber { +public final class ReadwriteSplittingQualifiedDataSourceDeletedSubscriber implements EventSubscriber { private final PersistRepository repository; @@ -37,7 +37,7 @@ public final class QualifiedDataSourceDeletedSubscriber implements EventSubscrib * @param event qualified data source deleted event */ @Subscribe - public void delete(final QualifiedDataSourceDeletedEvent event) { + public void delete(final ReadwriteSplittingQualifiedDataSourceDeletedEvent event) { repository.delete(QualifiedDataSourceNode.getQualifiedDataSourceNodePath(event.getQualifiedDataSource())); } } diff --git a/features/readwrite-splitting/core/src/main/java/org/apache/shardingsphere/readwritesplitting/subscriber/QualifiedDataSourceDeletedSubscriberFactory.java b/features/readwrite-splitting/core/src/main/java/org/apache/shardingsphere/readwritesplitting/subscriber/ReadwriteSplittingQualifiedDataSourceDeletedSubscriberFactory.java similarity index 82% rename from features/readwrite-splitting/core/src/main/java/org/apache/shardingsphere/readwritesplitting/subscriber/QualifiedDataSourceDeletedSubscriberFactory.java rename to features/readwrite-splitting/core/src/main/java/org/apache/shardingsphere/readwritesplitting/subscriber/ReadwriteSplittingQualifiedDataSourceDeletedSubscriberFactory.java index 942a64d45aa0c..0f9f4c3b3da3f 100644 --- a/features/readwrite-splitting/core/src/main/java/org/apache/shardingsphere/readwritesplitting/subscriber/QualifiedDataSourceDeletedSubscriberFactory.java +++ b/features/readwrite-splitting/core/src/main/java/org/apache/shardingsphere/readwritesplitting/subscriber/ReadwriteSplittingQualifiedDataSourceDeletedSubscriberFactory.java @@ -23,12 +23,12 @@ import org.apache.shardingsphere.mode.spi.PersistRepository; /** - * Qualified data source deleted subscriber factory. + * Readwrite-splitting qualified data source deleted subscriber factory. */ -public final class QualifiedDataSourceDeletedSubscriberFactory implements DeliverEventSubscriberFactory { +public final class ReadwriteSplittingQualifiedDataSourceDeletedSubscriberFactory implements DeliverEventSubscriberFactory { @Override public EventSubscriber create(final PersistRepository repository, final EventBusContext eventBusContext) { - return new QualifiedDataSourceDeletedSubscriber(repository); + return new ReadwriteSplittingQualifiedDataSourceDeletedSubscriber(repository); } } diff --git a/features/readwrite-splitting/core/src/main/resources/META-INF/services/org.apache.shardingsphere.mode.event.deliver.DeliverEventSubscriberFactory b/features/readwrite-splitting/core/src/main/resources/META-INF/services/org.apache.shardingsphere.mode.event.deliver.DeliverEventSubscriberFactory index 1578fc246e635..a40d43dc35746 100644 --- a/features/readwrite-splitting/core/src/main/resources/META-INF/services/org.apache.shardingsphere.mode.event.deliver.DeliverEventSubscriberFactory +++ b/features/readwrite-splitting/core/src/main/resources/META-INF/services/org.apache.shardingsphere.mode.event.deliver.DeliverEventSubscriberFactory @@ -15,4 +15,4 @@ # limitations under the License. # -org.apache.shardingsphere.readwritesplitting.subscriber.QualifiedDataSourceDeletedSubscriberFactory +org.apache.shardingsphere.readwritesplitting.subscriber.ReadwriteSplittingQualifiedDataSourceDeletedSubscriberFactory diff --git a/features/readwrite-splitting/core/src/test/java/org/apache/shardingsphere/readwritesplitting/rule/attribute/ReadwriteSplittingStaticDataSourceRuleAttributeTest.java b/features/readwrite-splitting/core/src/test/java/org/apache/shardingsphere/readwritesplitting/rule/attribute/ReadwriteSplittingStaticDataSourceRuleAttributeTest.java index cdfaf039bceb0..86946d7de5f60 100644 --- a/features/readwrite-splitting/core/src/test/java/org/apache/shardingsphere/readwritesplitting/rule/attribute/ReadwriteSplittingStaticDataSourceRuleAttributeTest.java +++ b/features/readwrite-splitting/core/src/test/java/org/apache/shardingsphere/readwritesplitting/rule/attribute/ReadwriteSplittingStaticDataSourceRuleAttributeTest.java @@ -20,7 +20,7 @@ import org.apache.shardingsphere.infra.instance.ComputeNodeInstanceContext; import org.apache.shardingsphere.infra.metadata.database.schema.QualifiedDataSource; import org.apache.shardingsphere.infra.state.datasource.DataSourceState; -import org.apache.shardingsphere.readwritesplitting.subscriber.QualifiedDataSourceDeletedEvent; +import org.apache.shardingsphere.readwritesplitting.subscriber.ReadwriteSplittingQualifiedDataSourceDeletedEvent; import org.apache.shardingsphere.readwritesplitting.exception.logic.ReadwriteSplittingDataSourceRuleNotFoundException; import org.apache.shardingsphere.readwritesplitting.rule.ReadwriteSplittingDataSourceGroupRule; import org.junit.jupiter.api.Test; @@ -75,7 +75,7 @@ void assertCleanStorageNodeDataSource() { ReadwriteSplittingStaticDataSourceRuleAttribute ruleAttribute = new ReadwriteSplittingStaticDataSourceRuleAttribute( "foo_db", Collections.singletonMap("foo_group", dataSourceGroupRule), computeNodeInstanceContext); ruleAttribute.cleanStorageNodeDataSource("foo_group"); - verify(computeNodeInstanceContext.getEventBusContext()).post(deepEq(new QualifiedDataSourceDeletedEvent(new QualifiedDataSource("foo_db.foo_group.read_ds")))); + verify(computeNodeInstanceContext.getEventBusContext()).post(deepEq(new ReadwriteSplittingQualifiedDataSourceDeletedEvent(new QualifiedDataSource("foo_db.foo_group.read_ds")))); } @Test @@ -87,6 +87,6 @@ void assertCleanStorageNodeDataSources() { ReadwriteSplittingStaticDataSourceRuleAttribute ruleAttribute = new ReadwriteSplittingStaticDataSourceRuleAttribute( "foo_db", Collections.singletonMap("foo_group", dataSourceGroupRule), computeNodeInstanceContext); ruleAttribute.cleanStorageNodeDataSources(); - verify(computeNodeInstanceContext.getEventBusContext()).post(deepEq(new QualifiedDataSourceDeletedEvent(new QualifiedDataSource("foo_db.foo_group.read_ds")))); + verify(computeNodeInstanceContext.getEventBusContext()).post(deepEq(new ReadwriteSplittingQualifiedDataSourceDeletedEvent(new QualifiedDataSource("foo_db.foo_group.read_ds")))); } } diff --git a/features/readwrite-splitting/core/src/test/java/org/apache/shardingsphere/readwritesplitting/subscriber/QualifiedDataSourceDeletedSubscriberTest.java b/features/readwrite-splitting/core/src/test/java/org/apache/shardingsphere/readwritesplitting/subscriber/ReadwriteSplittingQualifiedDataSourceDeletedSubscriberTest.java similarity index 80% rename from features/readwrite-splitting/core/src/test/java/org/apache/shardingsphere/readwritesplitting/subscriber/QualifiedDataSourceDeletedSubscriberTest.java rename to features/readwrite-splitting/core/src/test/java/org/apache/shardingsphere/readwritesplitting/subscriber/ReadwriteSplittingQualifiedDataSourceDeletedSubscriberTest.java index 1cdc92dde2f88..c18761ab6da0f 100644 --- a/features/readwrite-splitting/core/src/test/java/org/apache/shardingsphere/readwritesplitting/subscriber/QualifiedDataSourceDeletedSubscriberTest.java +++ b/features/readwrite-splitting/core/src/test/java/org/apache/shardingsphere/readwritesplitting/subscriber/ReadwriteSplittingQualifiedDataSourceDeletedSubscriberTest.java @@ -28,21 +28,21 @@ import static org.mockito.Mockito.verify; @ExtendWith(MockitoExtension.class) -class QualifiedDataSourceDeletedSubscriberTest { +class ReadwriteSplittingQualifiedDataSourceDeletedSubscriberTest { - private QualifiedDataSourceDeletedSubscriber subscriber; + private ReadwriteSplittingQualifiedDataSourceDeletedSubscriber subscriber; @Mock private PersistRepository repository; @BeforeEach void setUp() { - subscriber = new QualifiedDataSourceDeletedSubscriber(repository); + subscriber = new ReadwriteSplittingQualifiedDataSourceDeletedSubscriber(repository); } @Test void assertDeleteStorageNodeDataSourceDataSourceState() { - subscriber.delete(new QualifiedDataSourceDeletedEvent(new QualifiedDataSource("foo_db", "foo_group", "foo_ds"))); + subscriber.delete(new ReadwriteSplittingQualifiedDataSourceDeletedEvent(new QualifiedDataSource("foo_db", "foo_group", "foo_ds"))); verify(repository).delete("/nodes/qualified_data_sources/foo_db.foo_group.foo_ds"); } }