diff --git a/spring-integration-ftp/pom.xml b/spring-integration-ftp/pom.xml index b3ab0f838b..b72b350d77 100644 --- a/spring-integration-ftp/pom.xml +++ b/spring-integration-ftp/pom.xml @@ -85,5 +85,9 @@ commons-io 1.4 + + org.mockito + mockito-all + diff --git a/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/FtpParserTests-inbound-fail.xml b/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/FtpParserTests-inbound-fail.xml new file mode 100644 index 0000000000..e115a5df34 --- /dev/null +++ b/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/FtpParserTests-inbound-fail.xml @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + + diff --git a/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/FtpParserTests-inbound.xml b/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/FtpParserTests-inbound.xml new file mode 100644 index 0000000000..689b4441aa --- /dev/null +++ b/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/FtpParserTests-inbound.xml @@ -0,0 +1,72 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/FtpParserTests.java b/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/FtpParserTests.java new file mode 100644 index 0000000000..65fe45423e --- /dev/null +++ b/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/FtpParserTests.java @@ -0,0 +1,56 @@ +/* + * 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; + +import static junit.framework.Assert.assertTrue; + +import java.io.File; + +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import org.springframework.beans.factory.BeanCreationException; +import org.springframework.context.ApplicationContext; +import org.springframework.context.support.ClassPathXmlApplicationContext; + +/** + * @author Oleg Zhurakousky + * + */ +public class FtpParserTests { + @Before + public void prepare(){ + new File("target/foo").delete(); + } + + @Test + public void testLocalFilesAutoCreationTrue() throws Exception{ + assertTrue(!new File("target/foo").exists()); + new ClassPathXmlApplicationContext("FtpParserTests-inbound.xml", this.getClass()); + assertTrue(new File("target/foo").exists()); + assertTrue(!new File("target/bar").exists()); + } + @Test(expected=BeanCreationException.class) + public void testLocalFilesAutoCreationFalse() throws Exception{ + assertTrue(!new File("target/bar").exists()); + new ClassPathXmlApplicationContext("FtpParserTests-inbound-fail.xml", this.getClass()); + } + + @After + public void cleanUp() throws Exception{ + new File("target/foo").delete(); + } +} \ No newline at end of file