Search in sources :

Example 46 with Name

use of org.xbill.DNS.Name in project dim by 1and1.

the class NameTest method test_toString_special_char.

public void test_toString_special_char() throws TextParseException, WireParseException {
    byte[] raw = new byte[] { 1, '"', 1, '(', 1, ')', 1, '.', 1, ';', 1, '\\', 1, '@', 1, '$', 0 };
    String exp = "\\\".\\(.\\).\\..\\;.\\\\.\\@.\\$.";
    Name n = new Name(new DNSInput(raw));
    assertEquals(exp, n.toString());
}
Also used : Name(org.xbill.DNS.Name)

Example 47 with Name

use of org.xbill.DNS.Name in project dim by 1and1.

the class NameTest method test_wild.

public void test_wild() throws TextParseException {
    Name sub = Name.fromString("a.b.c.");
    Name exp = Name.fromString("*.b.c.");
    Name n = sub.wild(1);
    assertEquals(exp, n);
}
Also used : Name(org.xbill.DNS.Name)

Example 48 with Name

use of org.xbill.DNS.Name in project dim by 1and1.

the class NameTest method test_relativize_root.

public void test_relativize_root() throws TextParseException {
    Name sub = Name.fromString("a.b.c.");
    Name dom = Name.fromString(".");
    Name exp = Name.fromString("a.b.c");
    Name n = sub.relativize(dom);
    assertEquals(exp, n);
}
Also used : Name(org.xbill.DNS.Name)

Example 49 with Name

use of org.xbill.DNS.Name in project dim by 1and1.

the class NameTest method test_fromDNAME.

public void test_fromDNAME() throws NameTooLongException, TextParseException {
    Name own = new Name("the.owner.");
    Name alias = new Name("the.alias.");
    DNAMERecord dnr = new DNAMERecord(own, DClass.IN, 0xABCD, alias);
    Name sub = new Name("sub.the.owner.");
    Name exp = new Name("sub.the.alias.");
    Name n = sub.fromDNAME(dnr);
    assertEquals(exp, n);
}
Also used : Name(org.xbill.DNS.Name)

Example 50 with Name

use of org.xbill.DNS.Name in project dim by 1and1.

the class NameTest method test_wild_toobig.

public void test_wild_toobig() throws TextParseException {
    Name sub = Name.fromString("a.b.c.");
    try {
        sub.wild(4);
        fail("IllegalArgumentException not thrown");
    } catch (IllegalArgumentException e) {
    }
}
Also used : Name(org.xbill.DNS.Name)

Aggregations

Name (org.xbill.DNS.Name)110 Record (org.xbill.DNS.Record)38 Message (org.xbill.DNS.Message)19 SRVRecord (org.xbill.DNS.SRVRecord)18 ArrayList (java.util.ArrayList)13 IOException (java.io.IOException)12 UnknownHostException (java.net.UnknownHostException)11 Lookup (org.xbill.DNS.Lookup)10 TextParseException (org.xbill.DNS.TextParseException)10 ARecord (org.xbill.DNS.ARecord)9 CNAMERecord (org.xbill.DNS.CNAMERecord)9 ExtendedResolver (org.xbill.DNS.ExtendedResolver)9 RRset (org.xbill.DNS.RRset)9 SimpleResolver (org.xbill.DNS.SimpleResolver)9 Zone (org.xbill.DNS.Zone)9 NSRecord (org.xbill.DNS.NSRecord)8 TSIG (org.xbill.DNS.TSIG)7 TXTRecord (org.xbill.DNS.TXTRecord)7 HashSet (java.util.HashSet)6 Iterator (java.util.Iterator)6