Author: nfilotto
Date: 2011-06-07 14:31:03 -0400 (Tue, 07 Jun 2011)
New Revision: 4484
Modified:
jcr/trunk/exo.jcr.component.core/pom.xml
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/WorkspacePersistentDataManager.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/session/TransactionableResourceManager.java
jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/api/xa/TestUserTransaction.java
jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/cluster/test-configuration-jbc.xml
jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/cluster/test-configuration.xml
jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/test-configuration-jbc.xml
jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/test-configuration-sjdbc-jbc.xml
jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/test-configuration-sjdbc.xml
jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/test-configuration.xml
Log:
EXOJCR-1359: PROBLEMS during functional testing: test TestUserTransaction is in failure.
1. The unit has been modified in order to suspend the current Tx before calling
session.save for the parent remove in order to prevent being enlisted to the global tx
2. To be able to fails even with MyISAM, the parent node is removed before before commit
3. TransactionableResourceManager.isGlobalTxActive returned true even if the tx was
suspended which is a wrong behavior
4. MVCC has been enabled in the config to prevent any deadlocks on global Tx
5. The resource-connector has been added to the dependencies with the scope set to test
since it is necessary when we want to test the JCR with JOTM
6. Removed Incorrect Override annotation
Modified: jcr/trunk/exo.jcr.component.core/pom.xml
===================================================================
--- jcr/trunk/exo.jcr.component.core/pom.xml 2011-06-07 09:06:06 UTC (rev 4483)
+++ jcr/trunk/exo.jcr.component.core/pom.xml 2011-06-07 18:31:03 UTC (rev 4484)
@@ -228,6 +228,11 @@
</exclusions>
</dependency>
<dependency>
+ <groupId>javax.resource</groupId>
+ <artifactId>connector-api</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
</dependency>
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/WorkspacePersistentDataManager.java
===================================================================
---
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/WorkspacePersistentDataManager.java 2011-06-07
09:06:06 UTC (rev 4483)
+++
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/WorkspacePersistentDataManager.java 2011-06-07
18:31:03 UTC (rev 4484)
@@ -644,7 +644,6 @@
/**
* {@inheritDoc}
*/
- @Override
public int getLastOrderNumber(final NodeData nodeData) throws RepositoryException
{
final WorkspaceStorageConnection con = dataContainer.openConnection();
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/session/TransactionableResourceManager.java
===================================================================
---
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/session/TransactionableResourceManager.java 2011-06-07
09:06:06 UTC (rev 4483)
+++
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/session/TransactionableResourceManager.java 2011-06-07
18:31:03 UTC (rev 4484)
@@ -144,7 +144,16 @@
public boolean isGlobalTxActive()
{
TransactionContext ctx;
- return (ctx = contexts.get()) != null && ctx.getXidContext() != null;
+ try
+ {
+ // We need to check the status also to be able to manage properly suspend and
resume
+ return (ctx = contexts.get()) != null && ctx.getXidContext() != null
&& tm.getStatus() != Status.STATUS_NO_TRANSACTION;
+ }
+ catch (SystemException e)
+ {
+ log.warn("Could not check if a global Tx has been started", e);
+ }
+ return false;
}
/**
Modified:
jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/api/xa/TestUserTransaction.java
===================================================================
---
jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/api/xa/TestUserTransaction.java 2011-06-07
09:06:06 UTC (rev 4483)
+++
jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/api/xa/TestUserTransaction.java 2011-06-07
18:31:03 UTC (rev 4484)
@@ -30,6 +30,7 @@
import javax.jcr.Session;
import javax.jcr.SimpleCredentials;
import javax.naming.InitialContext;
+import javax.transaction.Transaction;
import javax.transaction.UserTransaction;
/**
@@ -231,13 +232,18 @@
repository.login(new SimpleCredentials("admin",
"admin".toCharArray()), session.getWorkspace().getName());
Node tx1 = s1.getRootNode().getNode("pretx").addNode("tx1");
- s1.save();
Node tx2 = s2.getRootNode().getNode("pretx").addNode("tx2");
- s2.save();
+ // keep this change out of the current Tx, this is necessary since
+ // we have now auto-enlistment mechanism that is triggered at session save
+ Transaction tx = txService.getTransactionManager().suspend();
s0.save(); // save that parent of tx1 removed
+ txService.getTransactionManager().resume(tx);
+ s1.save();
+ s2.save();
+
try
{
ut.commit();
Modified:
jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/cluster/test-configuration-jbc.xml
===================================================================
---
jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/cluster/test-configuration-jbc.xml 2011-06-07
09:06:06 UTC (rev 4483)
+++
jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/cluster/test-configuration-jbc.xml 2011-06-07
18:31:03 UTC (rev 4484)
@@ -267,7 +267,8 @@
<name>ref-addresses</name>
<description>ref-addresses</description>
<property name="driverClassName"
value="org.hsqldb.jdbcDriver"/>
- <property name="url"
value="jdbc:hsqldb:file:target/temp/data/portal"/>
+ <!-- MVCC configured to prevent possible deadlocks when a global Tx is
active -->
+ <property name="url"
value="jdbc:hsqldb:file:target/temp/data/portal;hsqldb.tx=mvcc"/>
<property name="username" value="sa"/>
<property name="password" value=""/>
</properties-param>
Modified:
jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/cluster/test-configuration.xml
===================================================================
---
jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/cluster/test-configuration.xml 2011-06-07
09:06:06 UTC (rev 4483)
+++
jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/cluster/test-configuration.xml 2011-06-07
18:31:03 UTC (rev 4484)
@@ -267,7 +267,8 @@
<name>ref-addresses</name>
<description>ref-addresses</description>
<property name="driverClassName"
value="org.hsqldb.jdbcDriver"/>
- <property name="url"
value="jdbc:hsqldb:file:target/temp/data/portal"/>
+ <!-- MVCC configured to prevent possible deadlocks when a global Tx is
active -->
+ <property name="url"
value="jdbc:hsqldb:file:target/temp/data/portal;hsqldb.tx=mvcc"/>
<property name="username" value="sa"/>
<property name="password" value=""/>
</properties-param>
Modified:
jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/test-configuration-jbc.xml
===================================================================
---
jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/test-configuration-jbc.xml 2011-06-07
09:06:06 UTC (rev 4483)
+++
jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/test-configuration-jbc.xml 2011-06-07
18:31:03 UTC (rev 4484)
@@ -249,7 +249,8 @@
<name>ref-addresses</name>
<description>ref-addresses</description>
<property name="driverClassName"
value="org.hsqldb.jdbcDriver"/>
- <property name="url"
value="jdbc:hsqldb:file:target/temp/data/portal"/>
+ <!-- MVCC configured to prevent possible deadlocks when a global Tx is
active -->
+ <property name="url"
value="jdbc:hsqldb:file:target/temp/data/portal;hsqldb.tx=mvcc"/>
<property name="username" value="sa"/>
<property name="password" value=""/>
</properties-param>
Modified:
jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/test-configuration-sjdbc-jbc.xml
===================================================================
---
jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/test-configuration-sjdbc-jbc.xml 2011-06-07
09:06:06 UTC (rev 4483)
+++
jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/test-configuration-sjdbc-jbc.xml 2011-06-07
18:31:03 UTC (rev 4484)
@@ -249,7 +249,8 @@
<name>ref-addresses</name>
<description>ref-addresses</description>
<property name="driverClassName"
value="org.hsqldb.jdbcDriver"/>
- <property name="url"
value="jdbc:hsqldb:file:target/temp/data/portal"/>
+ <!-- MVCC configured to prevent possible deadlocks when a global Tx is
active -->
+ <property name="url"
value="jdbc:hsqldb:file:target/temp/data/portal;hsqldb.tx=mvcc"/>
<property name="username" value="sa"/>
<property name="password" value=""/>
</properties-param>
Modified:
jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/test-configuration-sjdbc.xml
===================================================================
---
jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/test-configuration-sjdbc.xml 2011-06-07
09:06:06 UTC (rev 4483)
+++
jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/test-configuration-sjdbc.xml 2011-06-07
18:31:03 UTC (rev 4484)
@@ -249,7 +249,8 @@
<name>ref-addresses</name>
<description>ref-addresses</description>
<property name="driverClassName"
value="org.hsqldb.jdbcDriver"/>
- <property name="url"
value="jdbc:hsqldb:file:target/temp/data/portal"/>
+ <!-- MVCC configured to prevent possible deadlocks when a global Tx is
active -->
+ <property name="url"
value="jdbc:hsqldb:file:target/temp/data/portal;hsqldb.tx=mvcc"/>
<property name="username" value="sa"/>
<property name="password" value=""/>
</properties-param>
Modified:
jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/test-configuration.xml
===================================================================
---
jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/test-configuration.xml 2011-06-07
09:06:06 UTC (rev 4483)
+++
jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/test-configuration.xml 2011-06-07
18:31:03 UTC (rev 4484)
@@ -249,7 +249,8 @@
<name>ref-addresses</name>
<description>ref-addresses</description>
<property name="driverClassName"
value="org.hsqldb.jdbcDriver"/>
- <property name="url"
value="jdbc:hsqldb:file:target/temp/data/portal"/>
+ <!-- MVCC configured to prevent possible deadlocks when a global Tx is
active -->
+ <property name="url"
value="jdbc:hsqldb:file:target/temp/data/portal;hsqldb.tx=mvcc"/>
<property name="username" value="sa"/>
<property name="password" value=""/>
</properties-param>