Package javax.naming

Examples of javax.naming.BinaryRefAddr


    }
    Assert.assertNull(addr);
  }

  public void testBinaryRefAddr_TooSmallIndex() {
    BinaryRefAddr addr = null;

    // Test too small index
    try {
      addr = new BinaryRefAddr("binary", new byte[] { 2, 3 }, -1, 1);
      fail("Should throw ArrayIndexOutOfBoundsException here.");
    } catch (ArrayIndexOutOfBoundsException e) {
    }
    Assert.assertNull(addr);
  }
View Full Code Here


    }
    Assert.assertNull(addr);
  }

  public void testBinaryRefAddr_TooBigIndex() {
    BinaryRefAddr addr = null;

    // Test too big index
    try {
      addr = new BinaryRefAddr("binary", new byte[] { 2, 3 }, 2, 1);
      fail("Should throw ArrayIndexOutOfBoundsException here.");
    } catch (ArrayIndexOutOfBoundsException e) {
    }
    Assert.assertNull(addr);
  }
View Full Code Here

    Assert.assertNull(addr);
  }

  public void testBinaryRefAddr_ComplexZeroSize() {
    byte[] ab;
    BinaryRefAddr addr = null;

    // Test zero size
    addr = new BinaryRefAddr("binary", new byte[] { 2, 3 }, 0, 0);
    ab = (byte[]) addr.getContent();
    Assert.assertEquals(ab.length, 0);
    Assert.assertNotNull(addr);
  }
View Full Code Here

    Assert.assertEquals(ab.length, 0);
    Assert.assertNotNull(addr);
  }

  public void testBinaryRefAddr_TooSmallSize() {
    BinaryRefAddr addr = null;

    // Test too small size
    try {
      addr = new BinaryRefAddr("binary", new byte[] { 2, 3 }, 0, -1);
      fail("Should throw NegativeArraySizeException here.");
    } catch (NegativeArraySizeException e) {
    }
    Assert.assertNull(addr);
  }
View Full Code Here

  }

  public void testConstructor_ByRefAddr() {
    String className = "java.util.Hashtable";
    String type = "Binary";
    RefAddr refAddr = new BinaryRefAddr(type, buffer);
    Reference reference = new Reference(className, refAddr);

    assertEquals(className, reference.getClassName());
    assertEquals(refAddr, reference.get(0));
    assertNull(reference.getFactoryClassName());
View Full Code Here

    String className = "java.util.Hashtable";
    String factoryName = "factory name";
    String factoryLocation = "file:///home/";

    String type = "Binary";
    RefAddr refAddr = new BinaryRefAddr(type, buffer);

    Reference reference = new Reference(className, refAddr, factoryName,
        factoryLocation);

    assertEquals(className, reference.getClassName());
View Full Code Here

    assertEquals(1, reference.size());
  }

  public void testAdd_Simple() {
    String type = "Binary";
    BinaryRefAddr refAddr0 = new BinaryRefAddr(type, buffer);
    byte[] buffer1 = { 1, 2, 3, 4 };
    BinaryRefAddr refAddr1 = new BinaryRefAddr(type, buffer1);
    ref.add(refAddr0);
    ref.add(refAddr1);

    assertEquals(2, ref.size());
    assertEquals(refAddr0, ref.get(0));
View Full Code Here

    assertNull(ref.get(0));
  }

  public void testAdd_ByIndex() {
    String type = "Binary";
    BinaryRefAddr refAddr0 = new BinaryRefAddr(type, buffer);
    byte[] buffer1 = { 1, 2, 3, 4 };
    BinaryRefAddr refAddr1 = new BinaryRefAddr(type, buffer1);
    ref.add(0, refAddr0);
    ref.add(1, refAddr1);

    assertEquals(2, ref.size());
    assertEquals(refAddr0, ref.get(0));
View Full Code Here

    assertEquals(refAddr1, ref.get(1));
  }

  public void testAdd_ByIndexInsert() {
    String type = "Binary";
    BinaryRefAddr refAddr0 = new BinaryRefAddr(type, buffer);
    byte[] buffer1 = { 1, 2, 3, 4 };
    BinaryRefAddr refAddr1 = new BinaryRefAddr(type, buffer1);
    byte[] buffer2 = { 1, 2, 3, 4, 5 };
    BinaryRefAddr refAddr2 = new BinaryRefAddr(type, buffer2);

    ref.add(0, refAddr0);
    ref.add(1, refAddr1);
    ref.add(1, refAddr2);
View Full Code Here

    assertEquals(refAddr2, ref.get(1));
  }

  public void testAdd_ByIndexInvalidGreat() {
    String type = "Binary";
    BinaryRefAddr refAddr = new BinaryRefAddr(type, buffer);
    try {
      ref.add(1, refAddr);
      fail("This should throw a ArrayIndexOutOfBoundsException");
    } catch (ArrayIndexOutOfBoundsException e) {
    }
View Full Code Here

TOP

Related Classes of javax.naming.BinaryRefAddr

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.