Return-Path: Delivered-To: apmail-activemq-commits-archive@www.apache.org Received: (qmail 82391 invoked from network); 30 Apr 2007 10:46:44 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 30 Apr 2007 10:46:44 -0000 Received: (qmail 77489 invoked by uid 500); 30 Apr 2007 10:46:50 -0000 Delivered-To: apmail-activemq-commits-archive@activemq.apache.org Received: (qmail 77460 invoked by uid 500); 30 Apr 2007 10:46:50 -0000 Mailing-List: contact commits-help@activemq.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@activemq.apache.org Delivered-To: mailing list commits@activemq.apache.org Received: (qmail 77450 invoked by uid 99); 30 Apr 2007 10:46:50 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 30 Apr 2007 03:46:50 -0700 X-ASF-Spam-Status: No, hits=-99.5 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 30 Apr 2007 03:46:43 -0700 Received: by eris.apache.org (Postfix, from userid 65534) id 58EF11A9838; Mon, 30 Apr 2007 03:46:23 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r533688 - in /activemq/camel/trunk/camel-file/src: main/resources/ main/resources/META-INF/ main/resources/META-INF/services/ main/resources/META-INF/services/org/ main/resources/META-INF/services/org/apache/ main/resources/META-INF/service... Date: Mon, 30 Apr 2007 10:46:23 -0000 To: commits@activemq.apache.org From: rajdavies@apache.org X-Mailer: svnmailer-1.1.0 Message-Id: <20070430104623.58EF11A9838@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: rajdavies Date: Mon Apr 30 03:46:22 2007 New Revision: 533688 URL: http://svn.apache.org/viewvc?view=rev&rev=533688 Log: Added test case Added: activemq/camel/trunk/camel-file/src/main/resources/ activemq/camel/trunk/camel-file/src/main/resources/META-INF/ activemq/camel/trunk/camel-file/src/main/resources/META-INF/services/ activemq/camel/trunk/camel-file/src/main/resources/META-INF/services/org/ activemq/camel/trunk/camel-file/src/main/resources/META-INF/services/org/apache/ activemq/camel/trunk/camel-file/src/main/resources/META-INF/services/org/apache/camel/ activemq/camel/trunk/camel-file/src/main/resources/META-INF/services/org/apache/camel/component/ activemq/camel/trunk/camel-file/src/main/resources/META-INF/services/org/apache/camel/component/file activemq/camel/trunk/camel-file/src/test/java/org/ activemq/camel/trunk/camel-file/src/test/java/org/apache/ activemq/camel/trunk/camel-file/src/test/java/org/apache/camel/ activemq/camel/trunk/camel-file/src/test/java/org/apache/camel/component/ activemq/camel/trunk/camel-file/src/test/java/org/apache/camel/component/file/ activemq/camel/trunk/camel-file/src/test/java/org/apache/camel/component/file/FileRouteTest.java (with props) Added: activemq/camel/trunk/camel-file/src/main/resources/META-INF/services/org/apache/camel/component/file URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-file/src/main/resources/META-INF/services/org/apache/camel/component/file?view=auto&rev=533688 ============================================================================== --- activemq/camel/trunk/camel-file/src/main/resources/META-INF/services/org/apache/camel/component/file (added) +++ activemq/camel/trunk/camel-file/src/main/resources/META-INF/services/org/apache/camel/component/file Mon Apr 30 03:46:22 2007 @@ -0,0 +1 @@ +class=org.apache.camel.component.file.FileComponent Added: activemq/camel/trunk/camel-file/src/test/java/org/apache/camel/component/file/FileRouteTest.java URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-file/src/test/java/org/apache/camel/component/file/FileRouteTest.java?view=auto&rev=533688 ============================================================================== --- activemq/camel/trunk/camel-file/src/test/java/org/apache/camel/component/file/FileRouteTest.java (added) +++ activemq/camel/trunk/camel-file/src/test/java/org/apache/camel/component/file/FileRouteTest.java Mon Apr 30 03:46:22 2007 @@ -0,0 +1,90 @@ +/** + * + * 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.file; + +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.TimeUnit; +import junit.framework.TestCase; +import org.apache.camel.CamelContext; +import org.apache.camel.Endpoint; +import org.apache.camel.Message; +import org.apache.camel.Processor; +import org.apache.camel.Producer; +import org.apache.camel.builder.RouteBuilder; +import org.apache.camel.impl.DefaultCamelContext; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +/** + * @version $Revision: 529902 $ + */ +public class FileRouteTest extends TestCase { + private static final transient Log log = LogFactory.getLog(FileRouteTest.class); + protected CamelContext container = new DefaultCamelContext(); + protected CountDownLatch latch = new CountDownLatch(1); + protected FileExchange receivedExchange; + protected String uri = "file://foo.txt"; + protected Producer producer; + + + public void testFileRoute() throws Exception { + + // now lets fire in a message + Endpoint endpoint = container.getEndpoint(uri); + FileExchange exchange = endpoint.createExchange(); + Message message = exchange.getIn(); + message.setBody("Hello there!"); + message.setHeader("cheese", 123); + + producer = endpoint.createProducer(); + producer.process(exchange); + + // now lets sleep for a while + boolean received = latch.await(5000, TimeUnit.SECONDS); + assertTrue("Did not receive the message!", received); + } + + @Override + protected void setUp() throws Exception { + container.addRoutes(createRouteBuilder()); + container.start(); + } + + + @Override + protected void tearDown() throws Exception { + if (producer != null) { + producer.stop(); + } + container.stop(); + } + + protected RouteBuilder createRouteBuilder() { + return new RouteBuilder() { + public void configure() { + from(uri).process(new Processor() { + public void process(FileExchange e) { + System.out.println("Received exchange: " + e.getIn()); + receivedExchange = e; + latch.countDown(); + } + }); + } + }; + } +} Propchange: activemq/camel/trunk/camel-file/src/test/java/org/apache/camel/component/file/FileRouteTest.java ------------------------------------------------------------------------------ svn:eol-style = native