Package org.xbill.DNS

Examples of org.xbill.DNS.Name


  }

  public void test_ctor_7label() throws TextParseException
  {
      // 7 is the number of label positions that are cached
      Name n = new Name("a.b.c.d.e.f.");
      assertTrue(n.isAbsolute());
      assertFalse(n.isWild());
      assertEquals(7, n.labels());
      assertEquals(13, n.length());
      assertTrue(Arrays.equals(new byte[] { 1, 'a' }, n.getLabel(0)));
      assertEquals("a", n.getLabelString(0));
      assertTrue(Arrays.equals(new byte[] { 1, 'b' }, n.getLabel(1)));
      assertEquals("b", n.getLabelString(1));
      assertTrue(Arrays.equals(new byte[] { 1, 'c' }, n.getLabel(2)));
      assertEquals("c", n.getLabelString(2));
      assertTrue(Arrays.equals(new byte[] { 1, 'd' }, n.getLabel(3)));
      assertEquals("d", n.getLabelString(3));
      assertTrue(Arrays.equals(new byte[] { 1, 'e' }, n.getLabel(4)));
      assertEquals("e", n.getLabelString(4));
      assertTrue(Arrays.equals(new byte[] { 1, 'f' }, n.getLabel(5)));
      assertEquals("f", n.getLabelString(5));
      assertTrue(Arrays.equals(new byte[] { 0 }, n.getLabel(6)));
      assertEquals("", n.getLabelString(6));
  }
View Full Code Here


      assertFalse(n.equals(null));
  }

  public void test_notName() throws TextParseException
  {
      Name n = new Name("A.Name.");
      assertFalse(n.equals(new Object()));
  }
View Full Code Here

      assertFalse(n.equals(new Object()));
  }

  public void test_abs() throws TextParseException
  {
      Name n = new Name("A.Name.");
      Name n2 = new Name("a.name.");

      assertTrue(n.equals(n2));
      assertTrue(n2.equals(n));
  }
View Full Code Here

      assertTrue(n2.equals(n));
  }

  public void test_rel() throws TextParseException
  {
      Name n1 = new Name("A.Relative.Name");
      Name n2 = new Name("a.relative.name");

      assertTrue(n1.equals(n2));
      assertTrue(n2.equals(n1));
  }
View Full Code Here

      assertTrue(n2.equals(n1));
  }

  public void test_mixed() throws TextParseException
  {
      Name n1 = new Name("A.Name");
      Name n2 = new Name("a.name.");

      assertFalse(n1.equals(n2));
      assertFalse(n2.equals(n1));
  }
View Full Code Here

      assertFalse(n2.equals(n1));
  }

  public void test_weird() throws TextParseException
  {
      Name n1 = new Name("ab.c");
      Name n2 = new Name("abc.");

      assertFalse(n1.equals(n2));
      assertFalse(n2.equals(n1));
  }
View Full Code Here

    public static class Test_compareTo extends TestCase
    {
  public void test_notName() throws TextParseException
  {
      Name n = new Name("A.Name");
      try {
    n.compareTo(new Object());
    fail("ClassCastException not thrown");
      }
      catch(ClassCastException e ){}
  }
View Full Code Here

      catch(ClassCastException e ){}
  }

  public void test_same() throws TextParseException
  {
      Name n = new Name("A.Name");
      assertEquals(0, n.compareTo(n));
  }
View Full Code Here

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

  public void test_equal() throws TextParseException
  {
      Name n1 = new Name("A.Name.");
      Name n2 = new Name("a.name.");

      assertEquals(0, n1.compareTo(n2));
      assertEquals(0, n2.compareTo(n1));
  }
View Full Code Here

      assertEquals(0, n2.compareTo(n1));
  }

  public void test_close() throws TextParseException
  {
      Name n1 = new Name("a.name");
      Name n2 = new Name("a.name.");

      assertTrue(n1.compareTo(n2) > 0);
      assertTrue(n2.compareTo(n1) < 0);
  }
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.