Search in sources :

Example 1 with DnsConfiguration

use of org.apache.camel.component.dns.DnsConfiguration in project camel by apache.

the class DnsServiceDiscoveryTest method testServiceDiscovery.

@Test
public void testServiceDiscovery() throws Exception {
    DnsConfiguration configuration = new DnsConfiguration();
    DnsServiceDiscovery discovery = new DnsServiceDiscovery(configuration);
    configuration.setDomain("gmail.com");
    configuration.setProto("_tcp");
    List<ServiceDefinition> services = discovery.getServices("_xmpp-server");
    assertNotNull(services);
    assertFalse(services.isEmpty());
    for (ServiceDefinition service : services) {
        assertFalse(service.getMetadata().isEmpty());
        assertNotNull(service.getMetadata().get("priority"));
        assertNotNull(service.getMetadata().get("weight"));
    }
}
Also used : DnsConfiguration(org.apache.camel.component.dns.DnsConfiguration) ServiceDefinition(org.apache.camel.cloud.ServiceDefinition) Test(org.junit.Test)

Aggregations

ServiceDefinition (org.apache.camel.cloud.ServiceDefinition)1 DnsConfiguration (org.apache.camel.component.dns.DnsConfiguration)1 Test (org.junit.Test)1