[jboss-cvs] JBossAS SVN: r92017 - in branches/JBPAPP_5_0/testsuite/src/main/org/jboss/test/crashrecovery: taskdefs and 1 other directory.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Wed Aug 5 15:20:51 EDT 2009


Author: istudens at redhat.com
Date: 2009-08-05 15:20:51 -0400 (Wed, 05 Aug 2009)
New Revision: 92017

Modified:
   branches/JBPAPP_5_0/testsuite/src/main/org/jboss/test/crashrecovery/ASCrashRecovery01/TestWithJPA.java
   branches/JBPAPP_5_0/testsuite/src/main/org/jboss/test/crashrecovery/taskdefs/TransactionLog.java
Log:
fixed two bugs in the original TransactionLog class, JBPAPP-2386

Modified: branches/JBPAPP_5_0/testsuite/src/main/org/jboss/test/crashrecovery/ASCrashRecovery01/TestWithJPA.java
===================================================================
--- branches/JBPAPP_5_0/testsuite/src/main/org/jboss/test/crashrecovery/ASCrashRecovery01/TestWithJPA.java	2009-08-05 19:16:05 UTC (rev 92016)
+++ branches/JBPAPP_5_0/testsuite/src/main/org/jboss/test/crashrecovery/ASCrashRecovery01/TestWithJPA.java	2009-08-05 19:20:51 UTC (rev 92017)
@@ -69,7 +69,7 @@
 
    private String storeDir = null;
    private String storeImple = "HashedActionStore";
-   private String storeType = null; //"StateManager/BasicAction/TwoPhaseCoordinator/AtomicAction";
+   private String storeType = "StateManager/BasicAction/TwoPhaseCoordinator/AtomicAction";
    private TransactionLog store;
    private int existingUids;
 
@@ -383,7 +383,7 @@
          // try to recover, this failure was expected maybe?!
          print("Failure was expected (maybe): " + re.getMessage());
 
-         recoverUids();
+         return recoverUids();
       }
       catch (RuntimeException re)
       {
@@ -392,7 +392,7 @@
             // try to recover, this failure was expected maybe?!
             print("Failure was expected (maybe): " + re.getMessage());
 
-            recoverUids();
+            return recoverUids();
          }
          else
          {

Modified: branches/JBPAPP_5_0/testsuite/src/main/org/jboss/test/crashrecovery/taskdefs/TransactionLog.java
===================================================================
--- branches/JBPAPP_5_0/testsuite/src/main/org/jboss/test/crashrecovery/taskdefs/TransactionLog.java	2009-08-05 19:16:05 UTC (rev 92016)
+++ branches/JBPAPP_5_0/testsuite/src/main/org/jboss/test/crashrecovery/taskdefs/TransactionLog.java	2009-08-05 19:20:51 UTC (rev 92017)
@@ -26,11 +26,8 @@
 import com.arjuna.ats.arjuna.exceptions.ObjectStoreException;
 import com.arjuna.ats.arjuna.state.InputObjectState;
 import com.arjuna.ats.arjuna.AtomicAction;
-import com.arjuna.ats.arjuna.coordinator.ActionStatus;
 
-import java.util.List;
 import java.util.ArrayList;
-import java.util.Iterator;
 import java.util.Collection;
 
 /**
@@ -38,131 +35,130 @@
  */
 public class TransactionLog
 {
-    /**
-     * Default object type for store operations
-     */
-    public static final String DEFAULT_OBJECT_TYPE = "StateManager/BasicAction/TwoPhaseCoordinator/AtomicAction";
+   /**
+    * Default object type for store operations
+    */
+   public static final String DEFAULT_OBJECT_TYPE = "StateManager/BasicAction/TwoPhaseCoordinator/AtomicAction";
 
-    private ObjectStore store;
+   private ObjectStore store;
 
-    public TransactionLog(String storeDir, String impleType)
-    {
-        init(storeDir, impleType);
-    }
+   public TransactionLog(String storeDir, String impleType)
+   {
+      init(storeDir, impleType);
+   }
 
-    private void init(String storeDir, String impleType)
-    {
-        System.setProperty("com.arjuna.ats.arjuna.objectstore.objectStoreDir", storeDir);
+   private void init(String storeDir, String impleType)
+   {
+      System.setProperty("com.arjuna.ats.arjuna.objectstore.objectStoreDir", storeDir);
 
-        if (impleType != null)
-            store = new ObjectStore(new ClassName(impleType), (String) null);
-        else
-            store = new ObjectStore();
-    }
+      if (impleType != null)
+         store = new ObjectStore(new ClassName(impleType), (String) null);
+      else
+         store = new ObjectStore();
+   }
 
-    /**
-     * Remove any committed objects from the storer
-     * @param objectType the type of objects that should be removed
-     * @return the number of objects that were purged
-     * @throws ObjectStoreException the store implementation was unable to remove a committed object
-     */
-    public int clearXids(String objectType) throws ObjectStoreException
-    {
-        Collection<Uid> uids = getIds(objectType);
+   /**
+    * Remove any committed objects from the storer
+    * @param objectType the type of objects that should be removed
+    * @return the number of objects that were purged
+    * @throws ObjectStoreException the store implementation was unable to remove a committed object
+    */
+   public int clearXids(String objectType) throws ObjectStoreException
+   {
+      Collection<Uid> uids = getIds(objectType);
 
-        for (Uid uid : uids)
-            store.remove_committed(uid, objectType);
+      for (Uid uid : uids)
+         store.remove_committed(uid, objectType);
 
-        return uids.size();
-    }
+      return uids.size();
+   }
 
-    public Collection<Uid> getIds(String objectType) throws ObjectStoreException
-    {
-        return getIds(null, objectType);
-    }
+   public Collection<Uid> getIds(String objectType) throws ObjectStoreException
+   {
+      return getIds(null, objectType);
+   }
 
-    /**
-     * Get a list object ids for a given object type
-     *
-     * @param ids holder for the returned uids
-     * @param objectType The type of object to search in the store for
-     * @return all objects of the given type
-     * @throws ObjectStoreException the store implementation was unable retrieve all types of objects
-     */
-    public Collection<Uid> getIds(Collection<Uid> ids, String objectType) throws ObjectStoreException
-    {
-        if (ids == null)
-            ids = new ArrayList<Uid> ();
+   /**
+    * Get a list object ids for a given object type
+    *
+    * @param ids holder for the returned uids
+    * @param objectType The type of object to search in the store for
+    * @return all objects of the given type
+    * @throws ObjectStoreException the store implementation was unable retrieve all types of objects
+    */
+   public Collection<Uid> getIds(Collection<Uid> ids, String objectType) throws ObjectStoreException
+   {
+      if (ids == null)
+         ids = new ArrayList<Uid> ();
 
 
-        InputObjectState types = new InputObjectState();
+      InputObjectState types = new InputObjectState();
 
-        if (store.allTypes(types))
-        {
-            String theName;
+      if (store.allTypes(types))
+      {
+         String theName;
 
-            try
+         try
+         {
+            boolean endOfList = false;
+
+            while (!endOfList)
             {
-                boolean endOfList = false;
+               theName = types.unpackString();
 
-                while (!endOfList)
-                {
-                    theName = types.unpackString();
+               if (theName.compareTo("") == 0)
+                  endOfList = true;
+               else
+               {
+                  if (objectType != null && !theName.equals(objectType))
+                     continue;
 
-                    if (theName.compareTo("") == 0)
-                        endOfList = true;
-                    else
-                    {
-                        if (objectType != null && !theName.equals(objectType))
-                            continue;
+                  InputObjectState uids = new InputObjectState();
 
-                        InputObjectState uids = new InputObjectState();
+                  if (store.allObjUids(theName, uids))
+                  {
+                     try
+                     {
+                        boolean endOfUids = false;
 
-                        if (store.allObjUids(theName, uids))
+                        while (!endOfUids)
                         {
-                            Uid theUid = new Uid(Uid.nullUid());
+                           Uid theUid = new Uid(Uid.nullUid());
+                           theUid.unpack(uids);
 
-                            try
-                            {
-                                boolean endOfUids = false;
-
-                                while (!endOfUids)
-                                {
-                                    theUid.unpack(uids);
-
-                                    if (theUid.equals(Uid.nullUid()))
-                                        endOfUids = true;
-                                    else
-                                        ids.add(theUid);
-                                }
-                            }
-                            catch (Exception e)
-                            {
-                                // end of uids!
-                            }
+                           if (theUid.equals(Uid.nullUid()))
+                              endOfUids = true;
+                           else
+                              ids.add(theUid);
                         }
+                     }
+                     catch (Exception e)
+                     {
+                        // end of uids!
+                     }
+                  }
 
-                        System.out.println();
-                    }
-                }
+                  System.out.println();
+               }
             }
-            catch (Exception e)
-            {
-                System.err.println(e);
+         }
+         catch (Exception e)
+         {
+            System.err.println(e);
 
-                // end of list!
-            }
-        }
+            // end of list!
+         }
+      }
 
-        return ids;
-    }
+      return ids;
+   }
 
-    public int getStatus(Uid uid)
-    {
-        AtomicAction action = new AtomicAction(uid);
+   public int getStatus(Uid uid)
+   {
+      AtomicAction action = new AtomicAction(uid);
 
-        action.activate();
+      action.activate();
 
-        return action.status();
-    }
+      return action.status();
+   }
 }




More information about the jboss-cvs-commits mailing list