[
https://issues.apache.org/jira/browse/CAMEL-12853?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16639454#comment-16639454
]
ASF GitHub Bot commented on CAMEL-12853:
----------------------------------------
onderson closed pull request #2550: CAMEL-12853 - disable
SftpConsumerDisconnectTest
URL: https://github.com/apache/camel/pull/2550
This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:
As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):
diff --git
a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpConsumerDisconnectTest.java
b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpConsumerDisconnectTest.java
index 94508c29ea3..8b78a321f6d 100644
---
a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpConsumerDisconnectTest.java
+++
b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpConsumerDisconnectTest.java
@@ -24,22 +24,16 @@
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
import org.apache.commons.io.FileUtils;
-import org.junit.Before;
+import org.junit.Ignore;
import org.junit.Test;
+@Ignore
public class SftpConsumerDisconnectTest extends SftpServerTestSupport {
private static final String SAMPLE_FILE_NAME_1 =
String.format("sample-1-%s.txt",
SftpConsumerDisconnectTest.class.getSimpleName());
private static final String SAMPLE_FILE_NAME_2 =
String.format("sample-2-%s.txt",
SftpConsumerDisconnectTest.class.getSimpleName());
private static final String SAMPLE_FILE_CHARSET = "iso-8859-1";
private static final String SAMPLE_FILE_PAYLOAD = "abc";
- @Before
- public void setUp() throws Exception {
- super.setUp();
- context.stopRoute("foo");
- context.stopRoute("bar");
- }
-
@Test
public void testConsumeDelete() throws Exception {
if (!canTest()) {
@@ -58,25 +52,12 @@ public void testConsumeDelete() throws Exception {
// Check that expectations are satisfied
assertMockEndpointsSatisfied();
+
+ Thread.sleep(250);
// File is deleted
- assertTrue(fileRemovedEventually(FTP_ROOT_DIR + "/" +
SAMPLE_FILE_NAME_1));
- }
-
- public boolean fileRemovedEventually(String fileName) throws
InterruptedException {
- // try up to 10 seconds
- for (int i = 0; i < 10; i++) {
- // Give it a second to delete the file
- Thread.sleep(1000);
-
- // File is deleted
- File file = new File(FTP_ROOT_DIR + "/" + SAMPLE_FILE_NAME_1);
- if (!file.exists()) {
- return true;
- }
- }
-
- return false;
+ File deletedFile = new File(FTP_ROOT_DIR + "/" + SAMPLE_FILE_NAME_1);
+ assertFalse("File should have been deleted: " + deletedFile,
deletedFile.exists());
}
@Test
@@ -109,21 +90,25 @@ protected RouteBuilder createRouteBuilder() throws
Exception {
return new RouteBuilder() {
@Override
public void configure() throws Exception {
- from("sftp://localhost:" + getPort() + "/" + FTP_ROOT_DIR +
"?username=admin&password=admin&delete=true").routeId("foo").noAutoStartup().process(new
Processor() {
- @Override
- public void process(Exchange exchange) throws Exception {
- disconnectAllSessions(); // disconnect all Sessions
from
- // the SFTP server
- }
- }).to("mock:result");
- from("sftp://localhost:" + getPort() + "/" + FTP_ROOT_DIR +
"?username=admin&password=admin&noop=false&move=.camel").routeId("bar").noAutoStartup()
+ from("sftp://localhost:" + getPort() + "/" + FTP_ROOT_DIR +
"?username=admin&password=admin&delete=true")
+ .routeId("foo")
+ .noAutoStartup()
.process(new Processor() {
@Override
public void process(Exchange exchange) throws
Exception {
- disconnectAllSessions(); // disconnect all Sessions
- // from the SFTP server
+ disconnectAllSessions(); // disconnect all
Sessions from
+ // the SFTP server
}
}).to("mock:result");
+ from("sftp://localhost:" + getPort() + "/" + FTP_ROOT_DIR +
"?username=admin&password=admin&noop=false&move=.camel")
+ .routeId("bar")
+ .noAutoStartup().process(new Processor() {
+ @Override
+ public void process(Exchange exchange) throws
Exception {
+ disconnectAllSessions(); // disconnect all Sessions
+ // from the SFTP server
+ }
+ }).to("mock:result");
}
};
}
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
> camel-sftp: SftpConsumerDisconnectTest.testConsumeDelete almost always fail
> ----------------------------------------------------------------------------
>
> Key: CAMEL-12853
> URL: https://issues.apache.org/jira/browse/CAMEL-12853
> Project: Camel
> Issue Type: Test
> Components: camel-sftp
> Affects Versions: 2.22.1
> Environment: LinuxVM
> Reporter: Önder Sezgin
> Priority: Minor
>
> [INFO] Running
> org.apache.camel.component.file.remote.sftp.SftpConsumerDisconnectTest
> [ERROR] Tests run: 4, Failures: 3, Errors: 0, Skipped: 0, Time elapsed:
> 39.472 s <<< FAILURE! - in
> org.apache.camel.component.file.remote.sftp.SftpConsumerDisconnectTest
> [ERROR]
> testConsumeDelete(org.apache.camel.component.file.remote.sftp.SftpConsumerDisconnectTest)
> Time elapsed: 12.326 s <<< FAILURE!
> java.lang.AssertionError
> at
> org.apache.camel.component.file.remote.sftp.SftpConsumerDisconnectTest.testConsumeDelete(SftpConsumerDisconnectTest.java:63)
> [ERROR]
> testConsumeDelete(org.apache.camel.component.file.remote.sftp.SftpConsumerDisconnectTest)
> Time elapsed: 12.348 s <<< FAILURE!
> java.lang.AssertionError
> at
> org.apache.camel.component.file.remote.sftp.SftpConsumerDisconnectTest.testConsumeDelete(SftpConsumerDisconnectTest.java:63)
> [ERROR]
> testConsumeDelete(org.apache.camel.component.file.remote.sftp.SftpConsumerDisconnectTest)
> Time elapsed: 11.3 s <<< FAILURE!
> java.lang.AssertionError
> at
> org.apache.camel.component.file.remote.sftp.SftpConsumerDisconnectTest.testConsumeDelete(SftpConsumerDisconnectTest.java:63)
>
>
>
> In detail the logs are as the following;
> {code}
> 2018-10-03 12:28:12,128 [main ] INFO SftpConsumerDisconnectTest -
> ********************************************************************************
> 214 2018-10-03 12:28:12,128 [main ] INFO SftpConsumerDisconnectTest - Testing
> done:
> testConsumeDelete(org.apache.camel.component.file.remote.sftp.SftpConsumerDisc
> onnectTest)
> 215 2018-10-03 12:28:12,128 [main ] INFO SftpConsumerDisconnectTest - Took:
> 1.176 seconds (1176 millis)
> 216 2018-10-03 12:28:12,132 [main ] INFO SftpConsumerDisconnectTest -
> ********************************************************************************
> 217 2018-10-03 12:28:12,132 [main ] INFO DefaultCamelContext - Apache Camel
> 2.23.0-SNAPSHOT (CamelContext: camel-4) is shutting down
> 218 2018-10-03 12:28:12,132 [main ] INFO DefaultShutdownStrategy - Starting
> to graceful shutdown 1 routes (timeout 10 seconds)
> 219 2018-10-03 12:28:12,132 [ - ShutdownTask] INFO DefaultShutdownStrategy -
> Waiting as there are still 1 inflight and pending exchanges to complete,
> timeout in 10 secon ds. Inflights per route: [foo = 1]
> 220 2018-10-03 12:28:12,133 [ - ShutdownTask] INFO DefaultShutdownStrategy -
> There are 1 inflight exchanges:
> 221 InflightExchange: [exchangeId=ID-localhost-localdomain-1538558883329-3-1,
> fromRouteId=foo, routeId=foo, nodeId=to7, elapsed=0, duration=6]
> 222 2018-10-03 12:28:12,133 [target/res/home] WARN GenericFileOnCompletion -
> Error during commit. Exchange[ID-localhost-localdomain-1538558883329-3-1].
> Caused by: [org.a
> pache.camel.component.file.GenericFileOperationFailedException - Cannot
> delete file: target/res/home/sample-1-SftpConsumerDisconnectTest.txt]
> 223 org.apache.camel.component.file.GenericFileOperationFailedException:
> Cannot delete file: target/res/home/sample-1-SftpConsumerDisconnectTest.txt
> 224 at
> org.apache.camel.component.file.remote.SftpOperations.deleteFile(SftpOperations.java:477)
> ~[classes/:?]
> 225 at
> org.apache.camel.component.file.strategy.GenericFileDeleteProcessStrategy.commit(GenericFileDeleteProcessStrategy.java:72)
> ~[camel-core-2.23.0-SNAPSHOT.jar:2.23.0 -SNAPSHOT]
> 226 at
> org.apache.camel.component.file.GenericFileOnCompletion.processStrategyCommit(GenericFileOnCompletion.java:127)
> [camel-core-2.23.0-SNAPSHOT.jar:2.23.0-SNAPSHOT]
> 227 at
> org.apache.camel.component.file.GenericFileOnCompletion.onCompletion(GenericFileOnCompletion.java:83)
> [camel-core-2.23.0-SNAPSHOT.jar:2.23.0-SNAPSHOT]
> 228 at
> org.apache.camel.component.file.GenericFileOnCompletion.onComplete(GenericFileOnCompletion.java:59)
> [camel-core-2.23.0-SNAPSHOT.jar:2.23.0-SNAPSHOT]
> 229 at
> org.apache.camel.util.UnitOfWorkHelper.doneSynchronizations(UnitOfWorkHelper.java:104)
> [camel-core-2.23.0-SNAPSHOT.jar:2.23.0-SNAPSHOT]
> 230 at
> org.apache.camel.impl.DefaultUnitOfWork.done(DefaultUnitOfWork.java:243)
> [camel-core-2.23.0-SNAPSHOT.jar:2.23.0-SNAPSHOT]
> 231 at
> org.apache.camel.util.UnitOfWorkHelper.doneUow(UnitOfWorkHelper.java:65)
> [camel-core-2.23.0-SNAPSHOT.jar:2.23.0-SNAPSHOT]
> 232 at
> org.apache.camel.processor.CamelInternalProcessor$UnitOfWorkProcessorAdvice.after(CamelInternalProcessor.java:685)
> [camel-core-2.23.0-SNAPSHOT.jar:2.23.0-SNAPSHOT ]
> 233 at
> org.apache.camel.processor.CamelInternalProcessor$UnitOfWorkProcessorAdvice.after(CamelInternalProcessor.java:634)
> [camel-core-2.23.0-SNAPSHOT.jar:2.23.0-SNAPSHOT ]
> 234 at
> org.apache.camel.processor.CamelInternalProcessor$InternalCallback.done(CamelInternalProcessor.java:251)
> [camel-core-2.23.0-SNAPSHOT.jar:2.23.0-SNAPSHOT]
> 235 at
> org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:183)
> [camel-core-2.23.0-SNAPSHOT.jar:2.23.0-SNAPSHOT]
> 236 at
> org.apache.camel.component.file.GenericFileConsumer.processExchange(GenericFileConsumer.java:454)
> [camel-core-2.23.0-SNAPSHOT.jar:2.23.0-SNAPSHOT]
> 237 at
> org.apache.camel.component.file.remote.RemoteFileConsumer.processExchange(RemoteFileConsumer.java:138)
> [classes/:?]
> 238 at
> org.apache.camel.component.file.GenericFileConsumer.processBatch(GenericFileConsumer.java:223)
> [camel-core-2.23.0-SNAPSHOT.jar:2.23.0-SNAPSHOT]
> 239 at
> org.apache.camel.component.file.GenericFileConsumer.poll(GenericFileConsumer.java:187)
> [camel-core-2.23.0-SNAPSHOT.jar:2.23.0-SNAPSHOT]
> 240 at
> org.apache.camel.impl.ScheduledPollConsumer.doRun(ScheduledPollConsumer.java:174)
> [camel-core-2.23.0-SNAPSHOT.jar:2.23.0-SNAPSHOT]
> 241 at
> org.apache.camel.impl.ScheduledPollConsumer.run(ScheduledPollConsumer.java:101)
> [camel-core-2.23.0-SNAPSHOT.jar:2.23.0-SNAPSHOT]
> 242 at
> java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
> [?:1.8.0_172]
> 243 at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)
> [?:1.8.0_172]
> 244 at
> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180)
> [?:1.8.0_172]
> 245 at
> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294)
> [?:1.8.0_172]
> 246 at
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
> [?:1.8.0_172]
> 247 at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
> [?:1.8.0_172]
> 248 at java.lang.Thread.run(Thread.java:748) [?:1.8.0_172]
> 249 Caused by: com.jcraft.jsch.SftpException:
> 250 at com.jcraft.jsch.ChannelSftp.rm(ChannelSftp.java:1992)
> ~[jsch-0.1.54.jar:?]
> 251 at
> org.apache.camel.component.file.remote.SftpOperations.deleteFile(SftpOperations.java:473)
> ~[classes/:?]
> 252 ... 24 more
> 253 Caused by: java.io.IOException: inputstream is closed
> 254 at com.jcraft.jsch.ChannelSftp.fill(ChannelSftp.java:2911)
> ~[jsch-0.1.54.jar:?]
> 255 at com.jcraft.jsch.ChannelSftp.header(ChannelSftp.java:2935)
> ~[jsch-0.1.54.jar:?]
> 256 at com.jcraft.jsch.ChannelSftp.rm(ChannelSftp.java:1974)
> ~[jsch-0.1.54.jar:?]
> 257 at
> org.apache.camel.component.file.remote.SftpOperations.deleteFile(SftpOperations.java:473)
> ~[classes/:?]
> 258 ... 24 more
> 259 2018-10-03 12:28:13,133 [ - ShutdownTask] INFO DefaultShutdownStrategy -
> Route: foo shutdown complete, was consuming from:
> sftp://localhost:21000/target/res/home?del
> ete=true&password=xxxxxx&username=admin
> 260 2018-10-03 12:28:13,133 [main ] INFO DefaultShutdownStrategy - Graceful
> shutdown of 1 routes completed in 1 seconds
> 261 2018-10-03 12:28:13,135 [main ] INFO DefaultCamelContext - Apache Camel
> 2.23.0-SNAPSHOT (CamelContext: camel-4) uptime 2.208 seconds
> {code}
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)