@Override public SetResponse lookupRecords(Name name, int type, int minCred) { final SetResponse setResponse = super.lookupRecords(name, type, minCred); if (count++ == 0) { assertThat(setResponse.isUnknown(), is(true)); } else { assertThat(setResponse.isUnknown(), is(false)); } return setResponse; //To change body of overridden methods use File | Settings | File Templates. }
private RRset [] findRecords(Name name, int type, int minCred) { SetResponse cr = lookupRecords(name, type, minCred); if (cr.isSuccessful()) return cr.answers(); else return null; }
private RRset [] findRecords(Name name, int type, int minCred) { SetResponse cr = lookupRecords(name, type, minCred); if (cr.isSuccessful()) return cr.answers(); else return null; }
private RRset [] findRecords(Name name, int type, int minCred) { SetResponse cr = lookupRecords(name, type, minCred); if (cr.isSuccessful()) return cr.answers(); else return null; }
private RRset [] findRecords(Name name, int type, int minCred) { SetResponse cr = lookupRecords(name, type, minCred); if (cr.isSuccessful()) return cr.answers(); else return null; }
private final void addCacheNS(final Message response, final Cache cache, final Name name) { final SetResponse sr = cache.lookupRecords(name, Type.NS, Credibility.HINT); if (!sr.isDelegation()) return; final RRset nsRecords = sr.getNS(); @SuppressWarnings("unchecked") final Iterator<Record> it = nsRecords.rrs(); while (it.hasNext()) { final Record r = it.next(); response.addRecord(r, Section.AUTHORITY); } }
private final void addCacheNS(Message response, Cache cache, Name name) { SetResponse sr = cache.lookupRecords(name, Type.NS, Credibility.HINT); if (!sr.isDelegation()) return; RRset nsRecords = sr.getNS(); Iterator it = nsRecords.rrs(); while (it.hasNext()) { Record r = (Record) it.next(); response.addRecord(r, Section.AUTHORITY); } }
private void addCacheNS(Message response, Cache cache, Name name) { final SetResponse sr = cache.lookupRecords(name, Type.NS, Credibility.HINT); if (!sr.isDelegation()) { return; } final RRset nsRecords = sr.getNS(); final Iterator<?> it = nsRecords.rrs(); while (it.hasNext()) { final Record r = (Record) it.next(); response.addRecord(r, Section.AUTHORITY); } }
@Test public void testThreeMX() throws Exception { doAnswer(new ZoneCacheLookupRecordsAnswer(loadZone("three-mx.bar."))) .when(mockedCache).lookupRecords(any(Name.class), anyInt(), anyInt()); dnsServer.setCache(mockedCache); // a.setSearchPath(new String[] { "searchdomain.com." }); ArrayList<String> records = new ArrayList<>(dnsServer.findMXRecords("three-mx.bar.")); assertThat(records.size()).isEqualTo(3); assertThat(records.contains("mx1.three-mx.bar.")).isTrue(); assertThat(records.contains("mx2.three-mx.bar.")).isTrue(); assertThat(records.get(2)).isEqualTo("mx3.three-mx.bar."); }
@Test public void testThreeMX() throws Exception { doAnswer(new ZoneCacheLookupRecordsAnswer(loadZone("three-mx.bar."))) .when(mockedCache).lookupRecords(any(Name.class), anyInt(), anyInt()); dnsServer.setCache(mockedCache); // a.setSearchPath(new String[] { "searchdomain.com." }); ArrayList<String> records = new ArrayList<>(dnsServer.findMXRecords("three-mx.bar.")); assertThat(records.size()).isEqualTo(3); assertThat(records.contains("mx1.three-mx.bar.")).isTrue(); assertThat(records.contains("mx2.three-mx.bar.")).isTrue(); assertThat(records.get(2)).isEqualTo("mx3.three-mx.bar."); }
@Test public void testNoMX() throws Exception { doAnswer(new ZoneCacheLookupRecordsAnswer(loadZone("dnstest.com."))) .when(mockedCache).lookupRecords(any(Name.class), anyInt(), anyInt()); dnsServer.setCache(mockedCache); // a.setSearchPath(new String[] { "searchdomain.com." }); Collection<String> records = dnsServer.findMXRecords("nomx.dnstest.com."); assertThat(records.size()).isEqualTo(1); assertThat(records.iterator().next()).isEqualTo("nomx.dnstest.com."); }
@Test public void testINARecords() throws Exception { doAnswer(new ZoneCacheLookupRecordsAnswer(loadZone("pippo.com."))) .when(mockedCache).lookupRecords(any(Name.class), anyInt(), anyInt()); dnsServer.setCache(mockedCache); // dnsServer.setLookupper(new ZoneLookupper(z)); Collection<String> records = dnsServer.findMXRecords("www.pippo.com."); assertThat(records.size()).isEqualTo(1); assertThat(records.iterator().next()).isEqualTo("pippo.com.inbound.mxlogic.net."); }
@Test public void testINARecords() throws Exception { doAnswer(new ZoneCacheLookupRecordsAnswer(loadZone("pippo.com."))) .when(mockedCache).lookupRecords(any(Name.class), anyInt(), anyInt()); dnsServer.setCache(mockedCache); // dnsServer.setLookupper(new ZoneLookupper(z)); Collection<String> records = dnsServer.findMXRecords("www.pippo.com."); assertThat(records.size()).isEqualTo(1); assertThat(records.iterator().next()).isEqualTo("pippo.com.inbound.mxlogic.net."); }
@Test public void testNoMX() throws Exception { doAnswer(new ZoneCacheLookupRecordsAnswer(loadZone("dnstest.com."))) .when(mockedCache).lookupRecords(any(Name.class), anyInt(), anyInt()); dnsServer.setCache(mockedCache); // a.setSearchPath(new String[] { "searchdomain.com." }); Collection<String> records = dnsServer.findMXRecords("nomx.dnstest.com."); assertThat(records.size()).isEqualTo(1); assertThat(records.iterator().next()).isEqualTo("nomx.dnstest.com."); }
/** * Test for JAMES-1251 */ @Test public void testTwoMXDifferentPrio() throws Exception { doAnswer(new ZoneCacheLookupRecordsAnswer(loadZone("two-mx.differentprio."))) .when(mockedCache).lookupRecords(any(Name.class), anyInt(), anyInt()); dnsServer.setCache(mockedCache); // a.setSearchPath(new String[] { "searchdomain.com." }); Collection<String> records = dnsServer.findMXRecords("two-mx.differentprio."); assertThat(records.size()).isEqualTo(2); assertThat(records.contains("mx1.two-mx.differentprio.")).isTrue(); assertThat(records.contains("mx2.two-mx.differentprio.")).isTrue(); }
/** * Test for JAMES-1251 */ @Test public void testTwoMXDifferentPrio() throws Exception { doAnswer(new ZoneCacheLookupRecordsAnswer(loadZone("two-mx.differentprio."))) .when(mockedCache).lookupRecords(any(Name.class), anyInt(), anyInt()); dnsServer.setCache(mockedCache); // a.setSearchPath(new String[] { "searchdomain.com." }); Collection<String> records = dnsServer.findMXRecords("two-mx.differentprio."); assertThat(records.size()).isEqualTo(2); assertThat(records.contains("mx1.two-mx.differentprio.")).isTrue(); assertThat(records.contains("mx2.two-mx.differentprio.")).isTrue(); }
/** * Test for JAMES-1251 */ @Test public void testTwoMXSamePrio() throws Exception { doAnswer(new ZoneCacheLookupRecordsAnswer(loadZone("two-mx.sameprio."))) .when(mockedCache).lookupRecords(any(Name.class), anyInt(), anyInt()); dnsServer.setCache(mockedCache); // a.setSearchPath(new String[] { "searchdomain.com." }); Collection<String> records = dnsServer.findMXRecords("two-mx.sameprio."); assertThat(records.size()).isEqualTo(2); assertThat(records.contains("mx1.two-mx.sameprio.")).isTrue(); assertThat(records.contains("mx2.two-mx.sameprio.")).isTrue(); }
@Test public void testBadMX() throws Exception { doAnswer(new ZoneCacheLookupRecordsAnswer(loadZone("dnstest.com."))) .when(mockedCache).lookupRecords(any(Name.class), anyInt(), anyInt()); dnsServer.setCache(mockedCache); // a.setSearchPath(new String[] { "searchdomain.com." }); Collection<String> records = dnsServer.findMXRecords("badmx.dnstest.com."); assertThat(records.size()).isEqualTo(1); assertThat(records.iterator().next()).isEqualTo("badhost.dnstest.com."); // Iterator<HostAddress> it = // dnsServer.getSMTPHostAddresses("badmx.dnstest.com."); // assertFalse(it.hasNext()); }
@Test public void testBadMX() throws Exception { doAnswer(new ZoneCacheLookupRecordsAnswer(loadZone("dnstest.com."))) .when(mockedCache).lookupRecords(any(Name.class), anyInt(), anyInt()); dnsServer.setCache(mockedCache); // a.setSearchPath(new String[] { "searchdomain.com." }); Collection<String> records = dnsServer.findMXRecords("badmx.dnstest.com."); assertThat(records.size()).isEqualTo(1); assertThat(records.iterator().next()).isEqualTo("badhost.dnstest.com."); // Iterator<HostAddress> it = // dnsServer.getSMTPHostAddresses("badmx.dnstest.com."); // assertFalse(it.hasNext()); }
/** * Test for JAMES-1251 */ @Test public void testOneMX() throws Exception { doAnswer(new ZoneCacheLookupRecordsAnswer(loadZone("one-mx.bar."))) .when(mockedCache).lookupRecords(any(Name.class), anyInt(), anyInt()); dnsServer.setCache(mockedCache); // a.setSearchPath(new String[] { "searchdomain.com." }); Collection<String> records = dnsServer.findMXRecords("one-mx.bar."); assertThat(records.size()).isEqualTo(1); assertThat(records.contains("mx1.one-mx.bar.")).isTrue(); } /*