[jboss-svn-commits] JBL Code SVN: r31982 - in labs/jbosstm/trunk/ArjunaJTS/jts: tests/classes/com/hp/mwtests/ts/jts/recovery and 1 other directory.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Sun Mar 7 14:05:39 EST 2010
Author: mark.little at jboss.com
Date: 2010-03-07 14:05:39 -0500 (Sun, 07 Mar 2010)
New Revision: 31982
Added:
labs/jbosstm/trunk/ArjunaJTS/jts/tests/classes/com/hp/mwtests/ts/jts/recovery/AssumedCompleteUnitTest.java
Modified:
labs/jbosstm/trunk/ArjunaJTS/jts/classes/com/arjuna/ats/internal/jts/recovery/transactions/AssumedCompleteServerTransaction.java
labs/jbosstm/trunk/ArjunaJTS/jts/classes/com/arjuna/ats/internal/jts/recovery/transactions/AssumedCompleteTransaction.java
Log:
https://jira.jboss.org/jira/browse/JBTM-715
Modified: labs/jbosstm/trunk/ArjunaJTS/jts/classes/com/arjuna/ats/internal/jts/recovery/transactions/AssumedCompleteServerTransaction.java
===================================================================
--- labs/jbosstm/trunk/ArjunaJTS/jts/classes/com/arjuna/ats/internal/jts/recovery/transactions/AssumedCompleteServerTransaction.java 2010-03-07 16:46:31 UTC (rev 31981)
+++ labs/jbosstm/trunk/ArjunaJTS/jts/classes/com/arjuna/ats/internal/jts/recovery/transactions/AssumedCompleteServerTransaction.java 2010-03-07 19:05:39 UTC (rev 31982)
@@ -32,10 +32,7 @@
package com.arjuna.ats.internal.jts.recovery.transactions;
-import com.arjuna.ats.internal.jts.orbspecific.coordinator.ArjunaTransactionImple;
import com.arjuna.ats.arjuna.common.*;
-import com.arjuna.ats.arjuna.coordinator.*;
-import com.arjuna.ats.arjuna.objectstore.*;
import com.arjuna.ats.arjuna.state.*;
import org.omg.CosTransactions.*;
@@ -45,8 +42,6 @@
import com.arjuna.ats.arjuna.logging.FacilityCode;
import com.arjuna.common.util.logging.*;
-import org.omg.CORBA.SystemException;
-
/**
* Transaction relic of a committed transaction that did not get committed responses from
* all resources/subordinates.
@@ -63,6 +58,7 @@
*
* @message com.arjuna.ats.internal.jts.recovery.transactions.AssumedCompleteServerTransaction_1 [com.arjuna.ats.internal.jts.recovery.transactions.AssumedCompleteServerTransaction_1] - AssumedCompleteServerTransaction {0} created
*/
+
public class AssumedCompleteServerTransaction extends RecoveredServerTransaction
{
public AssumedCompleteServerTransaction ( Uid actionUid )
@@ -77,82 +73,82 @@
}
-/**
- * the original process must be deceased if we are assumed complete
- */
-public Status getOriginalStatus()
-{
- return Status.StatusNoTransaction;
-}
+ /**
+ * the original process must be deceased if we are assumed complete
+ */
+ public Status getOriginalStatus()
+ {
+ return Status.StatusNoTransaction;
+ }
-public String type ()
+ public String type ()
{
- return AssumedCompleteServerTransaction.typeName();
+ return AssumedCompleteServerTransaction.typeName();
}
- /**
- * typeName differs from original to force the ActionStore to
- * keep AssumedCompleteServerTransactions separate
- */
-public static String typeName ()
+ /**
+ * typeName differs from original to force the ActionStore to
+ * keep AssumedCompleteServerTransactions separate
+ */
+ public static String typeName ()
{
- return ourTypeName;
+ return ourTypeName;
}
-public String toString ()
+ public String toString ()
{
- return "AssumedCompleteServerTransaction < "+get_uid()+" >";
+ return "AssumedCompleteServerTransaction < "+get_uid()+" >";
}
-/**
- * This T is already assumed complete, so return false
- */
-public boolean assumeComplete()
+ /**
+ * This T is already assumed complete, so return false
+ */
+ public boolean assumeComplete()
{
- return false;
+ return false;
}
-public Date getLastActiveTime()
-{
- return _lastActiveTime;
-}
+ public Date getLastActiveTime()
+ {
+ return _lastActiveTime;
+ }
-public boolean restore_state (InputObjectState objectState, int ot)
-{
- // do the other stuff
- boolean result = super.restore_state(objectState,ot);
-
- if (result) {
- try {
- long oldtime = objectState.unpackLong();
- _lastActiveTime = new Date(oldtime);
- } catch (java.io.IOException ex) {
- // can assume the assumptionTime is missing - make it now
- _lastActiveTime = new Date();
- }
+ public boolean restore_state (InputObjectState objectState, int ot)
+ {
+ // do the other stuff
+ boolean result = super.restore_state(objectState,ot);
+
+ if (result) {
+ try {
+ long oldtime = objectState.unpackLong();
+ _lastActiveTime = new Date(oldtime);
+ } catch (java.io.IOException ex) {
+ // can assume the assumptionTime is missing - make it now
+ _lastActiveTime = new Date();
+ }
+ }
+ return result;
}
- return result;
-}
-public boolean save_state (OutputObjectState objectState, int ot)
-{
- // do the other stuff
- boolean result = super.save_state(objectState,ot);
-
- if (result ) {
- // a re-write means we have just been active
- _lastActiveTime = new Date();
- try {
- objectState.packLong(_lastActiveTime.getTime());
- } catch (java.io.IOException ex) {
- }
+ public boolean save_state (OutputObjectState objectState, int ot)
+ {
+ // do the other stuff
+ boolean result = super.save_state(objectState,ot);
+
+ if (result ) {
+ // a re-write means we have just been active
+ _lastActiveTime = new Date();
+ try {
+ objectState.packLong(_lastActiveTime.getTime());
+ } catch (java.io.IOException ex) {
+ }
+ }
+ return result;
+
}
- return result;
-}
+ private Date _lastActiveTime;
-private Date _lastActiveTime;
+ private static String ourTypeName = "/StateManager/BasicAction/TwoPhaseCoordinator/ArjunaTransactionImple/AssumedCompleteServerTransaction";
-private static String ourTypeName = "/StateManager/BasicAction/TwoPhaseCoordinator/ArjunaTransactionImple/AssumedCompleteServerTransaction";
-
}
Modified: labs/jbosstm/trunk/ArjunaJTS/jts/classes/com/arjuna/ats/internal/jts/recovery/transactions/AssumedCompleteTransaction.java
===================================================================
--- labs/jbosstm/trunk/ArjunaJTS/jts/classes/com/arjuna/ats/internal/jts/recovery/transactions/AssumedCompleteTransaction.java 2010-03-07 16:46:31 UTC (rev 31981)
+++ labs/jbosstm/trunk/ArjunaJTS/jts/classes/com/arjuna/ats/internal/jts/recovery/transactions/AssumedCompleteTransaction.java 2010-03-07 19:05:39 UTC (rev 31982)
@@ -32,14 +32,8 @@
package com.arjuna.ats.internal.jts.recovery.transactions;
-import com.arjuna.ats.internal.jts.orbspecific.coordinator.ArjunaTransactionImple;
-import com.arjuna.ats.internal.jts.recovery.contact.StatusChecker;
-import com.arjuna.ats.arjuna.exceptions.*;
import com.arjuna.ats.arjuna.common.*;
-import com.arjuna.ats.arjuna.coordinator.*;
-import com.arjuna.ats.arjuna.objectstore.*;
import com.arjuna.ats.arjuna.state.*;
-import com.arjuna.ats.arjuna.utils.*;
import com.arjuna.ats.jts.logging.jtsLogger;
import com.arjuna.ats.arjuna.logging.FacilityCode;
@@ -47,7 +41,6 @@
import org.omg.CosTransactions.*;
-import org.omg.CORBA.SystemException;
import java.util.Date;
/**
@@ -81,83 +74,83 @@
}
}
-/**
- * the original process must be deceased if we are assumed complete
- */
-public Status getOriginalStatus()
-{
- return Status.StatusNoTransaction;
-}
+ /**
+ * the original process must be deceased if we are assumed complete
+ */
+ public Status getOriginalStatus()
+ {
+ return Status.StatusNoTransaction;
+ }
-public String type ()
+ public String type ()
{
- return AssumedCompleteTransaction.typeName();
+ return AssumedCompleteTransaction.typeName();
}
- /**
- * typeName differs from original to force the ActionStore to
- * keep AssumedCompleteTransactions separate
- */
+ /**
+ * typeName differs from original to force the ActionStore to
+ * keep AssumedCompleteTransactions separate
+ */
-public static String typeName ()
+ public static String typeName ()
{
- return ourTypeName;
+ return ourTypeName;
}
-public String toString ()
+ public String toString ()
{
- return "AssumedCompleteTransaction < "+get_uid()+" >";
+ return "AssumedCompleteTransaction < "+get_uid()+" >";
}
-/**
- * This T is already assumed complete, so return false
- */
-public boolean assumeComplete()
+ /**
+ * This T is already assumed complete, so return false
+ */
+ public boolean assumeComplete()
{
- return false;
+ return false;
}
-public Date getLastActiveTime()
-{
- return _lastActiveTime;
-}
+ public Date getLastActiveTime()
+ {
+ return _lastActiveTime;
+ }
-public boolean restore_state (InputObjectState objectState, int ot)
-{
- // do the other stuff
- boolean result = super.restore_state(objectState,ot);
-
- if (result) {
- try {
- long oldtime = objectState.unpackLong();
- _lastActiveTime = new Date(oldtime);
- } catch (java.io.IOException ex) {
- // can assume the assumptionTime is missing - make it now
- _lastActiveTime = new Date();
- }
+ public boolean restore_state (InputObjectState objectState, int ot)
+ {
+ // do the other stuff
+ boolean result = super.restore_state(objectState,ot);
+
+ if (result) {
+ try {
+ long oldtime = objectState.unpackLong();
+ _lastActiveTime = new Date(oldtime);
+ } catch (java.io.IOException ex) {
+ // can assume the assumptionTime is missing - make it now
+ _lastActiveTime = new Date();
+ }
+ }
+ return result;
}
- return result;
-}
-public boolean save_state (OutputObjectState os, int ot)
-{
- // do the other stuff
- boolean result = super.save_state(os,ot);
-
- if (result ) {
- // a re-write means we have just been active
- _lastActiveTime = new Date();
- try {
- os.packLong(_lastActiveTime.getTime());
- } catch (java.io.IOException ex) {
- }
+ public boolean save_state (OutputObjectState os, int ot)
+ {
+ // do the other stuff
+ boolean result = super.save_state(os,ot);
+
+ if (result ) {
+ // a re-write means we have just been active
+ _lastActiveTime = new Date();
+ try {
+ os.packLong(_lastActiveTime.getTime());
+ } catch (java.io.IOException ex) {
+ }
+ }
+ return result;
+
}
- return result;
-}
+ private Date _lastActiveTime;
-private Date _lastActiveTime;
+ private static String ourTypeName = "/StateManager/BasicAction/TwoPhaseCoordinator/ArjunaTransactionImple/AssumedCompleteTransaction";
-private static String ourTypeName = "/StateManager/BasicAction/TwoPhaseCoordinator/ArjunaTransactionImple/AssumedCompleteTransaction";
-
}
Added: labs/jbosstm/trunk/ArjunaJTS/jts/tests/classes/com/hp/mwtests/ts/jts/recovery/AssumedCompleteUnitTest.java
===================================================================
--- labs/jbosstm/trunk/ArjunaJTS/jts/tests/classes/com/hp/mwtests/ts/jts/recovery/AssumedCompleteUnitTest.java (rev 0)
+++ labs/jbosstm/trunk/ArjunaJTS/jts/tests/classes/com/hp/mwtests/ts/jts/recovery/AssumedCompleteUnitTest.java 2010-03-07 19:05:39 UTC (rev 31982)
@@ -0,0 +1,94 @@
+/*
+ * 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) 2004,
+ *
+ * Arjuna Technologies Ltd,
+ * Newcastle upon Tyne,
+ * Tyne and Wear,
+ * UK.
+ *
+ * $Id: xidcheck.java 2342 2006-03-30 13:06:17Z $
+ */
+
+package com.hp.mwtests.ts.jts.recovery;
+
+import org.junit.Test;
+import org.omg.CosTransactions.Status;
+
+import com.arjuna.ats.arjuna.ObjectType;
+import com.arjuna.ats.arjuna.common.Uid;
+import com.arjuna.ats.arjuna.state.InputObjectState;
+import com.arjuna.ats.arjuna.state.OutputObjectState;
+import com.arjuna.ats.internal.jts.recovery.transactions.AssumedCompleteServerTransaction;
+import com.arjuna.ats.internal.jts.recovery.transactions.AssumedCompleteTransaction;
+import com.hp.mwtests.ts.jts.resources.TestBase;
+
+import static org.junit.Assert.*;
+
+public class AssumedCompleteUnitTest extends TestBase
+{
+ @Test
+ public void testTransaction () throws Exception
+ {
+ AssumedCompleteTransaction tx = new AssumedCompleteTransaction(new Uid());
+
+ assertEquals(tx.getOriginalStatus(), Status.StatusNoTransaction);
+
+ assertTrue(tx.type() != null);
+ assertEquals(AssumedCompleteTransaction.typeName(), tx.type());
+ assertTrue(tx.toString() != null);
+
+ assertFalse(tx.assumeComplete());
+ assertEquals(tx.getLastActiveTime(), null);
+
+ OutputObjectState os = new OutputObjectState();
+
+ assertTrue(tx.save_state(os, ObjectType.ANDPERSISTENT));
+
+ InputObjectState is = new InputObjectState(os);
+
+ assertTrue(tx.restore_state(is, ObjectType.ANDPERSISTENT));
+ }
+
+ @Test
+ public void testServerTransaction () throws Exception
+ {
+ AssumedCompleteServerTransaction tx = new AssumedCompleteServerTransaction(new Uid());
+
+ assertEquals(tx.getOriginalStatus(), Status.StatusNoTransaction);
+
+ assertTrue(tx.type() != null);
+ assertEquals(AssumedCompleteServerTransaction.typeName(), tx.type());
+ assertTrue(tx.toString() != null);
+
+ assertFalse(tx.assumeComplete());
+ assertEquals(tx.getLastActiveTime(), null);
+
+ OutputObjectState os = new OutputObjectState();
+
+ assertTrue(tx.save_state(os, ObjectType.ANDPERSISTENT));
+
+ InputObjectState is = new InputObjectState(os);
+
+ assertTrue(tx.restore_state(is, ObjectType.ANDPERSISTENT));
+ }
+}
More information about the jboss-svn-commits
mailing list