Package org.jboss.serial.regression.jbser83

Source Code of org.jboss.serial.regression.jbser83.RegressionTestCase

package org.jboss.serial.regression.jbser83;

import java.io.*;

import org.jboss.serial.io.JBossObjectInputStream;
import org.jboss.serial.io.JBossObjectOutputStream;

import junit.framework.TestCase;

public class RegressionTestCase extends TestCase
{

  public void testJava() throws Exception
  {
    ByteArrayOutputStream byteOut = new ByteArrayOutputStream();
    ObjectOutputStream objOut = new ObjectOutputStream(byteOut);
    TestReadResolveNull objNull = TestReadResolveNull.createTestInstance();
    objOut.writeObject(objNull);
    objOut.close();
    ObjectInputStream input = new ObjectInputStream(new ByteArrayInputStream(byteOut.toByteArray()));
    Object obj = input.readObject();
   
    assertNull(obj);
    System.out.println("obj=" + obj);
   
  }
 
  public void testJavaOnClassReferences() throws Exception
  {
    ByteArrayOutputStream byteOut = new ByteArrayOutputStream();
    ObjectOutputStream objOut = new ObjectOutputStream(byteOut);
    TestReferences obj1 = new TestReferences();
    objOut.writeObject(obj1);
    objOut.close();
    ObjectInputStream input = new ObjectInputStream(new ByteArrayInputStream(byteOut.toByteArray()));
    Object obj2 = input.readObject();
   
    System.out.println("obj2=" + obj2);
   
  }
 
  public void testJBoss() throws Exception
  {
    ByteArrayOutputStream byteOut = new ByteArrayOutputStream();
    JBossObjectOutputStream objOut = new JBossObjectOutputStream(byteOut);
    TestReadResolveNull objNull = TestReadResolveNull.createTestInstance();
    objOut.writeObject(objNull);
    objOut.close();
    ObjectInputStream input = new JBossObjectInputStream(new ByteArrayInputStream(byteOut.toByteArray()));
    Object obj = input.readObject();
    assertNull(obj);
   
    System.out.println("obj=" + obj);
  }
 
  public void testJBossOnClassReferences() throws Exception
  {
    ByteArrayOutputStream byteOut = new ByteArrayOutputStream();
    ObjectOutputStream objOut = new JBossObjectOutputStream(byteOut);
    TestReferences obj1 = new TestReferences();
    objOut.writeObject(obj1);
    objOut.close();
    ObjectInputStream input = new JBossObjectInputStream(new ByteArrayInputStream(byteOut.toByteArray()));
    Object obj2 = input.readObject();
   
    System.out.println("obj2=" + obj2);
   
  }
 
 
}
TOP

Related Classes of org.jboss.serial.regression.jbser83.RegressionTestCase

TOP
Copyright © 2018 www.massapi.com. 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.