camel-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Glen Mazza <glen.ma...@verizon.net>
Subject Re: svn commit: r649451 - /activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/issues/DavidSiefertTest.java
Date Fri, 18 Apr 2008 11:34:01 GMT
Instead of naming classes after people, which raises some privacy
concerns, perhaps email date or topic, or JIRA number (which is the way
CXF frequently does it) would be better.

Glen

Am Freitag, den 18.04.2008, 10:18 +0000 schrieb jstrachan@apache.org:
> Author: jstrachan
> Date: Fri Apr 18 03:18:19 2008
> New Revision: 649451
> 
> URL: http://svn.apache.org/viewvc?rev=649451&view=rev
> Log:
> added a test case to demostrate David Siefert's issue in this thread : http://www.nabble.com/Explanation-of-MEPs-within-Camel-td16750134s22882.html
> 
> Added:
>     activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/issues/DavidSiefertTest.java
  (with props)
> 
> Added: activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/issues/DavidSiefertTest.java
> URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/issues/DavidSiefertTest.java?rev=649451&view=auto
> ==============================================================================
> --- activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/issues/DavidSiefertTest.java
(added)
> +++ activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/issues/DavidSiefertTest.java
Fri Apr 18 03:18:19 2008
> @@ -0,0 +1,73 @@
> +/**
> + *
> + * 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.issues;
> +
> +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.component.mock.MockEndpoint;
> +
> +/**
> + * @version $Revision: 1.1 $
> + */
> +public class DavidSiefertTest extends ContextTestSupport {
> +    protected static Object expectedBody = "Some Output";
> +
> +    public void testWorks() throws Exception {
> +        MockEndpoint result = getMockEndpoint("mock:result");
> +        result.expectedMessageCount(1);
> +        result.expectedBodiesReceived(expectedBody);
> +        result.message(0).header("sample.name").equals("myValue");
> +        template.sendBody("direct:start", "<sample><name>value</name></sample>");
> +        result.assertIsSatisfied();
> +    }
> +
> +    public void testHeaderPredicateFails() throws Exception {
> +        MockEndpoint result = getMockEndpoint("mock:result");
> +        result.message(0).header("sample.name").isEqualTo("shouldNotMatch");
> +        template.sendBody("direct:start", "<sample><name>value</name></sample>");
> +        try {
> +            result.assertIsSatisfied();
> +            fail("Should have failed this test!");
> +        }
> +        catch (AssertionError e) {
> +            log.info("Caught expected assertion failure: " + e, e);
> +        }
> +    }
> +
> +    @Override
> +    protected RouteBuilder createRouteBuilder() throws Exception {
> +        return new RouteBuilder() {
> +            public void configure() throws Exception {
> +                from("direct:start").process(new MyProcessor()).to("mock:result");
> +            }
> +        };
> +    }
> +
> +    public static class MyProcessor implements Processor {
> +        public void process(Exchange exchange) throws Exception {
> +            String input = exchange.getIn().getBody(String.class);
> +
> +            Message output = exchange.getOut();
> +            output.setHeader("sample.name", "myValue");
> +            output.setBody(expectedBody);
> +        }
> +    }
> +}
> 
> Propchange: activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/issues/DavidSiefertTest.java
> ------------------------------------------------------------------------------
>     svn:eol-style = native
> 
> 


Mime
View raw message