Author: ningjiang Date: Tue Sep 15 00:58:05 2009 New Revision: 814947 URL: http://svn.apache.org/viewvc?rev=814947&view=rev Log: Fixed test errors in TC of Mac
Modified: camel/trunk/components/camel-printer/pom.xml camel/trunk/components/camel-printer/src/test/java/org/apache/camel/component/printer/PrinterPrintTest.java Modified: camel/trunk/components/camel-printer/pom.xml URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-printer/pom.xml?rev=814947&r1=814946&r2=814947&view=diff ============================================================================== --- camel/trunk/components/camel-printer/pom.xml (original) +++ camel/trunk/components/camel-printer/pom.xml Tue Sep 15 00:58:05 2009 @@ -71,8 +71,7 @@ <!-- testing --> <dependency> <groupId>org.apache.camel</groupId> - <artifactId>camel-core</artifactId> - <type>test-jar</type> + <artifactId>camel-test</artifactId> <scope>test</scope> </dependency> <dependency> Modified: camel/trunk/components/camel-printer/src/test/java/org/apache/camel/component/printer/PrinterPrintTest.java URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-printer/src/test/java/org/apache/camel/component/printer/PrinterPrintTest.java?rev=814947&r1=814946&r2=814947&view=diff ============================================================================== --- camel/trunk/components/camel-printer/src/test/java/org/apache/camel/component/printer/PrinterPrintTest.java (original) +++ camel/trunk/components/camel-printer/src/test/java/org/apache/camel/component/printer/PrinterPrintTest.java Tue Sep 15 00:58:05 2009 @@ -21,18 +21,30 @@ import java.io.FileInputStream; import java.io.InputStream; -import org.apache.camel.ContextTestSupport; import org.apache.camel.Exchange; import org.apache.camel.Message; import org.apache.camel.Processor; import org.apache.camel.builder.RouteBuilder; +import org.apache.camel.test.junit4.CamelTestSupport; +import org.junit.Test; -public class PrinterPrintTest extends ContextTestSupport { +public class PrinterPrintTest extends CamelTestSupport { @Override public boolean isUseRouteBuilder() { return false; } + + // Check if there is an awt library + private boolean isAwtHeadless() { + + if (Boolean.getBoolean("java.awt.headless")) { + System.out.println("Running headless. Skipping test as Images may not work."); + return true; + } else { + return false; + } + } private void sendFile() throws Exception { template.send("direct:start", new Processor() { @@ -101,7 +113,11 @@ }); } + @Test public void testSendingFileToPrinter() throws Exception { + if (isAwtHeadless()) { + return; + } context.addRoutes(new RouteBuilder() { public void configure() { from("direct:start"). @@ -113,7 +129,11 @@ sendFile(); } + @Test public void testSendingGIFToPrinter() throws Exception { + if (isAwtHeadless()) { + return; + } context.addRoutes(new RouteBuilder() { public void configure() { from("direct:start"). @@ -125,7 +145,11 @@ sendGIF(); } + @Test public void testSendingJPEGToPrinter() throws Exception { + if (isAwtHeadless()) { + return; + } context.addRoutes(new RouteBuilder() { public void configure() { from("direct:start").