Package org.xbill.DNS

Examples of org.xbill.DNS.Name


    }

    public void test_toString_escaped() throws TextParseException
    {
  String in = "my.escaped.junk\\128.label.";
  Name n = new Name(in);
  assertEquals(in, n.toString());
    }
View Full Code Here


    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());
    }
View Full Code Here

  }
     
  public void test_ctor_empty()
  {
      try {
    new Name("");
    fail("TextParseException not thrown");
      }
      catch(TextParseException e ){}
  }
View Full Code Here

      catch(TextParseException e ){}
  }

  public void test_ctor_at_null_origin() throws TextParseException
  {
      Name n = new Name("@");
      assertFalse(n.isAbsolute());
      assertFalse(n.isWild());
      assertEquals(0, n.labels());
      assertEquals(0, n.length());
  }
View Full Code Here

      assertEquals(0, n.length());
  }

  public void test_ctor_at_abs_origin() throws TextParseException
  {
      Name n = new Name("@", m_abs_origin);
      assertEquals(m_abs_origin, n);
  }
View Full Code Here

      assertEquals(m_abs_origin, n);
  }
     
  public void test_ctor_at_rel_origin() throws TextParseException
  {
      Name n = new Name("@", m_rel_origin);
      assertEquals(m_rel_origin, n);
  }
View Full Code Here

      assertEquals(m_rel_origin, n);
  }

  public void test_ctor_dot() throws TextParseException
  {
      Name n = new Name(".");
      assertEquals(Name.root, n);
      assertNotSame(Name.root, n);
      assertEquals(1, n.labels());
      assertEquals(1, n.length());
  }
View Full Code Here

      assertEquals(1, n.length());
  }

  public void test_ctor_wildcard() throws TextParseException
  {
      Name n = new Name("*");
      assertFalse(n.isAbsolute());
      assertTrue(n.isWild());
      assertEquals(1, n.labels());
      assertEquals(2, n.length());
      assertTrue(Arrays.equals(new byte[] { 1, '*' }, n.getLabel(0)));
      assertEquals("*", n.getLabelString(0));
  }
View Full Code Here

      assertEquals("*", n.getLabelString(0));
  }

  public void test_ctor_abs() throws TextParseException
  {
      Name n = new Name(m_abs);
      assertTrue(n.isAbsolute());
      assertFalse(n.isWild());
      assertEquals(4, n.labels());
      assertEquals(17, n.length());
      assertTrue(Arrays.equals(new byte[] { 3, 'W', 'W', 'W' },
             n.getLabel(0)));
      assertEquals("WWW", n.getLabelString(0));
      assertTrue(Arrays.equals(new byte[] { 7, 'D', 'n', 's', 'J', 'a', 'v', 'a' },
             n.getLabel(1)));
      assertEquals("DnsJava", n.getLabelString(1));
      assertTrue(Arrays.equals(new byte[] { 3, 'o', 'r', 'g' },
             n.getLabel(2)));
      assertEquals("org", n.getLabelString(2));
      assertTrue(Arrays.equals(new byte[] { 0 },
             n.getLabel(3)));
      assertEquals("", n.getLabelString(3));
  }
View Full Code Here

      assertEquals("", n.getLabelString(3));
  }

  public void test_ctor_rel() throws TextParseException
  {
      Name n = new Name(m_rel);
      assertFalse(n.isAbsolute());
      assertFalse(n.isWild());
      assertEquals(2, n.labels());
      assertEquals(12, n.length());
      assertTrue(Arrays.equals(new byte[] { 3, 'W', 'W', 'W' },
             n.getLabel(0)));
      assertEquals("WWW", n.getLabelString(0));
      assertTrue(Arrays.equals(new byte[] { 7, 'D', 'n', 's', 'J', 'a', 'v', 'a' },
             n.getLabel(1)));
      assertEquals("DnsJava", n.getLabelString(1));
  }
View Full Code Here

TOP

Related Classes of org.xbill.DNS.Name

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.