Package org.xbill.DNS

Examples of org.xbill.DNS.Name


  assertEquals(e, o);
    }

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


  assertEquals(Name.root, o);
    }

    public void test_init_from_name_empty() throws TextParseException
    {
  Name n = new Name("A.B.c.d.");
  Name n2 = new Name(n, 5);

  assertFalse(n2.isAbsolute());
  assertFalse(n2.isWild());
  assertEquals(0, n2.labels());
  assertEquals(0, n2.length());
    }
View Full Code Here

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

    public void test_concatenate_basic() throws NameTooLongException, TextParseException
    {
  Name p = Name.fromString("A.B");
  Name s = Name.fromString("c.d.");
  Name e = Name.fromString("A.B.c.d.");
 
  Name n = Name.concatenate(p, s);
  assertEquals(e, n);
    }
View Full Code Here

  assertEquals(e, n);
    }

    public void test_concatenate_abs_prefix() throws NameTooLongException, TextParseException
    {
  Name p = Name.fromString("A.B.");
  Name s = Name.fromString("c.d.");
  Name e = Name.fromString("A.B.");
 
  Name n = Name.concatenate(p, s);
  assertEquals(e, n);
    }
View Full Code Here

  assertEquals(e, n);
    }

    public void test_concatenate_too_long() throws TextParseException
    {
  Name p = Name.fromString("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb");
  Name s = Name.fromString("ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc.ddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd.");

  try {
      Name.concatenate(p, s);
      fail("NameTooLongException not thrown");
  }
View Full Code Here

  catch(NameTooLongException e ){}
    }

    public void test_relativize() throws TextParseException
    {
  Name sub = Name.fromString("a.b.c.");
  Name dom = Name.fromString("c.");
  Name exp = Name.fromString("a.b");

  Name n = sub.relativize(dom);
  assertEquals(exp, n);
    }
View Full Code Here

  assertEquals(exp, n);
    }

    public void test_relativize_null_origin() throws TextParseException
    {
  Name sub = Name.fromString("a.b.c.");
  Name dom = null;

  Name n = sub.relativize(dom);
  assertEquals(sub, n);
    }
View Full Code Here

  assertEquals(sub, n);
    }

    public void test_relativize_disjoint() throws TextParseException
    {
  Name sub = Name.fromString("a.b.c.");
  Name dom = Name.fromString("e.f.");

  Name n = sub.relativize(dom);
  assertEquals(sub, n);
    }
View Full Code Here

  }

  public void test_ctor_8label() throws TextParseException
  {
      // 7 is the number of label positions that are cached
      Name n = new Name("a.b.c.d.e.f.g.");
      assertTrue(n.isAbsolute());
      assertFalse(n.isWild());
      assertEquals(8, n.labels());
      assertEquals(15, 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[] { 1, 'g' }, n.getLabel(6)));
      assertEquals("g", n.getLabelString(6));
      assertTrue(Arrays.equals(new byte[] { 0 }, n.getLabel(7)));
      assertEquals("", n.getLabelString(7));
  }
View Full Code Here

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

  public void test_ctor_abs_abs_origin() throws TextParseException
  {
      Name n = new Name(m_abs, m_abs_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

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.