camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ningji...@apache.org
Subject [6/6] git commit: CAMEL-6932 Let the dns.server be optinal with thanks to Dai
Date Wed, 06 Nov 2013 13:53:31 GMT
CAMEL-6932 Let the dns.server be optinal with thanks to Dai


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/618e08e7
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/618e08e7
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/618e08e7

Branch: refs/heads/camel-2.11.x
Commit: 618e08e70201eb306179966475da2e91c41f47f7
Parents: 5ccfbe8
Author: Willem Jiang <willem.jiang@gmail.com>
Authored: Wed Nov 6 21:48:54 2013 +0800
Committer: Willem Jiang <willem.jiang@gmail.com>
Committed: Wed Nov 6 21:53:06 2013 +0800

----------------------------------------------------------------------
 .../org/apache/camel/component/dns/DnsDigEndpoint.java | 10 +++++++---
 .../apache/camel/component/dns/DnsDigEndpointTest.java | 13 +++++++------
 2 files changed, 14 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/618e08e7/components/camel-dns/src/main/java/org/apache/camel/component/dns/DnsDigEndpoint.java
----------------------------------------------------------------------
diff --git a/components/camel-dns/src/main/java/org/apache/camel/component/dns/DnsDigEndpoint.java
b/components/camel-dns/src/main/java/org/apache/camel/component/dns/DnsDigEndpoint.java
index 72f3fbf..ff4b03b 100644
--- a/components/camel-dns/src/main/java/org/apache/camel/component/dns/DnsDigEndpoint.java
+++ b/components/camel-dns/src/main/java/org/apache/camel/component/dns/DnsDigEndpoint.java
@@ -22,7 +22,6 @@ import org.apache.camel.Processor;
 import org.apache.camel.Producer;
 import org.apache.camel.impl.DefaultEndpoint;
 import org.apache.camel.impl.DefaultProducer;
-import org.apache.camel.util.ObjectHelper;
 import org.xbill.DNS.DClass;
 import org.xbill.DNS.Message;
 import org.xbill.DNS.Name;
@@ -50,7 +49,6 @@ public class DnsDigEndpoint extends DefaultEndpoint {
         return new DefaultProducer(this) {
             public void process(Exchange exchange) throws Exception {
                 String server = exchange.getIn().getHeader(DnsConstants.DNS_SERVER, String.class);
-                ObjectHelper.notEmpty(server, "Header " + DnsConstants.DNS_SERVER);
 
                 SimpleResolver resolver = new SimpleResolver(server);
                 int type = Type.value(exchange.getIn().getHeader(DnsConstants.DNS_TYPE, String.class));
@@ -58,7 +56,13 @@ public class DnsDigEndpoint extends DefaultEndpoint {
                     // default: if unparsable value given, use A.
                     type = Type.A;
                 }
-                int dclass = DClass.value(exchange.getIn().getHeader(DnsConstants.DNS_CLASS,
String.class));
+                
+                String dclassValue = exchange.getIn().getHeader(DnsConstants.DNS_CLASS, String.class);
+                if (dclassValue == null) {
+                	dclassValue = "";
+                }
+                	
+                int dclass = DClass.value(dclassValue);
                 if (dclass == -1) {
                     // by default, value is IN.
                     dclass = DClass.IN;

http://git-wip-us.apache.org/repos/asf/camel/blob/618e08e7/components/camel-dns/src/test/java/org/apache/camel/component/dns/DnsDigEndpointTest.java
----------------------------------------------------------------------
diff --git a/components/camel-dns/src/test/java/org/apache/camel/component/dns/DnsDigEndpointTest.java
b/components/camel-dns/src/test/java/org/apache/camel/component/dns/DnsDigEndpointTest.java
index 13e5f64..155e065 100644
--- a/components/camel-dns/src/test/java/org/apache/camel/component/dns/DnsDigEndpointTest.java
+++ b/components/camel-dns/src/test/java/org/apache/camel/component/dns/DnsDigEndpointTest.java
@@ -27,7 +27,6 @@ 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;
@@ -37,10 +36,13 @@ import org.xbill.DNS.Section;
  */
 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\"";
-
+    private static final String RESPONSE_MONKEY = "\"A Macaque, an old world species of "
+    		+ "monkey native to Southeast Asia|thumb]A monkey is a primate of the "
+    		+ "Haplorrhini suborder and simian infraorder, either an Old World monkey "
+    		+ "or a New World monkey, but excluding apes. There are about 260 known "
+    		+ "living specie\" \"s of monkey. Many are arboreal, although there are "
+    		+ "species that live primarily on the ground, such as baboons... "
+    		+ "http://en.wikipedia.org/wiki/Monkey\""; 
     @EndpointInject(uri = "mock:result")
     protected MockEndpoint resultEndpoint;
 
@@ -56,7 +58,6 @@ public class DnsDigEndpointTest extends CamelTestSupport {
     }
 
     @Test
-    @Ignore("Testing behind nat produces timeouts")
     public void testDigForMonkey() throws Exception {
         resultEndpoint.expectedMessageCount(1);
         resultEndpoint.expectedMessagesMatches(new Predicate() {


Mime
View raw message