use of org.xbill.DNS.Name in project dim by 1and1.
the class SignZone method getNameList.
/**
* Load a list of DNS names from a file.
*
* @param nameListFile
* the path of a file containing a bare list of DNS names.
* @return a list of {@link org.xbill.DNS.Name} objects.
*/
private static List<Name> getNameList(File nameListFile) throws IOException {
BufferedReader br = new BufferedReader(new FileReader(nameListFile));
List<Name> res = new ArrayList<Name>();
String line = null;
while ((line = br.readLine()) != null) {
try {
Name n = Name.fromString(line);
// root.
if (!n.isAbsolute())
n = Name.concatenate(n, Name.root);
res.add(n);
} catch (TextParseException e) {
log.severe("DNS Name parsing error:" + e);
}
}
br.close();
if (res.size() == 0)
return null;
return res;
}
use of org.xbill.DNS.Name in project dim by 1and1.
the class NameTest method test_subdomain_equal.
public void test_subdomain_equal() throws TextParseException {
Name dom = new Name("the.domain");
Name sub = new Name("the.domain");
assertTrue(sub.subdomain(dom));
assertTrue(dom.subdomain(sub));
}
use of org.xbill.DNS.Name in project dim by 1and1.
the class NameTest method test_fromDNAME_toobig.
public void test_fromDNAME_toobig() throws NameTooLongException, TextParseException {
Name own = new Name("the.owner.");
Name alias = new Name("the.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb.ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc.");
DNAMERecord dnr = new DNAMERecord(own, DClass.IN, 0xABCD, alias);
Name sub = new Name("ddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd.the.owner.");
try {
sub.fromDNAME(dnr);
fail("NameTooLongException not thrown");
} catch (NameTooLongException e) {
}
}
use of org.xbill.DNS.Name in project dim by 1and1.
the class NameTest method test_toString_at.
public void test_toString_at() throws TextParseException {
Name n = new Name("@", null);
assertEquals("@", n.toString());
}
use of org.xbill.DNS.Name in project dim by 1and1.
the class NameTest method test_init_from_name_root.
public void test_init_from_name_root() throws TextParseException {
Name n = new Name("A.B.c.d.");
Name o = new Name(n, 4);
assertEquals(Name.root, o);
}
Aggregations