You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by "surivig18 (via GitHub)" <gi...@apache.org> on 2023/06/30 06:56:58 UTC
[GitHub] [shardingsphere] surivig18 opened a new pull request, #26716: [26705] Unit test cases for ReadwriteSplittingRuleChangedEventCreator
surivig18 opened a new pull request, #26716:
URL: https://github.com/apache/shardingsphere/pull/26716
Fixes #ISSUSE_ID.
Changes proposed in this pull request:
-
---
Before committing this PR, I'm sure that I have checked the following options:
- [✅] My code follows the [code of conduct](https://shardingsphere.apache.org/community/en/involved/conduct/code/) of this project.
- [ ✅] I have self-reviewed the commit code.
- [ ✅] I have (or in comment I request) added corresponding labels for the pull request.
- [✅ ] I have passed maven check locally : `./mvnw clean install -B -T1C -Dmaven.javadoc.skip -Dmaven.jacoco.skip -e`.
- [✅ ] I have made corresponding changes to the documentation.
- [ ✅] I have added corresponding unit tests for my changes.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] zhaojinchao95 commented on a diff in pull request #26716: [26705] Unit test cases for ReadwriteSplittingRuleChangedEventCreator
Posted by "zhaojinchao95 (via GitHub)" <gi...@apache.org>.
zhaojinchao95 commented on code in PR #26716:
URL: https://github.com/apache/shardingsphere/pull/26716#discussion_r1247925563
##########
features/readwrite-splitting/core/src/test/java/org/apache/shardingsphere/readwritesplitting/event/ReadwriteSplittingRuleChangedEventCreatorTest.java:
##########
@@ -0,0 +1,76 @@
+/*
+ * 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.
+ */
+
+package org.apache.shardingsphere.readwritesplitting.event;
+
+import org.apache.shardingsphere.mode.event.DataChangedEvent;
+import org.apache.shardingsphere.readwritesplitting.event.datasource.AddReadwriteSplittingDataSourceEvent;
+import org.apache.shardingsphere.readwritesplitting.event.datasource.DeleteReadwriteSplittingDataSourceEvent;
+import org.apache.shardingsphere.readwritesplitting.event.loadbalance.AlterReadwriteSplittingLoadBalancerEvent;
+import org.apache.shardingsphere.readwritesplitting.event.loadbalance.DeleteReadwriteSplittingLoadBalancerEvent;
+import org.apache.shardingsphere.readwritesplitting.metadata.nodepath.ReadwriteSplittingRuleNodePathProvider;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtendWith;
+import org.mockito.junit.jupiter.MockitoExtension;
+import static org.hamcrest.CoreMatchers.instanceOf;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+
+@ExtendWith(MockitoExtension.class)
+class ReadwriteSplittingRuleChangedEventCreatorTest {
+
+ private ReadwriteSplittingRuleChangedEventCreator readwriteSplittingRuleChangedEventCreator;
+
+ @BeforeEach
+ void setUp() {
+ readwriteSplittingRuleChangedEventCreator = new ReadwriteSplittingRuleChangedEventCreator();
+ }
+
+ @Test
+ void assertReadWriteSplittingRuleChangeEventForDataSource() {
+
+ assertThat(readwriteSplittingRuleChangedEventCreator.create("test",
+ new DataChangedEvent("RANDOM", "RANDOM", DataChangedEvent.Type.DELETED),
+ ReadwriteSplittingRuleNodePathProvider.DATA_SOURCES, "test"), instanceOf(DeleteReadwriteSplittingDataSourceEvent.class));
+
+ assertThat(readwriteSplittingRuleChangedEventCreator.create("test",
+ new DataChangedEvent("RANDOM", "RANDOM", DataChangedEvent.Type.ADDED),
+ ReadwriteSplittingRuleNodePathProvider.DATA_SOURCES, "test"), instanceOf(AddReadwriteSplittingDataSourceEvent.class));
+
+ }
+
+ @Test
+ void assertReadWriteEventsRuleChangeCreatorForLoadBalancers() {
+ assertThat(readwriteSplittingRuleChangedEventCreator.create("test",
+ new DataChangedEvent("RANDOM", "RANDOM", DataChangedEvent.Type.DELETED),
+ ReadwriteSplittingRuleNodePathProvider.LOAD_BALANCERS, "test"), instanceOf(DeleteReadwriteSplittingLoadBalancerEvent.class));
+
+ assertThat(readwriteSplittingRuleChangedEventCreator.create("test",
+ new DataChangedEvent("RANDOM", "RANDOM", DataChangedEvent.Type.ADDED),
+ ReadwriteSplittingRuleNodePathProvider.LOAD_BALANCERS, "test"), instanceOf(AlterReadwriteSplittingLoadBalancerEvent.class));
+ }
+
+ @Test
+ void assertReadWriteEventsRuleChangeCreatorThrowsUnsupportedException() {
+
Review Comment:
Remove empty line please.
##########
features/readwrite-splitting/core/src/test/java/org/apache/shardingsphere/readwritesplitting/event/ReadwriteSplittingRuleChangedEventCreatorTest.java:
##########
@@ -0,0 +1,76 @@
+/*
+ * 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.
+ */
+
+package org.apache.shardingsphere.readwritesplitting.event;
+
+import org.apache.shardingsphere.mode.event.DataChangedEvent;
+import org.apache.shardingsphere.readwritesplitting.event.datasource.AddReadwriteSplittingDataSourceEvent;
+import org.apache.shardingsphere.readwritesplitting.event.datasource.DeleteReadwriteSplittingDataSourceEvent;
+import org.apache.shardingsphere.readwritesplitting.event.loadbalance.AlterReadwriteSplittingLoadBalancerEvent;
+import org.apache.shardingsphere.readwritesplitting.event.loadbalance.DeleteReadwriteSplittingLoadBalancerEvent;
+import org.apache.shardingsphere.readwritesplitting.metadata.nodepath.ReadwriteSplittingRuleNodePathProvider;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtendWith;
+import org.mockito.junit.jupiter.MockitoExtension;
+import static org.hamcrest.CoreMatchers.instanceOf;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+
+@ExtendWith(MockitoExtension.class)
+class ReadwriteSplittingRuleChangedEventCreatorTest {
+
+ private ReadwriteSplittingRuleChangedEventCreator readwriteSplittingRuleChangedEventCreator;
+
+ @BeforeEach
+ void setUp() {
+ readwriteSplittingRuleChangedEventCreator = new ReadwriteSplittingRuleChangedEventCreator();
+ }
+
+ @Test
+ void assertReadWriteSplittingRuleChangeEventForDataSource() {
+
+ assertThat(readwriteSplittingRuleChangedEventCreator.create("test",
+ new DataChangedEvent("RANDOM", "RANDOM", DataChangedEvent.Type.DELETED),
+ ReadwriteSplittingRuleNodePathProvider.DATA_SOURCES, "test"), instanceOf(DeleteReadwriteSplittingDataSourceEvent.class));
+
Review Comment:
Remove empty line please.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] zhaojinchao95 commented on a diff in pull request #26716: [26705] Unit test cases for ReadwriteSplittingRuleChangedEventCreator
Posted by "zhaojinchao95 (via GitHub)" <gi...@apache.org>.
zhaojinchao95 commented on code in PR #26716:
URL: https://github.com/apache/shardingsphere/pull/26716#discussion_r1247925875
##########
features/readwrite-splitting/core/src/test/java/org/apache/shardingsphere/readwritesplitting/event/ReadwriteSplittingRuleChangedEventCreatorTest.java:
##########
@@ -0,0 +1,76 @@
+/*
+ * 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.
+ */
+
+package org.apache.shardingsphere.readwritesplitting.event;
+
+import org.apache.shardingsphere.mode.event.DataChangedEvent;
+import org.apache.shardingsphere.readwritesplitting.event.datasource.AddReadwriteSplittingDataSourceEvent;
+import org.apache.shardingsphere.readwritesplitting.event.datasource.DeleteReadwriteSplittingDataSourceEvent;
+import org.apache.shardingsphere.readwritesplitting.event.loadbalance.AlterReadwriteSplittingLoadBalancerEvent;
+import org.apache.shardingsphere.readwritesplitting.event.loadbalance.DeleteReadwriteSplittingLoadBalancerEvent;
+import org.apache.shardingsphere.readwritesplitting.metadata.nodepath.ReadwriteSplittingRuleNodePathProvider;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtendWith;
+import org.mockito.junit.jupiter.MockitoExtension;
+import static org.hamcrest.CoreMatchers.instanceOf;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+
+@ExtendWith(MockitoExtension.class)
+class ReadwriteSplittingRuleChangedEventCreatorTest {
+
+ private ReadwriteSplittingRuleChangedEventCreator readwriteSplittingRuleChangedEventCreator;
+
+ @BeforeEach
+ void setUp() {
+ readwriteSplittingRuleChangedEventCreator = new ReadwriteSplittingRuleChangedEventCreator();
+ }
+
+ @Test
+ void assertReadWriteSplittingRuleChangeEventForDataSource() {
+
+ assertThat(readwriteSplittingRuleChangedEventCreator.create("test",
+ new DataChangedEvent("RANDOM", "RANDOM", DataChangedEvent.Type.DELETED),
+ ReadwriteSplittingRuleNodePathProvider.DATA_SOURCES, "test"), instanceOf(DeleteReadwriteSplittingDataSourceEvent.class));
+
+ assertThat(readwriteSplittingRuleChangedEventCreator.create("test",
+ new DataChangedEvent("RANDOM", "RANDOM", DataChangedEvent.Type.ADDED),
+ ReadwriteSplittingRuleNodePathProvider.DATA_SOURCES, "test"), instanceOf(AddReadwriteSplittingDataSourceEvent.class));
+
+ }
+
+ @Test
+ void assertReadWriteEventsRuleChangeCreatorForLoadBalancers() {
+ assertThat(readwriteSplittingRuleChangedEventCreator.create("test",
+ new DataChangedEvent("RANDOM", "RANDOM", DataChangedEvent.Type.DELETED),
+ ReadwriteSplittingRuleNodePathProvider.LOAD_BALANCERS, "test"), instanceOf(DeleteReadwriteSplittingLoadBalancerEvent.class));
+
Review Comment:
Remove empty line please.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] surivig18 commented on a diff in pull request #26716: [26705] Unit test cases for ReadwriteSplittingRuleChangedEventCreator
Posted by "surivig18 (via GitHub)" <gi...@apache.org>.
surivig18 commented on code in PR #26716:
URL: https://github.com/apache/shardingsphere/pull/26716#discussion_r1248074095
##########
features/readwrite-splitting/core/src/test/java/org/apache/shardingsphere/readwritesplitting/event/ReadwriteSplittingRuleChangedEventCreatorTest.java:
##########
@@ -0,0 +1,76 @@
+/*
+ * 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.
+ */
+
+package org.apache.shardingsphere.readwritesplitting.event;
+
+import org.apache.shardingsphere.mode.event.DataChangedEvent;
+import org.apache.shardingsphere.readwritesplitting.event.datasource.AddReadwriteSplittingDataSourceEvent;
+import org.apache.shardingsphere.readwritesplitting.event.datasource.DeleteReadwriteSplittingDataSourceEvent;
+import org.apache.shardingsphere.readwritesplitting.event.loadbalance.AlterReadwriteSplittingLoadBalancerEvent;
+import org.apache.shardingsphere.readwritesplitting.event.loadbalance.DeleteReadwriteSplittingLoadBalancerEvent;
+import org.apache.shardingsphere.readwritesplitting.metadata.nodepath.ReadwriteSplittingRuleNodePathProvider;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtendWith;
+import org.mockito.junit.jupiter.MockitoExtension;
+import static org.hamcrest.CoreMatchers.instanceOf;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+
+@ExtendWith(MockitoExtension.class)
+class ReadwriteSplittingRuleChangedEventCreatorTest {
+
+ private ReadwriteSplittingRuleChangedEventCreator readwriteSplittingRuleChangedEventCreator;
+
+ @BeforeEach
+ void setUp() {
+ readwriteSplittingRuleChangedEventCreator = new ReadwriteSplittingRuleChangedEventCreator();
+ }
+
+ @Test
+ void assertReadWriteSplittingRuleChangeEventForDataSource() {
+
+ assertThat(readwriteSplittingRuleChangedEventCreator.create("test",
+ new DataChangedEvent("RANDOM", "RANDOM", DataChangedEvent.Type.DELETED),
+ ReadwriteSplittingRuleNodePathProvider.DATA_SOURCES, "test"), instanceOf(DeleteReadwriteSplittingDataSourceEvent.class));
+
+ assertThat(readwriteSplittingRuleChangedEventCreator.create("test",
+ new DataChangedEvent("RANDOM", "RANDOM", DataChangedEvent.Type.ADDED),
+ ReadwriteSplittingRuleNodePathProvider.DATA_SOURCES, "test"), instanceOf(AddReadwriteSplittingDataSourceEvent.class));
+
+ }
+
+ @Test
+ void assertReadWriteEventsRuleChangeCreatorForLoadBalancers() {
+ assertThat(readwriteSplittingRuleChangedEventCreator.create("test",
+ new DataChangedEvent("RANDOM", "RANDOM", DataChangedEvent.Type.DELETED),
+ ReadwriteSplittingRuleNodePathProvider.LOAD_BALANCERS, "test"), instanceOf(DeleteReadwriteSplittingLoadBalancerEvent.class));
+
+ assertThat(readwriteSplittingRuleChangedEventCreator.create("test",
+ new DataChangedEvent("RANDOM", "RANDOM", DataChangedEvent.Type.ADDED),
+ ReadwriteSplittingRuleNodePathProvider.LOAD_BALANCERS, "test"), instanceOf(AlterReadwriteSplittingLoadBalancerEvent.class));
+ }
+
+ @Test
+ void assertReadWriteEventsRuleChangeCreatorThrowsUnsupportedException() {
+
Review Comment:
Removed 👍
##########
features/readwrite-splitting/core/src/test/java/org/apache/shardingsphere/readwritesplitting/event/ReadwriteSplittingRuleChangedEventCreatorTest.java:
##########
@@ -0,0 +1,76 @@
+/*
+ * 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.
+ */
+
+package org.apache.shardingsphere.readwritesplitting.event;
+
+import org.apache.shardingsphere.mode.event.DataChangedEvent;
+import org.apache.shardingsphere.readwritesplitting.event.datasource.AddReadwriteSplittingDataSourceEvent;
+import org.apache.shardingsphere.readwritesplitting.event.datasource.DeleteReadwriteSplittingDataSourceEvent;
+import org.apache.shardingsphere.readwritesplitting.event.loadbalance.AlterReadwriteSplittingLoadBalancerEvent;
+import org.apache.shardingsphere.readwritesplitting.event.loadbalance.DeleteReadwriteSplittingLoadBalancerEvent;
+import org.apache.shardingsphere.readwritesplitting.metadata.nodepath.ReadwriteSplittingRuleNodePathProvider;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtendWith;
+import org.mockito.junit.jupiter.MockitoExtension;
+import static org.hamcrest.CoreMatchers.instanceOf;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+
+@ExtendWith(MockitoExtension.class)
+class ReadwriteSplittingRuleChangedEventCreatorTest {
+
+ private ReadwriteSplittingRuleChangedEventCreator readwriteSplittingRuleChangedEventCreator;
+
+ @BeforeEach
+ void setUp() {
+ readwriteSplittingRuleChangedEventCreator = new ReadwriteSplittingRuleChangedEventCreator();
+ }
+
+ @Test
+ void assertReadWriteSplittingRuleChangeEventForDataSource() {
+
+ assertThat(readwriteSplittingRuleChangedEventCreator.create("test",
+ new DataChangedEvent("RANDOM", "RANDOM", DataChangedEvent.Type.DELETED),
+ ReadwriteSplittingRuleNodePathProvider.DATA_SOURCES, "test"), instanceOf(DeleteReadwriteSplittingDataSourceEvent.class));
+
Review Comment:
Removed 👍
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] terrymanu merged pull request #26716: [26705] Unit test cases for ReadwriteSplittingRuleChangedEventCreator
Posted by "terrymanu (via GitHub)" <gi...@apache.org>.
terrymanu merged PR #26716:
URL: https://github.com/apache/shardingsphere/pull/26716
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] surivig18 commented on a diff in pull request #26716: [26705] Unit test cases for ReadwriteSplittingRuleChangedEventCreator
Posted by "surivig18 (via GitHub)" <gi...@apache.org>.
surivig18 commented on code in PR #26716:
URL: https://github.com/apache/shardingsphere/pull/26716#discussion_r1248074359
##########
features/readwrite-splitting/core/src/test/java/org/apache/shardingsphere/readwritesplitting/event/ReadwriteSplittingRuleChangedEventCreatorTest.java:
##########
@@ -0,0 +1,76 @@
+/*
+ * 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.
+ */
+
+package org.apache.shardingsphere.readwritesplitting.event;
+
+import org.apache.shardingsphere.mode.event.DataChangedEvent;
+import org.apache.shardingsphere.readwritesplitting.event.datasource.AddReadwriteSplittingDataSourceEvent;
+import org.apache.shardingsphere.readwritesplitting.event.datasource.DeleteReadwriteSplittingDataSourceEvent;
+import org.apache.shardingsphere.readwritesplitting.event.loadbalance.AlterReadwriteSplittingLoadBalancerEvent;
+import org.apache.shardingsphere.readwritesplitting.event.loadbalance.DeleteReadwriteSplittingLoadBalancerEvent;
+import org.apache.shardingsphere.readwritesplitting.metadata.nodepath.ReadwriteSplittingRuleNodePathProvider;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtendWith;
+import org.mockito.junit.jupiter.MockitoExtension;
+import static org.hamcrest.CoreMatchers.instanceOf;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+
+@ExtendWith(MockitoExtension.class)
+class ReadwriteSplittingRuleChangedEventCreatorTest {
+
+ private ReadwriteSplittingRuleChangedEventCreator readwriteSplittingRuleChangedEventCreator;
+
+ @BeforeEach
+ void setUp() {
+ readwriteSplittingRuleChangedEventCreator = new ReadwriteSplittingRuleChangedEventCreator();
+ }
+
+ @Test
+ void assertReadWriteSplittingRuleChangeEventForDataSource() {
+
+ assertThat(readwriteSplittingRuleChangedEventCreator.create("test",
+ new DataChangedEvent("RANDOM", "RANDOM", DataChangedEvent.Type.DELETED),
+ ReadwriteSplittingRuleNodePathProvider.DATA_SOURCES, "test"), instanceOf(DeleteReadwriteSplittingDataSourceEvent.class));
+
+ assertThat(readwriteSplittingRuleChangedEventCreator.create("test",
+ new DataChangedEvent("RANDOM", "RANDOM", DataChangedEvent.Type.ADDED),
+ ReadwriteSplittingRuleNodePathProvider.DATA_SOURCES, "test"), instanceOf(AddReadwriteSplittingDataSourceEvent.class));
+
+ }
+
+ @Test
+ void assertReadWriteEventsRuleChangeCreatorForLoadBalancers() {
+ assertThat(readwriteSplittingRuleChangedEventCreator.create("test",
+ new DataChangedEvent("RANDOM", "RANDOM", DataChangedEvent.Type.DELETED),
+ ReadwriteSplittingRuleNodePathProvider.LOAD_BALANCERS, "test"), instanceOf(DeleteReadwriteSplittingLoadBalancerEvent.class));
+
Review Comment:
Removed 👍
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org