use of org.apache.camel.Predicate in project camel by apache.
the class DnsDigEndpointTest method testDigForMonkey.
@Test
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();
}
use of org.apache.camel.Predicate in project camel by apache.
the class DnsLookupEndpointSpringTest method testDNSWithNameHeaderAndType.
@Test
@Ignore("Testing behind nat produces timeouts")
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();
}
use of org.apache.camel.Predicate in project camel by apache.
the class DnsLookupEndpointSpringTest method testDNSWithNameHeader.
@Test
@Ignore("Testing behind nat produces timeouts")
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();
}
use of org.apache.camel.Predicate in project camel by apache.
the class DnsLookupEndpointTest method testDNSWithNameHeaderAndType.
@Test
@Ignore("Testing behind nat produces timeouts")
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();
}
use of org.apache.camel.Predicate in project camel by apache.
the class WikipediaEndpointTest method testWikipediaForMonkey.
@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();
}
Aggregations