You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by "VaishnaviR18 (via GitHub)" <gi...@apache.org> on 2024/01/19 12:33:50 UTC

[PR] CAMEL-19519 - camel-file: replace Thread.sleep in tests. [camel]

VaishnaviR18 opened a new pull request, #12844:
URL: https://github.com/apache/camel/pull/12844

   # Description
   Issue - https://issues.apache.org/jira/browse/CAMEL-19519
   <!--
   - Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
   -->
   
   # Target
   
   - [ ] I checked that the commit is targeting the correct branch (note that Camel 3 uses `camel-3.x`, whereas Camel 4 uses the `main` branch)
   
   # Tracking
   - [ ] If this is a large change, bug fix, or code improvement, I checked there is a [JIRA issue](https://issues.apache.org/jira/browse/CAMEL) filed for the change (usually before you start working on it).
   
   <!--
   # *Note*: trivial changes like, typos, minor documentation fixes and other small items do not require a JIRA issue. In this case your pull request should address just this issue, without pulling in other changes.
   -->
   
   # Apache Camel coding standards and style
   
   - [ ] I checked that each commit in the pull request has a meaningful subject line and body.
   
   <!--
   If you're unsure, you can format the pull request title like `[CAMEL-XXX] Fixes bug in camel-file component`, where you replace `CAMEL-XXX` with the appropriate JIRA issue.
   -->
   
   - [ ] I have run `mvn clean install -DskipTests` locally and I have committed all auto-generated changes
   
   <!--
   You can run the aforementioned command in your module so that the build auto-formats your code. This will also be verified as part of the checks and your PR may be rejected if if there are uncommited changes after running `mvn clean install -DskipTests`.
   
   You can learn more about the contribution guidelines at https://github.com/apache/camel/blob/main/CONTRIBUTING.md
   -->
   
   


-- 
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: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] CAMEL-19519 - camel-file: replace Thread.sleep in tests. [camel]

Posted by "orpiske (via GitHub)" <gi...@apache.org>.
orpiske commented on code in PR #12844:
URL: https://github.com/apache/camel/pull/12844#discussion_r1459014695


##########
core/camel-core/src/test/java/org/apache/camel/component/file/stress/FileAsyncStressReadLockRenameManualManualTest.java:
##########
@@ -17,15 +17,18 @@
 package org.apache.camel.component.file.stress;
 
 import java.util.Random;
+import java.util.concurrent.CountDownLatch;
 
-import org.apache.camel.Exchange;
-import org.apache.camel.Processor;
 import org.apache.camel.builder.RouteBuilder;
 import org.junit.jupiter.api.Disabled;
 
 @Disabled("Manual test")
 public class FileAsyncStressReadLockRenameManualManualTest extends FileAsyncStressManualTest {

Review Comment:
   This test does not need to be changed, as it's a manual one.



-- 
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: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] CAMEL-19519 - camel-file: replace Thread.sleep in tests. [camel]

Posted by "VaishnaviR18 (via GitHub)" <gi...@apache.org>.
VaishnaviR18 commented on PR #12844:
URL: https://github.com/apache/camel/pull/12844#issuecomment-1900767232

   Thanks a lot! @orpiske and @oscerd 
   I have reverted the changes, can you please review it? 


-- 
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: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] CAMEL-19519 - camel-file: replace Thread.sleep in tests. [camel]

Posted by "orpiske (via GitHub)" <gi...@apache.org>.
orpiske commented on code in PR #12844:
URL: https://github.com/apache/camel/pull/12844#discussion_r1459015736


##########
core/camel-core/src/test/java/org/apache/camel/component/file/stress/FileAsyncStressReadLockLockFileTestManualManualTest.java:
##########
@@ -17,15 +17,18 @@
 package org.apache.camel.component.file.stress;
 
 import java.util.Random;
+import java.util.concurrent.CountDownLatch;
 
-import org.apache.camel.Exchange;
-import org.apache.camel.Processor;
 import org.apache.camel.builder.RouteBuilder;
 import org.junit.jupiter.api.Disabled;
 
 @Disabled("Manual test")
 public class FileAsyncStressReadLockLockFileTestManualManualTest extends FileAsyncStressManualTest {

Review Comment:
   Same note about manual tests I wrote for `FileAsyncStressReadLockRenameManualManualTest`



-- 
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: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] CAMEL-19519 - camel-file: replace Thread.sleep in tests. [camel]

Posted by "orpiske (via GitHub)" <gi...@apache.org>.
orpiske commented on code in PR #12844:
URL: https://github.com/apache/camel/pull/12844#discussion_r1459015408


##########
core/camel-core/src/test/java/org/apache/camel/component/file/stress/FileAsyncStressReadLockNoneManualManualTest.java:
##########
@@ -17,15 +17,18 @@
 package org.apache.camel.component.file.stress;
 
 import java.util.Random;
+import java.util.concurrent.CountDownLatch;
 
-import org.apache.camel.Exchange;
-import org.apache.camel.Processor;
 import org.apache.camel.builder.RouteBuilder;
 import org.junit.jupiter.api.Disabled;
 
 @Disabled("Manual test")
 public class FileAsyncStressReadLockNoneManualManualTest extends FileAsyncStressManualTest {

Review Comment:
   Same note about manual tests I wrote for `FileAsyncStressReadLockRenameManualManualTest`



-- 
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: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] CAMEL-19519 - camel-file: replace Thread.sleep in tests. [camel]

Posted by "orpiske (via GitHub)" <gi...@apache.org>.
orpiske commented on PR #12844:
URL: https://github.com/apache/camel/pull/12844#issuecomment-1904187555

   I tested this manually and it seems OK. Let's merge.


-- 
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: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] CAMEL-19519 - camel-file: replace Thread.sleep in tests. [camel]

Posted by "VaishnaviR18 (via GitHub)" <gi...@apache.org>.
VaishnaviR18 commented on code in PR #12844:
URL: https://github.com/apache/camel/pull/12844#discussion_r1459345282


##########
core/camel-core/src/test/java/org/apache/camel/component/file/stress/FileAsyncStressManuallyManualTest.java:
##########
@@ -32,6 +31,10 @@
 @DisabledOnOs(OS.WINDOWS)
 public class FileAsyncStressManuallyManualTest extends ContextTestSupport {

Review Comment:
   Thanks! 
   I have reverted the 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: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] CAMEL-19519 - camel-file: replace Thread.sleep in tests. [camel]

Posted by "orpiske (via GitHub)" <gi...@apache.org>.
orpiske commented on code in PR #12844:
URL: https://github.com/apache/camel/pull/12844#discussion_r1459010708


##########
core/camel-core/src/test/java/org/apache/camel/component/file/FileBatchConsumerMemoryLeakManualTest.java:
##########
@@ -64,7 +69,7 @@ public void process(Exchange exchange) throws Exception {
         });
         context.start();
 
-        Thread.sleep(30 * 1000L);
+        latch.await(30, TimeUnit.SECONDS);

Review Comment:
   This is incorrect. There needs to be something to count down the latch. 



##########
core/camel-core/src/test/java/org/apache/camel/component/file/FileExclusiveReadNoneStrategyTest.java:
##########
@@ -73,7 +77,7 @@ public void process(Exchange exchange) throws Exception {
             try (OutputStream fos = Files.newOutputStream(testFile("slowfile/hello.txt"))) {
                 fos.write("Hello World".getBytes());
                 for (int i = 0; i < 3; i++) {
-                    Thread.sleep(100);
+                    latch.await(100, TimeUnit.MILLISECONDS);

Review Comment:
   Same note as above.



-- 
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: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] CAMEL-19519 - camel-file: replace Thread.sleep in tests. [camel]

Posted by "VaishnaviR18 (via GitHub)" <gi...@apache.org>.
VaishnaviR18 commented on code in PR #12844:
URL: https://github.com/apache/camel/pull/12844#discussion_r1459343894


##########
core/camel-core/src/test/java/org/apache/camel/component/file/FileBatchConsumerMemoryLeakManualTest.java:
##########
@@ -64,7 +69,7 @@ public void process(Exchange exchange) throws Exception {
         });
         context.start();
 
-        Thread.sleep(30 * 1000L);
+        latch.await(30, TimeUnit.SECONDS);

Review Comment:
   Thanks! 
   I have reverted the 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: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] CAMEL-19519 - camel-file: replace Thread.sleep in tests. [camel]

Posted by "orpiske (via GitHub)" <gi...@apache.org>.
orpiske merged PR #12844:
URL: https://github.com/apache/camel/pull/12844


-- 
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: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] CAMEL-19519 - camel-file: replace Thread.sleep in tests. [camel]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #12844:
URL: https://github.com/apache/camel/pull/12844#issuecomment-1900336290

   :star2: Thank you for your contribution to the Apache Camel project! :star2: 
   
   :robot: CI automation will test this PR automatically.
   
   :camel: Apache Camel Committers, please review the following items:
   
   * First-time contributors **require MANUAL approval** for the GitHub Actions to run
   
   * You can use the command `/component-test (camel-)component-name1 (camel-)component-name2..` to request a test from the test bot.
   
   * You can label PRs using `build-all`, `build-dependents`, `skip-tests` and `test-dependents` to fine-tune the checks executed by this PR.
   
   * Build and test logs are available in the Summary page. **Only** [Apache Camel committers](https://camel.apache.org/community/team/#committers) have access to the summary. 
   
   * :warning: Be careful when sharing logs. Review their contents before sharing them publicly.


-- 
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: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] CAMEL-19519 - camel-file: replace Thread.sleep in tests. [camel]

Posted by "orpiske (via GitHub)" <gi...@apache.org>.
orpiske commented on code in PR #12844:
URL: https://github.com/apache/camel/pull/12844#discussion_r1459017045


##########
core/camel-core/src/test/java/org/apache/camel/component/file/strategy/FileChangedReadLockTest.java:
##########
@@ -68,7 +72,7 @@ private void writeSlowFile() throws Exception {
             for (int i = 0; i < 20; i++) {
                 fos.write(("Line " + i + LS).getBytes());
                 LOG.debug("Writing line {}", i);
-                Thread.sleep(50);
+                latch.await(50, TimeUnit.MILLISECONDS);

Review Comment:
   The latch has to wait on something for it to count down. As it is, it's just timing out.



-- 
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: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] CAMEL-19519 - camel-file: replace Thread.sleep in tests. [camel]

Posted by "VaishnaviR18 (via GitHub)" <gi...@apache.org>.
VaishnaviR18 commented on code in PR #12844:
URL: https://github.com/apache/camel/pull/12844#discussion_r1459346299


##########
core/camel-core/src/test/java/org/apache/camel/component/file/FileExclusiveReadNoneStrategyTest.java:
##########
@@ -73,7 +77,7 @@ public void process(Exchange exchange) throws Exception {
             try (OutputStream fos = Files.newOutputStream(testFile("slowfile/hello.txt"))) {
                 fos.write("Hello World".getBytes());
                 for (int i = 0; i < 3; i++) {
-                    Thread.sleep(100);
+                    latch.await(100, TimeUnit.MILLISECONDS);

Review Comment:
   Thanks! 
   I have reverted the 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: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] CAMEL-19519 - camel-file: replace Thread.sleep in tests. [camel]

Posted by "orpiske (via GitHub)" <gi...@apache.org>.
orpiske commented on code in PR #12844:
URL: https://github.com/apache/camel/pull/12844#discussion_r1460299699


##########
core/camel-core/src/test/java/org/apache/camel/component/file/strategy/FileChangedReadLockMinAgeTest.java:
##########
@@ -79,4 +79,4 @@ public void configure() throws Exception {
             }
         };
     }
-}

Review Comment:
   I think you can remove this empty changes for this file and the other ones similar to this.



-- 
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: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] CAMEL-19519 - camel-file: replace Thread.sleep in tests. [camel]

Posted by "orpiske (via GitHub)" <gi...@apache.org>.
orpiske commented on code in PR #12844:
URL: https://github.com/apache/camel/pull/12844#discussion_r1459016044


##########
core/camel-core/src/test/java/org/apache/camel/component/file/stress/FileAsyncStressManuallyManualTest.java:
##########
@@ -32,6 +31,10 @@
 @DisabledOnOs(OS.WINDOWS)
 public class FileAsyncStressManuallyManualTest extends ContextTestSupport {

Review Comment:
   Same note about manual tests I wrote for `FileAsyncStressReadLockRenameManualManualTest`



##########
core/camel-core/src/test/java/org/apache/camel/component/file/stress/FileAsyncStressManualTest.java:
##########
@@ -33,6 +33,10 @@
 @DisabledOnOs(OS.WINDOWS)
 public class FileAsyncStressManualTest extends ContextTestSupport {

Review Comment:
   Same note about manual tests I wrote for `FileAsyncStressReadLockRenameManualManualTest`



-- 
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: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] CAMEL-19519 - camel-file: replace Thread.sleep in tests. [camel]

Posted by "VaishnaviR18 (via GitHub)" <gi...@apache.org>.
VaishnaviR18 commented on code in PR #12844:
URL: https://github.com/apache/camel/pull/12844#discussion_r1459345884


##########
core/camel-core/src/test/java/org/apache/camel/component/file/stress/FileAsyncStressReadLockNoneManualManualTest.java:
##########
@@ -17,15 +17,18 @@
 package org.apache.camel.component.file.stress;
 
 import java.util.Random;
+import java.util.concurrent.CountDownLatch;
 
-import org.apache.camel.Exchange;
-import org.apache.camel.Processor;
 import org.apache.camel.builder.RouteBuilder;
 import org.junit.jupiter.api.Disabled;
 
 @Disabled("Manual test")
 public class FileAsyncStressReadLockNoneManualManualTest extends FileAsyncStressManualTest {

Review Comment:
   Thanks! 
   I have reverted the changes. 



##########
core/camel-core/src/test/java/org/apache/camel/component/file/stress/FileAsyncStressReadLockLockFileTestManualManualTest.java:
##########
@@ -17,15 +17,18 @@
 package org.apache.camel.component.file.stress;
 
 import java.util.Random;
+import java.util.concurrent.CountDownLatch;
 
-import org.apache.camel.Exchange;
-import org.apache.camel.Processor;
 import org.apache.camel.builder.RouteBuilder;
 import org.junit.jupiter.api.Disabled;
 
 @Disabled("Manual test")
 public class FileAsyncStressReadLockLockFileTestManualManualTest extends FileAsyncStressManualTest {

Review Comment:
   Thanks! 
   I have reverted the changes. 



##########
core/camel-core/src/test/java/org/apache/camel/component/file/stress/FileAsyncStressReadLockRenameManualManualTest.java:
##########
@@ -17,15 +17,18 @@
 package org.apache.camel.component.file.stress;
 
 import java.util.Random;
+import java.util.concurrent.CountDownLatch;
 
-import org.apache.camel.Exchange;
-import org.apache.camel.Processor;
 import org.apache.camel.builder.RouteBuilder;
 import org.junit.jupiter.api.Disabled;
 
 @Disabled("Manual test")
 public class FileAsyncStressReadLockRenameManualManualTest extends FileAsyncStressManualTest {

Review Comment:
   Thanks! 
   I have reverted the 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: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] CAMEL-19519 - camel-file: replace Thread.sleep in tests. [camel]

Posted by "VaishnaviR18 (via GitHub)" <gi...@apache.org>.
VaishnaviR18 commented on code in PR #12844:
URL: https://github.com/apache/camel/pull/12844#discussion_r1459344575


##########
core/camel-core/src/test/java/org/apache/camel/component/file/strategy/FileChangedReadLockTest.java:
##########
@@ -68,7 +72,7 @@ private void writeSlowFile() throws Exception {
             for (int i = 0; i < 20; i++) {
                 fos.write(("Line " + i + LS).getBytes());
                 LOG.debug("Writing line {}", i);
-                Thread.sleep(50);
+                latch.await(50, TimeUnit.MILLISECONDS);

Review Comment:
   Thanks! 
   I have reverted the 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: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org