svn commit: r900688 - /camel/trunk/components/camel-gae/src/test/java/org/apache/camel/component/gae/mail/GMailBindingTest.java
Author: krasserm Date: Tue Jan 19 07:35:28 2010 New Revision: 900688 URL: http://svn.apache.org/viewvc?rev=900688&view=rev Log: fixes for checkstyle errors Modified: camel/trunk/components/camel-gae/src/test/java/org/apache/camel/component/gae/mail/GMailBindingTest.java Modified: camel/trunk/components/camel-gae/src/test/java/org/apache/camel/component/gae/mail/GMailBindingTest.java URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-gae/src/test/java/org/apache/camel/component/gae/mail/GMailBindingTest.java?rev=900688&r1=900687&r2=900688&view=diff == --- camel/trunk/components/camel-gae/src/test/java/org/apache/camel/component/gae/mail/GMailBindingTest.java (original) +++ camel/trunk/components/camel-gae/src/test/java/org/apache/camel/component/gae/mail/GMailBindingTest.java Tue Jan 19 07:35:28 2010 @@ -43,11 +43,11 @@ @BeforeClass public static void setUpClass() throws Exception { binding = new GMailBinding(); -endpoint = createEndpoint("gmail:us...@gmail.com" + - "?to=us...@gmail.com" + -"&cc=us...@gmail.com" + -"&bcc=us...@gmail.com" + - "&subject=test"); +endpoint = createEndpoint("gmail:us...@gmail.com" ++ "?to=us...@gmail.com" ++ "&cc=us...@gmail.com" ++ "&bcc=us...@gmail.com" ++ "&subject=test"); } @Before
[CONF] Apache Camel > gmail
gmail Page edited by Martin Krasser gmail Component The gmail component contributes to the Camel Components for Google App Engine (GAE). It supports sending of emails via the GAE mail service. Receiving mails is not supported yet but will be added later. Currently, only Google accounts that are application administrators can send emails. URI format gmail://u...@gmail.com[?options] gmail://u...@googlemail.com[?options] Options Name Default Value Context Description to null Producer To-receiver of the email. This can be a single receiver or a comma-separated list of receivers. cc null Producer Cc-receiver of the email. This can be a single receiver or a comma-separated list of receivers. bcc null Producer Bcc-receiver of the email. This can be a single receiver or a comma-separated list of receivers. subject null Producer Subject of the email. outboundBindingRef reference to GMailBinding Producer Reference to an OutboundBinding in the Registry for customizing the binding of an Exchange to the mail service. mailServiceRef reference to MailServiceFactory.getMailService() Producer Reference to a MailService in the Registry. Only relevant in context of testing. Message headers Name Type Context Description GMailBinding.GMAIL_SUBJECT String Producer Subject of the email. Overrides subject endpoint option. GMailBinding.GMAIL_SENDER String Producer Sender of the email. Overrides sender definition in endpoint URI. GMailBinding.GMAIL_TO String Producer To-receiver(s) of the email. Overrides to endpoint option. GMailBinding.GMAIL_CC String Producer Cc-receiver(s) of the email. Overrides cc endpoint option. GMailBinding.GMAIL_BCC String Producer Bcc-receiver(s) of the email. Overrides bcc endpoint option. Message body On the producer side the in message body is converted to a String. Usage ... .setHeader(GMailBinding.GMAIL_SUBJECT, constant("Hello")) .setHeader(GMailBinding.GMAIL_TO, constant("accou...@somewhere.com")) .to("gmail://accou...@gmail.com"); Sends an email with subject Hello from accou...@gmail.com to accou...@somewhere.com. The mail message body is taken from the in message body. Please note that accou...@gmail.com must be an administrator account for the current GAE application. Dependencies Maven users will need to add the following dependency to their pom.xml. pom.xml org.apache.camel camel-gae ${camel-version} where ${camel-version} must be replaced by the actual version of Camel (2.1.0 or higher). See Also Configuring Camel Component Endpoint Getting Started Change Notification Preferences View Online | View Change | Add Comment
svn commit: r900682 - in /camel/trunk/components/camel-gae: ./ src/main/java/org/apache/camel/component/gae/mail/ src/test/java/org/apache/camel/component/gae/mail/
Author: krasserm Date: Tue Jan 19 07:09:00 2010 New Revision: 900682 URL: http://svn.apache.org/viewvc?rev=900682&view=rev Log: extension to the gmail component to support cc, bcc, recipient lists and overriding the sender Modified: camel/trunk/components/camel-gae/pom.xml camel/trunk/components/camel-gae/src/main/java/org/apache/camel/component/gae/mail/GMailBinding.java camel/trunk/components/camel-gae/src/main/java/org/apache/camel/component/gae/mail/GMailEndpoint.java camel/trunk/components/camel-gae/src/test/java/org/apache/camel/component/gae/mail/GMailBindingTest.java camel/trunk/components/camel-gae/src/test/java/org/apache/camel/component/gae/mail/GMailEndpointTest.java Modified: camel/trunk/components/camel-gae/pom.xml URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-gae/pom.xml?rev=900682&r1=900681&r2=900682&view=diff == --- camel/trunk/components/camel-gae/pom.xml (original) +++ camel/trunk/components/camel-gae/pom.xml Tue Jan 19 07:09:00 2010 @@ -32,7 +32,7 @@ org.apache.camel.component.gae.* -1.2.8 +1.3.0 Modified: camel/trunk/components/camel-gae/src/main/java/org/apache/camel/component/gae/mail/GMailBinding.java URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-gae/src/main/java/org/apache/camel/component/gae/mail/GMailBinding.java?rev=900682&r1=900681&r2=900682&view=diff == --- camel/trunk/components/camel-gae/src/main/java/org/apache/camel/component/gae/mail/GMailBinding.java (original) +++ camel/trunk/components/camel-gae/src/main/java/org/apache/camel/component/gae/mail/GMailBinding.java Tue Jan 19 07:09:00 2010 @@ -27,16 +27,34 @@ public class GMailBinding implements OutboundBinding { /** + * Camel header for setting the mail message sender. + */ +public static final String GMAIL_SENDER = "org.apache.camel.component.gae.mail.Sender"; + +/** * Camel header for setting the mail message subject. */ public static final String GMAIL_SUBJECT = "org.apache.camel.component.gae.mail.Subject"; - + /** - * Camel header for setting the mail message recipient (list). + * Camel header for setting the mail message to-recipient (single recipient + * or comma-separated list). */ public static final String GMAIL_TO = "org.apache.camel.component.gae.mail.To"; /** + * Camel header for setting the mail message cc-recipient (single recipient + * or comma-separated list). + */ +public static final String GMAIL_CC = "org.apache.camel.component.gae.mail.Cc"; + +/** + * Camel header for setting the mail message bcc-recipient (single recipient + * or comma-separated list). + */ +public static final String GMAIL_BCC = "org.apache.camel.component.gae.mail.Bcc"; + +/** * Reads data from exchange and writes it to a newly created * {...@link Message} instance. The request parameter is * ignored. @@ -52,6 +70,8 @@ Message message = new Message(); writeFrom(endpoint, exchange, message); writeTo(endpoint, exchange, message); +writeCc(endpoint, exchange, message); +writeBcc(endpoint, exchange, message); writeSubject(endpoint, exchange, message); writeBody(endpoint, exchange, message); writeAttachments(endpoint, exchange, message); @@ -66,16 +86,39 @@ } protected void writeFrom(GMailEndpoint endpoint, Exchange exchange, Message request) { -request.setSender(endpoint.getSender()); +String sender = (String)exchange.getIn().getHeader(GMAIL_SENDER); +if (sender == null) { +sender = endpoint.getSender(); +} +request.setSender(sender); } protected void writeTo(GMailEndpoint endpoint, Exchange exchange, Message request) { -// TODO: support comma-separated list of receivers String to = (String)exchange.getIn().getHeader(GMAIL_TO); if (to == null) { to = endpoint.getTo(); } -request.setTo(to); +request.setTo(to.split(",")); +} + +protected void writeCc(GMailEndpoint endpoint, Exchange exchange, Message request) { +String cc = (String)exchange.getIn().getHeader(GMAIL_CC); +if (cc == null) { +cc = endpoint.getCc(); +} +if (cc != null) { +request.setCc(cc.split(",")); +} +} + +protected void writeBcc(GMailEndpoint endpoint, Exchange exchange, Message request) { +String bcc = (String)exchange.getIn().getHeader(GMAIL_BCC); +if (bcc == null) { +bcc = endpoint.getBcc(); +} +if (bcc != null) { +request.setBcc(bcc.split(",")); +} } protected void writeSubject(G
svn commit: r900669 - /camel/trunk/camel-core/src/test/java/org/apache/camel/impl/DefaultProducerTemplateAsyncTest.java
Author: davsclaus Date: Tue Jan 19 06:32:53 2010 New Revision: 900669 URL: http://svn.apache.org/viewvc?rev=900669&view=rev Log: CAMEL-2377: Fixed test to use AtomicInteger as shared state for testing correct order of execution path in concurrent test. Modified: camel/trunk/camel-core/src/test/java/org/apache/camel/impl/DefaultProducerTemplateAsyncTest.java Modified: camel/trunk/camel-core/src/test/java/org/apache/camel/impl/DefaultProducerTemplateAsyncTest.java URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/impl/DefaultProducerTemplateAsyncTest.java?rev=900669&r1=900668&r2=900669&view=diff == --- camel/trunk/camel-core/src/test/java/org/apache/camel/impl/DefaultProducerTemplateAsyncTest.java (original) +++ camel/trunk/camel-core/src/test/java/org/apache/camel/impl/DefaultProducerTemplateAsyncTest.java Tue Jan 19 06:32:53 2010 @@ -23,6 +23,7 @@ import java.util.concurrent.Executors; import java.util.concurrent.Future; import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicInteger; import org.apache.camel.ContextTestSupport; import org.apache.camel.Endpoint; @@ -41,7 +42,7 @@ */ public class DefaultProducerTemplateAsyncTest extends ContextTestSupport { -private static String order; +private static final AtomicInteger order = new AtomicInteger(0); public void testRequestAsync() throws Exception { Exchange exchange = new DefaultExchange(context); @@ -260,7 +261,7 @@ // produce it async so we use a helper Producer producer = endpoint.createProducer(); -// normally you will use a shared exectutor service with pools +// normally you will use a shared executor service with pools ExecutorService executor = Executors.newSingleThreadExecutor(); // send it async with the help of this helper Future future = AsyncProcessorHelper.asyncProcess(executor, producer, exchange); @@ -306,7 +307,7 @@ } public void testAsyncCallbackExchangeInOnly() throws Exception { -order = ""; +order.set(0); getMockEndpoint("mock:result").expectedBodiesReceived("Hello World"); @@ -318,22 +319,22 @@ template.asyncCallback("direct:start", exchange, new SynchronizationAdapter() { @Override public void onDone(Exchange exchange) { -order += "B"; +order.addAndGet(2); assertEquals("Hello World", exchange.getIn().getBody()); latch.countDown(); } }); -order += "A"; +order.addAndGet(1); latch.await(10, TimeUnit.SECONDS); -order += "C"; +order.addAndGet(4); assertMockEndpointsSatisfied(); -assertEquals("ABC", order); +assertEquals(7, order.get()); } public void testAsyncCallbackExchangeInOut() throws Exception { -order = ""; +order.set(0); final CountDownLatch latch = new CountDownLatch(1); @@ -344,21 +345,21 @@ template.asyncCallback("direct:echo", exchange, new SynchronizationAdapter() { @Override public void onDone(Exchange exchange) { -order += "B"; +order.addAndGet(2); assertEquals("HelloHello", exchange.getOut().getBody()); latch.countDown(); } }); -order += "A"; +order.addAndGet(1); latch.await(10, TimeUnit.SECONDS); -order += "C"; +order.addAndGet(4); -assertEquals("ABC", order); +assertEquals(7, order.get()); } public void testAsyncCallbackExchangeInOnlyGetResult() throws Exception { -order = ""; +order.set(0); getMockEndpoint("mock:result").expectedBodiesReceived("Hello World"); @@ -368,22 +369,22 @@ Future future = template.asyncCallback("direct:start", exchange, new SynchronizationAdapter() { @Override public void onDone(Exchange exchange) { -order += "B"; +order.addAndGet(2); assertEquals("Hello World", exchange.getIn().getBody()); } }); -order += "A"; +order.addAndGet(1); Exchange reply = future.get(10, TimeUnit.SECONDS); -order += "C"; +order.addAndGet(4); assertMockEndpointsSatisfied(); -assertEquals("ABC", order); +assertEquals(7, order.get()); assertNotNull(reply); } public void testAsyncCallbackExchangeInOutGetResult() throws Exception { -order = ""; +order.set(0); Exchange exchange = context.getEndpoint("direct:start").createExchange(); exchange.getIn().setBody("Hello"); @@ -392,22 +393,22 @@ Future future = template.asyncCallback("direct:echo", exc
svn commit: r900668 - in /camel/m2-repo/com/google/appengine: appengine-api-1.0-sdk/ appengine-api-1.0-sdk/1.3.0/ appengine-api-labs/ appengine-api-labs/1.3.0/
Author: krasserm Date: Tue Jan 19 06:31:14 2010 New Revision: 900668 URL: http://svn.apache.org/viewvc?rev=900668&view=rev Log: upload appengine sdk version 1.3.0 to camel maven repo Added: camel/m2-repo/com/google/appengine/appengine-api-1.0-sdk/1.3.0/ camel/m2-repo/com/google/appengine/appengine-api-1.0-sdk/1.3.0/appengine-api-1.0-sdk-1.3.0.jar (with props) camel/m2-repo/com/google/appengine/appengine-api-1.0-sdk/1.3.0/appengine-api-1.0-sdk-1.3.0.jar.md5 camel/m2-repo/com/google/appengine/appengine-api-1.0-sdk/1.3.0/appengine-api-1.0-sdk-1.3.0.jar.sha1 camel/m2-repo/com/google/appengine/appengine-api-1.0-sdk/1.3.0/appengine-api-1.0-sdk-1.3.0.pom camel/m2-repo/com/google/appengine/appengine-api-1.0-sdk/1.3.0/appengine-api-1.0-sdk-1.3.0.pom.md5 camel/m2-repo/com/google/appengine/appengine-api-1.0-sdk/1.3.0/appengine-api-1.0-sdk-1.3.0.pom.sha1 camel/m2-repo/com/google/appengine/appengine-api-labs/1.3.0/ camel/m2-repo/com/google/appengine/appengine-api-labs/1.3.0/appengine-api-labs-1.3.0.jar (with props) camel/m2-repo/com/google/appengine/appengine-api-labs/1.3.0/appengine-api-labs-1.3.0.jar.md5 camel/m2-repo/com/google/appengine/appengine-api-labs/1.3.0/appengine-api-labs-1.3.0.jar.sha1 camel/m2-repo/com/google/appengine/appengine-api-labs/1.3.0/appengine-api-labs-1.3.0.pom camel/m2-repo/com/google/appengine/appengine-api-labs/1.3.0/appengine-api-labs-1.3.0.pom.md5 camel/m2-repo/com/google/appengine/appengine-api-labs/1.3.0/appengine-api-labs-1.3.0.pom.sha1 Modified: camel/m2-repo/com/google/appengine/appengine-api-1.0-sdk/maven-metadata.xml camel/m2-repo/com/google/appengine/appengine-api-1.0-sdk/maven-metadata.xml.md5 camel/m2-repo/com/google/appengine/appengine-api-1.0-sdk/maven-metadata.xml.sha1 camel/m2-repo/com/google/appengine/appengine-api-labs/maven-metadata.xml camel/m2-repo/com/google/appengine/appengine-api-labs/maven-metadata.xml.md5 camel/m2-repo/com/google/appengine/appengine-api-labs/maven-metadata.xml.sha1 Added: camel/m2-repo/com/google/appengine/appengine-api-1.0-sdk/1.3.0/appengine-api-1.0-sdk-1.3.0.jar URL: http://svn.apache.org/viewvc/camel/m2-repo/com/google/appengine/appengine-api-1.0-sdk/1.3.0/appengine-api-1.0-sdk-1.3.0.jar?rev=900668&view=auto == Binary file - no diff available. Propchange: camel/m2-repo/com/google/appengine/appengine-api-1.0-sdk/1.3.0/appengine-api-1.0-sdk-1.3.0.jar -- svn:mime-type = application/octet-stream Added: camel/m2-repo/com/google/appengine/appengine-api-1.0-sdk/1.3.0/appengine-api-1.0-sdk-1.3.0.jar.md5 URL: http://svn.apache.org/viewvc/camel/m2-repo/com/google/appengine/appengine-api-1.0-sdk/1.3.0/appengine-api-1.0-sdk-1.3.0.jar.md5?rev=900668&view=auto == --- camel/m2-repo/com/google/appengine/appengine-api-1.0-sdk/1.3.0/appengine-api-1.0-sdk-1.3.0.jar.md5 (added) +++ camel/m2-repo/com/google/appengine/appengine-api-1.0-sdk/1.3.0/appengine-api-1.0-sdk-1.3.0.jar.md5 Tue Jan 19 06:31:14 2010 @@ -0,0 +1 @@ +7d97ec8cd71259e0fd5d1248b19b9df7 \ No newline at end of file Added: camel/m2-repo/com/google/appengine/appengine-api-1.0-sdk/1.3.0/appengine-api-1.0-sdk-1.3.0.jar.sha1 URL: http://svn.apache.org/viewvc/camel/m2-repo/com/google/appengine/appengine-api-1.0-sdk/1.3.0/appengine-api-1.0-sdk-1.3.0.jar.sha1?rev=900668&view=auto == --- camel/m2-repo/com/google/appengine/appengine-api-1.0-sdk/1.3.0/appengine-api-1.0-sdk-1.3.0.jar.sha1 (added) +++ camel/m2-repo/com/google/appengine/appengine-api-1.0-sdk/1.3.0/appengine-api-1.0-sdk-1.3.0.jar.sha1 Tue Jan 19 06:31:14 2010 @@ -0,0 +1 @@ +16e3b7e3993ac47d8e4f02a7723b1e5188be0053 \ No newline at end of file Added: camel/m2-repo/com/google/appengine/appengine-api-1.0-sdk/1.3.0/appengine-api-1.0-sdk-1.3.0.pom URL: http://svn.apache.org/viewvc/camel/m2-repo/com/google/appengine/appengine-api-1.0-sdk/1.3.0/appengine-api-1.0-sdk-1.3.0.pom?rev=900668&view=auto == --- camel/m2-repo/com/google/appengine/appengine-api-1.0-sdk/1.3.0/appengine-api-1.0-sdk-1.3.0.pom (added) +++ camel/m2-repo/com/google/appengine/appengine-api-1.0-sdk/1.3.0/appengine-api-1.0-sdk-1.3.0.pom Tue Jan 19 06:31:14 2010 @@ -0,0 +1,6 @@ + + 4.0.0 + com.google.appengine + appengine-api-1.0-sdk + 1.3.0 + \ No newline at end of file Added: camel/m2-repo/com/google/appengine/appengine-api-1.0-sdk/1.3.0/appengine-api-1.0-sdk-1.3.0.pom.md5 URL: http://svn.apache.org/viewvc/camel/m2-repo/com/google/appengine/appengine-api-1.0-sdk/1.3.0/appengine-api-1.0-sdk-1.3.0.pom.md5?rev=900668&view=auto ===
svn commit: r900666 - /camel/trunk/components/camel-web/pom.xml
Author: davsclaus Date: Tue Jan 19 06:18:00 2010 New Revision: 900666 URL: http://svn.apache.org/viewvc?rev=900666&view=rev Log: Avoiding SNAPSHOT deps in camel-web. Waiting for new jersey release. Modified: camel/trunk/components/camel-web/pom.xml Modified: camel/trunk/components/camel-web/pom.xml URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-web/pom.xml?rev=900666&r1=900665&r2=900666&view=diff == --- camel/trunk/components/camel-web/pom.xml (original) +++ camel/trunk/components/camel-web/pom.xml Tue Jan 19 06:18:00 2010 @@ -31,7 +31,7 @@ org.apache.camel.web.* - 1.1.5-ea-SNAPSHOT + 1.1.5-ea-20100104 8080 685 @@ -293,12 +293,12 @@ com.sun.jersey.contribs maven-wadl-plugin - ${jersey-version} + 1.1.4.1 com.sun.jersey.contribs wadl-resourcedoc-doclet - ${jersey-version} + 1.1.4.1
svn commit: r900663 - in /camel/trunk/camel-core/src/test/java/org/apache/camel/issues: RetryRouteScopedUntilRecipientListIssueTest.java RetryRouteScopedUntilRecipientListParallelIssueTest.java
Author: davsclaus Date: Tue Jan 19 06:04:39 2010 New Revision: 900663 URL: http://svn.apache.org/viewvc?rev=900663&view=rev Log: CAMEL-2376: Fixed brolen unit test on some boxes. Modified: camel/trunk/camel-core/src/test/java/org/apache/camel/issues/RetryRouteScopedUntilRecipientListIssueTest.java camel/trunk/camel-core/src/test/java/org/apache/camel/issues/RetryRouteScopedUntilRecipientListParallelIssueTest.java Modified: camel/trunk/camel-core/src/test/java/org/apache/camel/issues/RetryRouteScopedUntilRecipientListIssueTest.java URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/issues/RetryRouteScopedUntilRecipientListIssueTest.java?rev=900663&r1=900662&r2=900663&view=diff == --- camel/trunk/camel-core/src/test/java/org/apache/camel/issues/RetryRouteScopedUntilRecipientListIssueTest.java (original) +++ camel/trunk/camel-core/src/test/java/org/apache/camel/issues/RetryRouteScopedUntilRecipientListIssueTest.java Tue Jan 19 06:04:39 2010 @@ -35,7 +35,7 @@ */ public class RetryRouteScopedUntilRecipientListIssueTest extends ContextTestSupport { -protected static int invoked; +protected static volatile int invoked; @Override protected JndiRegistry createRegistry() throws Exception { @@ -131,7 +131,7 @@ invoked = 0; getMockEndpoint("mock:result").expectedMessageCount(0); -getMockEndpoint("mock:foo").expectedMessageCount(1); +getMockEndpoint("mock:foo").expectedMinimumMessageCount(0); template.sendBodyAndHeader("seda:start", "Hello World", "recipientListHeader", "fail,direct:foo"); @@ -146,7 +146,7 @@ invoked = 0; getMockEndpoint("mock:result").expectedMessageCount(0); -getMockEndpoint("mock:foo").expectedMessageCount(1); +getMockEndpoint("mock:foo").expectedMinimumMessageCount(0); template.sendBodyAndHeader("seda:start", "Hello World", "recipientListHeader", "direct:foo,fail"); @@ -176,7 +176,7 @@ invoked = 0; getMockEndpoint("mock:result").expectedMessageCount(0); -getMockEndpoint("mock:foo").expectedMessageCount(0); +getMockEndpoint("mock:foo").expectedMinimumMessageCount(0); template.sendBodyAndHeader("seda:start", "Hello World", "recipientListHeader", "fail,not-fail"); @@ -191,7 +191,7 @@ invoked = 0; getMockEndpoint("mock:result").expectedMessageCount(0); -getMockEndpoint("mock:foo").expectedMessageCount(0); +getMockEndpoint("mock:foo").expectedMinimumMessageCount(0); template.sendBodyAndHeader("seda:start", "Hello World", "recipientListHeader", "not-fail,fail"); Modified: camel/trunk/camel-core/src/test/java/org/apache/camel/issues/RetryRouteScopedUntilRecipientListParallelIssueTest.java URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/issues/RetryRouteScopedUntilRecipientListParallelIssueTest.java?rev=900663&r1=900662&r2=900663&view=diff == --- camel/trunk/camel-core/src/test/java/org/apache/camel/issues/RetryRouteScopedUntilRecipientListParallelIssueTest.java (original) +++ camel/trunk/camel-core/src/test/java/org/apache/camel/issues/RetryRouteScopedUntilRecipientListParallelIssueTest.java Tue Jan 19 06:04:39 2010 @@ -23,21 +23,6 @@ */ public class RetryRouteScopedUntilRecipientListParallelIssueTest extends RetryRouteScopedUntilRecipientListIssueTest { -public void testRetryUntilRecipientListOkAndFail() throws Exception { -invoked = 0; - -getMockEndpoint("mock:result").expectedMessageCount(0); -getMockEndpoint("mock:foo").expectedMessageCount(1); - -template.sendBodyAndHeader("seda:start", "Hello World", "recipientListHeader", "direct:foo,fail"); - -assertMockEndpointsSatisfied(); - -context.stop(); - -assertEquals(3, invoked); -} - @Override protected RouteBuilder createRouteBuilder() throws Exception { return new RouteBuilder() {
[CONF] Apache Camel > JAXB
JAXB Page edited by willem jiang CAMEL-2330 CAMEL-2330 JAXB JAXB is a Data Format which uses the JAXB2 XML marshalling standard which is included in Java 6 to unmarshal an XML payload into Java objects or to marshal Java objects into an XML payload. Using the Java DSL For example the following uses a named DataFormat of jaxb which is configured with a number of Java package names to initialize the JAXBContext. DataFormat jaxb = new JaxbDataFormat("com.acme.model"); from("activemq:My.Queue"). unmarshal(jaxb). to("mqseries:Another.Queue"); You can if you prefer use a named reference to a data format which can then be defined in your Registry such as via your Spring XML file. e.g. from("activemq:My.Queue"). unmarshal("myJaxbDataType"). to("mqseries:Another.Queue"); Using Spring XML The following example shows how to use JAXB to unmarshal using Spring configuring the jaxb data type "camel" xmlns="http://camel.apache.org/schema/spring"> "direct:start"/> "true" contextPath="org.apache.camel.example"/> "mock:result"/> This example shows how to configure the data type just once and reuse it on multiple routes. For Camel versions below 1.5.0 you have to set the element directly in . "camel" xmlns="http://camel.apache.org/schema/spring"> "myJaxb" prettyPrint="true" contextPath="org.apache.camel.example"/> "direct:start"/> "myJaxb"/> "direct:marshalled"/> "direct:marshalled"/> "myJaxb"/> "mock:result"/> Ignoring the NonXML Character This feature is new to Camel 2.2.0. JaxbDataFromat supports to ignore the NonXML Character, you just need to set the filterNonXmlChars property to be true, JaxbDataFromat will replace the NonXML character with " " when it is marshaling or unmarshaling the message. You can also do it by setting the Exchange property Exchange.FILTER_NON_XML_CHARS. JDK 1.5 JDK 1.6+ Filtering in use StAX API and implementation No Filtering not in use StAX API only No This feature has been tested with Woodstox 3.2.9 and Sun JDK 1.6 StAX implementation. Working with the ObjectFactory If you use XJC to create the java class from the schema, you will get an ObjectFactory for you JAXB context. Since the ObjectFactory uses JAXBElement to hold the reference of the schema and element instance value, from Camel 1.5.1 jaxbDataformat will ignore the JAXBElement by default and you will get the element instance value instead of the JAXBElement object form the unmarshaled message body. If you want to get the JAXBElement object form the unmarshaled message body, you need to set the JaxbDataFormat object's ignoreJAXBElement property to be false. Setting encoding In Camel 1.6.1 and newer you can set the encoding option to use when marshalling. Its the Marshaller.JAXB_ENCODING encoding property on the JAXB Marshaller. You can setup which encoding to use when you declare the JAXB data format. You can also provide the encoding in the Exchange property Exchange.CHARSET_NAME. This property will overrule the encoding set on the JAXB data format. In this Spring DSL we have defined to use iso-8859-1 as the encoding: "camel" xmlns="http://camel.apache.org/schema/spring"> "direct:start"/> "false" encoding="iso-8859-1" contextPath="org.apache.camel.example"/> "mock:result"/> Dependencies To use JAXB in your camel routes you need to add the a dependency on camel-jaxb which implements this data format. If you use maven you could just add the following to your pom.xml, substituting the version number for the latest & greatest release (see the download page for the latest versions). org.apache.camel camel-jaxb 1.6.0 Change Notification Preferences View Online | View Change | Add Comment
svn commit: r900649 - in /camel/trunk: components/camel-jaxb/ components/camel-jaxb/src/main/java/org/apache/camel/converter/jaxb/ components/camel-jaxb/src/test/java/org/apache/camel/converter/jaxb/
Author: ningjiang Date: Tue Jan 19 02:22:32 2010 New Revision: 900649 URL: http://svn.apache.org/viewvc?rev=900649&view=rev Log: CAMEL-2330 applied patch with thanks to Pavel Modified: camel/trunk/components/camel-jaxb/pom.xml camel/trunk/components/camel-jaxb/src/main/java/org/apache/camel/converter/jaxb/JaxbDataFormat.java camel/trunk/components/camel-jaxb/src/test/java/org/apache/camel/converter/jaxb/FilteringXmlStreamWriterTest.java camel/trunk/components/camel-jaxb/src/test/java/org/apache/camel/converter/jaxb/JaxbDataFormatTest.java camel/trunk/components/camel-jaxb/src/test/java/org/apache/camel/converter/jaxb/NonXmlCharFiltererTest.java camel/trunk/components/camel-jaxb/src/test/java/org/apache/camel/converter/jaxb/NonXmlFilterReaderTest.java camel/trunk/parent/pom.xml Modified: camel/trunk/components/camel-jaxb/pom.xml URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-jaxb/pom.xml?rev=900649&r1=900648&r2=900649&view=diff == --- camel/trunk/components/camel-jaxb/pom.xml (original) +++ camel/trunk/components/camel-jaxb/pom.xml Tue Jan 19 02:22:32 2010 @@ -100,8 +100,8 @@ test -org.easymock -easymockclassextension +org.mockito +mockito-core test Modified: camel/trunk/components/camel-jaxb/src/main/java/org/apache/camel/converter/jaxb/JaxbDataFormat.java URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-jaxb/src/main/java/org/apache/camel/converter/jaxb/JaxbDataFormat.java?rev=900649&r1=900648&r2=900649&view=diff == --- camel/trunk/components/camel-jaxb/src/main/java/org/apache/camel/converter/jaxb/JaxbDataFormat.java (original) +++ camel/trunk/components/camel-jaxb/src/main/java/org/apache/camel/converter/jaxb/JaxbDataFormat.java Tue Jan 19 02:22:32 2010 @@ -96,7 +96,7 @@ } } -public Object unmarshal(Exchange exchange, InputStream stream) throws IOException, ClassNotFoundException { +public Object unmarshal(Exchange exchange, InputStream stream) throws IOException { try { // must create a new instance of unmarshaller as its not thread safe Object answer; Modified: camel/trunk/components/camel-jaxb/src/test/java/org/apache/camel/converter/jaxb/FilteringXmlStreamWriterTest.java URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-jaxb/src/test/java/org/apache/camel/converter/jaxb/FilteringXmlStreamWriterTest.java?rev=900649&r1=900648&r2=900649&view=diff == --- camel/trunk/components/camel-jaxb/src/test/java/org/apache/camel/converter/jaxb/FilteringXmlStreamWriterTest.java (original) +++ camel/trunk/components/camel-jaxb/src/test/java/org/apache/camel/converter/jaxb/FilteringXmlStreamWriterTest.java Tue Jan 19 02:22:32 2010 @@ -19,98 +19,77 @@ import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamWriter; -import org.easymock.classextension.EasyMockSupport; import org.junit.Before; import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.Mock; +import org.mockito.runners.MockitoJUnitRunner; + +import static org.mockito.Matchers.eq; +import static org.mockito.Matchers.same; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; -import static org.easymock.EasyMock.eq; -import static org.easymock.EasyMock.expect; -import static org.easymock.EasyMock.same; - -public class FilteringXmlStreamWriterTest extends EasyMockSupport { +...@runwith(MockitoJUnitRunner.class) +public class FilteringXmlStreamWriterTest { private FilteringXmlStreamWriter filteringXmlStreamWriter; +@Mock private NonXmlCharFilterer nonXmlCharFiltererMock; +@Mock private XMLStreamWriter xmlStreamWriterMock; // only testing non-generated methods, those that do apply filtering @Before public void setUp() { -xmlStreamWriterMock = createStrictMock(XMLStreamWriter.class); -nonXmlCharFiltererMock = createStrictMock(NonXmlCharFilterer.class); filteringXmlStreamWriter = new FilteringXmlStreamWriter(xmlStreamWriterMock); filteringXmlStreamWriter.nonXmlCharFilterer = nonXmlCharFiltererMock; + + when(nonXmlCharFiltererMock.filter("value")).thenReturn("filteredValue"); } @Test public void testWriteAttribute2Args() throws XMLStreamException { - expect(nonXmlCharFiltererMock.filter("value")).andReturn("filteredValue"); -xmlStreamWriterMock.writeAttribute("localName", "filteredValue"); -replayAll(); - filteringXmlStreamWriter.writeAttribute("localName", "value"); -verifyAll(); +verify(xmlStreamWriterMock).writeAttribute("localName", "f
[CONF] Apache Camel > Building
Building Page edited by Jonathan Anstey Building Camel uses Maven as its build tool. If you don't fancy using Maven you can use your IDE directly or Download a distribution or JAR. Prequisites Required: Download and install Maven. (Currently Maven 2.0.9 is used to build the official releases, some components will not build with 2.1+) Get the latest Source Java 1.5 Optional: Prince should be in the executable PATH to generate the PDF documentation Maven options To build camel maven has to be configured to use more memory set MAVEN_OPTS=-Xmx512m -XX:MaxPermSize=128m A normal build mvn install Doing a Quick Build The following avoids running all the unit test cases, we just skip the test running phase and not the building part mvn -DskipTests clean install Using an IDE If you prefer to use an IDE then you can auto-generate the IDE's project files using maven plugins. e.g. mvn eclipse:eclipse or mvn idea:idea Adding Camel Eclipse templates to your workspace mvn -Psetup.eclipse -Declipse.workspace.dir=/path/to/your/workspace You can also find some helpful notes on usage here. Importing into Eclipse If you have not already done so, you will need to make Eclipse aware of the Maven repository so that it can build everything. In the preferences, go to Java->Build Path->Classpath and define a new Classpath Variable named M2_REPO that points to your local Maven repository (i.e., ~/.m2/repository on Unix and c:\Documents and Settings\\.m2\repository on Windows). You can also get Maven to do this for you: mvn eclipse:add-maven-repo -Declipse.workspace=/path/to/the/workspace/ Building with checkstyle To enable source style checking with checkstyle, build Camel with the -Psourcecheck parameter mvn -Psourcecheck clean install Building source jars If you want to build jar files with the source code, that for instance Eclipse can important so you can debug the Camel code as well. Then you can run this command from the camel root folder: mvn clean source:jar install -Dtest=false See Also Running Unit Tests Source Examples Change Notification Preferences View Online | View Change | Add Comment
svn commit: r900401 - in /camel/trunk/components/camel-web: pom.xml src/main/java/org/apache/camel/web/util/CamelOSGIResourceConfig.java src/main/java/org/apache/camel/web/util/JAXBContextResolverOSGI
Author: cmoulliard Date: Mon Jan 18 14:12:35 2010 New Revision: 900401 URL: http://svn.apache.org/viewvc?rev=900401&view=rev Log: Solve issue related to JSON (Json providers were not imported) Added: camel/trunk/components/camel-web/src/main/java/org/apache/camel/web/util/JAXBContextResolverOSGI.java (with props) Modified: camel/trunk/components/camel-web/pom.xml camel/trunk/components/camel-web/src/main/java/org/apache/camel/web/util/CamelOSGIResourceConfig.java Modified: camel/trunk/components/camel-web/pom.xml URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-web/pom.xml?rev=900401&r1=900400&r2=900401&view=diff == --- camel/trunk/components/camel-web/pom.xml (original) +++ camel/trunk/components/camel-web/pom.xml Mon Jan 18 14:12:35 2010 @@ -587,7 +587,7 @@ com.sun.jersey.spi.container;resolution:=optional, com.sun.jersey.spi.inject;resolution:=optional, com.sun.jersey.spi.resource;resolution:=optional, - com.sun.jersey.spi.spring.container.servlet;resolution:=optional + com.sun.jersey.spi.spring.container.servlet;resolution:=optional, com.sun.org.apache.xerces.internal.jaxp;resolution:=optional, com.sun.research.ws.wadl;resolution:=optional, com.sun.xml.bind.v2.ContextFactory;resolution:=optional, @@ -651,6 +651,7 @@ WEB-INF/lib/jersey-core-1.1.5-ea-SNAPSHOT.jar, WEB-INF/lib/jersey-server-1.1.5-ea-SNAPSHOT.jar, WEB-INF/lib/jersey-spring-1.1.5-ea-SNAPSHOT.jar, + WEB-INF/lib/jersey-json-1.1.5-ea-SNAPSHOT.jar, WEB-INF/tags/api @@ -740,6 +741,52 @@ com.sun.jersey + jersey-core + ${jersey-version} + + + org.apache.servicemix.specs + org.apache.servicemix.specs.activation-api-1.1 + + + org.apache.servicemix.specs + org.apache.servicemix.specs.jaxb-api-2.1 + + + org.apache.servicemix.specs + org.apache.servicemix.specs.stax-api-1.0 + + + org.apache.servicemix.bundles + org.apache.servicemix.bundles.jaxb-impl + + + + + com.sun.jersey + jersey-server + ${jersey-version} + + + org.apache.servicemix.specs + org.apache.servicemix.specs.activation-api-1.1 + + + org.apache.servicemix.specs + org.apache.servicemix.specs.jaxb-api-2.1 + + + org.apache.servicemix.specs + org.apache.servicemix.specs.stax-api-1.0 + + + or
svn commit: r900344 - in /camel/trunk/components/camel-web: pom.xml src/main/java/org/apache/camel/web/util/CamelOSGIResourceConfig.java src/profiles/osgi/webapp/WEB-INF/web.xml
Author: cmoulliard Date: Mon Jan 18 11:18:14 2010 New Revision: 900344 URL: http://svn.apache.org/viewvc?rev=900344&view=rev Log: Solve issue about rendering of jersey REST request for JAXB Added: camel/trunk/components/camel-web/src/main/java/org/apache/camel/web/util/CamelOSGIResourceConfig.java (with props) Modified: camel/trunk/components/camel-web/pom.xml camel/trunk/components/camel-web/src/profiles/osgi/webapp/WEB-INF/web.xml Modified: camel/trunk/components/camel-web/pom.xml URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-web/pom.xml?rev=900344&r1=900343&r2=900344&view=diff == --- camel/trunk/components/camel-web/pom.xml (original) +++ camel/trunk/components/camel-web/pom.xml Mon Jan 18 11:18:14 2010 @@ -622,7 +622,7 @@ org.apache.camel.spring;version="[2.1, 2.5)", org.apache.camel.osgi;version="[2.1, 2.5)", org.apache.camel.util;version="[2.1, 2.5)", - org.apache.camel.web.resources;version="[2.1, 2.5)", + org.apache.camel.web.resources;resolution:=optional, org.apache.commons.logging;resolution:=optional, org.osgi.service.http;version="[1.0.0,2.0.0)", org.ops4j.pax.web.service;resolution:=optional, Added: camel/trunk/components/camel-web/src/main/java/org/apache/camel/web/util/CamelOSGIResourceConfig.java URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-web/src/main/java/org/apache/camel/web/util/CamelOSGIResourceConfig.java?rev=900344&view=auto == --- camel/trunk/components/camel-web/src/main/java/org/apache/camel/web/util/CamelOSGIResourceConfig.java (added) +++ camel/trunk/components/camel-web/src/main/java/org/apache/camel/web/util/CamelOSGIResourceConfig.java Mon Jan 18 11:18:14 2010 @@ -0,0 +1,84 @@ +/** + * 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.web.util; + +import java.util.HashMap; +import java.util.Map; +import javax.ws.rs.core.MediaType; + +import com.sun.jersey.api.core.ClassNamesResourceConfig; +import com.sun.jersey.api.core.PackagesResourceConfig; +import org.apache.camel.web.resources.CamelContextResource; +import org.apache.camel.web.resources.ComponentResource; +import org.apache.camel.web.resources.ComponentsResource; +import org.apache.camel.web.resources.Constants; +import org.apache.camel.web.resources.ConvertersFromResource; +import org.apache.camel.web.resources.ConvertersResource; +import org.apache.camel.web.resources.EndpointResource; +import org.apache.camel.web.resources.EndpointsResource; +import org.apache.camel.web.resources.ExchangeResource; +import org.apache.camel.web.resources.LanguageResource; +import org.apache.camel.web.resources.LanguagesResource; +import org.apache.camel.web.resources.RouteResource; +import org.apache.camel.web.resources.RouteStatusResource; +import org.apache.camel.web.resources.RoutesResource; + +/** + * @version $Revision: 899610 $ + */ +public class CamelOSGIResourceConfig extends ClassNamesResourceConfig { + +public CamelOSGIResourceConfig() { +super(createProperties()); +} + +protected static Map createProperties() { +Map properties = new HashMap(); + +String[] resources = new String[] { + CamelContextResource.class.getName(), + ComponentResource.class.getName(), + ComponentsResource.class.getName(), + ConvertersFromResource.class.getName(), + ConvertersResource.class.getName(), + EndpointResource.class.getName(), + EndpointsResource.class.getName(), + ExchangeResource.class.getName(), + LanguageResource.class.getName(), + LanguagesResource.class.getName(), + RouteResource.class.getName(), + RoutesResource.class.getName(), + RouteStatusResource.clas
svn commit: r900309 - in /camel/trunk: camel-core/src/main/java/org/apache/camel/impl/ camel-core/src/main/java/org/apache/camel/util/ camel-core/src/test/java/org/apache/camel/issues/ components/came
Author: davsclaus Date: Mon Jan 18 08:58:07 2010 New Revision: 900309 URL: http://svn.apache.org/viewvc?rev=900309&view=rev Log: Fixed test on windows box. Endpoint uri is normalized for endpoint matching. Fixed spelling. Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java camel/trunk/camel-core/src/main/java/org/apache/camel/util/EndpointHelper.java camel/trunk/camel-core/src/test/java/org/apache/camel/issues/SplitPropertiesFileIssueTest.java camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/CamelContextFactoryBean.java Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java?rev=900309&r1=900308&r2=900309&view=diff == --- camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java (original) +++ camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java Mon Jan 18 08:58:07 2010 @@ -933,7 +933,7 @@ DefaultRouteStartupOrder other = inputs.get(startupOrder); if (other != null) { String otherId = other.getRoute().getId(); -throw new FailedToStartRouteException(holder.getRoute().getId(), "starupOrder clash. Route " + otherId + " already has startupOrder " +throw new FailedToStartRouteException(holder.getRoute().getId(), "startupOrder clash. Route " + otherId + " already has startupOrder " + startupOrder + " configured which this route have as well. Please correct startupOrder to be unique among all your routes."); } else { // no clash then add the holder to the existing inputs of routes to be started Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/util/EndpointHelper.java URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/util/EndpointHelper.java?rev=900309&r1=900308&r2=900309&view=diff == --- camel/trunk/camel-core/src/main/java/org/apache/camel/util/EndpointHelper.java (original) +++ camel/trunk/camel-core/src/main/java/org/apache/camel/util/EndpointHelper.java Mon Jan 18 08:58:07 2010 @@ -29,6 +29,7 @@ import org.apache.camel.Exchange; import org.apache.camel.PollingConsumer; import org.apache.camel.Processor; +import org.apache.camel.ResolveEndpointFailedException; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -98,6 +99,13 @@ * @return true if match, false otherwise. */ public static boolean matchEndpoint(String uri, String pattern) { +// normalize uri so we can do endpoint hits with minor mistakes and parameters is not in the same order +try { +uri = URISupport.normalizeUri(uri); +} catch (Exception e) { +throw new ResolveEndpointFailedException(uri, e); +} + // we need to test with and without scheme separators (//) if (uri.indexOf("://") != -1) { // try without :// also @@ -122,7 +130,7 @@ private static boolean doMatchEndpoint(String uri, String pattern) { if (uri.equals(pattern)) { -// excact match +// exact match return true; } Modified: camel/trunk/camel-core/src/test/java/org/apache/camel/issues/SplitPropertiesFileIssueTest.java URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/issues/SplitPropertiesFileIssueTest.java?rev=900309&r1=900308&r2=900309&view=diff == --- camel/trunk/camel-core/src/test/java/org/apache/camel/issues/SplitPropertiesFileIssueTest.java (original) +++ camel/trunk/camel-core/src/test/java/org/apache/camel/issues/SplitPropertiesFileIssueTest.java Mon Jan 18 08:58:07 2010 @@ -60,6 +60,7 @@ @Override public void configure() throws Exception { from("file://target/file/splitprop?move=done") +.convertBodyTo(String.class) .split(new MyCustomExpression()) .recipientList(header("myCustomDestination")); } Modified: camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/CamelContextFactoryBean.java URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/CamelContextFactoryBean.java?rev=900309&r1=900308&r2=900309&view=diff == --- camel/trunk/components/camel-spring/
svn commit: r900301 - /camel/trunk/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fix/
Author: davsclaus Date: Mon Jan 18 08:30:23 2010 New Revision: 900301 URL: http://svn.apache.org/viewvc?rev=900301&view=rev Log: CAMEL-2373: Fixed camel-bindy tests Modified: camel/trunk/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fix/BindyComplexOneToManyKeyValuePairUnMarshallTest.java camel/trunk/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fix/BindySimpleKeyValuePairSortedUnmarshallTest.java camel/trunk/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fix/BindySimpleKeyValuePairTabUnmarshallTest.java camel/trunk/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fix/BindySimpleKeyValuePairUnmarshallDslTest.java camel/trunk/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fix/BindySimpleKeyValuePairUnmarshallTest.java Modified: camel/trunk/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fix/BindyComplexOneToManyKeyValuePairUnMarshallTest.java URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fix/BindyComplexOneToManyKeyValuePairUnMarshallTest.java?rev=900301&r1=900300&r2=900301&view=diff == --- camel/trunk/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fix/BindyComplexOneToManyKeyValuePairUnMarshallTest.java (original) +++ camel/trunk/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fix/BindyComplexOneToManyKeyValuePairUnMarshallTest.java Mon Jan 18 08:30:23 2010 @@ -16,19 +16,10 @@ */ package org.apache.camel.dataformat.bindy.fix; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; - import org.apache.camel.builder.RouteBuilder; import org.apache.camel.dataformat.bindy.CommonBindyTest; import org.apache.camel.dataformat.bindy.kvp.BindyKeyValuePairDataFormat; -import org.apache.camel.dataformat.bindy.model.fix.complex.onetomany.Header; -import org.apache.camel.dataformat.bindy.model.fix.complex.onetomany.Order; -import org.apache.camel.dataformat.bindy.model.fix.complex.onetomany.Security; -import org.apache.camel.dataformat.bindy.model.fix.complex.onetomany.Trailer; +import org.junit.Assert; import org.junit.Test; import org.springframework.test.annotation.DirtiesContext; import org.springframework.test.context.ContextConfiguration; @@ -43,69 +34,18 @@ String message = "8=FIX 4.19=2034=135=049=INVMGR56=BRKR" + "1=BE.CHM.00111=CHM0001-0158=this is a camel - bindy test" + "22=448=BE000124567854=1" + "22=548=BE000987654354=2" + "22=648=BE00099954=3" + "10=220"; -result.expectedBodiesReceived(generateModel().toString()); +result.expectedMessageCount(1); template.sendBody(message); result.assertIsSatisfied(); -} - -public List> generateModel() { - -List> models = new ArrayList>(); -// must use linked to preserve order -Map model = new LinkedHashMap(); -List securities = new ArrayList(); - -Header header = new Header(); -header.setBeginString("FIX 4.1"); -header.setBodyLength(20); -header.setMsgSeqNum(1); -header.setMsgType("0"); -header.setSendCompId("INVMGR"); -header.setTargetCompId("BRKR"); - -Trailer trailer = new Trailer(); -trailer.setCheckSum(220); - -Order order = new Order(); -order.setAccount("BE.CHM.001"); -order.setClOrdId("CHM0001-01"); -order.setText("this is a camel - bindy test"); - -// 1st security -Security security = new Security(); -security.setIdSource("4"); -security.setSecurityCode("BE0001245678"); -security.setSide("1"); - -securities.add(security); - -// 2nd security -security = new Security(); -security.setIdSource("5"); -security.setSecurityCode("BE0009876543"); -security.setSide("2"); - -securities.add(security); - -// 3rd security -security = new Security(); -security.setIdSource("6"); -security.setSecurityCode("BE000999"); -security.setSide("3"); - -securities.add(security); - -order.setSecurities(securities); -order.setHeader(header); -order.setTrailer(trailer); - -model.put(order.getClass().getName(), order); -model.put(header.getClass().getName(), header); -model.put(trailer.getClass().getName(), trailer); -models.add(model); -return models; +String body = result.getReceivedExchanges().get(0).getIn().getBody(String.class); +Assert.assertTrue(body.contains("BE.CHM.001, 11: CHM0001-01, 58: this is a camel - bindy test")); +Assert.assertTrue(body.contains("
svn commit: r900295 - in /camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote: FtpShutdownCompleteAllTasksTest.java FtpShutdownCompleteCurrentTaskOnlyTest.java
Author: davsclaus Date: Mon Jan 18 08:11:53 2010 New Revision: 900295 URL: http://svn.apache.org/viewvc?rev=900295&view=rev Log: Fixed ftp test on slow boxes Modified: camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpShutdownCompleteAllTasksTest.java camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpShutdownCompleteCurrentTaskOnlyTest.java Modified: camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpShutdownCompleteAllTasksTest.java URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpShutdownCompleteAllTasksTest.java?rev=900295&r1=900294&r2=900295&view=diff == --- camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpShutdownCompleteAllTasksTest.java (original) +++ camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpShutdownCompleteAllTasksTest.java Mon Jan 18 08:11:53 2010 @@ -29,7 +29,7 @@ public class FtpShutdownCompleteAllTasksTest extends FtpServerTestSupport { private String getFtpUrl() { -return "ftp://ad...@localhost:"; + getPort() + "/pending?password=admin"; +return "ftp://ad...@localhost:"; + getPort() + "/pending?password=admin&initialDelay=5000"; } @Override @@ -56,7 +56,6 @@ MockEndpoint bar = getMockEndpoint("mock:bar"); bar.expectedMinimumMessageCount(1); -bar.setResultWaitTime(3000); assertMockEndpointsSatisfied(); Modified: camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpShutdownCompleteCurrentTaskOnlyTest.java URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpShutdownCompleteCurrentTaskOnlyTest.java?rev=900295&r1=900294&r2=900295&view=diff == --- camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpShutdownCompleteCurrentTaskOnlyTest.java (original) +++ camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpShutdownCompleteCurrentTaskOnlyTest.java Mon Jan 18 08:11:53 2010 @@ -29,7 +29,7 @@ public class FtpShutdownCompleteCurrentTaskOnlyTest extends FtpServerTestSupport { private String getFtpUrl() { -return "ftp://ad...@localhost:"; + getPort() + "/pending?password=admin"; +return "ftp://ad...@localhost:"; + getPort() + "/pending?password=admin&initialDelay=5000"; } @Override @@ -56,7 +56,6 @@ MockEndpoint bar = getMockEndpoint("mock:bar"); bar.expectedMinimumMessageCount(1); -bar.setResultWaitTime(3000); assertMockEndpointsSatisfied();