INT-1614 adding @Ignored sanity tests

This commit is contained in:
Oleg Zhurakousky
2010-11-19 13:05:23 -05:00
parent f91e5f4744
commit 564d72ee64
17 changed files with 254 additions and 54 deletions

2
spring-integration-ftp/.gitignore vendored Normal file
View File

@@ -0,0 +1,2 @@
local-test-dir/*.test
remote-target-dir/*test

View File

@@ -0,0 +1 @@
don't delete this dir used for testing

View File

@@ -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

View File

@@ -0,0 +1 @@
don't delete this dir used for testing

View File

@@ -0,0 +1 @@
don't delete this dir used for testing

View File

@@ -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

View File

@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:int="http://www.springframework.org/schema/integration"
xmlns:int-ftp="http://www.springframework.org/schema/integration/ftp"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/integration http://www.springframework.org/schema/integration/spring-integration-2.0.xsd
http://www.springframework.org/schema/integration/ftp http://www.springframework.org/schema/integration/ftp/spring-integration-ftp-2.0.xsd">
<bean id="ftpClientFactory" class="org.springframework.integration.ftp.client.DefaultFtpClientFactory">
<property name="host" value="localhost"/>
<property name="username" value="ozhurakousky"/>
<property name="password" value="seva@1994"/>
<property name="remoteWorkingDirectory" value="/Users/ozhurakousky/workspace-sts-2.3.3.M2/si/spring-integration/spring-integration-ftp/remote-test-dir"/>
</bean>
<int-ftp:inbound-channel-adapter id="ftpInbound"
channel="ftpChannel"
client-factory="ftpClientFactory"
charset="UTF-8"
auto-create-directories="true"
auto-delete-remote-files-on-sync="false"
filename-pattern=".*\.test$"
local-working-directory="file:local-test-dir">
<int:poller fixed-rate="1000"/>
</int-ftp:inbound-channel-adapter>
<int:channel id="ftpChannel">
<int:queue/>
</int:channel>
</beans>

View File

@@ -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<File>(fileA));
ftpChannel.send(new GenericMessage<File>(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());
}
}

View File

@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:int="http://www.springframework.org/schema/integration"
xmlns:int-ftp="http://www.springframework.org/schema/integration/ftp"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/integration http://www.springframework.org/schema/integration/spring-integration-2.0.xsd
http://www.springframework.org/schema/integration/ftp http://www.springframework.org/schema/integration/ftp/spring-integration-ftp-2.0.xsd">
<bean id="ftpClientFactory" class="org.springframework.integration.ftp.client.DefaultFtpClientFactory">
<property name="host" value="localhost"/>
<property name="username" value="ozhurakousky"/>
<property name="password" value="seva@1994"/>
<property name="remoteWorkingDirectory" value="/Users/ozhurakousky/workspace-sts-2.3.3.M2/si/spring-integration/spring-integration-ftp/remote-target-dir"/>
</bean>
<int:channel id="ftpChannel"/>
<int-ftp:outbound-channel-adapter
client-factory="ftpClientFactory"
channel="ftpChannel"/>
</beans>

View File

@@ -1 +1,2 @@
.test.txt
local-test-dir/*.test
remote-target-dir/*test-foo

View File

@@ -0,0 +1 @@
don't delete this dir used for testing

View File

@@ -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<File>(fileA));
ftpChannel.send(new GenericMessage<File>(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());
}
}

View File

@@ -10,7 +10,7 @@
http://www.springframework.org/schema/integration/sftp http://www.springframework.org/schema/integration/sftp/spring-integration-sftp-2.0.xsd">
<bean id="sftpSessionFactory" class="org.springframework.integration.sftp.session.SftpSessionFactory">
<bean id="sftpSessionFactory" class="org.springframework.integration.sftp.session.SimpleSftpSessionFactory">
<property name="host" value="localhost"/>
<property name="privateKey" value="classpath:org/springframework/integration/sftp/config/sftp_rsa"/>
<property name="privateKeyPassphrase" value="springintegration"/>

View File

@@ -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");
}
}

View File

@@ -8,21 +8,21 @@
http://www.springframework.org/schema/integration/sftp http://www.springframework.org/schema/integration/sftp/spring-integration-sftp-2.0.xsd">
<bean id="sftpSessionFactory" class="org.springframework.integration.sftp.session.SftpSessionFactory">
<bean id="sftpSessionFactory" class="org.springframework.integration.sftp.session.SimpleSftpSessionFactory">
<property name="host" value="localhost"/>
<property name="privateKey" value="file:/Users/ozhurakousky/.ssh/sftp_rsa"/>
<property name="privateKeyPassphrase" value="xxxx"/>
<property name="privateKey" value="classpath:org/springframework/integration/sftp/config/sftp_rsa"/>
<property name="privateKeyPassphrase" value="springintegration"/>
<property name="port" value="22"/>
<property name="user" value="ozhurakousky"/>
</bean>
<int:channel id="inputChannel"/>
<int:channel id="ftpChannel"/>
<int-sftp:outbound-channel-adapter id="sftpOutboundAdapter"
session-factory="sftpSessionFactory"
channel="inputChannel"
channel="ftpChannel"
charset="UTF-8"
remote-file-generator-expression="payload.getName() + '_foo'"
remote-directory="/Users/ozhurakousky/workspace-sts-2.3.3.M2/si/spring-integration/spring-integration-sftp/remote-test-dir"/>
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"/>
</beans>