You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ha...@apache.org on 2011/01/19 02:53:47 UTC
svn commit: r1060650 - in /camel/trunk:
camel-core/src/test/java/org/apache/camel/
camel-core/src/test/java/org/apache/camel/component/file/
components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/
components/camel-spring/src/test/jav...
Author: hadrian
Date: Wed Jan 19 01:53:47 2011
New Revision: 1060650
URL: http://svn.apache.org/viewvc?rev=1060650&view=rev
Log:
Consolidate use of assertFileExists
Modified:
camel/trunk/camel-core/src/test/java/org/apache/camel/TestSupport.java
camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileProducerExpressionTest.java
camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerExpressionTest.java
camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/placeholder/SimpleLanguageWithSprinPropertyPlaceholderRouteTest.java
camel/trunk/components/camel-test/src/main/java/org/apache/camel/test/TestSupport.java
camel/trunk/components/camel-test/src/main/java/org/apache/camel/test/junit4/TestSupport.java
Modified: camel/trunk/camel-core/src/test/java/org/apache/camel/TestSupport.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/TestSupport.java?rev=1060650&r1=1060649&r2=1060650&view=diff
==============================================================================
--- camel/trunk/camel-core/src/test/java/org/apache/camel/TestSupport.java (original)
+++ camel/trunk/camel-core/src/test/java/org/apache/camel/TestSupport.java Wed Jan 19 01:53:47 2011
@@ -472,6 +472,14 @@ public abstract class TestSupport extend
}
/**
+ * To be used to check is a file is found in the file system
+ */
+ public static void assertFileExists(String filename) {
+ File file = new File(filename).getAbsoluteFile();
+ assertTrue("File " + filename + " should exist", file.exists());
+ }
+
+ /**
* Is this OS the given platform.
* <p/>
* Uses <tt>os.name</tt> from the system properties to determine the OS.
Modified: camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileProducerExpressionTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileProducerExpressionTest.java?rev=1060650&r1=1060649&r2=1060650&view=diff
==============================================================================
--- camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileProducerExpressionTest.java (original)
+++ camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileProducerExpressionTest.java Wed Jan 19 01:53:47 2011
@@ -16,7 +16,6 @@
*/
package org.apache.camel.component.file;
-import java.io.File;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
@@ -98,12 +97,6 @@ public class FileProducerExpressionTest
assertFileExists("target/filelanguage/mybirthday-19740420.txt");
}
- private static void assertFileExists(String filename) {
- File file = new File(filename);
- file = file.getAbsoluteFile();
- assertTrue("File " + filename + " should exists", file.exists());
- }
-
public class MyGuidGenerator {
public String guid() {
return "123";
Modified: camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerExpressionTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerExpressionTest.java?rev=1060650&r1=1060649&r2=1060650&view=diff
==============================================================================
--- camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerExpressionTest.java (original)
+++ camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerExpressionTest.java Wed Jan 19 01:53:47 2011
@@ -16,7 +16,6 @@
*/
package org.apache.camel.component.file.remote;
-import java.io.File;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
@@ -113,12 +112,6 @@ public class FtpProducerExpressionTest e
assertFileExists(FTP_ROOT_DIR + "filelanguage/mybirthday-19740420.txt");
}
- private static void assertFileExists(String filename) {
- File file = new File(filename);
- file = file.getAbsoluteFile();
- assertTrue("File " + filename + " should exists", file.exists());
- }
-
public class MyGuidGenerator {
public String guid() {
return "123";
Modified: camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/placeholder/SimpleLanguageWithSprinPropertyPlaceholderRouteTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/placeholder/SimpleLanguageWithSprinPropertyPlaceholderRouteTest.java?rev=1060650&r1=1060649&r2=1060650&view=diff
==============================================================================
--- camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/placeholder/SimpleLanguageWithSprinPropertyPlaceholderRouteTest.java (original)
+++ camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/placeholder/SimpleLanguageWithSprinPropertyPlaceholderRouteTest.java Wed Jan 19 01:53:47 2011
@@ -62,14 +62,17 @@ public class SimpleLanguageWithSprinProp
Thread.sleep(500);
- assertFileExists("target/outBox/");
+ assertFileExists("target/outBox/" + getTestFileName());
}
- private void assertFileExists(String directory) {
+ private String getTestFileName() {
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
String s = sdf.format(new Date());
- String name = directory + "test-" + s + ".txt";
- File file = new File(name).getAbsoluteFile();
- assertTrue("File should exist: " + name, file.exists());
+ return "test-" + s + ".txt";
+ }
+
+ private void assertFileExists(String filename) {
+ File file = new File(filename).getAbsoluteFile();
+ assertTrue("File " + filename + " should exist", file.exists());
}
}
Modified: camel/trunk/components/camel-test/src/main/java/org/apache/camel/test/TestSupport.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-test/src/main/java/org/apache/camel/test/TestSupport.java?rev=1060650&r1=1060649&r2=1060650&view=diff
==============================================================================
--- camel/trunk/components/camel-test/src/main/java/org/apache/camel/test/TestSupport.java (original)
+++ camel/trunk/components/camel-test/src/main/java/org/apache/camel/test/TestSupport.java Wed Jan 19 01:53:47 2011
@@ -464,6 +464,14 @@ public abstract class TestSupport extend
}
/**
+ * To be used to check is a file is found in the file system
+ */
+ public static void assertFileExists(String filename) {
+ File file = new File(filename).getAbsoluteFile();
+ assertTrue("File " + filename + " should exist", file.exists());
+ }
+
+ /**
* Is this OS the given platform.
* <p/>
* Uses <tt>os.name</tt> from the system properties to determine the OS.
Modified: camel/trunk/components/camel-test/src/main/java/org/apache/camel/test/junit4/TestSupport.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-test/src/main/java/org/apache/camel/test/junit4/TestSupport.java?rev=1060650&r1=1060649&r2=1060650&view=diff
==============================================================================
--- camel/trunk/components/camel-test/src/main/java/org/apache/camel/test/junit4/TestSupport.java (original)
+++ camel/trunk/components/camel-test/src/main/java/org/apache/camel/test/junit4/TestSupport.java Wed Jan 19 01:53:47 2011
@@ -445,6 +445,14 @@ public abstract class TestSupport extend
}
/**
+ * To be used to check is a file is found in the file system
+ */
+ public static void assertFileExists(String filename) {
+ File file = new File(filename).getAbsoluteFile();
+ assertTrue("File " + filename + " should exist", file.exists());
+ }
+
+ /**
* Is this OS the given platform.
* <p/>
* Uses <tt>os.name</tt> from the system properties to determine the OS.