use of org.opennms.core.test.dns.annotations.JUnitDNSServer in project opennms by OpenNMS.
the class DnsMonitorIT method testNoAnswer.
@Test
@JUnitDNSServer(port = 9153, zones = {})
public void testNoAnswer() throws Exception {
final Lookup l = new Lookup("example.com", Type.AAAA);
// make sure we use a temporary cache so don't get results from a previously cached query
// from another test
l.setCache(null);
final SimpleResolver resolver = new SimpleResolver("::1");
resolver.setPort(9153);
l.setResolver(resolver);
l.run();
// and NXRRSET record should be sent meaning that the server has no records for
// example.com at all. This results in a null answers. This is result 4 I think
System.out.println("result: " + l.getResult());
final Record[] answers = l.getAnswers();
assertNull(answers);
}
use of org.opennms.core.test.dns.annotations.JUnitDNSServer in project opennms by OpenNMS.
the class DnsProvisioningAdapterTest method testDelete.
@Test
@JUnitDNSServer(port = 9153, zones = { @DNSZone(name = "example.com", entries = { @DNSEntry(hostname = "test", data = "192.168.0.1") }) })
public void testDelete() throws Exception {
OnmsNode n = m_nodeDao.findByForeignId("dns", "1");
m_adapter.deleteNode(n.getId());
m_adapter.processPendingOperationForNode(m_deleteOperation);
}
use of org.opennms.core.test.dns.annotations.JUnitDNSServer in project opennms by OpenNMS.
the class DnsProvisioningAdapterTest method testAdd.
@Test
@JUnitDNSServer(port = 9153, zones = { @DNSZone(name = "example.com", entries = { @DNSEntry(hostname = "test", data = "192.168.0.1") }) })
public void testAdd() throws Exception {
OnmsNode n = m_nodeDao.findByForeignId("dns", "1");
m_adapter.addNode(n.getId());
m_adapter.processPendingOperationForNode(m_addOperation);
}
use of org.opennms.core.test.dns.annotations.JUnitDNSServer in project opennms by OpenNMS.
the class ProvisionerIT method testDnsVisit.
/**
* We have to ignore this test until there is a DNS service available in the test harness
*
* @throws ForeignSourceRepositoryException
* @throws MalformedURLException
*/
@Test(timeout = 300000)
@JUnitDNSServer(port = 9153, zones = { @DNSZone(name = "opennms.com.", v4address = "1.2.3.4", entries = { @DNSEntry(hostname = "www", data = "1.2.3.4"), @DNSEntry(hostname = "www", data = "::1:2:3:4", type = "AAAA") }) })
public void testDnsVisit() throws ForeignSourceRepositoryException, MalformedURLException {
final Requisition requisition = m_foreignSourceRepository.importResourceRequisition(new UrlResource("dns://localhost:9153/opennms.com"));
final CountingVisitor visitor = new CountingVisitor() {
@Override
public void visitNode(final OnmsNodeRequisition req) {
LOG.debug("visitNode: {}/{} {}", req.getForeignSource(), req.getForeignId(), req.getNodeLabel());
m_nodes.add(req);
m_nodeCount++;
}
@Override
public void visitInterface(final OnmsIpInterfaceRequisition req) {
LOG.debug("visitInterface: {}", req.getIpAddr());
m_ifaces.add(req);
m_ifaceCount++;
}
};
requisition.visit(visitor);
verifyDnsImportCounts(visitor);
}
use of org.opennms.core.test.dns.annotations.JUnitDNSServer in project opennms by OpenNMS.
the class DnsRequisitionUrlConnectionIT method dwoConnect.
/**
* Just test that connection doesn't get implementation without fixing this test
* @throws IOException
*/
@Test
@JUnitDNSServer(port = 9153, zones = { @DNSZone(name = "example.com", entries = { @DNSEntry(hostname = "www", data = "72.14.204.99") }) })
public void dwoConnect() throws IOException {
URLConnection c = new DnsRequisitionUrlConnection(new URL(TEST_URL));
c.connect();
}
Aggregations