exo-jcr SVN: r1495 - in jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src: test/java/org/exoplatform/services/jcr/lab/cluster/test and 1 other directories.
by do-not-reply@jboss.org
Author: pnedonosko
Date: 2010-01-19 20:37:35 -0500 (Tue, 19 Jan 2010)
New Revision: 1495
Modified:
jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/dataflow/persistent/PersistedItemData.java
jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/dataflow/persistent/PersistedPropertyData.java
jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/lab/cluster/test/TestBLOBValue.java
jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/standalone/test-configuration-sjdbc.xml
jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/standalone/test-configuration.xml
Log:
EXOJCR-404 test and cleanup
Modified: jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/dataflow/persistent/PersistedItemData.java
===================================================================
--- jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/dataflow/persistent/PersistedItemData.java 2010-01-20 01:22:17 UTC (rev 1494)
+++ jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/dataflow/persistent/PersistedItemData.java 2010-01-20 01:37:35 UTC (rev 1495)
@@ -53,7 +53,7 @@
private static final long serialVersionUID = -3845740801904303663L;
protected String id;
-
+
protected QPath qpath;
protected String parentId;
@@ -63,7 +63,7 @@
private final static int NOT_NULL_VALUE = 1;
private final static int NULL_VALUE = -1;
-
+
/**
* Empty constructor to serialization.
*/
@@ -129,7 +129,7 @@
return false;
}
-
+
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
{
byte[] buf;
@@ -188,7 +188,9 @@
out.write(parentId.getBytes());
}
else
+ {
out.writeInt(NULL_VALUE);
+ }
out.writeInt(version);
}
Modified: jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/dataflow/persistent/PersistedPropertyData.java
===================================================================
--- jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/dataflow/persistent/PersistedPropertyData.java 2010-01-20 01:22:17 UTC (rev 1494)
+++ jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/dataflow/persistent/PersistedPropertyData.java 2010-01-20 01:37:35 UTC (rev 1495)
@@ -51,9 +51,9 @@
* serialVersionUID to serialization.
*/
private static final long serialVersionUID = 2035566403758848232L;
-
+
protected final static int NULL_VALUES = -1;
-
+
protected List<ValueData> values;
protected int type;
@@ -134,7 +134,9 @@
int listSize = values.size();
out.writeInt(listSize);
for (int i = 0; i < listSize; i++)
+ {
out.writeObject(values.get(i));
+ }
}
else
{
@@ -158,7 +160,9 @@
{
values = new ArrayList<ValueData>();
for (int i = 0; i < listSize; i++)
+ {
values.add((ValueData)in.readObject());
+ }
}
}
}
Modified: jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/lab/cluster/test/TestBLOBValue.java
===================================================================
--- jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/lab/cluster/test/TestBLOBValue.java 2010-01-20 01:22:17 UTC (rev 1494)
+++ jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/lab/cluster/test/TestBLOBValue.java 2010-01-20 01:37:35 UTC (rev 1495)
@@ -63,7 +63,7 @@
// read
Session user1 = repository.login(credentials, root.getSession().getWorkspace().getName());
- Node troot = user1.getRootNode().getNode("TestBLOBValue");
+ Node troot = user1.getRootNode().getNode(TEST_ROOT_NAME);
Property tblob = troot.getProperty("blob");
InputStream blobStream = tblob.getStream();
Modified: jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/standalone/test-configuration-sjdbc.xml
===================================================================
--- jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/standalone/test-configuration-sjdbc.xml 2010-01-20 01:22:17 UTC (rev 1494)
+++ jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/standalone/test-configuration-sjdbc.xml 2010-01-20 01:37:35 UTC (rev 1495)
@@ -265,33 +265,6 @@
</properties-param>
</init-params>
</component-plugin>
- <!-- Resource configuration for UserTransaction
- use JOTM
- -->
- <component-plugin>
- <name>jotm.tx</name>
- <set-method>addPlugin</set-method>
- <type>org.exoplatform.services.naming.BindReferencePlugin</type>
- <init-params>
- <value-param>
- <name>bind-name</name>
- <value>UserTransaction</value>
- </value-param>
- <value-param>
- <name>class-name</name>
- <value>javax.transaction.UserTransaction</value>
- </value-param>
- <value-param>
- <name>factory</name>
- <value>org.objectweb.jotm.UserTransactionFactory</value>
- </value-param>
- <properties-param>
- <name>ref-addresses</name>
- <description>ref-addresses</description>
- <property name="jotm.timeout" value="60"/>
- </properties-param>
- </init-params>
- </component-plugin>
<component-plugin>
<name>bind.jcr</name>
<set-method>addPlugin</set-method>
Modified: jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/standalone/test-configuration.xml
===================================================================
--- jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/standalone/test-configuration.xml 2010-01-20 01:22:17 UTC (rev 1494)
+++ jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/standalone/test-configuration.xml 2010-01-20 01:37:35 UTC (rev 1495)
@@ -206,7 +206,7 @@
<init-params>
<value-param>
<name>timeout</name>
- <value>300</value>
+ <value>3000</value>
</value-param>
</init-params>
</component>
@@ -521,34 +521,7 @@
</properties-param>
</init-params>
</component-plugin>
- <!-- Resource configuration for UserTransaction
- use JOTM
- -->
<component-plugin>
- <name>jotm.tx</name>
- <set-method>addPlugin</set-method>
- <type>org.exoplatform.services.naming.BindReferencePlugin</type>
- <init-params>
- <value-param>
- <name>bind-name</name>
- <value>UserTransaction</value>
- </value-param>
- <value-param>
- <name>class-name</name>
- <value>javax.transaction.UserTransaction</value>
- </value-param>
- <value-param>
- <name>factory</name>
- <value>org.objectweb.jotm.UserTransactionFactory</value>
- </value-param>
- <properties-param>
- <name>ref-addresses</name>
- <description>ref-addresses</description>
- <property name="jotm.timeout" value="60"/>
- </properties-param>
- </init-params>
- </component-plugin>
- <component-plugin>
<name>bind.jcr</name>
<set-method>addPlugin</set-method>
<type>org.exoplatform.services.naming.BindReferencePlugin</type>
16 years, 3 months
exo-jcr SVN: r1494 - jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent.
by do-not-reply@jboss.org
Author: pnedonosko
Date: 2010-01-19 20:22:17 -0500 (Tue, 19 Jan 2010)
New Revision: 1494
Modified:
jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/FilePersistedValueData.java
jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/StreamPersistedValueData.java
Log:
EXOJCR-404 empty constructors and serialization errors on null file
Modified: jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/FilePersistedValueData.java
===================================================================
--- jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/FilePersistedValueData.java 2010-01-20 00:45:17 UTC (rev 1493)
+++ jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/FilePersistedValueData.java 2010-01-20 01:22:17 UTC (rev 1494)
@@ -53,7 +53,7 @@
* The serialVersionUID.
*/
private static final long serialVersionUID = -8183328056670315388L;
-
+
protected File file;
protected FileChannel channel;
@@ -63,9 +63,8 @@
*/
public FilePersistedValueData()
{
- super();
}
-
+
/**
* FilePersistedValueData constructor.
* @param orderNumber int
@@ -239,10 +238,18 @@
orderNumber = in.readInt();
// read canonical file path
- byte[] buf = new byte[in.readInt()];
- in.readFully(buf);
-
- file = new File(new String(buf, "UTF-8"));
+ int size = in.readInt();
+ if (size >= 0)
+ {
+ byte[] buf = new byte[size];
+ in.readFully(buf);
+
+ file = new File(new String(buf, "UTF-8"));
+ }
+ else
+ {
+ throw new IOException("Persisted ValueData with null file found");
+ }
}
/**
@@ -251,10 +258,17 @@
public void writeExternal(ObjectOutput out) throws IOException
{
out.writeInt(orderNumber);
-
- // write canonical file path
- byte[] buf = file.getCanonicalPath().getBytes("UTF-8");
- out.writeInt(buf.length);
- out.write(buf);
+
+ // write canonical file path
+ if (file != null)
+ {
+ byte[] buf = file.getCanonicalPath().getBytes("UTF-8");
+ out.writeInt(buf.length);
+ out.write(buf);
+ }
+ else
+ {
+ throw new IOException("Persisted ValueData with null file found");
+ }
}
}
Modified: jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/StreamPersistedValueData.java
===================================================================
--- jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/StreamPersistedValueData.java 2010-01-20 00:45:17 UTC (rev 1493)
+++ jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/StreamPersistedValueData.java 2010-01-20 01:22:17 UTC (rev 1494)
@@ -96,6 +96,13 @@
}
/**
+ * StreamPersistedValueData empty constructor for serialization.
+ */
+ public StreamPersistedValueData()
+ {
+ }
+
+ /**
* Return original data stream or null. <br/>
* For persistent transformation from non-spooled TransientValueData to persistent layer.<br/>
* WARN: after the stream will be consumed it will not contains data anymore.
16 years, 3 months
exo-jcr SVN: r1493 - jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent.
by do-not-reply@jboss.org
Author: pnedonosko
Date: 2010-01-19 19:45:17 -0500 (Tue, 19 Jan 2010)
New Revision: 1493
Modified:
jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/CacheableWorkspaceDataManager.java
jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/TxIsolatedOperation.java
Log:
EXOJCR-405 rollback rework for storage transaction (don't call rollback after failed commit - it's not actual)
Modified: jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/CacheableWorkspaceDataManager.java
===================================================================
--- jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/CacheableWorkspaceDataManager.java 2010-01-19 23:30:39 UTC (rev 1492)
+++ jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/CacheableWorkspaceDataManager.java 2010-01-20 00:45:17 UTC (rev 1493)
@@ -295,8 +295,7 @@
}
@Override
- protected void txAction() throws RepositoryException, NotSupportedException, SystemException, SecurityException,
- IllegalStateException, RollbackException, HeuristicMixedException, HeuristicRollbackException
+ protected void txAction() throws RepositoryException
{
super.txAction();
Modified: jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/TxIsolatedOperation.java
===================================================================
--- jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/TxIsolatedOperation.java 2010-01-19 23:30:39 UTC (rev 1492)
+++ jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/TxIsolatedOperation.java 2010-01-20 00:45:17 UTC (rev 1493)
@@ -62,16 +62,16 @@
* Action will runs in dedicated XA transaction, i.e. only JCR storage stuff will be involved to.
* But if it's a nested isolated operation it will run the action assuming the same (current, active) transaction.
*
- * @throws SystemException if XA unexpected error
- * @throws NotSupportedException if unsupported XA operation
- * @throws HeuristicRollbackException if all relevant updates have been rolled back on commit
- * @throws HeuristicMixedException if some relevant updates have been committed and others have been rolled back on commit
- * @throws RollbackException rollback error
- * @throws IllegalStateException if thread is not associated with a transaction
- * @throws SecurityException if thread is not allowed to commit the transaction
+ * @throws RepositoryException if error occurs
*/
- protected void txAction() throws RepositoryException, NotSupportedException, SystemException, SecurityException,
- IllegalStateException, RollbackException, HeuristicMixedException, HeuristicRollbackException
+ // * @throws SystemException if XA unexpected error
+ // * @throws NotSupportedException if unsupported XA operation
+ // * @throws HeuristicRollbackException if all relevant updates have been rolled back on commit
+ // * @throws HeuristicMixedException if some relevant updates have been committed and others have been rolled back on commit
+ // * @throws RollbackException rollback performed
+ // * @throws IllegalStateException if thread is not associated with a transaction
+ // * @throws SecurityException if thread is not allowed to commit the transaction
+ protected void txAction() throws RepositoryException
{
final boolean actInTx = currentIsolated.get() == null;
if (actInTx)
@@ -91,9 +91,67 @@
action();
- commitTx();
+ try
+ {
+ commitTx();
+ }
+ catch (RollbackException e)
+ {
+ // Indicate that the transaction has been rolled back rather than committed.
+ throw new RepositoryException(e);
+ }
+ catch (HeuristicRollbackException e)
+ {
+ // if all relevant updates have been rolled back on commit
+ throw new RepositoryException(e);
+ }
+ catch (HeuristicMixedException e)
+ {
+ // if some relevant updates have been committed and others have been rolled back on commit
+ // TODO partial commit - got inconsistency. rollback not possible?
+ // doRollback();
+ throw new RepositoryException(e);
+ }
+ catch (IllegalStateException e)
+ {
+ // if thread is not associated with a transaction
+ // TODO can we do rollback if not in the tx thread?
+ // doRollback();
+ throw new RepositoryException(e);
+ }
+ catch (SecurityException e)
+ {
+ // if thread is not allowed to commit the transaction
+ // TODO can we do the rollback, will it have a rights?
+ // doRollback();
+ throw new RepositoryException(e);
+ }
+ catch (SystemException e)
+ {
+ // if XA unexpected error
+ // TODO rollback not possible?
+ // doRollback();
+ throw new RepositoryException(e);
+ }
+ finally
+ {
+ rollback = false;
+ }
+ }
+ catch (NotSupportedException e)
+ {
+ // if unsupported XA operation: nested transaction
rollback = false;
+ doRollback();
+ throw new RepositoryException(e);
}
+ catch (SystemException e)
+ {
+ // if XA unexpected error on begin or get transaction
+ rollback = false;
+ doRollback();
+ throw new RepositoryException("Unexpected error on begin or get of a transaction", e);
+ }
finally
{
if (rollback)
@@ -145,11 +203,11 @@
{
txAction();
}
- catch (RollbackException e)
- {
- // Indicate that the transaction has been rolled back rather than committed.
- throw new RepositoryException(actionError = e);
- }
+ // catch (RollbackException e)
+ // {
+ // // Indicate that the transaction has been rolled back rather than committed.
+ // throw new RepositoryException(actionError = e);
+ // }
catch (JCRInvalidItemStateException e)
{
throw new JCRInvalidItemStateException(e.getMessage(), e.getIdentifier(), e.getState(), actionError = e);
@@ -222,67 +280,5 @@
{
throw new RepositoryException("Error of Transaction suspend", e);
}
-
- // TODO to do not commit in curr thread (i.e. curr tx)
- // try
- // {
- // if (transactionManager.getStatus() == Status.STATUS_COMMITTING)
- // {
- // // The JCR session has been enrolled into a XA Transaction, the method applyChanges must be called in another thread since the operations
- // // that we do into the cache are not allowed within the current Transaction, so to do it in another Transaction we need to call the method
- // // from another Thread
- // final AtomicReference<Exception> exception = new AtomicReference<Exception>();
- // final CountDownLatch doneSignal = new CountDownLatch(1);
- // Thread t = new Thread()
- // {
- // public void run()
- // {
- // try
- // {
- // applyChanges(changesLog);
- // }
- // catch (Exception e)
- // {
- // exception.set(e);
- // }
- // finally
- // {
- // doneSignal.countDown();
- // }
- // }
- // };
- // t.start();
- // doneSignal.await();
- // Exception e = exception.get();
- // if (e != null)
- // {
- // if (e instanceof RepositoryException)
- // {
- // throw (RepositoryException)e;
- // }
- // else
- // {
- // throw new RuntimeException(e);
- // }
- // }
- // }
- // else
- // {
- // // Normal Transaction
- // applyChanges(changesLog);
- // }
- // }
- // catch (RepositoryException e)
- // {
- // throw e;
- // }
- // catch (InterruptedException e)
- // {
- // throw new RepositoryException(e.getLocalizedMessage(), e.getCause());
- // }
- // catch (SystemException e)
- // {
- // throw new RepositoryException(e.getLocalizedMessage(), e.getCause());
- // }
}
}
16 years, 3 months
exo-jcr SVN: r1492 - jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/api/xa.
by do-not-reply@jboss.org
Author: pnedonosko
Date: 2010-01-19 18:30:39 -0500 (Tue, 19 Jan 2010)
New Revision: 1492
Modified:
jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/api/xa/TestUserTransaction.java
Log:
EXOJCR-405 testUserTransactionFromJndi() excluded - we don't have JNDI for JBossTS now
Modified: jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/api/xa/TestUserTransaction.java
===================================================================
--- jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/api/xa/TestUserTransaction.java 2010-01-19 22:29:23 UTC (rev 1491)
+++ jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/api/xa/TestUserTransaction.java 2010-01-19 23:30:39 UTC (rev 1492)
@@ -161,7 +161,8 @@
}
}
- public void testUserTransactionFromJndi() throws Exception
+ // we don't have JNID for JBossTS in standalone now
+ public void _testUserTransactionFromJndi() throws Exception
{
assertNotNull(txService);
16 years, 3 months
exo-jcr SVN: r1491 - jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/lab/cluster/test.
by do-not-reply@jboss.org
Author: pnedonosko
Date: 2010-01-19 17:29:23 -0500 (Tue, 19 Jan 2010)
New Revision: 1491
Modified:
jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/lab/cluster/test/TestBLOBValue.java
Log:
EXOJCR-404 test read usecase
Modified: jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/lab/cluster/test/TestBLOBValue.java
===================================================================
--- jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/lab/cluster/test/TestBLOBValue.java 2010-01-19 22:01:26 UTC (rev 1490)
+++ jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/lab/cluster/test/TestBLOBValue.java 2010-01-19 22:29:23 UTC (rev 1491)
@@ -12,22 +12,32 @@
public class TestBLOBValue extends JcrAPIBaseTest
{
+ private static final String TEST_ROOT_NAME = "TestBLOBValue";
+
+ private static final int FILE_SIZE_KB = 1024;
+ private static File testFile;
+
private Node testRoot;
- private static File testFile;
-
@Override
public void setUp() throws Exception
{
super.setUp();
- testRoot = root.addNode("TestBLOBValue");
- root.save();
+ if (root.hasNode(TEST_ROOT_NAME))
+ {
+ testRoot = root.getNode(TEST_ROOT_NAME);
+ }
+ else
+ {
+ testRoot = root.addNode(TEST_ROOT_NAME);
+ root.save();
+ }
if (testFile == null)
{
- testFile = createBLOBTempFile(1020); // 1MB
+ testFile = createBLOBTempFile(FILE_SIZE_KB); // 1MB
}
}
@@ -50,13 +60,38 @@
testRoot.save();
fis.close();
-
+
// read
Session user1 = repository.login(credentials, root.getSession().getWorkspace().getName());
Node troot = user1.getRootNode().getNode("TestBLOBValue");
Property tblob = troot.getProperty("blob");
InputStream blobStream = tblob.getStream();
+
+ byte[] buff = new byte[1024];
+ int r = 0;
+ int size = 0;
+ while ((r = blobStream.read(buff))>=0) {
+ size += r;
+ }
+
+ assertEquals(FILE_SIZE_KB * 1024, size);
}
+
+ public void testReadProperty() throws Exception
+ {
+ // read
+ Property blob = testRoot.getProperty("blob");
+ InputStream blobStream = blob.getStream();
+
+ byte[] buff = new byte[1024];
+ int r = 0;
+ int size = 0;
+ while ((r = blobStream.read(buff))>=0) {
+ size += r;
+ }
+
+ assertEquals(FILE_SIZE_KB * 1024, size);
+ }
public void testUpdateProperty() throws Exception
{
16 years, 3 months
exo-jcr SVN: r1490 - jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr.
by do-not-reply@jboss.org
Author: pnedonosko
Date: 2010-01-19 17:01:26 -0500 (Tue, 19 Jan 2010)
New Revision: 1490
Modified:
jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/BaseStandaloneTest.java
Log:
EXOJCR-325 BaseStandaloneTest support for external configuration added
Modified: jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/BaseStandaloneTest.java
===================================================================
--- jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/BaseStandaloneTest.java 2010-01-19 22:00:38 UTC (rev 1489)
+++ jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/BaseStandaloneTest.java 2010-01-19 22:01:26 UTC (rev 1490)
@@ -40,6 +40,7 @@
import java.io.IOException;
import java.io.InputStream;
import java.lang.ref.WeakReference;
+import java.net.URL;
import java.util.Random;
import javax.jcr.Node;
@@ -102,22 +103,35 @@
public void setUp() throws Exception
{
+ String configPath = System.getProperty("jcr.test.configuration.file");
+ if (configPath == null)
+ {
+ fail("System property jcr.test.configuration.file not found");
+ }
- String containerConf =
- BaseStandaloneTest.class.getResource(System.getProperty("jcr.test.configuration.file")).toString();
- String loginConf = BaseStandaloneTest.class.getResource("/login.conf").toString();
-
- StandaloneContainer.addConfigurationURL(containerConf);
+ URL configUrl = BaseStandaloneTest.class.getResource(configPath);
+ if (configUrl != null)
+ {
+ StandaloneContainer.addConfigurationURL(configUrl.toString());
+ }
+ else
+ {
+ StandaloneContainer.addConfigurationPath(configPath);
+ }
// .addConfigurationPath("src/test/java/conf/standalone/test-configuration.xml");
// .addConfigurationPath("src/test/java/conf/standalone/test-configuration-sjdbc.xml");
// .addConfigurationPath("src/test/java/conf/standalone/test-configuration-sjdbc.pgsql.xml");
// .addConfigurationPath("src/test/java/conf/standalone/test-configuration-sjdbc.ora.xml");
- // .addConfigurationPath("src/test/java/conf/standalone/test-configuration-mjdbc.mysql.xml");
+ // .addConfigurationPath("src/test/java/conf/standalone/test-configuration-mjdbc.mysql.xml");
+ String loginConf = BaseStandaloneTest.class.getResource("/login.conf").toString();
+
container = StandaloneContainer.getInstance();
if (System.getProperty("java.security.auth.login.config") == null)
+ {
System.setProperty("java.security.auth.login.config", loginConf);
+ }
credentials = new CredentialsImpl("admin", "admin".toCharArray());
@@ -143,12 +157,10 @@
(WorkspaceFileCleanerHolder)wsc.getComponent(WorkspaceFileCleanerHolder.class);
fileCleaner = wfcleaner.getFileCleaner();
holder = new ReaderSpoolFileHolder();
-
}
protected void tearDown() throws Exception
{
-
if (session != null)
{
try
@@ -180,8 +192,6 @@
}
}
super.tearDown();
-
- // log.info("tearDown() END " + getClass().getName() + "." + getName());
}
protected abstract String getRepositoryName();
@@ -289,7 +299,6 @@
protected void compareStream(InputStream etalon, InputStream data, long etalonPos, long dataPos, long length)
throws IOException, CompareStreamException
{
-
int dindex = 0;
skipStream(etalon, etalonPos);
@@ -300,7 +309,6 @@
while ((eread = etalon.read(ebuff)) > 0)
{
-
byte[] dbuff = new byte[eread];
int erindex = 0;
while (erindex < eread)
@@ -317,22 +325,28 @@
}
if (dread == -1)
+ {
throw new CompareStreamException(
"Streams is not equals by length. Data end-of-stream reached at position " + dindex);
+ }
for (int i = 0; i < dread; i++)
{
byte eb = ebuff[i];
byte db = dbuff[i];
if (eb != db)
+ {
throw new CompareStreamException("Streams is not equals. Wrong byte stored at position " + dindex
+ " of data stream. Expected 0x" + Integer.toHexString(eb) + " '" + new String(new byte[]{eb})
+ "' but found 0x" + Integer.toHexString(db) + " '" + new String(new byte[]{db}) + "'");
+ }
erindex++;
dindex++;
if (length > 0 && dindex >= length)
+ {
return; // tested length reached
+ }
}
if (dread < eread)
@@ -341,8 +355,10 @@
}
if (data.available() > 0)
+ {
throw new CompareStreamException("Streams is not equals by length. Data stream contains more data. Were read "
+ dindex);
+ }
}
protected void skipStream(InputStream stream, long pos) throws IOException
@@ -353,10 +369,15 @@
{
curPos -= sk;
};
+
if (sk < 0)
+ {
fail("Can not read the stream (skip bytes)");
+ }
if (curPos != 0)
+ {
fail("Can not skip bytes from the stream (" + pos + " bytes)");
+ }
}
protected File createBLOBTempFile(int sizeInKb) throws IOException
16 years, 3 months
exo-jcr SVN: r1489 - jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/api/xa.
by do-not-reply@jboss.org
Author: pnedonosko
Date: 2010-01-19 17:00:38 -0500 (Tue, 19 Jan 2010)
New Revision: 1489
Modified:
jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/api/xa/TestUserTransaction.java
Log:
EXOJCR-405 test cleanup
Modified: jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/api/xa/TestUserTransaction.java
===================================================================
--- jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/api/xa/TestUserTransaction.java 2010-01-19 16:49:25 UTC (rev 1488)
+++ jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/api/xa/TestUserTransaction.java 2010-01-19 22:00:38 UTC (rev 1489)
@@ -21,7 +21,6 @@
import org.exoplatform.services.jcr.JcrAPIBaseTest;
import org.exoplatform.services.jcr.core.XASession;
import org.exoplatform.services.jcr.impl.core.SessionImpl;
-import org.exoplatform.services.jcr.impl.core.XASessionImpl;
import org.exoplatform.services.transaction.TransactionService;
import java.util.ArrayList;
@@ -32,7 +31,6 @@
import javax.jcr.Session;
import javax.jcr.SimpleCredentials;
import javax.naming.InitialContext;
-import javax.transaction.RollbackException;
import javax.transaction.UserTransaction;
/**
@@ -48,13 +46,7 @@
public void setUp() throws Exception
{
-
- // StandaloneContainer.setConfigurationPath("src/java/conf/standalone/test-configuration.xml");
- //
- // container = StandaloneContainer.getInstance();
-
super.setUp();
-
txService = (TransactionService)container.getComponentInstanceOfType(TransactionService.class);
}
@@ -113,7 +105,7 @@
return someSessions;
}
- public void _testCommit() throws Exception
+ public void testCommit() throws Exception
{
assertNotNull(txService);
List<Session> someSessions = openSomeSessions();
@@ -144,7 +136,7 @@
someSessions.clear();
}
- public void _testRollback() throws Exception
+ public void testRollback() throws Exception
{
assertNotNull(txService);
UserTransaction ut = txService.getUserTransaction();
@@ -169,11 +161,10 @@
}
}
- public void _testUserTransactionFromJndi() throws Exception
+ public void testUserTransactionFromJndi() throws Exception
{
assertNotNull(txService);
- // TODO in JNDI only JOTM today
InitialContext ctx = new InitialContext();
Object obj = ctx.lookup("UserTransaction");
UserTransaction ut = (UserTransaction)obj;
@@ -187,7 +178,7 @@
assertNotNull(session.getItem("/txcommit1"));
}
- public void _testReuseUT() throws Exception
+ public void testReuseUT() throws Exception
{
assertNotNull(txService);
// TODO in JNDI only JOTM today
16 years, 3 months
exo-jcr SVN: r1488 - jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster.
by do-not-reply@jboss.org
Author: skabashnyuk
Date: 2010-01-19 11:49:25 -0500 (Tue, 19 Jan 2010)
New Revision: 1488
Modified:
jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-jbosscache-config-ws.xml
jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-jbosscache-config-ws1.xml
Log:
EXOJCR-390 : remove tm
Modified: jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-jbosscache-config-ws.xml
===================================================================
--- jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-jbosscache-config-ws.xml 2010-01-19 16:48:30 UTC (rev 1487)
+++ jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-jbosscache-config-ws.xml 2010-01-19 16:49:25 UTC (rev 1488)
@@ -77,11 +77,6 @@
</clustering>
- <!-- Configure the TransactionManager -->
- <transaction
- transactionManagerLookupClass="org.jboss.cache.transaction.JBossStandaloneJTAManagerLookup" />
-
-
<!-- Eviction configuration -->
<eviction wakeUpInterval="5000">
<default algorithmClass="org.jboss.cache.eviction.LRUAlgorithm" eventQueueSize="1000000">
Modified: jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-jbosscache-config-ws1.xml
===================================================================
--- jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-jbosscache-config-ws1.xml 2010-01-19 16:48:30 UTC (rev 1487)
+++ jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-jbosscache-config-ws1.xml 2010-01-19 16:49:25 UTC (rev 1488)
@@ -77,11 +77,6 @@
</clustering>
- <!-- Configure the TransactionManager -->
- <transaction
- transactionManagerLookupClass="org.jboss.cache.transaction.JBossStandaloneJTAManagerLookup" />
-
-
<!-- Eviction configuration -->
<eviction wakeUpInterval="5000">
<default algorithmClass="org.jboss.cache.eviction.LRUAlgorithm" eventQueueSize="1000000">
16 years, 3 months
exo-jcr SVN: r1487 - jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster.
by do-not-reply@jboss.org
Author: skabashnyuk
Date: 2010-01-19 11:48:30 -0500 (Tue, 19 Jan 2010)
New Revision: 1487
Modified:
jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-jbosscache-lock-config_db1_ws.xml
jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-jbosscache-lock-config_db1_ws1.xml
Log:
EXOJCR-390 : change mcast port
Modified: jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-jbosscache-lock-config_db1_ws.xml
===================================================================
--- jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-jbosscache-lock-config_db1_ws.xml 2010-01-19 16:45:05 UTC (rev 1486)
+++ jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-jbosscache-lock-config_db1_ws.xml 2010-01-19 16:48:30 UTC (rev 1487)
@@ -22,7 +22,7 @@
oob_thread_pool.queue_enabled="false"
oob_thread_pool.queue_max_size="100"
oob_thread_pool.rejection_policy="run" />
- <MPING timeout="2000" num_initial_members="2" mcast_port="34530"
+ <MPING timeout="2000" num_initial_members="2" mcast_port="34540"
bind_addr="127.0.0.1" mcast_addr="224.0.0.1" />
Modified: jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-jbosscache-lock-config_db1_ws1.xml
===================================================================
--- jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-jbosscache-lock-config_db1_ws1.xml 2010-01-19 16:45:05 UTC (rev 1486)
+++ jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-jbosscache-lock-config_db1_ws1.xml 2010-01-19 16:48:30 UTC (rev 1487)
@@ -22,7 +22,7 @@
oob_thread_pool.queue_enabled="false"
oob_thread_pool.queue_max_size="100"
oob_thread_pool.rejection_policy="run" />
- <MPING timeout="2000" num_initial_members="2" mcast_port="34532"
+ <MPING timeout="2000" num_initial_members="2" mcast_port="34542"
bind_addr="127.0.0.1" mcast_addr="224.0.0.1" />
16 years, 3 months
exo-jcr SVN: r1486 - jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster.
by do-not-reply@jboss.org
Author: skabashnyuk
Date: 2010-01-19 11:45:05 -0500 (Tue, 19 Jan 2010)
New Revision: 1486
Modified:
jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-jbosscache-lock-config_db1_ws1.xml
Log:
EXOJCR-390 : change claster name
Modified: jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-jbosscache-lock-config_db1_ws1.xml
===================================================================
--- jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-jbosscache-lock-config_db1_ws1.xml 2010-01-19 15:26:42 UTC (rev 1485)
+++ jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-jbosscache-lock-config_db1_ws1.xml 2010-01-19 16:45:05 UTC (rev 1486)
@@ -3,7 +3,7 @@
<locking useLockStriping="false" concurrencyLevel="50000" lockParentForChildInsertRemove="false" lockAcquisitionTimeout="20000"/>
- <clustering mode="replication" clusterName="JBoss-Cache-Indexer-Cluster_db1_ws1">
+ <clustering mode="replication" clusterName="JBoss-Cache-Lock-Cluster_db1_ws1">
<stateRetrieval timeout="20000" fetchInMemoryState="false" nonBlocking="true"/>
<jgroupsConfig multiplexerStack="fc-fast-minimalthreads">
16 years, 3 months