You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2022/04/12 09:43:09 UTC
[GitHub] [shardingsphere] tianhao960 opened a new pull request, #16769: add unit test for DefaultSourceWritingStopAlgorithm
tianhao960 opened a new pull request, #16769:
URL: https://github.com/apache/shardingsphere/pull/16769
Fixes #16741.
Changes proposed in this pull request:
- add some test cases for DefaultSourceWritingStopAlgorithm
- not sure if we need to add test cases for concurrent scenario
--
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] yx9o commented on pull request #16769: add unit test for DefaultSourceWritingStopAlgorithm
Posted by GitBox <gi...@apache.org>.
yx9o commented on PR #16769:
URL: https://github.com/apache/shardingsphere/pull/16769#issuecomment-1097475145
@tianhao960 Hi, sorry, some ci failed, please merge the latest code, thank you.
--
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] yx9o commented on a diff in pull request #16769: add unit test for DefaultSourceWritingStopAlgorithm
Posted by GitBox <gi...@apache.org>.
yx9o commented on code in PR #16769:
URL: https://github.com/apache/shardingsphere/pull/16769#discussion_r848295260
##########
shardingsphere-test/shardingsphere-pipeline-test/src/test/java/org/apache/shardingsphere/data/pipeline/scenario/rulealtered/spi/DefaultSourceWritingStopAlgorithmTest.java:
##########
@@ -0,0 +1,46 @@
+package org.apache.shardingsphere.data.pipeline.scenario.rulealtered.spi;
+
+import org.apache.shardingsphere.data.pipeline.core.util.PipelineContextUtil;
+import org.junit.Before;
+import org.junit.Test;
+
+public class DefaultSourceWritingStopAlgorithmTest {
+
+ private final DefaultSourceWritingStopAlgorithm defaultSourceWritingStopAlgorithm = new DefaultSourceWritingStopAlgorithm();
+
+ private final String lockName = "lock1";
+ private final String jobId = "jobId1";
Review Comment:
It is best to add blank lines between variable definitions.
--
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] yx9o commented on a diff in pull request #16769: add unit test for DefaultSourceWritingStopAlgorithm
Posted by GitBox <gi...@apache.org>.
yx9o commented on code in PR #16769:
URL: https://github.com/apache/shardingsphere/pull/16769#discussion_r848284378
##########
shardingsphere-test/shardingsphere-pipeline-test/src/test/java/org/apache/shardingsphere/data/pipeline/scenario/rulealtered/spi/DefaultSourceWritingStopAlgorithmTest.java:
##########
@@ -0,0 +1,46 @@
+package org.apache.shardingsphere.data.pipeline.scenario.rulealtered.spi;
Review Comment:
Please add `License` in the header of the file, you can refer to other classes.
--
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] yx9o commented on a diff in pull request #16769: add unit test for DefaultSourceWritingStopAlgorithm
Posted by GitBox <gi...@apache.org>.
yx9o commented on code in PR #16769:
URL: https://github.com/apache/shardingsphere/pull/16769#discussion_r848285805
##########
shardingsphere-test/shardingsphere-pipeline-test/src/test/java/org/apache/shardingsphere/data/pipeline/scenario/rulealtered/spi/DefaultSourceWritingStopAlgorithmTest.java:
##########
@@ -0,0 +1,46 @@
+package org.apache.shardingsphere.data.pipeline.scenario.rulealtered.spi;
+
+import org.apache.shardingsphere.data.pipeline.core.util.PipelineContextUtil;
+import org.junit.Before;
+import org.junit.Test;
+
+public class DefaultSourceWritingStopAlgorithmTest {
+
+ private final DefaultSourceWritingStopAlgorithm defaultSourceWritingStopAlgorithm = new DefaultSourceWritingStopAlgorithm();
+
+ private final String lockName = "lock1";
+ private final String jobId = "jobId1";
+
+ @Before
+ public void setup() {
+ PipelineContextUtil.mockModeConfigAndContextManager();
+ }
+
+ @Test
+ public void assertSuccessLockReleaseLock() {
+ defaultSourceWritingStopAlgorithm.lock(lockName,jobId);
+ defaultSourceWritingStopAlgorithm.releaseLock(lockName,jobId);
+ }
+
+
+ @Test
+ public void assertSuccessLockTwiceReleaseLock() {
+ defaultSourceWritingStopAlgorithm.lock(lockName,jobId);
+ defaultSourceWritingStopAlgorithm.lock(lockName,jobId);
+ defaultSourceWritingStopAlgorithm.releaseLock(lockName,jobId);
+ }
+
+
+ @Test
+ public void assertSuccessLockReleaseLockTwice() {
+ defaultSourceWritingStopAlgorithm.lock(lockName,jobId);
+ defaultSourceWritingStopAlgorithm.releaseLock(lockName,jobId);
+ defaultSourceWritingStopAlgorithm.releaseLock(lockName,jobId);
+ }
+
+ @Test
+ public void assertSuccessReleaseNullLock() {
+ defaultSourceWritingStopAlgorithm.releaseLock(lockName,jobId);
+ }
+
Review Comment:
Please remove extra blank lines.
--
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] yx9o merged pull request #16769: add unit test for DefaultSourceWritingStopAlgorithm
Posted by GitBox <gi...@apache.org>.
yx9o merged PR #16769:
URL: https://github.com/apache/shardingsphere/pull/16769
--
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] tianhao960 commented on pull request #16769: add unit test for DefaultSourceWritingStopAlgorithm
Posted by GitBox <gi...@apache.org>.
tianhao960 commented on PR #16769:
URL: https://github.com/apache/shardingsphere/pull/16769#issuecomment-1096692992
hi, @yx9o, have changed the code as your suggestions. thanks.
--
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] yx9o commented on a diff in pull request #16769: add unit test for DefaultSourceWritingStopAlgorithm
Posted by GitBox <gi...@apache.org>.
yx9o commented on code in PR #16769:
URL: https://github.com/apache/shardingsphere/pull/16769#discussion_r848282638
##########
shardingsphere-test/shardingsphere-pipeline-test/src/test/java/org/apache/shardingsphere/data/pipeline/scenario/rulealtered/spi/DefaultSourceWritingStopAlgorithmTest.java:
##########
@@ -0,0 +1,46 @@
+package org.apache.shardingsphere.data.pipeline.scenario.rulealtered.spi;
+
+import org.apache.shardingsphere.data.pipeline.core.util.PipelineContextUtil;
+import org.junit.Before;
+import org.junit.Test;
+
+public class DefaultSourceWritingStopAlgorithmTest {
Review Comment:
Please add `final`.
--
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] yx9o commented on pull request #16769: add unit test for DefaultSourceWritingStopAlgorithm
Posted by GitBox <gi...@apache.org>.
yx9o commented on PR #16769:
URL: https://github.com/apache/shardingsphere/pull/16769#issuecomment-1098077314
@tianhao960 Hi, thanks for your contribution and congratulations on being a contributor to `Apache ShardingSphere`.
--
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] tianhao960 commented on pull request #16769: add unit test for DefaultSourceWritingStopAlgorithm
Posted by GitBox <gi...@apache.org>.
tianhao960 commented on PR #16769:
URL: https://github.com/apache/shardingsphere/pull/16769#issuecomment-1097510082
> @tianhao960 Hi, sorry, some ci failed, please merge the latest code, thank you.
have merge the master code, thanks
--
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