Author: ningjiang
Date: Mon Dec 21 08:32:35 2009
New Revision: 892726
URL: http://svn.apache.org/viewvc?rev=892726&view=rev
Log:
CAMEL-2148 added the camel-protobuf into the distribution kit, also update the
camel-protobuf unit test
Added:
camel/trunk/components/camel-protobuf/src/test/resources/log4j.properties
(with props)
Modified:
camel/trunk/apache-camel/pom.xml
camel/trunk/apache-camel/src/main/descriptors/common-bin.xml
camel/trunk/components/camel-protobuf/ (props changed)
camel/trunk/components/camel-protobuf/src/test/java/org/apache/camel/dataformat/protobuf/ProtobufMarshalTest.java
camel/trunk/components/camel-smpp/ (props changed)
camel/trunk/parent/pom.xml
Modified: camel/trunk/apache-camel/pom.xml
URL:
http://svn.apache.org/viewvc/camel/trunk/apache-camel/pom.xml?rev=892726&r1=892725&r2=892726&view=diff
==============================================================================
--- camel/trunk/apache-camel/pom.xml (original)
+++ camel/trunk/apache-camel/pom.xml Mon Dec 21 08:32:35 2009
@@ -196,6 +196,10 @@
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
+ <artifactId>camel-protobuf</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
<artifactId>camel-quartz</artifactId>
</dependency>
<dependency>
Modified: camel/trunk/apache-camel/src/main/descriptors/common-bin.xml
URL:
http://svn.apache.org/viewvc/camel/trunk/apache-camel/src/main/descriptors/common-bin.xml?rev=892726&r1=892725&r2=892726&view=diff
==============================================================================
--- camel/trunk/apache-camel/src/main/descriptors/common-bin.xml (original)
+++ camel/trunk/apache-camel/src/main/descriptors/common-bin.xml Mon Dec 21
08:32:35 2009
@@ -71,6 +71,7 @@
<include>org.apache.camel:camel-ognl</include>
<include>org.apache.camel:camel-osgi</include>
<include>org.apache.camel:camel-printer</include>
+ <include>org.apache.camel:camel-protobuf</include>
<include>org.apache.camel:camel-quartz</include>
<include>org.apache.camel:camel-quickfix</include>
<include>org.apache.camel:camel-rmi</include>
Propchange: camel/trunk/components/camel-protobuf/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Mon Dec 21 08:32:35 2009
@@ -0,0 +1,9 @@
+.project
+.checkstyle
+.pmd
+.classpath
+target
+.settings
+eclipse-classes
+*.i??
+
Modified:
camel/trunk/components/camel-protobuf/src/test/java/org/apache/camel/dataformat/protobuf/ProtobufMarshalTest.java
URL:
http://svn.apache.org/viewvc/camel/trunk/components/camel-protobuf/src/test/java/org/apache/camel/dataformat/protobuf/ProtobufMarshalTest.java?rev=892726&r1=892725&r2=892726&view=diff
==============================================================================
---
camel/trunk/components/camel-protobuf/src/test/java/org/apache/camel/dataformat/protobuf/ProtobufMarshalTest.java
(original)
+++
camel/trunk/components/camel-protobuf/src/test/java/org/apache/camel/dataformat/protobuf/ProtobufMarshalTest.java
Mon Dec 21 08:32:35 2009
@@ -17,7 +17,10 @@
package org.apache.camel.dataformat.protobuf;
+import org.apache.camel.CamelException;
+import org.apache.camel.FailedToCreateRouteException;
import org.apache.camel.InvalidPayloadException;
+import org.apache.camel.RoutesBuilder;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
import org.apache.camel.dataformat.protobuf.generated.AddressBookProtos;
@@ -31,15 +34,40 @@
* @throws Exception
*/
@Test
- public void testMarshalAndUnmarshalWithDSL() throws Exception {
+ public void testMarshalAndUnmarshalWithDataFormat() throws Exception {
marshalAndUnmarshal("direct:in", "direct:back");
}
@Test
- public void testMarshalAndUnmarshalWithDataFormat() throws Exception {
- marshalAndUnmarshal("direct:marshal", "direct:unmarshal");
+ public void testMarshalAndUnmarshalWithDSL1() throws Exception {
+ marshalAndUnmarshal("direct:marshal", "direct:unmarshalA");
}
+ @Test
+ public void testMarshalAndUnmarshalWithDSL2() throws Exception {
+ marshalAndUnmarshal("direct:marshal", "direct:unmarshalB");
+ }
+
+ @Test
+ public void testMarshalAndUnmashalWithDSL3() throws Exception {
+ try {
+ context.addRoutes(new RouteBuilder() {
+
+ @Override
+ public void configure() throws Exception {
+ from("direct:unmarshalC").unmarshal().protobuf(new
CamelException("wrong instance"))
+ .to("mock:reverse");
+
+ }
+ });
+ fail("Expect the exception here");
+ } catch (Exception ex) {
+ assertTrue("Expect FailedToCreateRouteException", ex instanceof
FailedToCreateRouteException);
+ assertTrue("Get a wrong reason", ex.getCause() instanceof
IllegalArgumentException);
+ }
+ }
+
+
private void marshalAndUnmarshal(String inURI, String outURI) throws
Exception {
org.apache.camel.dataformat.protobuf.generated.AddressBookProtos.Person input =
AddressBookProtos.Person
.newBuilder().setName("Martin").setId(1234).build();
@@ -72,7 +100,10 @@
from("direct:back").unmarshal(format).to("mock:reverse");
from("direct:marshal").marshal().protobuf();
-
from("direct:unmarshal").unmarshal().protobuf("org.apache.camel.dataformat.protobuf.generated.AddressBookProtos$Person").to("mock:reverse");
+
from("direct:unmarshalA").unmarshal().protobuf("org.apache.camel.dataformat.protobuf.generated.AddressBookProtos$Person").to("mock:reverse");
+
+
from("direct:unmarshalB").unmarshal().protobuf(Person.getDefaultInstance()).to("mock:reverse");
+
}
};
Added: camel/trunk/components/camel-protobuf/src/test/resources/log4j.properties
URL:
http://svn.apache.org/viewvc/camel/trunk/components/camel-protobuf/src/test/resources/log4j.properties?rev=892726&view=auto
==============================================================================
--- camel/trunk/components/camel-protobuf/src/test/resources/log4j.properties
(added)
+++ camel/trunk/components/camel-protobuf/src/test/resources/log4j.properties
Mon Dec 21 08:32:35 2009
@@ -0,0 +1,36 @@
+## ------------------------------------------------------------------------
+## 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=DEBUG
+
+# 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-protobuf-test.log
Propchange:
camel/trunk/components/camel-protobuf/src/test/resources/log4j.properties
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
camel/trunk/components/camel-protobuf/src/test/resources/log4j.properties
------------------------------------------------------------------------------
svn:keywords = Rev Date
Propchange:
camel/trunk/components/camel-protobuf/src/test/resources/log4j.properties
------------------------------------------------------------------------------
svn:mime-type = text/plain
Propchange: camel/trunk/components/camel-smpp/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Mon Dec 21 08:32:35 2009
@@ -0,0 +1,9 @@
+.project
+.checkstyle
+.pmd
+.classpath
+target
+.settings
+eclipse-classes
+*.i??
+
Modified: camel/trunk/parent/pom.xml
URL:
http://svn.apache.org/viewvc/camel/trunk/parent/pom.xml?rev=892726&r1=892725&r2=892726&view=diff
==============================================================================
--- camel/trunk/parent/pom.xml (original)
+++ camel/trunk/parent/pom.xml Mon Dec 21 08:32:35 2009
@@ -376,6 +376,11 @@
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
+ <artifactId>camel-protobuf</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
<artifactId>camel-quartz</artifactId>
<version>${project.version}</version>
</dependency>