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);
}
}