Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
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;
Expand Down Expand Up @@ -50,15 +49,20 @@ public Producer createProducer() throws Exception {
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));
if (type == -1) {
// 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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
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;
Expand All @@ -37,10 +36,13 @@
*/
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;

Expand All @@ -56,7 +58,6 @@ protected RouteBuilder createRouteBuilder() throws Exception {
}

@Test
@Ignore("Testing behind nat produces timeouts")
public void testDigForMonkey() throws Exception {
resultEndpoint.expectedMessageCount(1);
resultEndpoint.expectedMessagesMatches(new Predicate() {
Expand Down