You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ni...@apache.org on 2009/10/13 10:54:15 UTC

svn commit: r824642 [3/3] - in /camel/trunk/components/camel-printer: ./ src/main/java/org/apache/camel/component/printer/ src/main/resources/META-INF/ src/test/java/org/apache/camel/component/printer/ src/test/resources/

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=824642&r1=824641&r2=824642&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 Oct 13 08:54:14 2009
@@ -1,166 +1,166 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.apache.camel.component.printer;
-
-import java.io.BufferedInputStream;
-import java.io.FileInputStream;
-import java.io.InputStream;
-
-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.Ignore;
-import org.junit.Test;
-
-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() {
-            public void process(Exchange exchange) throws Exception {
-             // Read from an input stream
-                InputStream is = new BufferedInputStream(
-                    new FileInputStream("./src/test/resources/test.txt"));
-
-                byte buffer[] = new byte[is.available()];
-                int n = is.available();
-                for (int i = 0; i < n; i++) {
-                    buffer[i] = (byte)is.read();
-                }
-
-                is.close();
-                // Set the property of the charset encoding
-                exchange.setProperty(Exchange.CHARSET_NAME, "UTF-8");
-                Message in = exchange.getIn();
-                in.setBody(buffer);
-            }            
-        });       
-    }
-    
-    private void sendGIF() throws Exception {
-        template.send("direct:start", new Processor() {
-            public void process(Exchange exchange) throws Exception {
-             // Read from an input stream
-                InputStream is = new BufferedInputStream(
-                    new FileInputStream("./src/test/resources/asf-logo.gif"));
-
-                byte buffer[] = new byte[is.available()];
-                int n = is.available();
-                for (int i = 0; i < n; i++) {
-                    buffer[i] = (byte)is.read();
-                }
-                  
-                is.close();
-                // Set the property of the charset encoding
-                exchange.setProperty(Exchange.CHARSET_NAME, "UTF-8");
-                Message in = exchange.getIn();
-                in.setBody(buffer);
-            }            
-        });       
-    }
-    
-    private void sendJPEG() throws Exception {
-        template.send("direct:start", new Processor() {
-            public void process(Exchange exchange) throws Exception {
-             // Read from an input stream
-                InputStream is = new BufferedInputStream(
-                    new FileInputStream("./src/test/resources/asf-logo.JPG"));
-
-                byte buffer[] = new byte[is.available()];
-                int n = is.available();
-                for (int i = 0; i < n; i++) {
-                    buffer[i] = (byte)is.read();
-                }
-                
-                is.close();
-                
-                // Set the property of the charset encoding
-                exchange.setProperty(Exchange.CHARSET_NAME, "UTF-8");
-                Message in = exchange.getIn();
-                in.setBody(buffer);
-            }            
-        });       
-    }
-
-    @Test
-    @Ignore
-    public void testSendingFileToPrinter() throws Exception {
-        if (isAwtHeadless()) {
-            return;
-        }
-        context.addRoutes(new RouteBuilder() {
-            public void configure() {
-                from("direct:start").
-                    to("lpr://localhost/default?copies=1&flavor=DocFlavor.BYTE_ARRAY&mimeType=AUTOSENSE&mediaSize=na-letter&sides=one-sided&sendToPrinter=false");
-            }
-        });
-        context.start();
-
-        sendFile();
-    }
-    
-    @Test
-    @Ignore
-    public void testSendingGIFToPrinter() throws Exception {
-        if (isAwtHeadless()) {
-            return;
-        }
-        context.addRoutes(new RouteBuilder() {
-            public void configure() {
-                from("direct:start").
-                    to("lpr://localhost/default?flavor=DocFlavor.INPUT_STREAM&mimeType=GIF&mediaSize=na-letter&sides=one-sided&sendToPrinter=false");
-            }
-        });
-        context.start();
-
-        sendGIF();
-    }
-    
-    @Test
-    @Ignore
-    public void testSendingJPEGToPrinter() throws Exception {
-        if (isAwtHeadless()) {
-            return;
-        }
-        context.addRoutes(new RouteBuilder() {
-            public void configure() {
-                from("direct:start").
-                    to("lpr://localhost/default?copies=2&flavor=DocFlavor.INPUT_STREAM&mimeType=JPEG&mediaSize=na-letter&sides=one-sided&sendToPrinter=false");
-            }
-        });
-        context.start();
-
-        sendJPEG();
-    }
-
-}
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.apache.camel.component.printer;
+
+import java.io.BufferedInputStream;
+import java.io.FileInputStream;
+import java.io.InputStream;
+
+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.Ignore;
+import org.junit.Test;
+
+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() {
+            public void process(Exchange exchange) throws Exception {
+             // Read from an input stream
+                InputStream is = new BufferedInputStream(
+                    new FileInputStream("./src/test/resources/test.txt"));
+
+                byte buffer[] = new byte[is.available()];
+                int n = is.available();
+                for (int i = 0; i < n; i++) {
+                    buffer[i] = (byte)is.read();
+                }
+
+                is.close();
+                // Set the property of the charset encoding
+                exchange.setProperty(Exchange.CHARSET_NAME, "UTF-8");
+                Message in = exchange.getIn();
+                in.setBody(buffer);
+            }            
+        });       
+    }
+    
+    private void sendGIF() throws Exception {
+        template.send("direct:start", new Processor() {
+            public void process(Exchange exchange) throws Exception {
+             // Read from an input stream
+                InputStream is = new BufferedInputStream(
+                    new FileInputStream("./src/test/resources/asf-logo.gif"));
+
+                byte buffer[] = new byte[is.available()];
+                int n = is.available();
+                for (int i = 0; i < n; i++) {
+                    buffer[i] = (byte)is.read();
+                }
+                  
+                is.close();
+                // Set the property of the charset encoding
+                exchange.setProperty(Exchange.CHARSET_NAME, "UTF-8");
+                Message in = exchange.getIn();
+                in.setBody(buffer);
+            }            
+        });       
+    }
+    
+    private void sendJPEG() throws Exception {
+        template.send("direct:start", new Processor() {
+            public void process(Exchange exchange) throws Exception {
+             // Read from an input stream
+                InputStream is = new BufferedInputStream(
+                    new FileInputStream("./src/test/resources/asf-logo.JPG"));
+
+                byte buffer[] = new byte[is.available()];
+                int n = is.available();
+                for (int i = 0; i < n; i++) {
+                    buffer[i] = (byte)is.read();
+                }
+                
+                is.close();
+                
+                // Set the property of the charset encoding
+                exchange.setProperty(Exchange.CHARSET_NAME, "UTF-8");
+                Message in = exchange.getIn();
+                in.setBody(buffer);
+            }            
+        });       
+    }
+
+    @Test
+    @Ignore
+    public void testSendingFileToPrinter() throws Exception {
+        if (isAwtHeadless()) {
+            return;
+        }
+        context.addRoutes(new RouteBuilder() {
+            public void configure() {
+                from("direct:start").
+                    to("lpr://localhost/default?copies=1&flavor=DocFlavor.BYTE_ARRAY&mimeType=AUTOSENSE&mediaSize=na-letter&sides=one-sided&sendToPrinter=false");
+            }
+        });
+        context.start();
+
+        sendFile();
+    }
+    
+    @Test
+    @Ignore
+    public void testSendingGIFToPrinter() throws Exception {
+        if (isAwtHeadless()) {
+            return;
+        }
+        context.addRoutes(new RouteBuilder() {
+            public void configure() {
+                from("direct:start").
+                    to("lpr://localhost/default?flavor=DocFlavor.INPUT_STREAM&mimeType=GIF&mediaSize=na-letter&sides=one-sided&sendToPrinter=false");
+            }
+        });
+        context.start();
+
+        sendGIF();
+    }
+    
+    @Test
+    @Ignore
+    public void testSendingJPEGToPrinter() throws Exception {
+        if (isAwtHeadless()) {
+            return;
+        }
+        context.addRoutes(new RouteBuilder() {
+            public void configure() {
+                from("direct:start").
+                    to("lpr://localhost/default?copies=2&flavor=DocFlavor.INPUT_STREAM&mimeType=JPEG&mediaSize=na-letter&sides=one-sided&sendToPrinter=false");
+            }
+        });
+        context.start();
+
+        sendJPEG();
+    }
+
+}

Propchange: camel/trunk/components/camel-printer/src/test/java/org/apache/camel/component/printer/PrinterPrintTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: camel/trunk/components/camel-printer/src/test/java/org/apache/camel/component/printer/PrinterPrintTest.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: camel/trunk/components/camel-printer/src/test/resources/asf-logo.JPG
------------------------------------------------------------------------------
--- svn:mime-type (original)
+++ svn:mime-type Tue Oct 13 08:54:14 2009
@@ -1 +1 @@
-application/octet-stream
+image/jpeg

Propchange: camel/trunk/components/camel-printer/src/test/resources/asf-logo.gif
------------------------------------------------------------------------------
--- svn:mime-type (original)
+++ svn:mime-type Tue Oct 13 08:54:14 2009
@@ -1 +1 @@
-application/octet-stream
+image/gif

Modified: camel/trunk/components/camel-printer/src/test/resources/log4j.properties
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-printer/src/test/resources/log4j.properties?rev=824642&r1=824641&r2=824642&view=diff
==============================================================================
--- camel/trunk/components/camel-printer/src/test/resources/log4j.properties (original)
+++ camel/trunk/components/camel-printer/src/test/resources/log4j.properties Tue Oct 13 08:54:14 2009
@@ -1,38 +1,38 @@
-## ------------------------------------------------------------------------
-## Licensed to the Apache Software Foundation (ASF) under one or more
-## contributor license agreements.  See the NOTICE file distributed with
-## this work for additional information regarding copyright ownership.
-## The ASF licenses this file to You 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.
-## ------------------------------------------------------------------------
-
-#
-# The logging properties used for eclipse testing, We want to see debug output on the console.
-#
-log4j.rootLogger=INFO, file
-
-# uncomment the following to enable camel debugging
-log4j.logger.org.apache.camel.component.printer=INFO
-#log4j.logger.org.apache.camel=DEBUG
-#log4j.logger.org.apache.commons.net=TRACE
-
-# CONSOLE appender not used by default
-log4j.appender.out=org.apache.log4j.ConsoleAppender
-log4j.appender.out.layout=org.apache.log4j.PatternLayout
-#log4j.appender.out.layout.ConversionPattern=[%30.30t] %-30.30c{1} %-5p %m%n
-log4j.appender.out.layout.ConversionPattern=%d [%-15.15t] %-5p %-30.30c{1} - %m%n
-
-# File appender
-log4j.appender.file=org.apache.log4j.FileAppender
-log4j.appender.file.layout=org.apache.log4j.PatternLayout
-log4j.appender.file.layout.ConversionPattern=%d [%-15.15t] %-5p %-30.30c{1} - %m%n
-log4j.appender.file.file=target/camel-printer-test.log
+## ------------------------------------------------------------------------
+## Licensed to the Apache Software Foundation (ASF) under one or more
+## contributor license agreements.  See the NOTICE file distributed with
+## this work for additional information regarding copyright ownership.
+## The ASF licenses this file to You 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.
+## ------------------------------------------------------------------------
+
+#
+# The logging properties used for eclipse testing, We want to see debug output on the console.
+#
+log4j.rootLogger=INFO, file
+
+# uncomment the following to enable camel debugging
+log4j.logger.org.apache.camel.component.printer=INFO
+#log4j.logger.org.apache.camel=DEBUG
+#log4j.logger.org.apache.commons.net=TRACE
+
+# CONSOLE appender not used by default
+log4j.appender.out=org.apache.log4j.ConsoleAppender
+log4j.appender.out.layout=org.apache.log4j.PatternLayout
+#log4j.appender.out.layout.ConversionPattern=[%30.30t] %-30.30c{1} %-5p %m%n
+log4j.appender.out.layout.ConversionPattern=%d [%-15.15t] %-5p %-30.30c{1} - %m%n
+
+# File appender
+log4j.appender.file=org.apache.log4j.FileAppender
+log4j.appender.file.layout=org.apache.log4j.PatternLayout
+log4j.appender.file.layout.ConversionPattern=%d [%-15.15t] %-5p %-30.30c{1} - %m%n
+log4j.appender.file.file=target/camel-printer-test.log

Propchange: camel/trunk/components/camel-printer/src/test/resources/log4j.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: camel/trunk/components/camel-printer/src/test/resources/log4j.properties
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: camel/trunk/components/camel-printer/src/test/resources/log4j.properties
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: camel/trunk/components/camel-printer/src/test/resources/test.txt
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-printer/src/test/resources/test.txt?rev=824642&r1=824641&r2=824642&view=diff
==============================================================================
--- camel/trunk/components/camel-printer/src/test/resources/test.txt (original)
+++ camel/trunk/components/camel-printer/src/test/resources/test.txt Tue Oct 13 08:54:14 2009
@@ -1,11 +1,11 @@
-All that is gold does not glitter 
-by: JRR Tolkien 
-
-All that is gold does not glitter,
-Not all those who wander are lost
-The old that is strong does not wither,
-Deep roots are not reached by the frost.
-From the ashes a fire shall be woken,
-A light from the shadows shall spring;
-Renewed shall be blade that was broken,
+All that is gold does not glitter 
+by: JRR Tolkien 
+
+All that is gold does not glitter,
+Not all those who wander are lost
+The old that is strong does not wither,
+Deep roots are not reached by the frost.
+From the ashes a fire shall be woken,
+A light from the shadows shall spring;
+Renewed shall be blade that was broken,
 The crownless again shall be king.
\ No newline at end of file

Propchange: camel/trunk/components/camel-printer/src/test/resources/test.txt
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: camel/trunk/components/camel-printer/src/test/resources/test.txt
------------------------------------------------------------------------------
    svn:mime-type = text/plain