Author: pnedonosko
Date: 2010-02-03 05:09:14 -0500 (Wed, 03 Feb 2010)
New Revision: 1640
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/storage/jdbc/JDBCStorageConnection.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/db/OracleConnectionFactory.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/db/OraclePoolConnectionFactory.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/OracleConnectionFactory.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/OraclePoolConnectionFactory.java
jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCConnectionTestBase.java
jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/storage/jdbc/db/TestMultiDbJDBCConnection.java
jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/storage/jdbc/db/TestSingleDbJDBCConnection.java
jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/storage/value/fs/TestRemoveFromValueStorage.java
Log:
EXOJCR-403 WPDM use conn.close instead of rollback on for-read connection (SNS check);
code format; reorg tests for JDBC container testing
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 2010-02-03
10:01:42 UTC (rev 1639)
+++
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/WorkspacePersistentDataManager.java 2010-02-03
10:09:14 UTC (rev 1640)
@@ -570,7 +570,7 @@
}
finally
{
- acon.rollback();
+ acon.close();
}
}
}
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCStorageConnection.java
===================================================================
---
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCStorageConnection.java 2010-02-03
10:01:42 UTC (rev 1639)
+++
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCStorageConnection.java 2010-02-03
10:09:14 UTC (rev 1640)
@@ -268,7 +268,11 @@
checkIfOpened();
try
{
- dbConnection.rollback();
+ if (!this.readOnly)
+ {
+ dbConnection.rollback();
+ }
+
dbConnection.close();
// rollback from the end
@@ -321,14 +325,19 @@
checkIfOpened();
try
{
- dbConnection.commit();
+ if (!this.readOnly)
+ {
+ dbConnection.commit();
+ }
+
dbConnection.close();
try
{
for (ValueIOChannel vo : valueChanges)
+ {
vo.commit();
-
+ }
}
catch (IOException e)
{
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/db/OracleConnectionFactory.java
===================================================================
---
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/db/OracleConnectionFactory.java 2010-02-03
10:01:42 UTC (rev 1639)
+++
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/db/OracleConnectionFactory.java 2010-02-03
10:09:14 UTC (rev 1640)
@@ -177,8 +177,11 @@
{
Connection conn = getCachedConnection();
- if (readOnly) // set this feature only if it asked
+ if (readOnly)
+ {
+ // set this feature only if it asked
conn.setReadOnly(true);
+ }
return conn;
}
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/db/OraclePoolConnectionFactory.java
===================================================================
---
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/db/OraclePoolConnectionFactory.java 2010-02-03
10:01:42 UTC (rev 1639)
+++
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/db/OraclePoolConnectionFactory.java 2010-02-03
10:09:14 UTC (rev 1640)
@@ -163,8 +163,11 @@
{
Connection conn = getPoolConnection();
- if (readOnly) // set this feature only if it asked
+ if (readOnly)
+ {
+ // set this feature only if it asked
conn.setReadOnly(true);
+ }
return conn;
}
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/OracleConnectionFactory.java
===================================================================
---
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/OracleConnectionFactory.java 2010-02-03
10:01:42 UTC (rev 1639)
+++
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/OracleConnectionFactory.java 2010-02-03
10:09:14 UTC (rev 1640)
@@ -177,8 +177,11 @@
{
Connection conn = getCachedConnection();
- if (readOnly) // set this feature only if it asked
+ if (readOnly)
+ {
+ // set this feature only if it asked
conn.setReadOnly(true);
+ }
return conn;
}
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/OraclePoolConnectionFactory.java
===================================================================
---
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/OraclePoolConnectionFactory.java 2010-02-03
10:01:42 UTC (rev 1639)
+++
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/OraclePoolConnectionFactory.java 2010-02-03
10:09:14 UTC (rev 1640)
@@ -163,8 +163,11 @@
{
Connection conn = getPoolConnection();
- if (readOnly) // set this feature only if it asked
+ if (readOnly)
+ {
+ // set this feature only if it asked
conn.setReadOnly(true);
+ }
return conn;
}
Modified:
jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCConnectionTestBase.java
===================================================================
---
jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCConnectionTestBase.java 2010-02-03
10:01:42 UTC (rev 1639)
+++
jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCConnectionTestBase.java 2010-02-03
10:09:14 UTC (rev 1640)
@@ -47,13 +47,6 @@
private Connection connect = null;
- public void setUp(String scriptPath, boolean multiDB) throws Exception
- {
-
- super.setUp();
- new DBInitializer("ws3", getJNDIConnection(), scriptPath,
multiDB).init();
- }
-
protected void tearDown() throws Exception
{
Modified:
jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/storage/jdbc/db/TestMultiDbJDBCConnection.java
===================================================================
---
jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/storage/jdbc/db/TestMultiDbJDBCConnection.java 2010-02-03
10:01:42 UTC (rev 1639)
+++
jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/storage/jdbc/db/TestMultiDbJDBCConnection.java 2010-02-03
10:09:14 UTC (rev 1640)
@@ -17,6 +17,7 @@
package org.exoplatform.services.jcr.impl.storage.jdbc.db;
import org.exoplatform.services.jcr.impl.storage.jdbc.JDBCConnectionTestBase;
+import org.exoplatform.services.jcr.impl.storage.jdbc.init.DBInitializer;
import java.sql.SQLException;
import java.sql.Statement;
@@ -32,13 +33,16 @@
public class TestMultiDbJDBCConnection extends JDBCConnectionTestBase
{
- /* (non-Javadoc)
- * @see org.exoplatform.services.jcr.BaseStandaloneTest#setUp()
- */
+ private void setUp(String scriptPath, boolean multiDB) throws Exception
+ {
+ super.setUp();
+ new DBInitializer("ws3", getJNDIConnection(), scriptPath,
multiDB).init();
+ }
+
@Override
public void setUp() throws Exception
{
- super.setUp("/conf/storage/jcr-mjdbc.sql", true);
+ setUp("/conf/storage/jcr-mjdbc.sql", true);
try
{
Modified:
jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/storage/jdbc/db/TestSingleDbJDBCConnection.java
===================================================================
---
jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/storage/jdbc/db/TestSingleDbJDBCConnection.java 2010-02-03
10:01:42 UTC (rev 1639)
+++
jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/storage/jdbc/db/TestSingleDbJDBCConnection.java 2010-02-03
10:09:14 UTC (rev 1640)
@@ -17,6 +17,7 @@
package org.exoplatform.services.jcr.impl.storage.jdbc.db;
import org.exoplatform.services.jcr.impl.storage.jdbc.JDBCConnectionTestBase;
+import org.exoplatform.services.jcr.impl.storage.jdbc.init.DBInitializer;
import java.sql.SQLException;
import java.sql.Statement;
@@ -32,16 +33,18 @@
public class TestSingleDbJDBCConnection extends JDBCConnectionTestBase
{
- /* (non-Javadoc)
- * @see org.exoplatform.services.jcr.BaseStandaloneTest#setUp()
- */
+ private void setUp(String scriptPath, boolean multiDB) throws Exception
+ {
+ super.setUp();
+ new DBInitializer("ws3", getJNDIConnection(), scriptPath,
multiDB).init();
+ }
+
@Override
public void setUp() throws Exception
{
- super.setUp("/conf/storage/jcr-sjdbc.sql", false);
+ setUp("/conf/storage/jcr-sjdbc.sql", false);
try
{
-
Statement st = getJNDIConnection().createStatement();
st.executeUpdate("insert into JCR_SITEM values" +
"('A','A','test1',20090525,'ws3',2,1233,1,10,5)");
st.executeUpdate("insert into JCR_SITEM values" +
"('B','A','test2',20090625,'ws3',1,1233,5,10,4)");
@@ -56,7 +59,6 @@
st.close();
jdbcConn = new SingleDbJDBCConnection(getJNDIConnection(), false,
"ws3", null, 10, null, null);
tableType = "S";
-
}
catch (SQLException se)
{
Modified:
jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/storage/value/fs/TestRemoveFromValueStorage.java
===================================================================
---
jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/storage/value/fs/TestRemoveFromValueStorage.java 2010-02-03
10:01:42 UTC (rev 1639)
+++
jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/storage/value/fs/TestRemoveFromValueStorage.java 2010-02-03
10:09:14 UTC (rev 1640)
@@ -60,9 +60,9 @@
private int smallValueSize = 1000 * 1024;
- private SessionImpl my_session;
+ private SessionImpl mySession;
- private Node my_root;
+ private Node myRoot;
@Override
public void setUp() throws Exception
@@ -70,11 +70,11 @@
super.setUp();
// This test uses special workspace ("ws3"), with complex value storage.
So
// we need to login into another workspace.
- my_session = (SessionImpl)repository.login(credentials, "ws3");
- my_root = my_session.getRootNode();
+ mySession = (SessionImpl)repository.login(credentials, "ws3");
+ myRoot = mySession.getRootNode();
// creating property with binary values.
- testRoot = my_root.addNode("TestRoot");
+ testRoot = myRoot.addNode("TestRoot");
values = new Value[largeCount + smallCount];
@@ -98,6 +98,7 @@
generator.nextBytes(smallValue);
values[i] = testRoot.getSession().getValueFactory().createValue(new
ByteArrayInputStream(smallValue));
}
+
if (values.length == 1)
{
prop = testRoot.setProperty("binaryProperty", values[0]);
@@ -106,7 +107,7 @@
{
prop = testRoot.setProperty("binaryProperty", values);
}
- my_session.save();
+ mySession.save();
}
public void testRemoveValue() throws Exception
@@ -114,7 +115,7 @@
// reading values directly from value storage
PropertyImpl propertyImpl = (PropertyImpl)prop;
ValueStoragePluginProvider storageProvider =
-
(ValueStoragePluginProvider)my_session.getContainer().getComponentInstanceOfType(
+
(ValueStoragePluginProvider)mySession.getContainer().getComponentInstanceOfType(
ValueStoragePluginProvider.class);
String propertyId = propertyImpl.getInternalIdentifier();
@@ -143,7 +144,7 @@
}
prop.remove();
- my_session.save();
+ mySession.save();
// checking whether values are still in value storage.
for (int i = 0; i < count; i++)
@@ -170,10 +171,10 @@
@Override
protected void tearDown() throws Exception
{
- if (my_session != null)
+ if (mySession != null)
{
testRoot.remove();
- my_session.logout();
+ mySession.logout();
}
super.tearDown();
}