From 564d72ee64551fbbed193822f2751260e9b36000 Mon Sep 17 00:00:00 2001 From: Oleg Zhurakousky Date: Fri, 19 Nov 2010 13:05:23 -0500 Subject: [PATCH] INT-1614 adding @Ignored sanity tests --- spring-integration-ftp/.gitignore | 2 + .../local-test-dir/readme.txt | 1 + spring-integration-ftp/log4j.properties | 8 ++ .../remote-target-dir/readme.txt | 1 + spring-integration-ftp/remote-test-dir/a.test | 0 spring-integration-ftp/remote-test-dir/b.test | 0 .../remote-test-dir/readme.txt | 1 + .../src/test/java/log4j.properties | 8 ++ ...FtpInboundChannelAdapterSample-context.xml | 32 +++++++ .../FtpInboundOutboundSanitySample.java | 83 +++++++++++++++++++ ...tpOutboundChannelAdapterSample-context.xml | 25 ++++++ spring-integration-sftp/.gitignore | 3 +- .../remote-target-dir/readme.txt | 1 + .../SftpInboundOutboundSanitySample.java | 82 ++++++++++++++++++ ...l => SftpInboundReceiveSample-ignored.xml} | 2 +- .../sftp/config/SftpInboundReceiveSample.java | 45 ---------- .../SftpOutboundTransferSample-ignored.xml | 14 ++-- 17 files changed, 254 insertions(+), 54 deletions(-) create mode 100644 spring-integration-ftp/.gitignore create mode 100644 spring-integration-ftp/local-test-dir/readme.txt create mode 100644 spring-integration-ftp/log4j.properties create mode 100644 spring-integration-ftp/remote-target-dir/readme.txt create mode 100644 spring-integration-ftp/remote-test-dir/a.test create mode 100644 spring-integration-ftp/remote-test-dir/b.test create mode 100644 spring-integration-ftp/remote-test-dir/readme.txt create mode 100644 spring-integration-ftp/src/test/java/log4j.properties create mode 100644 spring-integration-ftp/src/test/java/org/springframework/integration/ftp/config/FtpInboundChannelAdapterSample-context.xml create mode 100644 spring-integration-ftp/src/test/java/org/springframework/integration/ftp/config/FtpInboundOutboundSanitySample.java create mode 100644 spring-integration-ftp/src/test/java/org/springframework/integration/ftp/config/FtpOutboundChannelAdapterSample-context.xml create mode 100644 spring-integration-sftp/remote-target-dir/readme.txt create mode 100644 spring-integration-sftp/src/test/java/org/springframework/integration/sftp/config/SftpInboundOutboundSanitySample.java rename spring-integration-sftp/src/test/java/org/springframework/integration/sftp/config/{SftpInboundReceiveSample-ignored-context.xml => SftpInboundReceiveSample-ignored.xml} (97%) delete mode 100644 spring-integration-sftp/src/test/java/org/springframework/integration/sftp/config/SftpInboundReceiveSample.java diff --git a/spring-integration-ftp/.gitignore b/spring-integration-ftp/.gitignore new file mode 100644 index 0000000000..b97386c397 --- /dev/null +++ b/spring-integration-ftp/.gitignore @@ -0,0 +1,2 @@ +local-test-dir/*.test +remote-target-dir/*test diff --git a/spring-integration-ftp/local-test-dir/readme.txt b/spring-integration-ftp/local-test-dir/readme.txt new file mode 100644 index 0000000000..e308f5e4ee --- /dev/null +++ b/spring-integration-ftp/local-test-dir/readme.txt @@ -0,0 +1 @@ +don't delete this dir used for testing \ No newline at end of file diff --git a/spring-integration-ftp/log4j.properties b/spring-integration-ftp/log4j.properties new file mode 100644 index 0000000000..c4672eb722 --- /dev/null +++ b/spring-integration-ftp/log4j.properties @@ -0,0 +1,8 @@ +log4j.rootCategory=WARN, stdout + +log4j.appender.stdout=org.apache.log4j.ConsoleAppender +log4j.appender.stdout.layout=org.apache.log4j.PatternLayout +log4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE} %5p %t %c{2}:%L - %m%n + +log4j.category.org.springframework=WARN +log4j.category.org.springframework.integration=DEBUG diff --git a/spring-integration-ftp/remote-target-dir/readme.txt b/spring-integration-ftp/remote-target-dir/readme.txt new file mode 100644 index 0000000000..e308f5e4ee --- /dev/null +++ b/spring-integration-ftp/remote-target-dir/readme.txt @@ -0,0 +1 @@ +don't delete this dir used for testing \ No newline at end of file diff --git a/spring-integration-ftp/remote-test-dir/a.test b/spring-integration-ftp/remote-test-dir/a.test new file mode 100644 index 0000000000..e69de29bb2 diff --git a/spring-integration-ftp/remote-test-dir/b.test b/spring-integration-ftp/remote-test-dir/b.test new file mode 100644 index 0000000000..e69de29bb2 diff --git a/spring-integration-ftp/remote-test-dir/readme.txt b/spring-integration-ftp/remote-test-dir/readme.txt new file mode 100644 index 0000000000..e308f5e4ee --- /dev/null +++ b/spring-integration-ftp/remote-test-dir/readme.txt @@ -0,0 +1 @@ +don't delete this dir used for testing \ No newline at end of file diff --git a/spring-integration-ftp/src/test/java/log4j.properties b/spring-integration-ftp/src/test/java/log4j.properties new file mode 100644 index 0000000000..c4672eb722 --- /dev/null +++ b/spring-integration-ftp/src/test/java/log4j.properties @@ -0,0 +1,8 @@ +log4j.rootCategory=WARN, stdout + +log4j.appender.stdout=org.apache.log4j.ConsoleAppender +log4j.appender.stdout.layout=org.apache.log4j.PatternLayout +log4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE} %5p %t %c{2}:%L - %m%n + +log4j.category.org.springframework=WARN +log4j.category.org.springframework.integration=DEBUG diff --git a/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/config/FtpInboundChannelAdapterSample-context.xml b/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/config/FtpInboundChannelAdapterSample-context.xml new file mode 100644 index 0000000000..35ade82acf --- /dev/null +++ b/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/config/FtpInboundChannelAdapterSample-context.xml @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + + + + + + diff --git a/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/config/FtpInboundOutboundSanitySample.java b/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/config/FtpInboundOutboundSanitySample.java new file mode 100644 index 0000000000..298e6aee51 --- /dev/null +++ b/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/config/FtpInboundOutboundSanitySample.java @@ -0,0 +1,83 @@ +/* + * Copyright 2002-2010 the original author or authors. + * + * Licensed 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.springframework.integration.ftp.config; + +import static junit.framework.Assert.assertTrue; + +import java.io.File; + +import org.junit.Before; +import org.junit.Ignore; +import org.junit.Test; + +import org.springframework.context.ApplicationContext; +import org.springframework.context.support.ClassPathXmlApplicationContext; +import org.springframework.integration.MessageChannel; +import org.springframework.integration.message.GenericMessage; + +/** + * @author Oleg Zhurakousky + */ +public class FtpInboundOutboundSanitySample { + + + @Test + @Ignore + public void testFtpInboundChannelAdapter() throws Exception{ + File fileA = new File("local-test-dir/a.test"); + if (fileA.exists()){ + fileA.delete(); + } + File fileB = new File("local-test-dir/b.test"); + if (fileB.exists()){ + fileB.delete(); + } + fileA = new File("remote-target-dir/a.test"); + if (fileA.exists()){ + fileA.delete(); + } + fileB = new File("remote-target-dir/b.test"); + if (fileB.exists()){ + fileB.delete(); + } + + new ClassPathXmlApplicationContext("FtpInboundChannelAdapterSample-context.xml", this.getClass()); + Thread.sleep(3000); + fileA = new File("local-test-dir/b.test"); + fileB = new File("local-test-dir/b.test"); + assertTrue(fileA.exists()); + assertTrue(fileB.exists()); + } + + @Test + @Ignore + public void testFtpOutboundChannelAdapter() throws Exception{ + ApplicationContext ac = + new ClassPathXmlApplicationContext("FtpOutboundChannelAdapterSample-context.xml", this.getClass()); + File fileA = new File("local-test-dir/a.test"); + File fileB = new File("local-test-dir/b.test"); + MessageChannel ftpChannel = ac.getBean("ftpChannel", MessageChannel.class); + ftpChannel.send(new GenericMessage(fileA)); + ftpChannel.send(new GenericMessage(fileB)); + Thread.sleep(3000); + fileA = new File("remote-target-dir/a.test"); + fileB = new File("remote-target-dir/b.test"); + assertTrue(fileA.exists()); + assertTrue(fileB.exists()); + } + +} diff --git a/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/config/FtpOutboundChannelAdapterSample-context.xml b/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/config/FtpOutboundChannelAdapterSample-context.xml new file mode 100644 index 0000000000..19b8acd1cf --- /dev/null +++ b/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/config/FtpOutboundChannelAdapterSample-context.xml @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + diff --git a/spring-integration-sftp/.gitignore b/spring-integration-sftp/.gitignore index 94c5648915..314bcda8e2 100644 --- a/spring-integration-sftp/.gitignore +++ b/spring-integration-sftp/.gitignore @@ -1 +1,2 @@ -.test.txt +local-test-dir/*.test +remote-target-dir/*test-foo diff --git a/spring-integration-sftp/remote-target-dir/readme.txt b/spring-integration-sftp/remote-target-dir/readme.txt new file mode 100644 index 0000000000..e308f5e4ee --- /dev/null +++ b/spring-integration-sftp/remote-target-dir/readme.txt @@ -0,0 +1 @@ +don't delete this dir used for testing \ No newline at end of file diff --git a/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/config/SftpInboundOutboundSanitySample.java b/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/config/SftpInboundOutboundSanitySample.java new file mode 100644 index 0000000000..c02faa2e34 --- /dev/null +++ b/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/config/SftpInboundOutboundSanitySample.java @@ -0,0 +1,82 @@ +/* + * Copyright 2002-2010 the original author or authors. + * + * Licensed 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.springframework.integration.sftp.config; + +import static junit.framework.Assert.assertTrue; + +import java.io.File; + +import org.junit.Ignore; +import org.junit.Test; + +import org.springframework.context.ApplicationContext; +import org.springframework.context.support.ClassPathXmlApplicationContext; +import org.springframework.integration.MessageChannel; +import org.springframework.integration.message.GenericMessage; + +/** + * @author Oleg Zhurakousy + * + */ +public class SftpInboundOutboundSanitySample { + + + @Test + @Ignore + public void testInbound() throws Exception{ + File fileA = new File("local-test-dir/a.test"); + if (fileA.exists()){ + fileA.delete(); + } + File fileB = new File("local-test-dir/b.test"); + if (fileB.exists()){ + fileB.delete(); + } + fileA = new File("remote-target-dir/a.test-foo"); + if (fileA.exists()){ + fileA.delete(); + } + fileB = new File("remote-target-dir/b.test-foo"); + if (fileB.exists()){ + fileB.delete(); + } + + new ClassPathXmlApplicationContext("SftpInboundReceiveSample-ignored.xml", this.getClass()); + Thread.sleep(3000); + fileA = new File("local-test-dir/a.test"); + fileB = new File("local-test-dir/b.test"); + assertTrue(fileA.exists()); + assertTrue(fileB.exists()); + } + + @Test + @Ignore + public void testOutbound() throws Exception{ + ApplicationContext ac = + new ClassPathXmlApplicationContext("SftpOutboundTransferSample-ignored.xml", this.getClass()); + File fileA = new File("local-test-dir/a.test"); + File fileB = new File("local-test-dir/b.test"); + MessageChannel ftpChannel = ac.getBean("ftpChannel", MessageChannel.class); + ftpChannel.send(new GenericMessage(fileA)); + ftpChannel.send(new GenericMessage(fileB)); + Thread.sleep(3000); + fileA = new File("remote-target-dir/a.test-foo"); + fileB = new File("remote-target-dir/b.test-foo"); + assertTrue(fileA.exists()); + assertTrue(fileB.exists()); + } + +} diff --git a/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/config/SftpInboundReceiveSample-ignored-context.xml b/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/config/SftpInboundReceiveSample-ignored.xml similarity index 97% rename from spring-integration-sftp/src/test/java/org/springframework/integration/sftp/config/SftpInboundReceiveSample-ignored-context.xml rename to spring-integration-sftp/src/test/java/org/springframework/integration/sftp/config/SftpInboundReceiveSample-ignored.xml index 3595266569..b498de214f 100644 --- a/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/config/SftpInboundReceiveSample-ignored-context.xml +++ b/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/config/SftpInboundReceiveSample-ignored.xml @@ -10,7 +10,7 @@ http://www.springframework.org/schema/integration/sftp http://www.springframework.org/schema/integration/sftp/spring-integration-sftp-2.0.xsd"> - + diff --git a/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/config/SftpInboundReceiveSample.java b/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/config/SftpInboundReceiveSample.java deleted file mode 100644 index 91ef2f5c6e..0000000000 --- a/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/config/SftpInboundReceiveSample.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright 2002-2010 the original author or authors. - * - * Licensed 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.springframework.integration.sftp.config; - -import static junit.framework.Assert.assertTrue; - -import java.io.File; - -import org.junit.Ignore; -import org.junit.Test; - -import org.springframework.context.support.ClassPathXmlApplicationContext; - -/** - * @author Oleg Zhurakousy - * - */ -public class SftpInboundReceiveSample { - - @Test - @Ignore - public void testInbound() throws Exception{ - new ClassPathXmlApplicationContext("SftpInboundReceiveSample-ignored-context.xml", SftpInboundReceiveSample.class); - Thread.sleep(3000); - File fileA = new File("local-test-dir/a.test"); - File fileB = new File("local-test-dir/a.test"); - assertTrue(new File("local-test-dir/a.test").exists()); - assertTrue(new File("local-test-dir/b.test").exists()); - System.out.println("Done"); - } - -} diff --git a/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/config/SftpOutboundTransferSample-ignored.xml b/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/config/SftpOutboundTransferSample-ignored.xml index c4cbec6c0c..869ced53c1 100644 --- a/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/config/SftpOutboundTransferSample-ignored.xml +++ b/spring-integration-sftp/src/test/java/org/springframework/integration/sftp/config/SftpOutboundTransferSample-ignored.xml @@ -8,21 +8,21 @@ http://www.springframework.org/schema/integration/sftp http://www.springframework.org/schema/integration/sftp/spring-integration-sftp-2.0.xsd"> - + - - + + - + + remote-filename-generator-expression="payload.getName() + '-foo'" + remote-directory="/Users/ozhurakousky/workspace-sts-2.3.3.M2/si/spring-integration/spring-integration-sftp/remote-target-dir"/>