[jboss-svn-commits] JBL Code SVN: r31474 - in labs/jbosstm/trunk/ArjunaCore/arjuna: classes/com/arjuna/ats/internal/arjuna/objectstore and 3 other directories.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Sat Feb 6 17:59:49 EST 2010


Author: mark.little at jboss.com
Date: 2010-02-06 17:59:48 -0500 (Sat, 06 Feb 2010)
New Revision: 31474

Added:
   labs/jbosstm/trunk/ArjunaCore/arjuna/tests/classes/com/hp/mwtests/ts/arjuna/state/
   labs/jbosstm/trunk/ArjunaCore/arjuna/tests/classes/com/hp/mwtests/ts/arjuna/state/IOStateUnitTest.java
Removed:
   labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/objectstore/StoreList.java
Modified:
   labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/state/InputBuffer.java
   labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/state/InputObjectState.java
   labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/state/OutputBuffer.java
   labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/state/OutputObjectState.java
   labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/objectstore/FileSystemStore.java
   labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/objectstore/HashedStore.java
   labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/objectstore/NullActionStore.java
   labs/jbosstm/trunk/ArjunaCore/arjuna/tests/classes/com/hp/mwtests/ts/arjuna/objectstore/ObjectStoreTest.java
Log:
https://jira.jboss.org/jira/browse/JBTM-698

Modified: labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/state/InputBuffer.java
===================================================================
--- labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/state/InputBuffer.java	2010-02-06 16:36:34 UTC (rev 31473)
+++ labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/state/InputBuffer.java	2010-02-06 22:59:48 UTC (rev 31474)
@@ -443,13 +443,8 @@
          * byte separately.
          */
 
-        int i = buff.unpackInt();
+        _byteArray = buff.unpackBytes();
 
-        _byteArray = new byte[i];
-
-        for (int j = 0; j < i; j++)
-            _byteArray[j] = buff.unpackByte();
-
         _valid = true;
 
         try

Modified: labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/state/InputObjectState.java
===================================================================
--- labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/state/InputObjectState.java	2010-02-06 16:36:34 UTC (rev 31473)
+++ labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/state/InputObjectState.java	2010-02-06 22:59:48 UTC (rev 31474)
@@ -157,7 +157,7 @@
 	bufferUid = new Uid(copyFrom.stateUid());
 	super._valid = bufferUid.valid();
 	
-	imageType = new String(copyFrom.type());
+	imageType = (copyFrom.type() == null ? null : new String(copyFrom.type()));
     }
     
 public void print (PrintWriter strm)
@@ -201,12 +201,13 @@
 	bufferUid = new Uid(objstate.bufferUid);
 	super._valid = bufferUid.valid();
 	
-	imageType = new String(objstate.imageType);
+	imageType = (objstate.imageType == null ? null : new String(objstate.imageType));
     }
 
 public synchronized void unpackFrom (InputBuffer buff) throws IOException
     {
 	imageType = buff.unpackString();
+	
 	bufferUid = UidHelper.unpackFrom(buff);
 
 	super.unpackFrom(buff);

Modified: labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/state/OutputBuffer.java
===================================================================
--- labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/state/OutputBuffer.java	2010-02-06 16:36:34 UTC (rev 31473)
+++ labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/state/OutputBuffer.java	2010-02-06 22:59:48 UTC (rev 31474)
@@ -435,11 +435,7 @@
              * pack number of bytes and then pack each byte separately.
              */
 
-            byte[] b = buffer();
-            buff.packInt(b.length);
-
-            for (int i = 0; i < b.length; i++)
-                buff.packByte(b[i]);
+            buff.packBytes(buffer());
         }
     }
 

Modified: labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/state/OutputObjectState.java
===================================================================
--- labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/state/OutputObjectState.java	2010-02-06 16:36:34 UTC (rev 31473)
+++ labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/state/OutputObjectState.java	2010-02-06 22:59:48 UTC (rev 31474)
@@ -214,7 +214,7 @@
 	bufferUid = new Uid(objstate.bufferUid);
 	super._valid = bufferUid.valid();
 	
-	imageType = new String(objstate.imageType);
+	imageType = (objstate.imageType == null ? null : new String(objstate.imageType));
     }
     
 public synchronized void packInto (OutputBuffer buff) throws IOException

Modified: labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/objectstore/FileSystemStore.java
===================================================================
--- labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/objectstore/FileSystemStore.java	2010-02-06 16:36:34 UTC (rev 31473)
+++ labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/objectstore/FileSystemStore.java	2010-02-06 22:59:48 UTC (rev 31474)
@@ -239,7 +239,7 @@
          * If typename starts with a '/' then skip over it.
          */
 
-        if ((tName != null) && (tName.charAt(0) == File.separatorChar))
+        if ((tName != null) && (tName.length() > 0) && (tName.charAt(0) == File.separatorChar))
         {
             String s = tName.substring(1, tName.length());
             directory = new String(fullStoreName + s);

Modified: labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/objectstore/HashedStore.java
===================================================================
--- labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/objectstore/HashedStore.java	2010-02-06 16:36:34 UTC (rev 31473)
+++ labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/objectstore/HashedStore.java	2010-02-06 22:59:48 UTC (rev 31474)
@@ -107,7 +107,7 @@
 
         /* Does typename start with a '/' if so skip over */
 
-        if ((tName != null) && (tName.charAt(0) == File.separatorChar))
+        if ((tName != null) && (tName.length() > 0) && (tName.charAt(0) == File.separatorChar))
             directory = directory + tName.substring(1, tName.length());
         else
             directory = directory + tName;

Modified: labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/objectstore/NullActionStore.java
===================================================================
--- labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/objectstore/NullActionStore.java	2010-02-06 16:36:34 UTC (rev 31473)
+++ labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/objectstore/NullActionStore.java	2010-02-06 22:59:48 UTC (rev 31474)
@@ -31,7 +31,6 @@
 
 package com.arjuna.ats.internal.arjuna.objectstore;
 
-import com.arjuna.ats.arjuna.objectstore.ObjectStore;
 import com.arjuna.ats.arjuna.objectstore.ObjectStoreType;
 import com.arjuna.ats.arjuna.objectstore.StateStatus;
 import com.arjuna.ats.arjuna.objectstore.StateType;
@@ -185,7 +184,7 @@
     {
         try
         {
-            setupStore(location);
+            super.setupStore(location);
         }
         catch (ObjectStoreException e)
         {

Deleted: labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/objectstore/StoreList.java
===================================================================
--- labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/objectstore/StoreList.java	2010-02-06 16:36:34 UTC (rev 31473)
+++ labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/objectstore/StoreList.java	2010-02-06 22:59:48 UTC (rev 31474)
@@ -1,52 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors 
- * as indicated by the @author tags. 
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors. 
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A 
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A 
- * PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
- * MA  02110-1301, USA.
- * 
- * (C) 2005-2006,
- * @author JBoss Inc.
- */
-/*
- * Copyright (C) 1998, 1999, 2000,
- *
- * Arjuna Solutions Limited,
- * Newcastle upon Tyne,
- * Tyne and Wear,
- * UK.  
- *
- * $Id: StoreList.java 2342 2006-03-30 13:06:17Z  $
- */
-
-package com.arjuna.ats.internal.arjuna.objectstore;
-
-/*
- * Default visibility.
- */
-
-class StoreList
-{
-
-    public StoreList ()
-    {
-	useCount = 0;
-	instance = null;
-	next = null;
-    }
-
-    public long             useCount;
-    public Object instance;
-    public StoreList        next;
-    
-}

Modified: labs/jbosstm/trunk/ArjunaCore/arjuna/tests/classes/com/hp/mwtests/ts/arjuna/objectstore/ObjectStoreTest.java
===================================================================
--- labs/jbosstm/trunk/ArjunaCore/arjuna/tests/classes/com/hp/mwtests/ts/arjuna/objectstore/ObjectStoreTest.java	2010-02-06 16:36:34 UTC (rev 31473)
+++ labs/jbosstm/trunk/ArjunaCore/arjuna/tests/classes/com/hp/mwtests/ts/arjuna/objectstore/ObjectStoreTest.java	2010-02-06 22:59:48 UTC (rev 31474)
@@ -31,16 +31,107 @@
  * $Id: ObjectStoreTest.java 2342 2006-03-30 13:06:17Z  $
  */
 
+import com.arjuna.ats.arjuna.common.Uid;
 import com.arjuna.ats.arjuna.common.arjPropertyManager;
+import com.arjuna.ats.arjuna.exceptions.ObjectStoreException;
 import com.arjuna.ats.arjuna.objectstore.ObjectStore;
 import com.arjuna.ats.arjuna.objectstore.ObjectStoreType;
+import com.arjuna.ats.arjuna.objectstore.StateStatus;
 import com.arjuna.ats.arjuna.objectstore.StateType;
+import com.arjuna.ats.arjuna.state.InputObjectState;
+import com.arjuna.ats.arjuna.state.OutputObjectState;
+import com.arjuna.ats.arjuna.utils.FileLock;
+import com.arjuna.ats.internal.arjuna.objectstore.ActionStore;
+import com.arjuna.ats.internal.arjuna.objectstore.FileLockingStore;
+import com.arjuna.ats.internal.arjuna.objectstore.HashedActionStore;
+import com.arjuna.ats.internal.arjuna.objectstore.NullActionStore;
+import com.arjuna.ats.internal.arjuna.objectstore.ShadowNoFileLockStore;
+import com.arjuna.ats.internal.arjuna.objectstore.VolatileStore;
 
 import org.junit.Test;
 import static org.junit.Assert.*;
 
+import java.io.File;
 import java.io.IOException;
 
+class DummyOS extends FileLockingStore
+{
+    public DummyOS ()
+    {
+        this(null, 0);
+    }
+    
+    public DummyOS(String locationOfStore, int ss)
+    {
+        super(locationOfStore, ss);
+    }
+
+    public boolean lock ()
+    {
+        return super.lock(new File("foo"), FileLock.F_WRLCK, true);
+    }
+    
+    public boolean unlock ()
+    {
+        return super.unlock(new File("foo"));
+    }
+    
+    @Override
+    protected InputObjectState read_state (Uid u, String tn, int s)
+            throws ObjectStoreException
+    {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    protected boolean remove_state (Uid u, String tn, int s)
+            throws ObjectStoreException
+    {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    @Override
+    protected boolean write_state (Uid u, String tn, OutputObjectState buff,
+            int s) throws ObjectStoreException
+    {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    public int typeIs ()
+    {
+        // TODO Auto-generated method stub
+        return 0;
+    }
+
+    public boolean commit_state (Uid u, String tn) throws ObjectStoreException
+    {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    public int currentState (Uid u, String tn) throws ObjectStoreException
+    {
+        // TODO Auto-generated method stub
+        return 0;
+    }
+
+    public boolean hide_state (Uid u, String tn) throws ObjectStoreException
+    {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    public boolean reveal_state (Uid u, String tn) throws ObjectStoreException
+    {
+        // TODO Auto-generated method stub
+        return false;
+    }
+    
+}
+
 public class ObjectStoreTest
 {
     @SuppressWarnings("unchecked")
@@ -74,6 +165,247 @@
         assertTrue(validate(objStore));
     }
 
+    @Test
+    public void testActionStore () throws Exception
+    {
+        ActionStore as = new ActionStore("", StateType.OS_SHARED);
+        
+        assertTrue(as.typeIs() != -1);
+        
+        final OutputObjectState buff = new OutputObjectState();
+        final String tn = "/StateManager/junit";
+        
+        for (int i = 0; i < 100; i++)
+        {
+            Uid u = new Uid();
+            
+            as.write_uncommitted(u, tn, buff);
+            
+            as.commit_state(u, tn);
+            
+            assertTrue(as.currentState(u, tn) != StateStatus.OS_UNCOMMITTED);
+            
+            InputObjectState ios = new InputObjectState();
+            
+            as.allObjUids("", ios);
+            
+            assertTrue(as.read_uncommitted(u, tn) == null);
+            
+            as.write_committed(u, tn, buff);
+            as.read_committed(u, tn);
+            
+            assertTrue(!as.remove_uncommitted(u, tn));
+            
+            as.remove_committed(u, tn);
+            
+            assertTrue(!as.hide_state(u, tn));
+            
+            assertTrue(!as.reveal_state(u, tn));
+        }
+    }
+    
+    @Test
+    public void testShadowNoFileLockStore () throws Exception
+    {
+        ShadowNoFileLockStore as = new ShadowNoFileLockStore("", StateType.OS_SHARED);
+        
+        assertTrue(as.typeIs() != -1);
+        
+        final OutputObjectState buff = new OutputObjectState();
+        final String tn = "/StateManager/junit";
+        
+        for (int i = 0; i < 100; i++)
+        {
+            Uid u = new Uid();
+            
+            as.write_uncommitted(u, tn, buff);
+            
+            as.commit_state(u, tn);
+            
+            assertTrue(as.currentState(u, tn) != StateStatus.OS_UNCOMMITTED);
+            
+            InputObjectState ios = new InputObjectState();
+            
+            as.allObjUids("", ios);
+            
+            assertTrue(as.read_uncommitted(u, tn) == null);
+            
+            as.write_committed(u, tn, buff);
+            as.read_committed(u, tn);
+            
+            assertTrue(!as.remove_uncommitted(u, tn));
+            
+            as.remove_committed(u, tn);
+            
+            assertTrue(!as.hide_state(u, tn));
+            
+            assertTrue(!as.reveal_state(u, tn));
+        }
+    }
+    
+    @Test
+    public void testHashedActionStore () throws Exception
+    {
+        HashedActionStore as = new HashedActionStore("", StateType.OS_SHARED);
+        
+        assertTrue(as.typeIs() != -1);
+        
+        final OutputObjectState buff = new OutputObjectState();
+        final String tn = "/StateManager/junit";
+        
+        for (int i = 0; i < 100; i++)
+        {
+            Uid u = new Uid();
+            
+            as.write_uncommitted(u, tn, buff);
+            
+            as.commit_state(u, tn);
+            
+            assertTrue(as.currentState(u, tn) != StateStatus.OS_UNCOMMITTED);
+            
+            InputObjectState ios = new InputObjectState();
+            
+            as.allObjUids("", ios);
+            
+            assertTrue(as.read_uncommitted(u, tn) == null);
+            
+            as.write_committed(u, tn, buff);
+            as.read_committed(u, tn);
+            
+            assertTrue(!as.remove_uncommitted(u, tn));
+            
+            as.remove_committed(u, tn);
+            
+            assertTrue(!as.hide_state(u, tn));
+            
+            assertTrue(!as.reveal_state(u, tn));
+        }
+    }
+    
+    @Test
+    public void testNullActionStore () throws Exception
+    {
+        NullActionStore as = new NullActionStore("", StateType.OS_SHARED);
+        
+        assertTrue(as.typeIs() != -1);
+        
+        final OutputObjectState buff = new OutputObjectState();
+        final String tn = "/StateManager/junit";
+        
+        for (int i = 0; i < 100; i++)
+        {
+            Uid u = new Uid();
+            
+            as.write_uncommitted(u, tn, buff);
+
+            as.commit_state(u, tn);
+            
+            assertTrue(as.currentState(u, tn) != StateStatus.OS_UNCOMMITTED);
+            
+            InputObjectState ios = new InputObjectState();
+            
+            as.allObjUids("", ios);
+            
+            assertTrue(as.read_uncommitted(u, tn) == null);
+            
+            as.write_committed(u, tn, buff);
+            as.read_committed(u, tn);
+            
+            assertTrue(!as.remove_uncommitted(u, tn));
+            
+            as.remove_committed(u, tn);
+            
+            assertTrue(!as.hide_state(u, tn));
+            
+            assertTrue(!as.reveal_state(u, tn));
+        }
+    }
+
+    @Test
+    public void testVolatileStore () throws Exception
+    {
+        VolatileStore as = new VolatileStore();
+        
+        assertTrue(as.typeIs() != -1);
+        
+        final OutputObjectState buff = new OutputObjectState();
+        final String tn = "/StateManager/junit";
+        
+        for (int i = 0; i < 100; i++)
+        {
+            Uid u = new Uid();
+            
+            InputObjectState ios = new InputObjectState();
+            
+            try
+            {
+                as.allObjUids("", ios);
+            }
+            catch (final Exception ex)
+            {              
+            }
+            
+            try
+            {
+                assertTrue(as.read_uncommitted(u, tn) == null);
+            }
+            catch (final Exception ex)
+            {
+            }
+            
+            try
+            {
+                as.commit_state(u, tn);
+            }
+            catch (final Exception ex)
+            {
+            }
+            
+            as.write_committed(u, tn, buff);
+            
+            assertTrue(as.currentState(u, tn) == StateStatus.OS_COMMITTED);
+            
+            as.read_committed(u, tn);
+            
+            try
+            {
+                assertTrue(as.remove_uncommitted(u, tn));
+            }
+            catch (final Exception ex)
+            {
+            }
+            
+            as.remove_committed(u, tn);
+            
+            try
+            {
+                assertTrue(as.hide_state(u, tn));
+            }
+            catch (final Exception ex)
+            {
+            }
+            
+            try
+            {               
+                assertTrue(as.reveal_state(u, tn));
+            }
+            catch (final Exception ex)
+            {
+            }
+        }
+    }
+    
+    @Test
+    public void testFileLockingStore () throws Exception
+    {
+        DummyOS as = new DummyOS();
+        
+        assertTrue(as.typeIs() != -1);
+        
+        assertTrue(as.lock());
+        assertTrue(as.unlock());
+    }
+
     private static final boolean validate(ObjectStore objStore)
     {
         if (objStore == null)

Added: labs/jbosstm/trunk/ArjunaCore/arjuna/tests/classes/com/hp/mwtests/ts/arjuna/state/IOStateUnitTest.java
===================================================================
--- labs/jbosstm/trunk/ArjunaCore/arjuna/tests/classes/com/hp/mwtests/ts/arjuna/state/IOStateUnitTest.java	                        (rev 0)
+++ labs/jbosstm/trunk/ArjunaCore/arjuna/tests/classes/com/hp/mwtests/ts/arjuna/state/IOStateUnitTest.java	2010-02-06 22:59:48 UTC (rev 31474)
@@ -0,0 +1,102 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * (C) 2005-2006,
+ * @author JBoss Inc.
+ */
+package com.hp.mwtests.ts.arjuna.state;
+
+import org.junit.Test;
+
+import com.arjuna.ats.arjuna.common.Uid;
+import com.arjuna.ats.arjuna.state.InputBuffer;
+import com.arjuna.ats.arjuna.state.InputObjectState;
+import com.arjuna.ats.arjuna.state.OutputBuffer;
+import com.arjuna.ats.arjuna.state.OutputObjectState;
+import com.arjuna.ats.internal.arjuna.common.UidHelper;
+
+import static org.junit.Assert.*;
+
+public class IOStateUnitTest
+{
+    @Test
+    public void test() throws Exception
+    {
+        OutputObjectState oos = new OutputObjectState(new Uid(), "");
+        
+        oos.packBoolean(true);
+        oos.packByte((byte) 0);
+        oos.packChar('a');
+        oos.packDouble(1.0);
+        oos.packFloat((float) 1.0);
+        oos.packInt(1);
+        oos.packLong(1234);
+        oos.packShort((short) 10);
+        oos.packString("test");
+        
+        assertTrue(oos.length() != 0);
+        assertTrue(oos.notempty());
+        assertTrue(oos.stateUid() != Uid.nullUid());
+        assertTrue(oos.buffer() != null);
+        assertTrue(oos.size() > 0);
+        assertTrue(oos.type() != null);
+        
+        InputObjectState ios = new InputObjectState(oos);
+
+        assertTrue(ios.buffer() != null);
+        assertTrue(ios.length() > 0);
+        assertTrue(ios.notempty());
+        assertTrue(ios.size() > 0);
+        assertTrue(ios.stateUid() != Uid.nullUid());
+        
+        assertTrue(ios.unpackBoolean());
+        assertEquals(ios.unpackByte(), (byte) 0);
+        assertEquals(ios.unpackChar(), 'a');
+        assertTrue(ios.unpackDouble() == 1.0);
+        assertTrue(ios.unpackFloat() == (float) 1.0);
+        assertEquals(ios.unpackInt(), 1);
+        assertEquals(ios.unpackLong(), 1234);
+        assertEquals(ios.unpackShort(), (short) 10);
+        assertEquals(ios.unpackString(), "test");
+        
+        InputObjectState c = new InputObjectState();
+        OutputObjectState buff = new OutputObjectState();
+        OutputObjectState o = new OutputObjectState();
+        Uid u = new Uid();
+        
+        buff.packString("foobar");
+        UidHelper.packInto(u, buff);
+
+        buff.packInto(o);
+        
+        InputBuffer ibuff = new InputBuffer(o.buffer());
+        
+        c.copy(ios);
+        ios.unpackFrom(ibuff);
+        ios.copyFrom(new OutputObjectState());
+        
+        assertTrue(ios.toString() != null);
+        
+        oos.reset();
+        oos.rewrite();
+        
+        oos.packInto(new OutputObjectState());
+        oos.copy(new OutputObjectState());
+        
+        assertTrue(oos.toString() != null);
+    }
+}



More information about the jboss-svn-commits mailing list