Added: camel/trunk/components/camel-avro/src/test/java/org/apache/camel/component/avro/AvroHttpProducerTest.java URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-avro/src/test/java/org/apache/camel/component/avro/AvroHttpProducerTest.java?rev=1240351&view=auto ============================================================================== --- camel/trunk/components/camel-avro/src/test/java/org/apache/camel/component/avro/AvroHttpProducerTest.java (added) +++ camel/trunk/components/camel-avro/src/test/java/org/apache/camel/component/avro/AvroHttpProducerTest.java Fri Feb 3 21:41:13 2012 @@ -0,0 +1,63 @@ +/** + * 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.avro; + +import java.io.IOException; +import junit.framework.Assert; +import org.apache.avro.Protocol; +import org.apache.avro.ipc.HttpServer; +import org.apache.avro.ipc.Server; +import org.apache.avro.ipc.specific.SpecificResponder; +import org.apache.camel.CamelContext; +import org.apache.camel.avro.generated.Key; +import org.apache.camel.avro.generated.KeyValueProtocol; +import org.apache.camel.avro.generated.Value; +import org.apache.camel.avro.impl.KeyValueProtocolImpl; +import org.apache.camel.builder.RouteBuilder; +import org.apache.camel.component.mock.MockEndpoint; +import org.apache.camel.test.CamelTestSupport; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +public class AvroHttpProducerTest extends AvroProducerTestSupport { + + static int avroPort = setupFreePort("avroport"); + + @Override + protected void initializeServer() throws IOException { + if (server == null) { + server = new HttpServer(new SpecificResponder(KeyValueProtocol.PROTOCOL, keyValue), avroPort); + server.start(); + } + } + + protected RouteBuilder createRouteBuilder() throws Exception { + return new RouteBuilder() { + @Override + public void configure() throws Exception { + //In Only + from("direct:in").to("avro:http:localhost:" + avroPort); + + //InOut + from("direct:inout").to("avro:http:localhost:" + avroPort).to("mock:result-inout"); + } + }; + } + +}
Added: camel/trunk/components/camel-avro/src/test/java/org/apache/camel/component/avro/AvroHttpSpringProducerTest.java URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-avro/src/test/java/org/apache/camel/component/avro/AvroHttpSpringProducerTest.java?rev=1240351&view=auto ============================================================================== --- camel/trunk/components/camel-avro/src/test/java/org/apache/camel/component/avro/AvroHttpSpringProducerTest.java (added) +++ camel/trunk/components/camel-avro/src/test/java/org/apache/camel/component/avro/AvroHttpSpringProducerTest.java Fri Feb 3 21:41:13 2012 @@ -0,0 +1,75 @@ +/** + * 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.avro; + +import junit.framework.Assert; +import org.apache.avro.Protocol; +import org.apache.avro.ipc.HttpServer; +import org.apache.avro.ipc.Server; +import org.apache.avro.ipc.specific.SpecificResponder; +import org.apache.camel.CamelContext; +import org.apache.camel.avro.generated.Key; +import org.apache.camel.avro.generated.KeyValueProtocol; +import org.apache.camel.avro.generated.Value; +import org.apache.camel.avro.impl.KeyValueProtocolImpl; +import org.apache.camel.builder.RouteBuilder; +import org.apache.camel.component.mock.MockEndpoint; +import org.apache.camel.model.ModelCamelContext; +import org.apache.camel.spring.SpringCamelContext; +import org.apache.camel.test.CamelTestSupport; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import org.springframework.context.support.AbstractApplicationContext; +import org.springframework.context.support.ClassPathXmlApplicationContext; + +public class AvroHttpSpringProducerTest extends AvroHttpProducerTest { + + private AbstractApplicationContext applicationContext; + + @Override + @Before + public void setUp() throws Exception { + initializeServer(); + applicationContext = createApplicationContext(); + super.setUp(); + } + + @Override + @After + public void tearDown() throws Exception { + super.tearDown(); + if (applicationContext != null) { + applicationContext.destroy(); + } + } + + public AbstractApplicationContext createApplicationContext() throws Exception { + return new ClassPathXmlApplicationContext("org/apache/camel/component/avro/avro-http-producer.xml"); + } + + @Override + protected CamelContext createCamelContext() throws Exception { + return (ModelCamelContext) SpringCamelContext.springCamelContext(applicationContext); + } + + @Override + public boolean isUseRouteBuilder() { + return false; + } +} Added: camel/trunk/components/camel-avro/src/test/java/org/apache/camel/component/avro/AvroNettyConsumerTest.java URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-avro/src/test/java/org/apache/camel/component/avro/AvroNettyConsumerTest.java?rev=1240351&view=auto ============================================================================== --- camel/trunk/components/camel-avro/src/test/java/org/apache/camel/component/avro/AvroNettyConsumerTest.java (added) +++ camel/trunk/components/camel-avro/src/test/java/org/apache/camel/component/avro/AvroNettyConsumerTest.java Fri Feb 3 21:41:13 2012 @@ -0,0 +1,60 @@ +/** + * 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.avro; + +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.InetSocketAddress; +import java.net.URI; +import java.net.URISyntaxException; +import java.net.URL; +import org.apache.avro.ipc.HttpTransceiver; +import org.apache.avro.ipc.NettyTransceiver; +import org.apache.avro.ipc.specific.SpecificRequestor; +import org.apache.camel.avro.generated.KeyValueProtocol; +import org.apache.camel.builder.RouteBuilder; +import org.apache.camel.component.avro.processors.GetProcessor; +import org.apache.camel.component.avro.processors.PutProcessor; +import org.apache.camel.test.CamelTestSupport; +import org.apache.camel.util.URISupport; +import org.junit.Assert; +import org.junit.Test; + + +public class AvroNettyConsumerTest extends AvroConsumerTestSupport { + + static int avroPort = setupFreePort("avroport"); + + @Override + protected void initializeTranceiver() throws IOException { + transceiver = new NettyTransceiver(new InetSocketAddress("localhost", avroPort)); + requestor = new SpecificRequestor(KeyValueProtocol.class, transceiver); + } + + protected RouteBuilder createRouteBuilder() throws Exception { + return new RouteBuilder() { + @Override + public void configure() throws Exception { + //In Only + from("avro:netty:localhost:" + avroPort).choice() + .when().el("${in.headers." + AvroConstants.AVRO_MESSAGE_NAME + " == 'put'}").process(new PutProcessor(keyValue)) + .when().el("${in.headers." + AvroConstants.AVRO_MESSAGE_NAME + " == 'get'}").process(new GetProcessor(keyValue)); + } + }; + } +} Added: camel/trunk/components/camel-avro/src/test/java/org/apache/camel/component/avro/AvroNettyProducerTest.java URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-avro/src/test/java/org/apache/camel/component/avro/AvroNettyProducerTest.java?rev=1240351&view=auto ============================================================================== --- camel/trunk/components/camel-avro/src/test/java/org/apache/camel/component/avro/AvroNettyProducerTest.java (added) +++ camel/trunk/components/camel-avro/src/test/java/org/apache/camel/component/avro/AvroNettyProducerTest.java Fri Feb 3 21:41:13 2012 @@ -0,0 +1,64 @@ +/** + * 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.avro; + +import java.net.InetSocketAddress; +import org.apache.avro.Protocol; +import org.apache.avro.ipc.HttpServer; +import org.apache.avro.ipc.NettyServer; +import org.apache.avro.ipc.Server; +import org.apache.avro.ipc.specific.SpecificResponder; +import org.apache.camel.CamelContext; +import org.apache.camel.avro.generated.Key; +import org.apache.camel.avro.generated.KeyValueProtocol; +import org.apache.camel.avro.generated.Value; +import org.apache.camel.avro.impl.KeyValueProtocolImpl; +import org.apache.camel.builder.RouteBuilder; +import org.apache.camel.component.mock.MockEndpoint; +import org.apache.camel.test.CamelTestSupport; +import org.junit.After; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; + +public class AvroNettyProducerTest extends AvroProducerTestSupport { + + static int avroPort = setupFreePort("avroport"); + + @After + protected RouteBuilder createRouteBuilder() throws Exception { + return new RouteBuilder() { + @Override + public void configure() throws Exception { + //In Only + from("direct:in").to("avro:netty:localhost:" + avroPort); + + //InOut + from("direct:inout").to("avro:netty:localhost:" + avroPort).to("mock:result-inout"); + } + }; + } + + @Override + protected void initializeServer() { + if (server == null) { + server = new NettyServer(new SpecificResponder(KeyValueProtocol.PROTOCOL, keyValue), new InetSocketAddress("localhost", avroPort)); + server.start(); + } + } +} Added: camel/trunk/components/camel-avro/src/test/java/org/apache/camel/component/avro/AvroNettySpringConsumerTest.java URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-avro/src/test/java/org/apache/camel/component/avro/AvroNettySpringConsumerTest.java?rev=1240351&view=auto ============================================================================== --- camel/trunk/components/camel-avro/src/test/java/org/apache/camel/component/avro/AvroNettySpringConsumerTest.java (added) +++ camel/trunk/components/camel-avro/src/test/java/org/apache/camel/component/avro/AvroNettySpringConsumerTest.java Fri Feb 3 21:41:13 2012 @@ -0,0 +1,62 @@ +/** + * 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.avro; + +import java.io.IOException; +import org.apache.camel.avro.impl.KeyValueProtocolImpl; +import org.apache.camel.builder.RouteBuilder; +import org.apache.camel.component.avro.processors.GetProcessor; +import org.apache.camel.component.avro.processors.PutProcessor; +import org.apache.camel.model.ModelCamelContext; +import org.apache.camel.spring.SpringCamelContext; +import org.junit.After; +import org.junit.Before; +import org.springframework.context.support.AbstractApplicationContext; +import org.springframework.context.support.ClassPathXmlApplicationContext; + +public class AvroNettySpringConsumerTest extends AvroNettyConsumerTest { + + private AbstractApplicationContext applicationContext; + + @Override + @Before + public void setUp() throws Exception { + applicationContext = createApplicationContext(); + context = (ModelCamelContext) SpringCamelContext.springCamelContext(applicationContext); + keyValue = (KeyValueProtocolImpl) applicationContext.getBean("keyValue"); + super.setUp(); + } + + @Override + @After + public void tearDown() throws Exception { + super.tearDown(); + if (applicationContext != null) { + applicationContext.destroy(); + } + } + + public AbstractApplicationContext createApplicationContext() throws Exception { + return new ClassPathXmlApplicationContext("org/apache/camel/component/avro/avro-netty-consumer.xml"); + } + + @Override + public boolean isUseRouteBuilder() { + return false; + } +} Added: camel/trunk/components/camel-avro/src/test/java/org/apache/camel/component/avro/AvroNettySpringProducerTest.java URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-avro/src/test/java/org/apache/camel/component/avro/AvroNettySpringProducerTest.java?rev=1240351&view=auto ============================================================================== --- camel/trunk/components/camel-avro/src/test/java/org/apache/camel/component/avro/AvroNettySpringProducerTest.java (added) +++ camel/trunk/components/camel-avro/src/test/java/org/apache/camel/component/avro/AvroNettySpringProducerTest.java Fri Feb 3 21:41:13 2012 @@ -0,0 +1,62 @@ +/** + * 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.avro; + +import org.apache.camel.CamelContext; +import org.apache.camel.model.ModelCamelContext; +import org.apache.camel.spring.SpringCamelContext; +import org.junit.After; +import org.junit.Before; +import org.springframework.context.support.AbstractApplicationContext; +import org.springframework.context.support.ClassPathXmlApplicationContext; + +public class AvroNettySpringProducerTest extends AvroNettyProducerTest { + + private AbstractApplicationContext applicationContext; + + @Override + @Before + public void setUp() throws Exception { + initializeServer(); + applicationContext = createApplicationContext(); + super.setUp(); + } + + @Override + @After + public void tearDown() throws Exception { + super.tearDown(); + if (applicationContext != null) { + applicationContext.destroy(); + } + } + + public AbstractApplicationContext createApplicationContext() throws Exception { + return new ClassPathXmlApplicationContext("org/apache/camel/component/avro/avro-netty-producer.xml"); + } + + @Override + protected CamelContext createCamelContext() throws Exception { + return (ModelCamelContext) SpringCamelContext.springCamelContext(applicationContext); + } + + @Override + public boolean isUseRouteBuilder() { + return false; + } +} Added: camel/trunk/components/camel-avro/src/test/java/org/apache/camel/component/avro/AvroProducerTestSupport.java URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-avro/src/test/java/org/apache/camel/component/avro/AvroProducerTestSupport.java?rev=1240351&view=auto ============================================================================== --- camel/trunk/components/camel-avro/src/test/java/org/apache/camel/component/avro/AvroProducerTestSupport.java (added) +++ camel/trunk/components/camel-avro/src/test/java/org/apache/camel/component/avro/AvroProducerTestSupport.java Fri Feb 3 21:41:13 2012 @@ -0,0 +1,96 @@ +/** + * 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.avro; + +import java.io.IOException; +import java.net.InetSocketAddress; +import junit.framework.Assert; +import org.apache.avro.Protocol; +import org.apache.avro.ipc.HttpServer; +import org.apache.avro.ipc.NettyServer; +import org.apache.avro.ipc.Server; +import org.apache.avro.ipc.specific.SpecificResponder; +import org.apache.camel.CamelContext; +import org.apache.camel.avro.generated.Key; +import org.apache.camel.avro.generated.KeyValueProtocol; +import org.apache.camel.avro.generated.Value; +import org.apache.camel.avro.impl.KeyValueProtocolImpl; +import org.apache.camel.builder.RouteBuilder; +import org.apache.camel.component.mock.MockEndpoint; +import org.apache.camel.test.CamelTestSupport; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +public abstract class AvroProducerTestSupport extends AvroTestSupport { + + Server server; + KeyValueProtocolImpl keyValue = new KeyValueProtocolImpl(); + + protected abstract void initializeServer() throws IOException; + + @Before + protected void setUp() throws Exception { + initializeServer(); + super.setUp(); + } + + @After + protected void tearDown() throws Exception { + super.tearDown(); + if (server != null) { + server.close(); + } + } + + @Test + public void testInOnly() throws InterruptedException { + Key key = Key.newBuilder().setKey("1").build(); + Value value = Value.newBuilder().setValue("test value").build(); + Object[] request = {key, value}; + template.sendBodyAndHeader("direct:in", request, AvroConstants.AVRO_MESSAGE_NAME, "put"); + Assert.assertEquals(value, keyValue.getStore().get(key)); + } + + + @Test + public void testInOut() throws InterruptedException { + keyValue.getStore().clear(); + Key key = Key.newBuilder().setKey("2").build(); + Value value = Value.newBuilder().setValue("test value").build(); + keyValue.getStore().put(key, value); + + MockEndpoint mock = getMockEndpoint("mock:result-inout"); + mock.expectedMessageCount(1); + mock.expectedBodiesReceived(value); + template.sendBodyAndHeader("direct:inout", key, AvroConstants.AVRO_MESSAGE_NAME, "get"); + mock.assertIsSatisfied(10000); + } + + @Override + protected CamelContext createCamelContext() throws Exception { + CamelContext context = super.createCamelContext(); + Protocol protocol = KeyValueProtocol.PROTOCOL; + AvroConfiguration configuration = new AvroConfiguration(); + configuration.setProtocol(protocol); + AvroComponent component = new AvroComponent(context); + component.setConfiguration(configuration); + context.addComponent("avro", component); + return context; + } +} \ No newline at end of file Added: camel/trunk/components/camel-avro/src/test/java/org/apache/camel/component/avro/AvroTestSupport.java URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-avro/src/test/java/org/apache/camel/component/avro/AvroTestSupport.java?rev=1240351&view=auto ============================================================================== --- camel/trunk/components/camel-avro/src/test/java/org/apache/camel/component/avro/AvroTestSupport.java (added) +++ camel/trunk/components/camel-avro/src/test/java/org/apache/camel/component/avro/AvroTestSupport.java Fri Feb 3 21:41:13 2012 @@ -0,0 +1,71 @@ +/** + * 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.avro; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.util.Properties; +import org.apache.camel.test.AvailablePortFinder; +import org.apache.camel.test.CamelTestSupport; + +public class AvroTestSupport extends CamelTestSupport { + + + public static int setupFreePort(String name) { + int port = -1; + FileInputStream fis = null; + FileOutputStream fos = null; + try { + Properties properties = new Properties(); + File propertiesFile = new File("target/custom.properties"); + if (!propertiesFile.exists()) { + propertiesFile.createNewFile(); + } + fis = new FileInputStream(propertiesFile); + fos = new FileOutputStream(propertiesFile); + properties.load(fis); + if (properties.contains(name)) { + return Integer.parseInt((String) properties.get(name)); + } else { + // find a free port number from 9100 onwards, and write that in the custom.properties file + // which we will use for the unit tests, to avoid port number in use problems + port = AvailablePortFinder.getNextAvailable(9100); + properties.put(name, String.valueOf(port)); + properties.store(fos, "avro"); + } + } catch (IOException e) { + //Ignore + } finally { + if (fis != null) { + try { + fis.close(); + } catch (Exception ex) { + } + } + if (fos != null) { + try { + fos.close(); + } catch (Exception ex) { + } + } + } + return port; + } + +} Added: camel/trunk/components/camel-avro/src/test/java/org/apache/camel/component/avro/processors/GetProcessor.java URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-avro/src/test/java/org/apache/camel/component/avro/processors/GetProcessor.java?rev=1240351&view=auto ============================================================================== --- camel/trunk/components/camel-avro/src/test/java/org/apache/camel/component/avro/processors/GetProcessor.java (added) +++ camel/trunk/components/camel-avro/src/test/java/org/apache/camel/component/avro/processors/GetProcessor.java Fri Feb 3 21:41:13 2012 @@ -0,0 +1,53 @@ +/** + * 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.avro.processors; + + +import org.apache.camel.Exchange; +import org.apache.camel.Processor; +import org.apache.camel.avro.generated.Key; +import org.apache.camel.avro.generated.KeyValueProtocol; +import org.apache.camel.avro.generated.Value; + +public class GetProcessor implements Processor { + + private KeyValueProtocol keyValue; + + public GetProcessor(KeyValueProtocol keyValue) { + this.keyValue = keyValue; + } + + @Override + public void process(Exchange exchange) throws Exception { + Object body = exchange.getIn().getBody(); + if (body instanceof Object[]) { + Object[] args = (Object[]) body; + if (args.length == 1 && args[0] instanceof Key) { + Value v = keyValue.get((Key) args[0]); + exchange.getOut().setBody(v); + } + } + } + + public KeyValueProtocol getKeyValue() { + return keyValue; + } + + public void setKeyValue(KeyValueProtocol keyValue) { + this.keyValue = keyValue; + } +} Added: camel/trunk/components/camel-avro/src/test/java/org/apache/camel/component/avro/processors/PutProcessor.java URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-avro/src/test/java/org/apache/camel/component/avro/processors/PutProcessor.java?rev=1240351&view=auto ============================================================================== --- camel/trunk/components/camel-avro/src/test/java/org/apache/camel/component/avro/processors/PutProcessor.java (added) +++ camel/trunk/components/camel-avro/src/test/java/org/apache/camel/component/avro/processors/PutProcessor.java Fri Feb 3 21:41:13 2012 @@ -0,0 +1,52 @@ +/** + * 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.avro.processors; + + +import org.apache.camel.Exchange; +import org.apache.camel.Processor; +import org.apache.camel.avro.generated.Key; +import org.apache.camel.avro.generated.KeyValueProtocol; +import org.apache.camel.avro.generated.Value; + +public class PutProcessor implements Processor { + + private KeyValueProtocol keyValue; + + public PutProcessor(KeyValueProtocol keyValue) { + this.keyValue = keyValue; + } + + @Override + public void process(Exchange exchange) throws Exception { + Object body = exchange.getIn().getBody(); + if (body instanceof Object[]) { + Object[] args = (Object[]) body; + if (args.length == 2 && args[0] instanceof Key && args[1] instanceof Value) { + keyValue.put((Key) args[0], (Value) args[1]); + } + } + } + + public KeyValueProtocol getKeyValue() { + return keyValue; + } + + public void setKeyValue(KeyValueProtocol keyValue) { + this.keyValue = keyValue; + } +} Added: camel/trunk/components/camel-avro/src/test/java/org/apache/camel/dataformat/avro/AvroMarshalAndUnmarshalSpringTest.java URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-avro/src/test/java/org/apache/camel/dataformat/avro/AvroMarshalAndUnmarshalSpringTest.java?rev=1240351&view=auto ============================================================================== --- camel/trunk/components/camel-avro/src/test/java/org/apache/camel/dataformat/avro/AvroMarshalAndUnmarshalSpringTest.java (added) +++ camel/trunk/components/camel-avro/src/test/java/org/apache/camel/dataformat/avro/AvroMarshalAndUnmarshalSpringTest.java Fri Feb 3 21:41:13 2012 @@ -0,0 +1,27 @@ +/** + * 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.dataformat.avro; + +import org.springframework.context.support.ClassPathXmlApplicationContext; + +public class AvroMarshalAndUnmarshalSpringTest extends AvroMarshalAndUnmarshallTest { + + protected ClassPathXmlApplicationContext createApplicationContext() { + return new ClassPathXmlApplicationContext("org/apache/camel/dataformat/avro/springDataFormat.xml"); + } + +} Added: camel/trunk/components/camel-avro/src/test/java/org/apache/camel/dataformat/avro/AvroMarshalAndUnmarshallTest.java URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-avro/src/test/java/org/apache/camel/dataformat/avro/AvroMarshalAndUnmarshallTest.java?rev=1240351&view=auto ============================================================================== --- camel/trunk/components/camel-avro/src/test/java/org/apache/camel/dataformat/avro/AvroMarshalAndUnmarshallTest.java (added) +++ camel/trunk/components/camel-avro/src/test/java/org/apache/camel/dataformat/avro/AvroMarshalAndUnmarshallTest.java Fri Feb 3 21:41:13 2012 @@ -0,0 +1,99 @@ +/** + * 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.dataformat.avro; + +import org.apache.camel.CamelException; +import org.apache.camel.FailedToCreateRouteException; +import org.apache.camel.avro.generated.Value; +import org.apache.camel.builder.RouteBuilder; +import org.apache.camel.component.mock.MockEndpoint; +import org.apache.camel.test.junit4.CamelTestSupport; +import org.junit.Test; + +public class AvroMarshalAndUnmarshallTest extends CamelTestSupport { + + @Test + public void testMarshalAndUnmarshalWithDataFormat() throws Exception { + marshalAndUnmarshal("direct:in", "direct:back"); + } + + @Test + public void testMarshalAndUnmarshalWithDSL1() throws Exception { + marshalAndUnmarshal("direct:marshal", "direct:unmarshalA"); + } + + @Test + public void testMarshalAndUnmarshalWithDSL2() throws Exception { + marshalAndUnmarshal("direct:marshal", "direct:unmarshalB"); + } + + @Test + public void testMarshalAndUnmarshalWithDSL3() throws Exception { + try { + context.addRoutes(new RouteBuilder() { + @Override + public void configure() throws Exception { + from("direct:unmarshalC").unmarshal().avro(new CamelException("wrong schema")) + .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 { + Value input = Value.newBuilder().build(); + input.setValue("test body"); + + MockEndpoint mock = getMockEndpoint("mock:reverse"); + mock.expectedMessageCount(1); + mock.message(0).body().isInstanceOf(Value.class); + mock.message(0).body().equals(input); + + Object marshalled = template.requestBody(inURI, input); + + template.sendBody(outURI, marshalled); + + mock.assertIsSatisfied(); + + Value output = mock.getReceivedExchanges().get(0).getIn().getBody(Value.class); + assertEquals(input, output); + } + + @Override + protected RouteBuilder createRouteBuilder() throws Exception { + return new RouteBuilder() { + @Override + public void configure() throws Exception { + AvroDataFormat format = new AvroDataFormat(Value.SCHEMA$); + + from("direct:in").marshal(format); + from("direct:back").unmarshal(format).to("mock:reverse"); + + from("direct:marshal").marshal().avro(); + from("direct:unmarshalA").unmarshal().avro(Value.class.getName()).to("mock:reverse"); + + from("direct:unmarshalB").unmarshal().avro(Value.SCHEMA$).to("mock:reverse"); + } + }; + } + +} Added: camel/trunk/components/camel-avro/src/test/resources/org/apache/camel/component/avro/avro-http-consumer.xml URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-avro/src/test/resources/org/apache/camel/component/avro/avro-http-consumer.xml?rev=1240351&view=auto ============================================================================== --- camel/trunk/components/camel-avro/src/test/resources/org/apache/camel/component/avro/avro-http-consumer.xml (added) +++ camel/trunk/components/camel-avro/src/test/resources/org/apache/camel/component/avro/avro-http-consumer.xml Fri Feb 3 21:41:13 2012 @@ -0,0 +1,53 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + 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. + --> +<beans xmlns="http://www.springframework.org/schema/beans" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation=" + http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd + http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd"> + + + <camelContext id="camel" xmlns="http://camel.apache.org/schema/spring"> + <propertyPlaceholder id="properties" location="file:target/custom.properties"/> + <route> + <from uri="avro:http:localhost:{{avroport}}?protocolClassName=org.apache.camel.avro.generated.KeyValueProtocol"/> + <choice> + <when> + <el>${in.headers.CamelAvroMessageName == 'put'}</el> + <process ref="putProcessor"/> + </when> + <when> + <el>${in.headers.CamelAvroMessageName == 'get'}</el> + <process ref="getProcessor"/> + </when> + </choice> + </route> + + </camelContext> + + <bean id="keyValue" class="org.apache.camel.avro.impl.KeyValueProtocolImpl"/> + + <bean id="getProcessor" class="org.apache.camel.component.avro.processors.GetProcessor"> + <constructor-arg ref="keyValue"/> + </bean> + + <bean id="putProcessor" class="org.apache.camel.component.avro.processors.PutProcessor"> + <constructor-arg ref="keyValue"/> + </bean> + +</beans> \ No newline at end of file Added: camel/trunk/components/camel-avro/src/test/resources/org/apache/camel/component/avro/avro-http-producer.xml URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-avro/src/test/resources/org/apache/camel/component/avro/avro-http-producer.xml?rev=1240351&view=auto ============================================================================== --- camel/trunk/components/camel-avro/src/test/resources/org/apache/camel/component/avro/avro-http-producer.xml (added) +++ camel/trunk/components/camel-avro/src/test/resources/org/apache/camel/component/avro/avro-http-producer.xml Fri Feb 3 21:41:13 2012 @@ -0,0 +1,40 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + 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. + --> +<beans xmlns="http://www.springframework.org/schema/beans" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation=" + http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd + http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd"> + + + <camelContext id="camel" xmlns="http://camel.apache.org/schema/spring"> + <propertyPlaceholder id="properties" location="file:target/custom.properties"/> + <route> + <from uri="direct:in"/> + <to uri="avro:http:localhost:{{avroport}}?protocolClassName=org.apache.camel.avro.generated.KeyValueProtocol"/> + </route> + + <route> + <from uri="direct:inout"/> + <to uri="avro:http:localhost:{{avroport}}?protocolClassName=org.apache.camel.avro.generated.KeyValueProtocol"/> + <to uri="mock:result-inout"/> + </route> + + </camelContext> + +</beans> \ No newline at end of file Added: camel/trunk/components/camel-avro/src/test/resources/org/apache/camel/component/avro/avro-netty-consumer.xml URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-avro/src/test/resources/org/apache/camel/component/avro/avro-netty-consumer.xml?rev=1240351&view=auto ============================================================================== --- camel/trunk/components/camel-avro/src/test/resources/org/apache/camel/component/avro/avro-netty-consumer.xml (added) +++ camel/trunk/components/camel-avro/src/test/resources/org/apache/camel/component/avro/avro-netty-consumer.xml Fri Feb 3 21:41:13 2012 @@ -0,0 +1,53 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + 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. + --> +<beans xmlns="http://www.springframework.org/schema/beans" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation=" + http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd + http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd"> + + + <camelContext id="camel" xmlns="http://camel.apache.org/schema/spring"> + <propertyPlaceholder id="properties" location="file:target/custom.properties"/> + <route> + <from uri="avro:netty:localhost:{{avroport}}?protocolClassName=org.apache.camel.avro.generated.KeyValueProtocol"/> + <choice> + <when> + <el>${in.headers.CamelAvroMessageName == 'put'}</el> + <process ref="putProcessor"/> + </when> + <when> + <el>${in.headers.CamelAvroMessageName == 'get'}</el> + <process ref="getProcessor"/> + </when> + </choice> + </route> + + </camelContext> + + <bean id="keyValue" class="org.apache.camel.avro.impl.KeyValueProtocolImpl"/> + + <bean id="getProcessor" class="org.apache.camel.component.avro.processors.GetProcessor"> + <constructor-arg ref="keyValue"/> + </bean> + + <bean id="putProcessor" class="org.apache.camel.component.avro.processors.PutProcessor"> + <constructor-arg ref="keyValue"/> + </bean> + +</beans> \ No newline at end of file Added: camel/trunk/components/camel-avro/src/test/resources/org/apache/camel/component/avro/avro-netty-producer.xml URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-avro/src/test/resources/org/apache/camel/component/avro/avro-netty-producer.xml?rev=1240351&view=auto ============================================================================== --- camel/trunk/components/camel-avro/src/test/resources/org/apache/camel/component/avro/avro-netty-producer.xml (added) +++ camel/trunk/components/camel-avro/src/test/resources/org/apache/camel/component/avro/avro-netty-producer.xml Fri Feb 3 21:41:13 2012 @@ -0,0 +1,40 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + 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. + --> +<beans xmlns="http://www.springframework.org/schema/beans" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation=" + http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd + http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd"> + + + <camelContext id="camel" xmlns="http://camel.apache.org/schema/spring"> + <propertyPlaceholder id="properties" location="file:target/custom.properties"/> + <route> + <from uri="direct:in"/> + <to uri="avro:netty:localhost:{{avroport}}?protocolClassName=org.apache.camel.avro.generated.KeyValueProtocol"/> + </route> + + <route> + <from uri="direct:inout"/> + <to uri="avro:netty:localhost:{{avroport}}?protocolClassName=org.apache.camel.avro.generated.KeyValueProtocol"/> + <to uri="mock:result-inout"/> + </route> + + </camelContext> + +</beans> \ No newline at end of file Added: camel/trunk/components/camel-avro/src/test/resources/org/apache/camel/dataformat/avro/springDataFormat.xml URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-avro/src/test/resources/org/apache/camel/dataformat/avro/springDataFormat.xml?rev=1240351&view=auto ============================================================================== --- camel/trunk/components/camel-avro/src/test/resources/org/apache/camel/dataformat/avro/springDataFormat.xml (added) +++ camel/trunk/components/camel-avro/src/test/resources/org/apache/camel/dataformat/avro/springDataFormat.xml Fri Feb 3 21:41:13 2012 @@ -0,0 +1,62 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + 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. +--> +<beans xmlns="http://www.springframework.org/schema/beans" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation=" + http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd + http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd"> + + + <camelContext id="camel" xmlns="http://camel.apache.org/schema/spring"> + <dataFormats> + <avro id="avro1" instanceClass="org.apache.camel.dataformat.avro.Message"/> + </dataFormats> + <route> + <from uri="direct:in"/> + <marshal> + <avro instanceClass="org.apache.camel.dataformat.avro.Message"/> + </marshal> + </route> + <route> + <from uri="direct:back"/> + <unmarshal> + <avro instanceClass="org.apache.camel.dataformat.avro.Message"/> + </unmarshal> + <to uri="mock:reverse"/> + </route> + <route> + <from uri="direct:marshal"/> + <marshal ref="avro1"/> + </route> + <route> + <from uri="direct:unmarshalA"/> + <unmarshal ref="avro1"/> + <to uri="mock:reverse"/> + </route> + <route> + <from uri="direct:unmarshalB"/> + <unmarshal ref="avro1"/> + <to uri="mock:reverse"/> + </route> + </camelContext> + + <bean id="avro2" class="org.apache.camel.datafromat.avro.AvrofDataFormat"> + <property name="instanceClassName" value="org.apache.camel.dataformat.avro.Message"/> + </bean> + +</beans> Modified: camel/trunk/components/pom.xml URL: http://svn.apache.org/viewvc/camel/trunk/components/pom.xml?rev=1240351&r1=1240350&r2=1240351&view=diff ============================================================================== --- camel/trunk/components/pom.xml (original) +++ camel/trunk/components/pom.xml Fri Feb 3 21:41:13 2012 @@ -57,6 +57,7 @@ <module>camel-amqp</module> <module>camel-apns</module> <module>camel-atom</module> + <module>camel-avro</module> <module>camel-aws</module> <module>camel-bean-validator</module> <module>camel-bindy</module> @@ -150,6 +151,7 @@ <module>camel-xmpp</module> <module>camel-xstream</module> <module>camel-zookeeper</module> + <module>camel-websocket</module> </modules> </project> Modified: camel/trunk/parent/pom.xml URL: http://svn.apache.org/viewvc/camel/trunk/parent/pom.xml?rev=1240351&r1=1240350&r2=1240351&view=diff ============================================================================== --- camel/trunk/parent/pom.xml (original) +++ camel/trunk/parent/pom.xml Fri Feb 3 21:41:13 2012 @@ -41,6 +41,8 @@ <apacheds-version>1.5.7</apacheds-version> <aries-blueprint-version>0.3</aries-blueprint-version> <atomikos-trascations-version>3.7.0</atomikos-trascations-version> + <avro-version>1.6.1</avro-version> + <avro-bundle-version>1.6.1_1</avro-bundle-version> <axiom-version>1.2.12</axiom-version> <bouncycastle-version>1.46</bouncycastle-version> <castor-bundle-version>1.3.1_2</castor-bundle-version> @@ -126,6 +128,7 @@ <ode-version>1.3.3</ode-version> <ognl-version>3.0.2_1</ognl-version> <osgi-version>4.2.0</osgi-version> + <paranamer-bundle-version>2.4_1</paranamer-bundle-version> <pax-exam-version>1.2.4</pax-exam-version> <pax-runner-version>1.6.1</pax-runner-version> <pax-tiny-bundle-version>1.3.1</pax-tiny-bundle-version> @@ -144,6 +147,7 @@ <shiro-version>1.2.0</shiro-version> <slf4j-version>1.6.1</slf4j-version> <smack-version>3.2.1</smack-version> + <snappy-bundle-version>1.0.4.1_1</snappy-bundle-version> <snmp4j-version>1.8.1_5</snmp4j-version> <solr-version>3.5.0</solr-version> <spring-integration-version>2.1.0.RELEASE</spring-integration-version> @@ -250,6 +254,11 @@ </dependency> <dependency> <groupId>org.apache.camel</groupId> + <artifactId>camel-avro</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.apache.camel</groupId> <artifactId>camel-aws</artifactId> <version>${project.version}</version> </dependency> @@ -1460,6 +1469,18 @@ <version>${xerces-version}</version> </dependency> + <!-- optional avro --> + <dependency> + <groupId>org.apache.avro</groupId> + <artifactId>avro</artifactId> + <version>${avro-version}</version> + </dependency> + <dependency> + <groupId>org.apache.avro</groupId> + <artifactId>avro-ipc</artifactId> + <version>${avro-version}</version> + </dependency> + <!-- optional ftpserver --> <dependency> <groupId>org.apache.ftpserver</groupId> Modified: camel/trunk/platforms/karaf/features/src/main/resources/features.xml URL: http://svn.apache.org/viewvc/camel/trunk/platforms/karaf/features/src/main/resources/features.xml?rev=1240351&r1=1240350&r2=1240351&view=diff ============================================================================== --- camel/trunk/platforms/karaf/features/src/main/resources/features.xml (original) +++ camel/trunk/platforms/karaf/features/src/main/resources/features.xml Fri Feb 3 21:41:13 2012 @@ -187,6 +187,17 @@ <feature version='${project.version}'>camel-core</feature> <bundle>mvn:org.apache.camel/camel-aws/${project.version}</bundle> </feature> + <feature name='camel-avro' version='${project.version}' resolver='(obr)' start-level='50'> + <feature version='${project.version}'>camel-core</feature> + <bundle dependency='true'>mvn:org.codehaus.jackson/jackson-core-asl/${jackson-version}</bundle> + <bundle dependency='true'>mvn:org.codehaus.jackson/jackson-mapper-asl/${jackson-version}</bundle> + <bundle dependency='true'>mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.snappy-java/${snappy-bundle-version}</bundle> + <bundle dependency='true'>mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.netty/${netty-bundle-version}</bundle> + <bundle dependency='true'>mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.paranamer/${paranamer-bundle-version}</bundle> + <bundle dependency='true'>mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.avro/${avro-bundle-version}</bundle> + <bundle dependency='true'>mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.avro-ipc/${avro-bundle-version}</bundle> + <bundle>mvn:org.apache.camel/camel-avro/${project.version}</bundle> + </feature> <feature name='camel-bam' version='${project.version}' resolver='(obr)' start-level='50'> <feature version='[3,4)'>spring-tx</feature> <feature version='[3,4)'>spring-web</feature>