You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by jo...@apache.org on 2011/02/22 21:50:56 UTC

svn commit: r1073494 - in /camel/trunk: components/ components/camel-dns/ components/camel-dns/src/ components/camel-dns/src/main/ components/camel-dns/src/main/java/ components/camel-dns/src/main/java/org/ components/camel-dns/src/main/java/org/apache...

Author: joed
Date: Tue Feb 22 20:50:54 2011
New Revision: 1073494

URL: http://svn.apache.org/viewvc?rev=1073494&view=rev
Log:
New component - Camel-DNS.

https://issues.apache.org/jira/browse/CAMEL-3667

Initial patch check-in from https://issues.apache.org/jira/browse/CAMEL-3667

Many, many thanks to : Antoine Toulme.

2 tests are marked as @Ignored, they are not testable over NAT connections.

Added:
    camel/trunk/components/camel-dns/
    camel/trunk/components/camel-dns/README.rdoc
    camel/trunk/components/camel-dns/pom.xml
    camel/trunk/components/camel-dns/src/
    camel/trunk/components/camel-dns/src/main/
    camel/trunk/components/camel-dns/src/main/java/
    camel/trunk/components/camel-dns/src/main/java/org/
    camel/trunk/components/camel-dns/src/main/java/org/apache/
    camel/trunk/components/camel-dns/src/main/java/org/apache/camel/
    camel/trunk/components/camel-dns/src/main/java/org/apache/camel/component/
    camel/trunk/components/camel-dns/src/main/java/org/apache/camel/component/dns/
    camel/trunk/components/camel-dns/src/main/java/org/apache/camel/component/dns/DNSComponent.java
    camel/trunk/components/camel-dns/src/main/java/org/apache/camel/component/dns/DNSDigEndpoint.java
    camel/trunk/components/camel-dns/src/main/java/org/apache/camel/component/dns/DNSIPEndpoint.java
    camel/trunk/components/camel-dns/src/main/java/org/apache/camel/component/dns/DNSLookupEndpoint.java
    camel/trunk/components/camel-dns/src/main/java/org/apache/camel/component/dns/WikipediaEndpoint.java
    camel/trunk/components/camel-dns/src/main/java/org/apache/camel/component/dns/types/
    camel/trunk/components/camel-dns/src/main/java/org/apache/camel/component/dns/types/DNSConverter.java
    camel/trunk/components/camel-dns/src/main/java/org/apache/camel/component/dns/types/DNSRecordConverter.java
    camel/trunk/components/camel-dns/src/main/resources/
    camel/trunk/components/camel-dns/src/main/resources/META-INF/
    camel/trunk/components/camel-dns/src/main/resources/META-INF/services/
    camel/trunk/components/camel-dns/src/main/resources/META-INF/services/org/
    camel/trunk/components/camel-dns/src/main/resources/META-INF/services/org/apache/
    camel/trunk/components/camel-dns/src/main/resources/META-INF/services/org/apache/camel/
    camel/trunk/components/camel-dns/src/main/resources/META-INF/services/org/apache/camel/TypeConverter
    camel/trunk/components/camel-dns/src/main/resources/META-INF/services/org/apache/camel/component/
    camel/trunk/components/camel-dns/src/main/resources/META-INF/services/org/apache/camel/component/dns
    camel/trunk/components/camel-dns/src/test/
    camel/trunk/components/camel-dns/src/test/java/
    camel/trunk/components/camel-dns/src/test/java/org/
    camel/trunk/components/camel-dns/src/test/java/org/apache/
    camel/trunk/components/camel-dns/src/test/java/org/apache/camel/
    camel/trunk/components/camel-dns/src/test/java/org/apache/camel/component/
    camel/trunk/components/camel-dns/src/test/java/org/apache/camel/component/dns/
    camel/trunk/components/camel-dns/src/test/java/org/apache/camel/component/dns/DNSDigEndpointSpringTest.java
    camel/trunk/components/camel-dns/src/test/java/org/apache/camel/component/dns/DNSDigEndpointTest.java
    camel/trunk/components/camel-dns/src/test/java/org/apache/camel/component/dns/DNSIPEndpointSpringTest.java
    camel/trunk/components/camel-dns/src/test/java/org/apache/camel/component/dns/DNSIPEndpointTest.java
    camel/trunk/components/camel-dns/src/test/java/org/apache/camel/component/dns/DNSLookupEndpointSpringTest.java
    camel/trunk/components/camel-dns/src/test/java/org/apache/camel/component/dns/DNSLookupEndpointTest.java
    camel/trunk/components/camel-dns/src/test/java/org/apache/camel/component/dns/WikipediaEndpointSpringTest.java
    camel/trunk/components/camel-dns/src/test/java/org/apache/camel/component/dns/WikipediaEndpointTest.java
    camel/trunk/components/camel-dns/src/test/resources/
    camel/trunk/components/camel-dns/src/test/resources/DNSDig.xml
    camel/trunk/components/camel-dns/src/test/resources/DNSLookup.xml
    camel/trunk/components/camel-dns/src/test/resources/IPCheck.xml
    camel/trunk/components/camel-dns/src/test/resources/Wikipedia.xml
    camel/trunk/components/camel-dns/src/test/resources/log4j.properties
Modified:
    camel/trunk/components/pom.xml
    camel/trunk/parent/pom.xml

Added: camel/trunk/components/camel-dns/README.rdoc
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-dns/README.rdoc?rev=1073494&view=auto
==============================================================================
--- camel/trunk/components/camel-dns/README.rdoc (added)
+++ camel/trunk/components/camel-dns/README.rdoc Tue Feb 22 20:50:54 2011
@@ -0,0 +1,64 @@
+=Camel-DNS
+
+This is an additional component for Camel to run DNS queries, using DNSJava.
+
+The component should be a thin layer on top of DNSJava.
+
+==License
+
+Licensed under ASL 2.0
+
+See the LICENSE file.
+
+=Functionalities
+
+==IP lookup
+
+<code>
+        <route id="IPCheck">
+            <from uri="direct:start"/>
+            <to uri="dns:ip"/>
+            ...
+        </route>
+</code>
+
+This looks up a domain's IP. For example, www.example.com resolves to 192.0.32.10.
+
+The dns:ip URI will look for those headers:
+* dns.domain: the domain name.
+
+==DNS lookup
+
+<code>
+        <route id="IPCheck">
+            <from uri="direct:start"/>
+            <to uri="dns:lookup"/>
+            ...
+        </route>
+</code>
+
+This returns a set of DNS records associated with a domain.
+
+The dns:lookup URI will look for those headers:
+* dns.name: the lookup name. Usually the domain. Mandatory.
+* dns.type: the type of the lookup. Should match the values of org.xbill.dns.Type. Optional.
+* dns.class: the DNS class of the lookup. Should match the values of org.xbill.dns.DClass. Optional.
+
+==DNS Dig
+
+Dig is a Unix command-line utility to run DNS queries.
+
+<code>
+        <route id="IPCheck">
+            <from uri="direct:start"/>
+            <to uri="dns:dig"/>
+            ....
+        </route>
+</code>
+
+
+The dns:dig URI will look for those headers:
+* dns.server: the server in particular for the query. If none is given, the default one specified by the OS will be used.
+* dns.query: the query itself. Mandatory.
+* dns.type: the type of the lookup. Should match the values of org.xbill.dns.Type. Optional.
+* dns.class: the DNS class of the lookup. Should match the values org.xbill.dns.DClass. Optional.

Added: camel/trunk/components/camel-dns/pom.xml
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-dns/pom.xml?rev=1073494&view=auto
==============================================================================
--- camel/trunk/components/camel-dns/pom.xml (added)
+++ camel/trunk/components/camel-dns/pom.xml Tue Feb 22 20:50:54 2011
@@ -0,0 +1,87 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+  <parent>
+    <groupId>org.apache.camel</groupId>
+    <artifactId>camel-parent</artifactId>
+    <version>2.7-SNAPSHOT</version>
+    <relativePath>../../parent</relativePath>
+  </parent>
+
+  <name>Camel :: DNS</name>
+  <artifactId>camel-dns</artifactId>
+  <description>Camel :: DNS support</description>
+  <packaging>bundle</packaging>
+
+  <properties>
+    <camel.osgi.export.pkg>
+      org.apache.camel.component.dns*
+    </camel.osgi.export.pkg>
+
+    <camel.osgi.import.pkg>
+      !org.apache.camel.component.dns*,
+      *
+    </camel.osgi.import.pkg>
+  </properties>
+
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.camel</groupId>
+      <artifactId>camel-core</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>dnsjava</groupId>
+      <artifactId>dnsjava</artifactId>
+      <version>${dnsjava-version}</version>
+    </dependency>
+
+    <!-- Testing -->
+
+    <dependency>
+      <groupId>org.apache.camel</groupId>
+      <artifactId>camel-core</artifactId>
+      <type>test-jar</type>
+      <scope>test</scope>
+    </dependency>
+
+    <dependency>
+      <groupId>org.apache.camel</groupId>
+      <artifactId>camel-core-xml</artifactId>
+      <scope>test</scope>
+    </dependency>
+
+    <dependency>
+      <groupId>org.apache.camel</groupId>
+      <artifactId>camel-test</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.camel</groupId>
+      <artifactId>camel-spring</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.camel</groupId>
+      <artifactId>camel-spring</artifactId>
+      <type>test-jar</type>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-log4j12</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>log4j</groupId>
+      <artifactId>log4j</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <scope>test</scope>
+    </dependency>
+  </dependencies>
+
+</project>
\ No newline at end of file

Added: camel/trunk/components/camel-dns/src/main/java/org/apache/camel/component/dns/DNSComponent.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-dns/src/main/java/org/apache/camel/component/dns/DNSComponent.java?rev=1073494&view=auto
==============================================================================
--- camel/trunk/components/camel-dns/src/main/java/org/apache/camel/component/dns/DNSComponent.java (added)
+++ camel/trunk/components/camel-dns/src/main/java/org/apache/camel/component/dns/DNSComponent.java Tue Feb 22 20:50:54 2011
@@ -0,0 +1,98 @@
+/**
+ * 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.dns;
+
+import java.util.Map;
+
+import org.apache.camel.Endpoint;
+import org.apache.camel.impl.DefaultComponent;
+
+/**
+ * 
+ *         The DNS components creates endpoints of the form: <br/>
+ *         dns:///... <br/>
+ *         At this point, the DNS component works with these operations:<br/>
+ *         <p>
+ *         dns:///ip <br/>
+ * 
+ *         This will return the IP address associated with the domain passed in
+ *         the header dns.domain.
+ *         </p>
+ *         <p>
+ *         dns:///lookup This endpoint accepts three parameters.
+ *         <ul>
+ *         <li>dns.name: the lookup name. Usually the domain. Mandatory.</li>
+ *         <li>dns.type: the type of the lookup. Should match the values of
+ *         {@see org.xbill.dns.Type}. Optional.</li>
+ *         <li>dns.class: the DNS class of the lookup. Should match the values
+ *         of {@see org.xbill.dns.DClass}. Optional.</li>
+ *         </ul>
+ *         </p>
+ * 
+ *         <p>
+ *         dns:///dig This endpoint takes a few parameters, most of them
+ *         optional :
+ *         <ul>
+ *         <li>dns.server: the server in particular for the query. If none is
+ *         given, the default one specified by the OS will be used.</li>
+ *         <li>dns.query: the query itself. Mandatory.</li>
+ *         <li>dns.type: the type of the lookup. Should match the values of
+ *         {@see org.xbill.dns.Type}. Optional.</li>
+ *         <li>dns.class: the DNS class of the lookup. Should match the values
+ *         of {@see org.xbill.dns.DClass}. Optional.</li>
+ *         </ul>
+ * 
+ *         </p>
+ *         
+ *         <p>
+ *         dns:///wikipedia This endpoint takes one paramter :
+ *         <ul>
+ *         <li>term: the search term on wikipedia</li>
+ *         </ul>
+ * 
+ *         </p>
+ * 
+ */
+public class DNSComponent extends DefaultComponent {
+
+    private static final String OPERATION_IP = "ip";
+
+    private static final String OPERATION_LOOKUP = "lookup";
+
+    private static final String OPERATION_DIG = "dig";
+    
+    private static final String OPERATION_WIKIPEDIA = "wikipedia";
+
+    protected Endpoint createEndpoint(String uri, String remaining,
+            Map<String, Object> parameters) throws Exception {
+        if (OPERATION_IP.equals(remaining)) {
+            return new DNSIPEndpoint(getCamelContext());
+        } else if (OPERATION_LOOKUP.equals(remaining)) {
+            return new DNSLookupEndpoint(getCamelContext());
+        } else if (OPERATION_DIG.equals(remaining)) {
+            return new DNSDigEndpoint(getCamelContext());
+        } else if (OPERATION_WIKIPEDIA.equals(remaining)) {
+            return new WikipediaEndpoint(getCamelContext());
+        }else {
+            throw new IllegalArgumentException(uri
+                    + "is unsupported by the DNS component");
+        }
+    }
+
+}

Added: camel/trunk/components/camel-dns/src/main/java/org/apache/camel/component/dns/DNSDigEndpoint.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-dns/src/main/java/org/apache/camel/component/dns/DNSDigEndpoint.java?rev=1073494&view=auto
==============================================================================
--- camel/trunk/components/camel-dns/src/main/java/org/apache/camel/component/dns/DNSDigEndpoint.java (added)
+++ camel/trunk/components/camel-dns/src/main/java/org/apache/camel/component/dns/DNSDigEndpoint.java Tue Feb 22 20:50:54 2011
@@ -0,0 +1,93 @@
+/**
+ * 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.dns;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.Consumer;
+import org.apache.camel.Exchange;
+import org.apache.camel.Processor;
+import org.apache.camel.Producer;
+import org.apache.camel.impl.DefaultEndpoint;
+import org.apache.camel.impl.DefaultProducer;
+import org.xbill.DNS.DClass;
+import org.xbill.DNS.Message;
+import org.xbill.DNS.Name;
+import org.xbill.DNS.Record;
+import org.xbill.DNS.SimpleResolver;
+import org.xbill.DNS.Type;
+
+/**
+ *         An endpoint for dig-like operations over DNS adresses.
+ * 
+ *         Inspired from Dig.java coming with the distribution of dnsjava,
+ *         though most if not all options are unsupported.
+ */
+public class DNSDigEndpoint extends DefaultEndpoint {
+
+    private static final String DNS_SERVER = "dns.server";
+    private static final String DNS_TYPE = "dns.type";
+    private static final String DNS_CLASS = "dns.class";
+    private static final String DNS_NAME = "dns.name";
+
+    public DNSDigEndpoint(CamelContext ctxt) {
+        super("dns://dig", ctxt);
+    }
+
+    public Consumer createConsumer(Processor arg0) throws Exception {
+        throw new UnsupportedOperationException();
+    }
+
+    public Producer createProducer() throws Exception {
+        return new DefaultProducer(this) {
+
+            public void process(Exchange exchange) throws Exception {
+                String server = null;
+                if (exchange.getIn().getHeader(DNS_SERVER) != null) {
+                    server = String.valueOf(exchange.getIn().
+                            getHeader(DNS_SERVER));
+                }
+                SimpleResolver resolver = new SimpleResolver(server);
+                int type = Type.value(String.valueOf(exchange.getIn()
+                        .getHeader(DNS_TYPE)));
+                if (type == -1) {
+                    // default: if unparsable value given, use A.
+                    type = Type.A;
+                }
+                int dclass = DClass.value(String.valueOf(exchange.getIn()
+                        .getHeader(DNS_CLASS)));
+                if (dclass == -1) {
+                    // by default, value is IN.
+                    dclass = DClass.IN;
+                }
+                Name name = Name.fromString(
+                        String.valueOf(exchange.getIn().getHeader(DNS_NAME)),
+                        Name.root);
+                Record rec = Record.newRecord(name, type, dclass);
+                Message query = Message.newQuery(rec);
+                Message response = resolver.send(query);
+                exchange.getOut().setBody(response);
+            }
+        };
+    }
+
+    public boolean isSingleton() {
+        return false;
+    }
+
+}

Added: camel/trunk/components/camel-dns/src/main/java/org/apache/camel/component/dns/DNSIPEndpoint.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-dns/src/main/java/org/apache/camel/component/dns/DNSIPEndpoint.java?rev=1073494&view=auto
==============================================================================
--- camel/trunk/components/camel-dns/src/main/java/org/apache/camel/component/dns/DNSIPEndpoint.java (added)
+++ camel/trunk/components/camel-dns/src/main/java/org/apache/camel/component/dns/DNSIPEndpoint.java Tue Feb 22 20:50:54 2011
@@ -0,0 +1,67 @@
+/**
+ * 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.dns;
+
+import java.net.InetAddress;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.Consumer;
+import org.apache.camel.Exchange;
+import org.apache.camel.Processor;
+import org.apache.camel.Producer;
+import org.apache.camel.impl.DefaultEndpoint;
+import org.apache.camel.impl.DefaultProducer;
+import org.xbill.DNS.Address;
+
+/**
+ * 
+ *         An endpoint to conduct IP address lookup from the host name.
+ * 
+ */
+public class DNSIPEndpoint extends DefaultEndpoint {
+
+    public DNSIPEndpoint(CamelContext context) {
+        super("dns://ip", context);
+    }
+
+    public Consumer createConsumer(Processor arg0) throws Exception {
+        throw new UnsupportedOperationException();
+    }
+
+    public Producer createProducer() throws Exception {
+        return new DefaultProducer(this) {
+
+            public void process(Exchange exchange) throws Exception {
+                Object domain = exchange.getIn().getHeader("dns.domain");
+                if (!(domain instanceof String)
+                        || ((String) domain).length() == 0) {
+                    throw new IllegalArgumentException(
+                            "Invalid or null domain :" + domain);
+                }
+                InetAddress address = Address.getByName((String) domain);
+                exchange.getOut().setBody(address);
+            }
+        };
+    }
+
+    public boolean isSingleton() {
+        return false;
+    }
+
+}

Added: camel/trunk/components/camel-dns/src/main/java/org/apache/camel/component/dns/DNSLookupEndpoint.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-dns/src/main/java/org/apache/camel/component/dns/DNSLookupEndpoint.java?rev=1073494&view=auto
==============================================================================
--- camel/trunk/components/camel-dns/src/main/java/org/apache/camel/component/dns/DNSLookupEndpoint.java (added)
+++ camel/trunk/components/camel-dns/src/main/java/org/apache/camel/component/dns/DNSLookupEndpoint.java Tue Feb 22 20:50:54 2011
@@ -0,0 +1,95 @@
+/**
+ * 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.dns;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.Consumer;
+import org.apache.camel.Exchange;
+import org.apache.camel.Processor;
+import org.apache.camel.Producer;
+import org.apache.camel.impl.DefaultEndpoint;
+import org.apache.camel.impl.DefaultProducer;
+import org.xbill.DNS.DClass;
+import org.xbill.DNS.Lookup;
+import org.xbill.DNS.Type;
+
+/**
+ * 
+ *         An endpoint to manage lookup operations, using the API from dnsjava.
+ * 
+ */
+public class DNSLookupEndpoint extends DefaultEndpoint {
+
+    private static final String DNS_NAME = "dns.name";
+    private static final String DNS_TYPE = "dns.type";
+    private static final String DNS_CLASS = "dns.class";
+
+    public DNSLookupEndpoint(CamelContext context) {
+        super("dns://lookup", context);
+    }
+
+    public Consumer createConsumer(Processor processor) throws Exception {
+        throw new UnsupportedOperationException();
+    }
+
+    public Producer createProducer() throws Exception {
+        return new DefaultProducer(this) {
+
+            public void process(Exchange exchange) throws Exception {
+                Object name = exchange.getIn().getHeader(DNS_NAME);
+                if (name == null || "".equals(name)) {
+                    throw new IllegalArgumentException("name is null or empty");
+                }
+                String dns_name = String.valueOf(name);
+                Object type = exchange.getIn().getHeader(DNS_TYPE);
+                Integer dns_type = null;
+                if (type != null) {
+                    dns_type = Type.value(String.valueOf(type));
+                }
+                Object dclass = exchange.getIn().getHeader(DNS_CLASS);
+                Integer dns_class = null;
+                if (dclass != null) {
+                    dns_class = DClass.value(String.valueOf(dclass));
+                }
+
+                Lookup lookup = null;
+                if (dns_type != null && dns_class != null) {
+                    lookup = new Lookup(dns_name, dns_type, dns_class);
+                } else if (dns_type != null) {
+                    lookup = new Lookup(dns_name, dns_type);
+                } else {
+                    lookup = new Lookup(dns_name);
+                }
+
+                lookup.run();
+                if (lookup.getAnswers() != null) {
+                    exchange.getOut().setBody(lookup.getAnswers());
+                } else {
+                    exchange.getOut().setBody(lookup.getErrorString());
+                }
+            }
+
+        };
+    }
+
+    public boolean isSingleton() {
+        return false;
+    }
+
+}

Added: camel/trunk/components/camel-dns/src/main/java/org/apache/camel/component/dns/WikipediaEndpoint.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-dns/src/main/java/org/apache/camel/component/dns/WikipediaEndpoint.java?rev=1073494&view=auto
==============================================================================
--- camel/trunk/components/camel-dns/src/main/java/org/apache/camel/component/dns/WikipediaEndpoint.java (added)
+++ camel/trunk/components/camel-dns/src/main/java/org/apache/camel/component/dns/WikipediaEndpoint.java Tue Feb 22 20:50:54 2011
@@ -0,0 +1,87 @@
+/**
+ * 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.dns;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.Consumer;
+import org.apache.camel.Exchange;
+import org.apache.camel.Processor;
+import org.apache.camel.Producer;
+import org.apache.camel.impl.DefaultEndpoint;
+import org.apache.camel.impl.DefaultProducer;
+import org.xbill.DNS.DClass;
+import org.xbill.DNS.Message;
+import org.xbill.DNS.Name;
+import org.xbill.DNS.Record;
+import org.xbill.DNS.Section;
+import org.xbill.DNS.SimpleResolver;
+import org.xbill.DNS.Type;
+
+/**
+ * 
+ * an endpoint to make queries against wikipedia using
+ * the short TXT query.
+ * 
+ * See here for a reference:
+ * http://www.commandlinefu.com/commands/view/2829/query-wikipedia-via-console-over-dns
+ * 
+ * This endpoint accepts the following header:
+ * term: a simple term to use to query wikipedia.
+ *
+ */
+public class WikipediaEndpoint extends DefaultEndpoint {
+    
+    private static final String TERM = "term";
+    
+    public WikipediaEndpoint(CamelContext context) {
+        super("dns:///wikipedia", context);
+    }
+
+    public Consumer createConsumer(Processor processor) throws Exception {
+        throw new UnsupportedOperationException();
+    }
+
+    public Producer createProducer() throws Exception {
+        return new DefaultProducer(this) {
+
+            public void process(Exchange exchange) throws Exception {
+                SimpleResolver resolver = new SimpleResolver();
+                int type = Type.TXT;
+                Name name = Name.fromString(
+                        String.valueOf(
+                                exchange.getIn().getHeader(TERM)) + ".wp.dg.cx",
+                        Name.root);
+                Record rec = Record.newRecord(name, type, DClass.IN);
+                Message query = Message.newQuery(rec);
+                Message response = resolver.send(query);
+                Record[] records = response.getSectionArray(Section.ANSWER);
+                if (records.length > 0) {
+                    exchange.getOut().setBody(records[0].rdataToString());
+                } else {
+                    exchange.getOut().setBody(null);
+                }
+            }
+        };
+    }
+
+    public boolean isSingleton() {
+        return false;
+    }
+
+}

Added: camel/trunk/components/camel-dns/src/main/java/org/apache/camel/component/dns/types/DNSConverter.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-dns/src/main/java/org/apache/camel/component/dns/types/DNSConverter.java?rev=1073494&view=auto
==============================================================================
--- camel/trunk/components/camel-dns/src/main/java/org/apache/camel/component/dns/types/DNSConverter.java (added)
+++ camel/trunk/components/camel-dns/src/main/java/org/apache/camel/component/dns/types/DNSConverter.java Tue Feb 22 20:50:54 2011
@@ -0,0 +1,106 @@
+/**
+ * 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.dns.types;
+
+import java.net.InetAddress;
+import java.net.UnknownHostException;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.camel.Converter;
+import org.xbill.DNS.Address;
+import org.xbill.DNS.DClass;
+import org.xbill.DNS.ExtendedResolver;
+import org.xbill.DNS.Message;
+import org.xbill.DNS.Name;
+import org.xbill.DNS.Record;
+import org.xbill.DNS.Resolver;
+import org.xbill.DNS.ReverseMap;
+import org.xbill.DNS.Section;
+import org.xbill.DNS.Type;
+
+/**
+ * 
+ * A converter for all the DNS objects used by the DNS component.
+ *
+ */
+@Converter
+public class DNSConverter {
+
+    /**
+     * @param record
+     * @return the String representation of a record.
+     */
+    @Converter
+    public String convert(Record record) {
+        return record.toString();
+    }
+    
+    /**
+     * @param records
+     * @return the String representation of a record.
+     */
+    @Converter
+    public List<String> convert(Record[] records) {
+        List<String> list = new ArrayList<String>();
+        for (Record rec : records) {
+            list.add(convert(rec));
+        }
+        return list;
+    }
+    
+    /**
+     * @param message
+     * @return the String representation of a message.
+     */
+    @Converter
+    public String convert(Message message) {
+        return message.toString();
+    }
+    
+    /**
+     * 
+     * @param address a DNS address
+     * @return its String representation.
+     */
+    @Converter
+    public String convert(Address address) {
+        return address.toString();
+    }
+    
+    /**
+     * 
+     * @param address
+     * @return the host name of the address.
+     */
+    @Converter
+    public String convert(InetAddress address) {
+        return address.getHostAddress();
+    }
+    
+    /**
+     * @param domain
+     * @return the InetAddress object for a given domain.
+     * @throws UnknownHostException
+     */
+    @Converter
+    public InetAddress convert(String domain) throws UnknownHostException {
+        return Address.getByName((String) domain);
+    }
+}

Added: camel/trunk/components/camel-dns/src/main/java/org/apache/camel/component/dns/types/DNSRecordConverter.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-dns/src/main/java/org/apache/camel/component/dns/types/DNSRecordConverter.java?rev=1073494&view=auto
==============================================================================
--- camel/trunk/components/camel-dns/src/main/java/org/apache/camel/component/dns/types/DNSRecordConverter.java (added)
+++ camel/trunk/components/camel-dns/src/main/java/org/apache/camel/component/dns/types/DNSRecordConverter.java Tue Feb 22 20:50:54 2011
@@ -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.dns.types;
+
+import java.io.IOException;
+import org.xbill.DNS.DClass;
+import org.xbill.DNS.ExtendedResolver;
+import org.xbill.DNS.Message;
+import org.xbill.DNS.Name;
+import org.xbill.DNS.Record;
+import org.xbill.DNS.Resolver;
+import org.xbill.DNS.ReverseMap;
+import org.xbill.DNS.Section;
+import org.xbill.DNS.Type;
+
+/**
+ * 
+ * More converters for all the DNS objects used by the DNS component.
+ *
+ */
+public class DNSRecordConverter {
+
+    /**
+     * @param ip, like "192.168.1.1"
+     * @return the complete DNS record for that IP.
+     * @throws IOException
+     */
+    public Record convert(String ip) throws IOException {
+        Resolver res = new ExtendedResolver();
+
+        Name name = ReverseMap.fromAddress(ip);
+        int type = Type.PTR;
+        int dclass = DClass.IN;
+        Record rec = Record.newRecord(name, type, dclass);
+        Message query = Message.newQuery(rec);
+        Message response = res.send(query);
+
+        Record[] answers = response.getSectionArray(Section.ANSWER);
+        if (answers.length == 0)
+           return null;
+        else
+           return answers[0];
+    }
+    
+}

Added: camel/trunk/components/camel-dns/src/main/resources/META-INF/services/org/apache/camel/TypeConverter
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-dns/src/main/resources/META-INF/services/org/apache/camel/TypeConverter?rev=1073494&view=auto
==============================================================================
--- camel/trunk/components/camel-dns/src/main/resources/META-INF/services/org/apache/camel/TypeConverter (added)
+++ camel/trunk/components/camel-dns/src/main/resources/META-INF/services/org/apache/camel/TypeConverter Tue Feb 22 20:50:54 2011
@@ -0,0 +1 @@
+org.apache.camel.component.dns.types
\ No newline at end of file

Added: camel/trunk/components/camel-dns/src/main/resources/META-INF/services/org/apache/camel/component/dns
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-dns/src/main/resources/META-INF/services/org/apache/camel/component/dns?rev=1073494&view=auto
==============================================================================
--- camel/trunk/components/camel-dns/src/main/resources/META-INF/services/org/apache/camel/component/dns (added)
+++ camel/trunk/components/camel-dns/src/main/resources/META-INF/services/org/apache/camel/component/dns Tue Feb 22 20:50:54 2011
@@ -0,0 +1,19 @@
+#
+# 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.
+#
+class=org.apache.camel.component.dns.DNSComponent
\ No newline at end of file

Added: camel/trunk/components/camel-dns/src/test/java/org/apache/camel/component/dns/DNSDigEndpointSpringTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-dns/src/test/java/org/apache/camel/component/dns/DNSDigEndpointSpringTest.java?rev=1073494&view=auto
==============================================================================
--- camel/trunk/components/camel-dns/src/test/java/org/apache/camel/component/dns/DNSDigEndpointSpringTest.java (added)
+++ camel/trunk/components/camel-dns/src/test/java/org/apache/camel/component/dns/DNSDigEndpointSpringTest.java Tue Feb 22 20:50:54 2011
@@ -0,0 +1,74 @@
+/**
+ * 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.dns;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.camel.EndpointInject;
+import org.apache.camel.Exchange;
+import org.apache.camel.Predicate;
+import org.apache.camel.Produce;
+import org.apache.camel.ProducerTemplate;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.test.junit4.CamelSpringTestSupport;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.springframework.context.support.AbstractApplicationContext;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+import org.xbill.DNS.Message;
+import org.xbill.DNS.Section;
+
+/**
+ * Tests for the dig endpoint.
+ */
+public class DNSDigEndpointSpringTest extends CamelSpringTestSupport {
+
+    private static final String RESPONSE_MONKEY = "\"A monkey is a nonhuman "
+        + "primate mammal with the exception usually of the lemurs and tarsiers. More specifically, the term monkey refers to a subset "
+        + "of monkeys: any of the smaller longer-tailed catarrhine or " + "platyrrhine primates as contrasted with the apes.\" "
+        + "\" http://en.wikipedia.org/wiki/Monkey\"";
+
+    @EndpointInject(uri = "mock:result")
+    protected MockEndpoint resultEndpoint;
+
+    @Produce(uri = "direct:start")
+    protected ProducerTemplate template;
+
+    @Override
+    protected AbstractApplicationContext createApplicationContext() {
+        return new ClassPathXmlApplicationContext("DNSDig.xml");
+    }
+
+    @Test
+    @Ignore("Testing behind nat produces timeouts")
+    public void testDigForMonkey() throws Exception {
+        resultEndpoint.expectedMessageCount(1);
+        resultEndpoint.expectedMessagesMatches(new Predicate() {
+            public boolean matches(Exchange exchange) {
+                String str = ((Message) exchange.getIn().getBody()).getSectionArray(Section.ANSWER)[0].rdataToString();
+                return RESPONSE_MONKEY.equals(str);
+            }
+        });
+        Map<String, Object> headers = new HashMap<String, Object>();
+        headers.put("dns.name", "monkey.wp.dg.cx");
+        headers.put("dns.type", "TXT");
+        template.sendBodyAndHeaders(null, headers);
+        resultEndpoint.assertIsSatisfied();
+    }
+
+}

Added: camel/trunk/components/camel-dns/src/test/java/org/apache/camel/component/dns/DNSDigEndpointTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-dns/src/test/java/org/apache/camel/component/dns/DNSDigEndpointTest.java?rev=1073494&view=auto
==============================================================================
--- camel/trunk/components/camel-dns/src/test/java/org/apache/camel/component/dns/DNSDigEndpointTest.java (added)
+++ camel/trunk/components/camel-dns/src/test/java/org/apache/camel/component/dns/DNSDigEndpointTest.java Tue Feb 22 20:50:54 2011
@@ -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.dns;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.camel.EndpointInject;
+import org.apache.camel.Exchange;
+import org.apache.camel.Predicate;
+import org.apache.camel.Produce;
+import org.apache.camel.ProducerTemplate;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.test.junit4.CamelTestSupport;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.xbill.DNS.Message;
+import org.xbill.DNS.Section;
+
+/**
+ * Tests for the dig endpoint.
+ */
+public class DNSDigEndpointTest extends CamelTestSupport {
+
+    private static final String RESPONSE_MONKEY = "\"A monkey is a nonhuman " + "primate mammal with the exception usually of the lemurs and "
+        + "tarsiers. More specifically, the term monkey refers to a subset " + "of monkeys: any of the smaller longer-tailed catarrhine or "
+        + "platyrrhine primates as contrasted with the apes.\" " + "\" http://en.wikipedia.org/wiki/Monkey\"";
+
+    @EndpointInject(uri = "mock:result")
+    protected MockEndpoint resultEndpoint;
+
+    @Produce(uri = "direct:start")
+    protected ProducerTemplate template;
+
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        RouteBuilder routeBuilder = super.createRouteBuilder();
+
+        routeBuilder.from("direct:start").to("dns:dig").to("mock:result");
+
+        return routeBuilder;
+    }
+
+    @Test
+    @Ignore("Testing behind nat produces timeouts")
+    public void testDigForMonkey() throws Exception {
+        resultEndpoint.expectedMessageCount(1);
+        resultEndpoint.expectedMessagesMatches(new Predicate() {
+            public boolean matches(Exchange exchange) {
+                String str = ((Message) exchange.getIn().getBody()).getSectionArray(Section.ANSWER)[0].rdataToString();
+                return RESPONSE_MONKEY.equals(str);
+            }
+        });
+        Map<String, Object> headers = new HashMap<String, Object>();
+        headers.put("dns.name", "monkey.wp.dg.cx");
+        headers.put("dns.type", "TXT");
+        template.sendBodyAndHeaders(null, headers);
+        resultEndpoint.assertIsSatisfied();
+    }
+
+}

Added: camel/trunk/components/camel-dns/src/test/java/org/apache/camel/component/dns/DNSIPEndpointSpringTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-dns/src/test/java/org/apache/camel/component/dns/DNSIPEndpointSpringTest.java?rev=1073494&view=auto
==============================================================================
--- camel/trunk/components/camel-dns/src/test/java/org/apache/camel/component/dns/DNSIPEndpointSpringTest.java (added)
+++ camel/trunk/components/camel-dns/src/test/java/org/apache/camel/component/dns/DNSIPEndpointSpringTest.java Tue Feb 22 20:50:54 2011
@@ -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.dns;
+
+import org.apache.camel.EndpointInject;
+import org.apache.camel.Produce;
+import org.apache.camel.ProducerTemplate;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.test.junit4.CamelSpringTestSupport;
+import org.junit.Test;
+import org.springframework.context.support.AbstractApplicationContext;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+
+/**
+ * A series of tests to check the IP lookup operation.
+ */
+public class DNSIPEndpointSpringTest extends CamelSpringTestSupport {
+
+    @EndpointInject(uri = "mock:result")
+    protected MockEndpoint resultEndpoint;
+
+    @Produce(uri = "direct:start")
+    protected ProducerTemplate template;
+
+    @Test
+    public void testNullIPRequests() throws Exception {
+        resultEndpoint.expectedMessageCount(0);
+        try {
+            template.sendBodyAndHeader("hello", "dns.domain", null);
+        } catch (Throwable t) {
+            assertTrue(t.getCause() instanceof IllegalArgumentException);
+        }
+        resultEndpoint.assertIsSatisfied();
+    }
+
+    @Test
+    public void testEmptyIPRequests() throws Exception {
+        resultEndpoint.expectedMessageCount(0);
+        try {
+            template.sendBodyAndHeader("hello", "dns.domain", "");
+        } catch (Throwable t) {
+            assertTrue(t.getCause() instanceof IllegalArgumentException);
+        }
+        resultEndpoint.assertIsSatisfied();
+    }
+
+    @Test
+    public void testValidIPRequests() throws Exception {
+        resultEndpoint.expectedMessageCount(1);
+
+        resultEndpoint.expectedBodiesReceived("192.0.32.10");
+
+        template.sendBodyAndHeader("hello", "dns.domain", "www.example.com");
+        resultEndpoint.assertIsSatisfied();
+    }
+
+    @Override
+    protected AbstractApplicationContext createApplicationContext() {
+        return new ClassPathXmlApplicationContext("IPCheck.xml");
+    }
+}

Added: camel/trunk/components/camel-dns/src/test/java/org/apache/camel/component/dns/DNSIPEndpointTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-dns/src/test/java/org/apache/camel/component/dns/DNSIPEndpointTest.java?rev=1073494&view=auto
==============================================================================
--- camel/trunk/components/camel-dns/src/test/java/org/apache/camel/component/dns/DNSIPEndpointTest.java (added)
+++ camel/trunk/components/camel-dns/src/test/java/org/apache/camel/component/dns/DNSIPEndpointTest.java Tue Feb 22 20:50:54 2011
@@ -0,0 +1,77 @@
+/**
+ * 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.dns;
+
+import org.apache.camel.EndpointInject;
+import org.apache.camel.Produce;
+import org.apache.camel.ProducerTemplate;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.test.junit4.CamelTestSupport;
+import org.junit.Test;
+
+/**
+ * A series of tests to check the IP lookup operation.
+ */
+public class DNSIPEndpointTest extends CamelTestSupport {
+
+    @EndpointInject(uri = "mock:result")
+    protected MockEndpoint resultEndpoint;
+
+    @Produce(uri = "direct:start")
+    protected ProducerTemplate template;
+
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        RouteBuilder routeBuilder = super.createRouteBuilder();
+
+        routeBuilder.from("direct:start").to("dns:ip").to("mock:result");
+
+        return routeBuilder;
+    }
+
+    @Test
+    public void testNullIPRequests() throws Exception {
+        resultEndpoint.expectedMessageCount(0);
+        try {
+            template.sendBodyAndHeader("hello", "dns.domain", null);
+        } catch (Throwable t) {
+            assertTrue(t.getCause() instanceof IllegalArgumentException);
+        }
+        resultEndpoint.assertIsSatisfied();
+    }
+
+    @Test
+    public void testEmptyIPRequests() throws Exception {
+        resultEndpoint.expectedMessageCount(0);
+        try {
+            template.sendBodyAndHeader("hello", "dns.domain", "");
+        } catch (Throwable t) {
+            assertTrue(t.getCause() instanceof IllegalArgumentException);
+        }
+        resultEndpoint.assertIsSatisfied();
+    }
+
+    @Test
+    public void testValidIPRequests() throws Exception {
+        resultEndpoint.expectedMessageCount(1);
+
+        resultEndpoint.expectedBodiesReceived("192.0.32.10");
+
+        template.sendBodyAndHeader("hello", "dns.domain", "www.example.com");
+        resultEndpoint.assertIsSatisfied();
+    }
+}

Added: camel/trunk/components/camel-dns/src/test/java/org/apache/camel/component/dns/DNSLookupEndpointSpringTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-dns/src/test/java/org/apache/camel/component/dns/DNSLookupEndpointSpringTest.java?rev=1073494&view=auto
==============================================================================
--- camel/trunk/components/camel-dns/src/test/java/org/apache/camel/component/dns/DNSLookupEndpointSpringTest.java (added)
+++ camel/trunk/components/camel-dns/src/test/java/org/apache/camel/component/dns/DNSLookupEndpointSpringTest.java Tue Feb 22 20:50:54 2011
@@ -0,0 +1,103 @@
+/**
+ * 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.dns;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.camel.EndpointInject;
+import org.apache.camel.Exchange;
+import org.apache.camel.Predicate;
+import org.apache.camel.Produce;
+import org.apache.camel.ProducerTemplate;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.test.junit4.CamelSpringTestSupport;
+import org.junit.Test;
+import org.springframework.context.support.AbstractApplicationContext;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+import org.xbill.DNS.Record;
+
+/**
+ * A set of test cases to make DNS lookups.
+ */
+public class DNSLookupEndpointSpringTest extends CamelSpringTestSupport {
+
+    @EndpointInject(uri = "mock:result")
+    protected MockEndpoint resultEndpoint;
+
+    @Produce(uri = "direct:start")
+    protected ProducerTemplate template;
+
+    @Test
+    public void testDNSWithNoHeaders() throws Exception {
+        resultEndpoint.expectedMessageCount(0);
+        try {
+            template.sendBody("hello");
+        } catch (Throwable t) {
+            assertTrue(t.getCause() instanceof IllegalArgumentException);
+        }
+        resultEndpoint.assertIsSatisfied();
+    }
+
+    @Test
+    public void testDNSWithEmptyNameHeader() throws Exception {
+        resultEndpoint.expectedMessageCount(0);
+        try {
+            template.sendBodyAndHeader("hello", "dns.name", "");
+        } catch (Throwable t) {
+
+            assertTrue(t.toString(), t.getCause() instanceof IllegalArgumentException);
+        }
+        resultEndpoint.assertIsSatisfied();
+    }
+
+    @Test
+    public void testDNSWithNameHeader() throws Exception {
+        resultEndpoint.expectedMessageCount(1);
+        resultEndpoint.expectedMessagesMatches(new Predicate() {
+            public boolean matches(Exchange exchange) {
+                Record[] record = (Record[]) exchange.getIn().getBody();
+                return record[0].getName().toString().equals("www.example.com.");
+            }
+        });
+        Map<String, Object> headers = new HashMap<String, Object>();
+        headers.put("dns.name", "www.example.com");
+        template.sendBodyAndHeaders("hello", headers);
+        resultEndpoint.assertIsSatisfied();
+    }
+
+    @Test
+    public void testDNSWithNameHeaderAndType() throws Exception {
+        resultEndpoint.expectedMessageCount(1);
+        resultEndpoint.expectedMessagesMatches(new Predicate() {
+            public boolean matches(Exchange exchange) {
+                Record[] record = (Record[]) exchange.getIn().getBody();
+                return record[0].getName().toString().equals("www.example.com.");
+            }
+        });
+        Map<String, Object> headers = new HashMap<String, Object>();
+        headers.put("dns.name", "www.example.com");
+        headers.put("dns.type", "A");
+        template.sendBodyAndHeaders("hello", headers);
+        resultEndpoint.assertIsSatisfied();
+    }
+
+    @Override
+    protected AbstractApplicationContext createApplicationContext() {
+        return new ClassPathXmlApplicationContext("DNSLookup.xml");
+    }
+}

Added: camel/trunk/components/camel-dns/src/test/java/org/apache/camel/component/dns/DNSLookupEndpointTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-dns/src/test/java/org/apache/camel/component/dns/DNSLookupEndpointTest.java?rev=1073494&view=auto
==============================================================================
--- camel/trunk/components/camel-dns/src/test/java/org/apache/camel/component/dns/DNSLookupEndpointTest.java (added)
+++ camel/trunk/components/camel-dns/src/test/java/org/apache/camel/component/dns/DNSLookupEndpointTest.java Tue Feb 22 20:50:54 2011
@@ -0,0 +1,105 @@
+/**
+ * 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.dns;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.camel.EndpointInject;
+import org.apache.camel.Exchange;
+import org.apache.camel.Predicate;
+import org.apache.camel.Produce;
+import org.apache.camel.ProducerTemplate;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.test.junit4.CamelTestSupport;
+import org.junit.Test;
+import org.xbill.DNS.Record;
+
+/**
+ * A set of test cases to make DNS lookups.
+ */
+public class DNSLookupEndpointTest extends CamelTestSupport {
+
+    @EndpointInject(uri = "mock:result")
+    protected MockEndpoint resultEndpoint;
+
+    @Produce(uri = "direct:start")
+    protected ProducerTemplate template;
+
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        RouteBuilder routeBuilder = super.createRouteBuilder();
+
+        routeBuilder.from("direct:start").to("dns:lookup").to("mock:result");
+
+        return routeBuilder;
+    }
+
+    @Test
+    public void testDNSWithNoHeaders() throws Exception {
+        resultEndpoint.expectedMessageCount(0);
+        try {
+            template.sendBody("hello");
+        } catch (Throwable t) {
+            assertTrue(t.getCause() instanceof IllegalArgumentException);
+        }
+        resultEndpoint.assertIsSatisfied();
+    }
+
+    @Test
+    public void testDNSWithEmptyNameHeader() throws Exception {
+        resultEndpoint.expectedMessageCount(0);
+        try {
+            template.sendBodyAndHeader("hello", "dns.name", "");
+        } catch (Throwable t) {
+
+            assertTrue(t.toString(), t.getCause() instanceof IllegalArgumentException);
+        }
+        resultEndpoint.assertIsSatisfied();
+    }
+
+    @Test
+    public void testDNSWithNameHeader() throws Exception {
+        resultEndpoint.expectedMessageCount(1);
+        resultEndpoint.expectedMessagesMatches(new Predicate() {
+            public boolean matches(Exchange exchange) {
+                Record[] record = (Record[]) exchange.getIn().getBody();
+                return record[0].getName().toString().equals("www.example.com.");
+            }
+        });
+        Map<String, Object> headers = new HashMap<String, Object>();
+        headers.put("dns.name", "www.example.com");
+        template.sendBodyAndHeaders("hello", headers);
+        resultEndpoint.assertIsSatisfied();
+    }
+
+    @Test
+    public void testDNSWithNameHeaderAndType() throws Exception {
+        resultEndpoint.expectedMessageCount(1);
+        resultEndpoint.expectedMessagesMatches(new Predicate() {
+            public boolean matches(Exchange exchange) {
+                Record[] record = (Record[]) exchange.getIn().getBody();
+                return record[0].getName().toString().equals("www.example.com.");
+            }
+        });
+        Map<String, Object> headers = new HashMap<String, Object>();
+        headers.put("dns.name", "www.example.com");
+        headers.put("dns.type", "A");
+        template.sendBodyAndHeaders("hello", headers);
+        resultEndpoint.assertIsSatisfied();
+    }
+}

Added: camel/trunk/components/camel-dns/src/test/java/org/apache/camel/component/dns/WikipediaEndpointSpringTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-dns/src/test/java/org/apache/camel/component/dns/WikipediaEndpointSpringTest.java?rev=1073494&view=auto
==============================================================================
--- camel/trunk/components/camel-dns/src/test/java/org/apache/camel/component/dns/WikipediaEndpointSpringTest.java (added)
+++ camel/trunk/components/camel-dns/src/test/java/org/apache/camel/component/dns/WikipediaEndpointSpringTest.java Tue Feb 22 20:50:54 2011
@@ -0,0 +1,70 @@
+/**
+ * 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.dns;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.camel.EndpointInject;
+import org.apache.camel.Exchange;
+import org.apache.camel.Predicate;
+import org.apache.camel.Produce;
+import org.apache.camel.ProducerTemplate;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.test.junit4.CamelSpringTestSupport;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.springframework.context.support.AbstractApplicationContext;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+
+/**
+ * A test case to check wikipedia records.
+ */
+public class WikipediaEndpointSpringTest extends CamelSpringTestSupport {
+
+    private static final String RESPONSE_MONKEY = "\"A monkey is a nonhuman " + "primate mammal with the exception usually of the lemurs and "
+        + "tarsiers. More specifically, the term monkey refers to a subset " + "of monkeys: any of the smaller longer-tailed catarrhine or "
+        + "platyrrhine primates as contrasted with the apes.\" " + "\" http://en.wikipedia.org/wiki/Monkey\"";
+
+    @EndpointInject(uri = "mock:result")
+    protected MockEndpoint resultEndpoint;
+
+    @Produce(uri = "direct:start")
+    protected ProducerTemplate template;
+
+    @Test
+    @Ignore("Testing behind nat produces timeouts")
+    public void testWikipediaForMonkey() throws Exception {
+        resultEndpoint.expectedMessageCount(1);
+        resultEndpoint.expectedMessagesMatches(new Predicate() {
+            public boolean matches(Exchange exchange) {
+                String str = (String) exchange.getIn().getBody();
+                return RESPONSE_MONKEY.equals(str);
+            }
+        });
+        Map<String, Object> headers = new HashMap<String, Object>();
+        headers.put("term", "monkey");
+        template.sendBodyAndHeaders(null, headers);
+        resultEndpoint.assertIsSatisfied();
+    }
+
+    @Override
+    protected AbstractApplicationContext createApplicationContext() {
+        return new ClassPathXmlApplicationContext("Wikipedia.xml");
+    }
+
+}
\ No newline at end of file

Added: camel/trunk/components/camel-dns/src/test/java/org/apache/camel/component/dns/WikipediaEndpointTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-dns/src/test/java/org/apache/camel/component/dns/WikipediaEndpointTest.java?rev=1073494&view=auto
==============================================================================
--- camel/trunk/components/camel-dns/src/test/java/org/apache/camel/component/dns/WikipediaEndpointTest.java (added)
+++ camel/trunk/components/camel-dns/src/test/java/org/apache/camel/component/dns/WikipediaEndpointTest.java Tue Feb 22 20:50:54 2011
@@ -0,0 +1,72 @@
+/**
+ * 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.dns;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.camel.EndpointInject;
+import org.apache.camel.Exchange;
+import org.apache.camel.Predicate;
+import org.apache.camel.Produce;
+import org.apache.camel.ProducerTemplate;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.test.junit4.CamelTestSupport;
+import org.junit.Ignore;
+import org.junit.Test;
+
+/**
+ * A test case to check wikipedia records.
+ */
+public class WikipediaEndpointTest extends CamelTestSupport {
+
+    private static final String RESPONSE_MONKEY = "\"A monkey is a nonhuman " + "primate mammal with the exception usually of the lemurs and "
+        + "tarsiers. More specifically, the term monkey refers to a subset " + "of monkeys: any of the smaller longer-tailed catarrhine or "
+        + "platyrrhine primates as contrasted with the apes.\" " + "\" http://en.wikipedia.org/wiki/Monkey\"";
+
+    @EndpointInject(uri = "mock:result")
+    protected MockEndpoint resultEndpoint;
+
+    @Produce(uri = "direct:start")
+    protected ProducerTemplate template;
+
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        RouteBuilder routeBuilder = super.createRouteBuilder();
+
+        routeBuilder.from("direct:start").to("dns:wikipedia").to("mock:result");
+
+        return routeBuilder;
+    }
+
+    @Test
+    @Ignore("Testing behind nat produces timeouts")
+    public void testWikipediaForMonkey() throws Exception {
+        resultEndpoint.expectedMessageCount(1);
+        resultEndpoint.expectedMessagesMatches(new Predicate() {
+            public boolean matches(Exchange exchange) {
+                String str = (String) exchange.getIn().getBody();
+                return RESPONSE_MONKEY.equals(str);
+            }
+        });
+        Map<String, Object> headers = new HashMap<String, Object>();
+        headers.put("term", "monkey");
+        template.sendBodyAndHeaders(null, headers);
+        resultEndpoint.assertIsSatisfied();
+    }
+
+}
\ No newline at end of file

Added: camel/trunk/components/camel-dns/src/test/resources/DNSDig.xml
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-dns/src/test/resources/DNSDig.xml?rev=1073494&view=auto
==============================================================================
--- camel/trunk/components/camel-dns/src/test/resources/DNSDig.xml (added)
+++ camel/trunk/components/camel-dns/src/test/resources/DNSDig.xml Tue Feb 22 20:50:54 2011
@@ -0,0 +1,38 @@
+<?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"
+       xmlns:camel="http://camel.apache.org/schema/spring"
+       xsi:schemaLocation="
+         http://www.springframework.org/schema/beans
+         http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
+         http://camel.apache.org/schema/spring
+         http://camel.apache.org/schema/spring/camel-spring.xsd">
+
+
+
+    <camelContext id="camel" trace="true" xmlns="http://camel.apache.org/schema/spring">
+        <route id="IPCheck">
+            <from uri="direct:start"/>
+            <to uri="dns:dig"/>
+            <to uri="mock:result"/>
+        </route>
+    </camelContext>
+</beans>

Added: camel/trunk/components/camel-dns/src/test/resources/DNSLookup.xml
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-dns/src/test/resources/DNSLookup.xml?rev=1073494&view=auto
==============================================================================
--- camel/trunk/components/camel-dns/src/test/resources/DNSLookup.xml (added)
+++ camel/trunk/components/camel-dns/src/test/resources/DNSLookup.xml Tue Feb 22 20:50:54 2011
@@ -0,0 +1,38 @@
+<?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"
+       xmlns:camel="http://camel.apache.org/schema/spring"
+       xsi:schemaLocation="
+         http://www.springframework.org/schema/beans
+         http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
+         http://camel.apache.org/schema/spring
+         http://camel.apache.org/schema/spring/camel-spring.xsd">
+
+
+
+    <camelContext id="camel" trace="true" xmlns="http://camel.apache.org/schema/spring">
+        <route id="IPCheck">
+            <from uri="direct:start"/>
+            <to uri="dns:lookup"/>
+            <to uri="mock:result"/>
+        </route>
+    </camelContext>
+</beans>

Added: camel/trunk/components/camel-dns/src/test/resources/IPCheck.xml
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-dns/src/test/resources/IPCheck.xml?rev=1073494&view=auto
==============================================================================
--- camel/trunk/components/camel-dns/src/test/resources/IPCheck.xml (added)
+++ camel/trunk/components/camel-dns/src/test/resources/IPCheck.xml Tue Feb 22 20:50:54 2011
@@ -0,0 +1,38 @@
+<?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"
+       xmlns:camel="http://camel.apache.org/schema/spring"
+       xsi:schemaLocation="
+         http://www.springframework.org/schema/beans
+         http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
+         http://camel.apache.org/schema/spring
+         http://camel.apache.org/schema/spring/camel-spring.xsd">
+
+
+
+    <camelContext id="camel" trace="true" xmlns="http://camel.apache.org/schema/spring">
+        <route id="IPCheck">
+            <from uri="direct:start"/>
+            <to uri="dns:ip"/>
+            <to uri="mock:result"/>
+        </route>
+    </camelContext>
+</beans>

Added: camel/trunk/components/camel-dns/src/test/resources/Wikipedia.xml
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-dns/src/test/resources/Wikipedia.xml?rev=1073494&view=auto
==============================================================================
--- camel/trunk/components/camel-dns/src/test/resources/Wikipedia.xml (added)
+++ camel/trunk/components/camel-dns/src/test/resources/Wikipedia.xml Tue Feb 22 20:50:54 2011
@@ -0,0 +1,38 @@
+<?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"
+       xmlns:camel="http://camel.apache.org/schema/spring"
+       xsi:schemaLocation="
+         http://www.springframework.org/schema/beans
+         http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
+         http://camel.apache.org/schema/spring
+         http://camel.apache.org/schema/spring/camel-spring.xsd">
+
+
+
+    <camelContext id="camel" trace="true" xmlns="http://camel.apache.org/schema/spring">
+        <route id="IPCheck">
+            <from uri="direct:start"/>
+            <to uri="dns:wikipedia"/>
+            <to uri="mock:result"/>
+        </route>
+    </camelContext>
+</beans>

Added: camel/trunk/components/camel-dns/src/test/resources/log4j.properties
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-dns/src/test/resources/log4j.properties?rev=1073494&view=auto
==============================================================================
--- camel/trunk/components/camel-dns/src/test/resources/log4j.properties (added)
+++ camel/trunk/components/camel-dns/src/test/resources/log4j.properties Tue Feb 22 20:50:54 2011
@@ -0,0 +1,35 @@
+## ---------------------------------------------------------------------------
+## 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 during tests..
+#
+log4j.rootLogger=INFO, file
+
+# debug loging for Camel
+#log4j.logger.org.apache.camel.component.dns=DEBUG
+
+# CONSOLE appender not used by default
+log4j.appender.console=org.apache.log4j.ConsoleAppender
+log4j.appender.console.layout=org.apache.log4j.PatternLayout
+log4j.appender.console.layout.ConversionPattern=%d %-5p %c{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 %-5p %c{1} - %m %n
+log4j.appender.file.file=target/camel-dns-test.log
\ No newline at end of file

Modified: camel/trunk/components/pom.xml
URL: http://svn.apache.org/viewvc/camel/trunk/components/pom.xml?rev=1073494&r1=1073493&r2=1073494&view=diff
==============================================================================
--- camel/trunk/components/pom.xml (original)
+++ camel/trunk/components/pom.xml Tue Feb 22 20:50:54 2011
@@ -47,6 +47,7 @@
     <module>camel-crypto</module>
     <module>camel-csv</module>
     <module>camel-cxf</module>
+    <module>camel-dns</module>
     <module>camel-dozer</module>
     <module>camel-eclipse</module>
     <module>camel-ejb</module>

Modified: camel/trunk/parent/pom.xml
URL: http://svn.apache.org/viewvc/camel/trunk/parent/pom.xml?rev=1073494&r1=1073493&r2=1073494&view=diff
==============================================================================
--- camel/trunk/parent/pom.xml (original)
+++ camel/trunk/parent/pom.xml Tue Feb 22 20:50:54 2011
@@ -54,6 +54,7 @@
     <cxf-version>2.3.2</cxf-version>
     <cxf-xjc-utils-version>2.3.2</cxf-xjc-utils-version>
     <derby-version>10.4.2.0</derby-version>
+    <dnsjava-version>2.1.0</dnsjava-version>
     <dozer-version>5.3.1</dozer-version>
     <easymock-version>2.5.2</easymock-version>
     <ehcache-bundle-version>2.3.0_1</ehcache-bundle-version>