Package org.xbill.DNS

Examples of org.xbill.DNS.Name


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

  public void test_ctor_abs_rel_origin() throws TextParseException
  {
      Name n = new Name(m_abs, m_rel_origin);
      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_abs_origin() throws TextParseException
  {
      Name n = new Name(m_rel, m_abs_origin);
      assertTrue(n.isAbsolute());
      assertFalse(n.isWild());
      assertEquals(4, n.labels());
      assertEquals(18, 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[] { 4, 'O', 'r', 'i', 'g'},
             n.getLabel(2)));
      assertEquals("Orig", n.getLabelString(2));
      assertTrue(Arrays.equals(new byte[] { 0 },
             n.getLabel(3)));
      assertEquals("", n.getLabelString(3));
  }
View Full Code Here

  }

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

  }

  public void test_ctor_max_label() throws TextParseException
  {
      // name with a 63 char label
      Name n = new Name("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.b.");
      assertTrue(n.isAbsolute());
      assertFalse(n.isWild());
      assertEquals(3, n.labels());
      assertEquals(67, n.length());
      assertTrue(Arrays.equals(new byte[] { 63, 'a','a','a','a','a','a','a','a','a','a','a','a','a','a','a','a','a','a','a','a','a','a','a','a','a','a','a','a','a','a','a','a','a','a','a','a','a','a','a','a','a','a','a','a','a','a','a','a','a','a','a','a','a','a','a','a','a','a','a','a','a','a','a' },
             n.getLabel(0)));
      assertEquals("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", n.getLabelString(0));
      assertTrue(Arrays.equals(new byte[] { 1, 'b' },
             n.getLabel(1)));
      assertEquals("b", n.getLabelString(1));
      assertTrue(Arrays.equals(new byte[] { 0 },
             n.getLabel(2)));
      assertEquals("", n.getLabelString(2));
  }
View Full Code Here

  public void test_ctor_toobig_label()
  {
      // name with a 64 char label
      try {
    new Name("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.b.");
    fail("TextParseException not thrown");
      }
      catch(TextParseException e ){}
  }
View Full Code Here

  }

  public void test_ctor_max_length_rel() throws TextParseException
  {
      // relative name with three 63-char labels and a 62-char label
      Name n = new Name("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb.ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc.dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd");
      assertFalse(n.isAbsolute());
      assertFalse(n.isWild());
      assertEquals(4, n.labels());
      assertEquals(255, n.length());
  }
View Full Code Here

  }
     
  public void test_ctor_max_length_abs() throws TextParseException
  {
      // absolute name with three 63-char labels and a 61-char label
      Name n = new Name("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb.ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc.ddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd.");
      assertTrue(n.isAbsolute());
      assertFalse(n.isWild());
      assertEquals(5, n.labels());
      assertEquals(255, n.length());
  }
View Full Code Here

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

  public void test_ctor_escaped() throws TextParseException
  {
      Name n = new Name("ab\\123cd");
      assertFalse(n.isAbsolute());
      assertFalse(n.isWild());
      assertEquals(1, n.labels());
      assertEquals(6, n.length());
      assertTrue(Arrays.equals(new byte[] { 5, 'a', 'b', (byte)123, 'c', 'd' }, n.getLabel(0)));
  }
View Full Code Here

      assertTrue(Arrays.equals(new byte[] { 5, 'a', 'b', (byte)123, 'c', 'd' }, n.getLabel(0)));
  }
     
  public void test_ctor_escaped_end() throws TextParseException
  {
      Name n = new Name("abcd\\123");
      assertFalse(n.isAbsolute());
      assertFalse(n.isWild());
      assertEquals(1, n.labels());
      assertEquals(6, n.length());
      assertTrue(Arrays.equals(new byte[] { 5, 'a', 'b', 'c', 'd', (byte)123 }, n.getLabel(0)));
  }
View Full Code Here

  }

  public void test_ctor_short_escaped() throws TextParseException
  {
      try {
    new Name("ab\\12cd");
    fail("TextParseException not throw");
      }
      catch(TextParseException e){}
  }
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.