Package org.jboss.serial.data

Examples of org.jboss.serial.data.TestCircularReferences


  public void testJava() throws Exception
  {
    ByteArrayOutputStream byteOut = new ByteArrayOutputStream();
    ObjectOutputStream objOut = new ObjectOutputStream(byteOut);

    TestCircularReferences circular = TestCircularReferences.createTestInstance();
    objOut.writeObject(circular.getReferences());
    objOut.writeObject(circular);
    objOut.reset();
    objOut.writeObject(circular.getReferences());
   
    ObjectInputStream objInput = new ObjectInputStream(new ByteArrayInputStream(byteOut.toByteArray()));
   
    Object first = objInput.readObject();
    TestCircularReferences second = (TestCircularReferences)objInput.readObject();
    Object third = objInput.readObject();
    assertSame((Object)second.getReferences(),first);
    assertEquals(circular.getReferences().size(),((Collection)third).size());
    assertNotSame(third,second);
  }
View Full Code Here


  public void testJBoss() throws Exception
  {
    ByteArrayOutputStream byteOut = new ByteArrayOutputStream();
    ObjectOutputStream objOut = new JBossObjectOutputStreamSharedTree(byteOut);

    TestCircularReferences circular = TestCircularReferences.createTestInstance();
    objOut.writeObject(circular.getReferences());
    objOut.writeObject(circular);
    objOut.reset();
    objOut.writeObject(circular.getReferences());
   
    ObjectInputStream objInput = new JBossObjectInputStreamSharedTree(new ByteArrayInputStream(byteOut.toByteArray()));
   
    Object first = objInput.readObject();
    TestCircularReferences second = (TestCircularReferences)objInput.readObject();
    Object third = objInput.readObject();
    assertSame((Object)second.getReferences(),first);
    assertEquals(circular.getReferences().size(),((Collection)third).size());
    assertNotSame(third,second);
  }
View Full Code Here

TOP

Related Classes of org.jboss.serial.data.TestCircularReferences

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.