exo-jcr SVN: r2746 - jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent.
by do-not-reply@jboss.org
Author: tolusha
Date: 2010-07-07 01:50:36 -0400 (Wed, 07 Jul 2010)
New Revision: 2746
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/LinkedWorkspaceStorageCacheImpl.java
Log:
EXOJCR-840: avoid java.util.ConcurrentModificationException in LinkedWorkspaceStorageCacheImpl.onSaveItems()
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/LinkedWorkspaceStorageCacheImpl.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/LinkedWorkspaceStorageCacheImpl.java 2010-07-06 10:31:07 UTC (rev 2745)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/LinkedWorkspaceStorageCacheImpl.java 2010-07-07 05:50:36 UTC (rev 2746)
@@ -563,6 +563,7 @@
*/
class CleanerTask extends WorkerTask
{
+ @Override
public void run()
{
if (currentWorker == null || currentWorker.done)
@@ -582,6 +583,7 @@
*/
class StatisticTask extends WorkerTask
{
+ @Override
public void run()
{
if (currentWorker == null || currentWorker.done)
@@ -1784,33 +1786,41 @@
// delete parent containing child nodes list
nodesCache.remove(parent.getParentIdentifier());
- // traverse itemCache
- Iterator<CacheValue> cacheIterator = cache.values().iterator();
- while (cacheIterator.hasNext())
+ writeLock.lock();
+ try
{
- ItemData cachedItem = cacheIterator.next().getItem();
- if (cachedItem.isNode())
+ // traverse itemCache
+ Iterator<CacheValue> cacheIterator = cache.values().iterator();
+ while (cacheIterator.hasNext())
{
- if (cachedItem.getQPath().isDescendantOf(parent.getQPath()))
+ ItemData cachedItem = cacheIterator.next().getItem();
+ if (cachedItem.isNode())
{
- cacheIterator.remove();
+ if (cachedItem.getQPath().isDescendantOf(parent.getQPath()))
+ {
+ cacheIterator.remove();
+ }
}
}
- }
- // traverse child node Cache
- Iterator<List<NodeData>> childNodesIterator = nodesCache.values().iterator();
- while (childNodesIterator.hasNext())
- {
- List<NodeData> list = childNodesIterator.next();
- if (list != null && list.size() > 0)
+ // traverse child node Cache
+ Iterator<List<NodeData>> childNodesIterator = nodesCache.values().iterator();
+ while (childNodesIterator.hasNext())
{
- if (list.get(0).getQPath().isDescendantOf(parent.getQPath()))
+ List<NodeData> list = childNodesIterator.next();
+ if (list != null && list.size() > 0)
{
- childNodesIterator.remove();
+ if (list.get(0).getQPath().isDescendantOf(parent.getQPath()))
+ {
+ childNodesIterator.remove();
+ }
}
}
}
+ finally
+ {
+ writeLock.unlock();
+ }
}
put(item);
}
13 years, 10 months
exo-jcr SVN: r2745 - in jcr/branches/1.12.x/docs/userguide/en/src/main/docbook/en-US: modules and 1 other directory.
by do-not-reply@jboss.org
Author: tolusha
Date: 2010-07-06 06:31:07 -0400 (Tue, 06 Jul 2010)
New Revision: 2745
Added:
jcr/branches/1.12.x/docs/userguide/en/src/main/docbook/en-US/modules/managed-datasources.xml
Modified:
jcr/branches/1.12.x/docs/userguide/en/src/main/docbook/en-US/master.xml
Log:
EXOJCR-815: Document how to use AS Managed DataSource
Modified: jcr/branches/1.12.x/docs/userguide/en/src/main/docbook/en-US/master.xml
===================================================================
--- jcr/branches/1.12.x/docs/userguide/en/src/main/docbook/en-US/master.xml 2010-07-06 10:30:32 UTC (rev 2744)
+++ jcr/branches/1.12.x/docs/userguide/en/src/main/docbook/en-US/master.xml 2010-07-06 10:31:07 UTC (rev 2745)
@@ -61,5 +61,8 @@
<xi:include href="modules/portal-container.xml"
xmlns:xi="http://www.w3.org/2001/XInclude" />
+
+ <xi:include href="modules/managed-datasources.xml"
+ xmlns:xi="http://www.w3.org/2001/XInclude" />
</book>
Added: jcr/branches/1.12.x/docs/userguide/en/src/main/docbook/en-US/modules/managed-datasources.xml
===================================================================
--- jcr/branches/1.12.x/docs/userguide/en/src/main/docbook/en-US/modules/managed-datasources.xml (rev 0)
+++ jcr/branches/1.12.x/docs/userguide/en/src/main/docbook/en-US/modules/managed-datasources.xml 2010-07-06 10:31:07 UTC (rev 2745)
@@ -0,0 +1,98 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
+<part>
+ <title>How to use AS Managed DataSource under JBoss AS</title>
+
+ <chapter id="Introduction">
+ <title>Configurations Steps</title>
+
+ <important>
+ <para>Checked under Gatein 3.1.0-GA Final</para>
+ </important>
+
+ <important>
+ <para>only no-tx-datasource is supported in JCR 1.12</para>
+ </important>
+
+ <section id="Overview">
+ <title>Declaring the datasources in the AS</title>
+
+ <para>Under JBoss, just put a file XXX-ds.xml in the deploy server
+ (example: \server\default\deploy). In this file we will configure all
+ datasources which eXo will need. (there should be 4 named:
+ jdbcjcr_portal, jdbcjcr_portal-sample, jdbcidm_portal &
+ jdbcidm_sample-portal).</para>
+
+ <para>Example:<programlisting><?xml version="1.0" encoding="UTF-8"?>
+<datasources>
+ <no-tx-datasource>
+ <jndi-name>jdbcjcr_portal</jndi-name>
+ <connection-url>jdbc:hsqldb:${jboss.server.data.dir}/data/jdbcjcr_portal</connection-url>
+ <driver-class>org.hsqldb.jdbcDriver</driver-class>
+ <user-name>sa</user-name>
+ <password></password>
+ </no-tx-datasource>
+
+ <no-tx-datasource>
+ <jndi-name>jdbcjcr_sample-portal</jndi-name>
+ <connection-url>jdbc:hsqldb:${jboss.server.data.dir}/data/jdbcjcr_sample-portal</connection-url>
+ <driver-class>org.hsqldb.jdbcDriver</driver-class>
+ <user-name>sa</user-name>
+ <password></password>
+ </no-tx-datasource>
+
+ <no-tx-datasource>
+ <jndi-name>jdbcidm_portal</jndi-name>
+ <connection-url>jdbc:hsqldb:${jboss.server.data.dir}/data/jdbcidm_portal</connection-url>
+ <driver-class>org.hsqldb.jdbcDriver</driver-class>
+ <user-name>sa</user-name>
+ <password></password>
+ </no-tx-datasource>
+
+ <no-tx-datasource>
+ <jndi-name>jdbcidm_sample-portal</jndi-name>
+ <connection-url>jdbc:hsqldb:${jboss.server.data.dir}/data/jdbcidm_sample-portal</connection-url>
+ <driver-class>org.hsqldb.jdbcDriver</driver-class>
+ <user-name>sa</user-name>
+ <password></password>
+ </no-tx-datasource>
+</datasources></programlisting></para>
+
+ <para>Which properties can be set for datasource can be found here:
+ <link
+ linkend="???">http://docs.jboss.org/jbossas/docs/Server_Configuration_Guide/4/html/Conn...</link></para>
+ </section>
+
+ <section>
+ <title>Do not let eXo bind datasources explicitly</title>
+
+ <para>Edit server/default/conf/gatein/configuration.properties and
+ comment out next rows in JCR section:</para>
+
+ <programlisting>#gatein.jcr.datasource.driver=org.hsqldb.jdbcDriver
+#gatein.jcr.datasource.url=jdbc:hsqldb:file:${gatein.db.data.dir}/data/jdbcjcr_${name}
+#gatein.jcr.datasource.username=sa
+#gatein.jcr.datasource.password=</programlisting>
+
+ <para>and in IDM section:</para>
+
+ <programlisting>#gatein.idm.datasource.driver=org.hsqldb.jdbcDriver
+#gatein.idm.datasource.url=jdbc:hsqldb:file:${gatein.db.data.dir}/data/jdbcidm_${name}
+#gatein.idm.datasource.username=sa
+#gatein.idm.datasource.password=</programlisting>
+
+ <para>In jcr-configuration.xml and idm-configuration.xml comment out the
+ plugin InitialContextInitializer.</para>
+
+ <programlisting><!-- Commented because, Datasources are declared and bound by AS, not in eXo -->
+<!--
+<external-component-plugins>
+ [...]
+</external-component-plugins>
+--></programlisting>
+
+ <para>Running eXo after these configurations goes well.</para>
+ </section>
+ </chapter>
+</part>
13 years, 10 months
exo-jcr SVN: r2744 - in jcr/trunk/docs/userguide/en/src/main/docbook/en-US: modules and 1 other directory.
by do-not-reply@jboss.org
Author: tolusha
Date: 2010-07-06 06:30:32 -0400 (Tue, 06 Jul 2010)
New Revision: 2744
Added:
jcr/trunk/docs/userguide/en/src/main/docbook/en-US/modules/managed-datasources.xml
Modified:
jcr/trunk/docs/userguide/en/src/main/docbook/en-US/master.xml
Log:
EXOJCR-815: Document how to use AS Managed DataSource
Modified: jcr/trunk/docs/userguide/en/src/main/docbook/en-US/master.xml
===================================================================
--- jcr/trunk/docs/userguide/en/src/main/docbook/en-US/master.xml 2010-07-06 07:00:30 UTC (rev 2743)
+++ jcr/trunk/docs/userguide/en/src/main/docbook/en-US/master.xml 2010-07-06 10:30:32 UTC (rev 2744)
@@ -61,5 +61,8 @@
<xi:include href="modules/portal-container.xml"
xmlns:xi="http://www.w3.org/2001/XInclude" />
+
+ <xi:include href="modules/managed-datasources.xml"
+ xmlns:xi="http://www.w3.org/2001/XInclude" />
</book>
Added: jcr/trunk/docs/userguide/en/src/main/docbook/en-US/modules/managed-datasources.xml
===================================================================
--- jcr/trunk/docs/userguide/en/src/main/docbook/en-US/modules/managed-datasources.xml (rev 0)
+++ jcr/trunk/docs/userguide/en/src/main/docbook/en-US/modules/managed-datasources.xml 2010-07-06 10:30:32 UTC (rev 2744)
@@ -0,0 +1,98 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
+<part>
+ <title>How to use AS Managed DataSource under JBoss AS</title>
+
+ <chapter id="Introduction">
+ <title>Configurations Steps</title>
+
+ <important>
+ <para>Checked under Gatein 3.1.0-GA Final</para>
+ </important>
+
+ <important>
+ <para>only no-tx-datasource is supported in JCR 1.12</para>
+ </important>
+
+ <section id="Overview">
+ <title>Declaring the datasources in the AS</title>
+
+ <para>Under JBoss, just put a file XXX-ds.xml in the deploy server
+ (example: \server\default\deploy). In this file we will configure all
+ datasources which eXo will need. (there should be 4 named:
+ jdbcjcr_portal, jdbcjcr_portal-sample, jdbcidm_portal &
+ jdbcidm_sample-portal).</para>
+
+ <para>Example:<programlisting><?xml version="1.0" encoding="UTF-8"?>
+<datasources>
+ <no-tx-datasource>
+ <jndi-name>jdbcjcr_portal</jndi-name>
+ <connection-url>jdbc:hsqldb:${jboss.server.data.dir}/data/jdbcjcr_portal</connection-url>
+ <driver-class>org.hsqldb.jdbcDriver</driver-class>
+ <user-name>sa</user-name>
+ <password></password>
+ </no-tx-datasource>
+
+ <no-tx-datasource>
+ <jndi-name>jdbcjcr_sample-portal</jndi-name>
+ <connection-url>jdbc:hsqldb:${jboss.server.data.dir}/data/jdbcjcr_sample-portal</connection-url>
+ <driver-class>org.hsqldb.jdbcDriver</driver-class>
+ <user-name>sa</user-name>
+ <password></password>
+ </no-tx-datasource>
+
+ <no-tx-datasource>
+ <jndi-name>jdbcidm_portal</jndi-name>
+ <connection-url>jdbc:hsqldb:${jboss.server.data.dir}/data/jdbcidm_portal</connection-url>
+ <driver-class>org.hsqldb.jdbcDriver</driver-class>
+ <user-name>sa</user-name>
+ <password></password>
+ </no-tx-datasource>
+
+ <no-tx-datasource>
+ <jndi-name>jdbcidm_sample-portal</jndi-name>
+ <connection-url>jdbc:hsqldb:${jboss.server.data.dir}/data/jdbcidm_sample-portal</connection-url>
+ <driver-class>org.hsqldb.jdbcDriver</driver-class>
+ <user-name>sa</user-name>
+ <password></password>
+ </no-tx-datasource>
+</datasources></programlisting></para>
+
+ <para>Which properties can be set for datasource can be found here:
+ <link
+ linkend="???">http://docs.jboss.org/jbossas/docs/Server_Configuration_Guide/4/html/Conn...</link></para>
+ </section>
+
+ <section>
+ <title>Do not let eXo bind datasources explicitly</title>
+
+ <para>Edit server/default/conf/gatein/configuration.properties and
+ comment out next rows in JCR section:</para>
+
+ <programlisting>#gatein.jcr.datasource.driver=org.hsqldb.jdbcDriver
+#gatein.jcr.datasource.url=jdbc:hsqldb:file:${gatein.db.data.dir}/data/jdbcjcr_${name}
+#gatein.jcr.datasource.username=sa
+#gatein.jcr.datasource.password=</programlisting>
+
+ <para>and in IDM section:</para>
+
+ <programlisting>#gatein.idm.datasource.driver=org.hsqldb.jdbcDriver
+#gatein.idm.datasource.url=jdbc:hsqldb:file:${gatein.db.data.dir}/data/jdbcidm_${name}
+#gatein.idm.datasource.username=sa
+#gatein.idm.datasource.password=</programlisting>
+
+ <para>In jcr-configuration.xml and idm-configuration.xml comment out the
+ plugin InitialContextInitializer.</para>
+
+ <programlisting><!-- Commented because, Datasources are declared and bound by AS, not in eXo -->
+<!--
+<external-component-plugins>
+ [...]
+</external-component-plugins>
+--></programlisting>
+
+ <para>Running eXo after these configurations goes well.</para>
+ </section>
+ </chapter>
+</part>
13 years, 10 months
exo-jcr SVN: r2743 - jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc.
by do-not-reply@jboss.org
Author: nzamosenchuk
Date: 2010-07-06 03:00:30 -0400 (Tue, 06 Jul 2010)
New Revision: 2743
Modified:
jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCWorkspaceDataContainer.java
Log:
EXOJCR-808: If Sybase RDBMS found and checkSNSNewConnection not configured, it is set to false by default.
Modified: jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCWorkspaceDataContainer.java
===================================================================
--- jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCWorkspaceDataContainer.java 2010-07-06 06:11:41 UTC (rev 2742)
+++ jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCWorkspaceDataContainer.java 2010-07-06 07:00:30 UTC (rev 2743)
@@ -368,7 +368,7 @@
}
catch (RepositoryConfigurationException e)
{
- this.checkSNSNewConnection = true;
+ this.checkSNSNewConnection = DBConstants.DB_DIALECT_SYBASE.equals(this.dbDialect) ? false : true;
}
// ------------- Values swap config ------------------
13 years, 10 months
exo-jcr SVN: r2742 - jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc.
by do-not-reply@jboss.org
Author: nzamosenchuk
Date: 2010-07-06 02:11:41 -0400 (Tue, 06 Jul 2010)
New Revision: 2742
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCWorkspaceDataContainer.java
Log:
EXOJCR-808: If Sybase RDBMS found and checkSNSNewConnection not configured, it is set to false by default.
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCWorkspaceDataContainer.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCWorkspaceDataContainer.java 2010-07-05 11:31:55 UTC (rev 2741)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCWorkspaceDataContainer.java 2010-07-06 06:11:41 UTC (rev 2742)
@@ -370,7 +370,7 @@
}
catch (RepositoryConfigurationException e)
{
- this.checkSNSNewConnection = true;
+ this.checkSNSNewConnection = DBConstants.DB_DIALECT_SYBASE.equals(this.dbDialect) ? false : true;
}
// ------------- Values swap config ------------------
@@ -393,7 +393,9 @@
this.swapDirectory = new File(DEF_SWAPDIR);
}
if (!PrivilegedFileHelper.exists(swapDirectory))
+ {
PrivilegedFileHelper.mkdirs(swapDirectory);
+ }
this.swapCleaner = new FileCleaner(false);
@@ -409,7 +411,9 @@
catch (RepositoryConfigurationException e)
{
if (LOG.isDebugEnabled())
+ {
LOG.debug("update-storage parameter is not set " + dbSourceName);
+ }
}
this.storageVersion =
@@ -435,8 +439,10 @@
{
DataSource ds = (DataSource)new InitialContext().lookup(dbSourceName);
if (ds != null)
+ {
return new GenericConnectionFactory(ds, containerName, multiDb, valueStorageProvider, maxBufferSize,
swapDirectory, swapCleaner);
+ }
throw new RepositoryException("Datasource '" + dbSourceName + "' is not bound in this context.");
}
@@ -483,7 +489,9 @@
if (wsEntry.getName().equals(wsConfig.getName())
|| !wsEntry.getContainer().getType().equals(wsConfig.getContainer().getType())
|| !wsEntry.getContainer().getType().equals(this.getClass().getName()))
+ {
continue;
+ }
// MULTIDB
if (!wsEntry.getContainer().getParameterValue(MULTIDB).equals(
@@ -586,11 +594,15 @@
LOG.warn(DBConstants.DB_DIALECT_ORACLEOCI + " dialect is experimental!");
// sample of connection factory customization
if (dbSourceName != null)
+ {
this.connFactory = defaultConnectionFactory();
+ }
else
+ {
this.connFactory =
new OracleConnectionFactory(dbDriver, dbUrl, dbUserName, dbPassword, containerName, multiDb,
valueStorageProvider, maxBufferSize, swapDirectory, swapCleaner);
+ }
sqlPath = "/conf/storage/jcr-" + (multiDb ? "m" : "s") + "jdbc.ora.sql";
@@ -616,16 +628,22 @@
{
DataSource ds = (DataSource)new InitialContext().lookup(dbSourceName);
if (ds != null)
+ {
this.connFactory =
new MySQLConnectionFactory(ds, containerName, multiDb, valueStorageProvider, maxBufferSize,
swapDirectory, swapCleaner);
+ }
else
+ {
throw new RepositoryException("Datasource '" + dbSourceName + "' is not bound in this context.");
+ }
}
else
+ {
this.connFactory =
new MySQLConnectionFactory(dbDriver, dbUrl, dbUserName, dbPassword, containerName, multiDb,
valueStorageProvider, maxBufferSize, swapDirectory, swapCleaner);
+ }
sqlPath = "/conf/storage/jcr-" + (multiDb ? "m" : "s") + "jdbc.mysql.sql";
dbInitilizer = defaultDBInitializer(sqlPath);
@@ -637,16 +655,22 @@
{
DataSource ds = (DataSource)new InitialContext().lookup(dbSourceName);
if (ds != null)
+ {
this.connFactory =
new MySQLConnectionFactory(ds, containerName, multiDb, valueStorageProvider, maxBufferSize,
swapDirectory, swapCleaner);
+ }
else
+ {
throw new RepositoryException("Datasource '" + dbSourceName + "' is not bound in this context.");
+ }
}
else
+ {
this.connFactory =
new MySQLConnectionFactory(dbDriver, dbUrl, dbUserName, dbPassword, containerName, multiDb,
valueStorageProvider, maxBufferSize, swapDirectory, swapCleaner);
+ }
sqlPath = "/conf/storage/jcr-" + (multiDb ? "m" : "s") + "jdbc.mysql-utf8.sql";
dbInitilizer = defaultDBInitializer(sqlPath);
@@ -695,16 +719,22 @@
{
DataSource ds = (DataSource)new InitialContext().lookup(dbSourceName);
if (ds != null)
+ {
this.connFactory =
new HSQLDBConnectionFactory(ds, containerName, multiDb, valueStorageProvider, maxBufferSize,
swapDirectory, swapCleaner);
+ }
else
+ {
throw new RepositoryException("Datasource '" + dbSourceName + "' is not bound in this context.");
+ }
}
else
+ {
this.connFactory =
new HSQLDBConnectionFactory(dbDriver, dbUrl, dbUserName, dbPassword, containerName, multiDb,
valueStorageProvider, maxBufferSize, swapDirectory, swapCleaner);
+ }
sqlPath = "/conf/storage/jcr-" + (multiDb ? "m" : "s") + "jdbc.sql";
dbInitilizer = defaultDBInitializer(sqlPath);
}
@@ -875,15 +905,19 @@
public boolean isSame(WorkspaceDataContainer another)
{
if (another == this)
+ {
return true;
+ }
if (another instanceof JDBCWorkspaceDataContainer)
{
JDBCWorkspaceDataContainer anotherJdbc = (JDBCWorkspaceDataContainer)another;
if (getDbSourceName() != null)
+ {
// by jndi ds name
return getDbSourceName().equals(anotherJdbc.getDbSourceName());
+ }
// by db connection params
return getDbDriver().equals(anotherJdbc.getDbDriver()) && getDbUrl().equals(anotherJdbc.getDbUrl())
13 years, 10 months
exo-jcr SVN: r2741 - jcr/branches/1.12.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/storage/value/fs.
by do-not-reply@jboss.org
Author: nzamosenchuk
Date: 2010-07-05 07:31:55 -0400 (Mon, 05 Jul 2010)
New Revision: 2741
Modified:
jcr/branches/1.12.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/storage/value/fs/TestRemoveFromValueStorage.java
Log:
EXOJCR-810 : Added check if value storages are configured.
Modified: jcr/branches/1.12.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/storage/value/fs/TestRemoveFromValueStorage.java
===================================================================
--- jcr/branches/1.12.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/storage/value/fs/TestRemoveFromValueStorage.java 2010-07-05 09:48:12 UTC (rev 2740)
+++ jcr/branches/1.12.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/storage/value/fs/TestRemoveFromValueStorage.java 2010-07-05 11:31:55 UTC (rev 2741)
@@ -19,6 +19,8 @@
package org.exoplatform.services.jcr.impl.storage.value.fs;
import org.exoplatform.services.jcr.BaseStandaloneTest;
+import org.exoplatform.services.jcr.config.WorkspaceEntry;
+import org.exoplatform.services.jcr.core.WorkspaceContainerFacade;
import org.exoplatform.services.jcr.datamodel.PropertyData;
import org.exoplatform.services.jcr.impl.core.PropertyImpl;
import org.exoplatform.services.jcr.impl.core.SessionImpl;
@@ -27,6 +29,7 @@
import java.io.ByteArrayInputStream;
import java.io.File;
+import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import java.util.Random;
@@ -98,7 +101,7 @@
generator.nextBytes(smallValue);
values[i] = testRoot.getSession().getValueFactory().createValue(new ByteArrayInputStream(smallValue));
}
-
+
if (values.length == 1)
{
prop = testRoot.setProperty("binaryProperty", values[0]);
@@ -112,59 +115,68 @@
public void testRemoveValue() throws Exception
{
- // reading values directly from value storage
- PropertyImpl propertyImpl = (PropertyImpl)prop;
- ValueStoragePluginProvider storageProvider =
- (ValueStoragePluginProvider)mySession.getContainer().getComponentInstanceOfType(
- ValueStoragePluginProvider.class);
+ WorkspaceContainerFacade containerFacade = repository.getWorkspaceContainer(mySession.getWorkspace().getName());
+ WorkspaceEntry wsConfig = (WorkspaceEntry)containerFacade.getComponent(WorkspaceEntry.class);
- String propertyId = propertyImpl.getInternalIdentifier();
- int count = prop.getValues().length;
- Map<Integer, FileIOChannel> channels = new HashMap<Integer, FileIOChannel>();
+ if (wsConfig.getContainer().getValueStorages() != null && wsConfig.getContainer().getValueStorages().size() > 0)
+ {
- for (int i = 0; i < count; i++)
- {
- ValueIOChannel channel = storageProvider.getApplicableChannel((PropertyData)propertyImpl.getData(), i);
- if (channel != null)
+ // reading values directly from value storage
+ PropertyImpl propertyImpl = (PropertyImpl)prop;
+ ValueStoragePluginProvider storageProvider =
+ (ValueStoragePluginProvider)containerFacade.getComponent(ValueStoragePluginProvider.class);
+
+ String propertyId = propertyImpl.getInternalIdentifier();
+ int count = prop.getValues().length;
+ Map<Integer, FileIOChannel> channels = new HashMap<Integer, FileIOChannel>();
+
+ for (int i = 0; i < count; i++)
{
- channels.put(i, (FileIOChannel)channel);
+ ValueIOChannel channel = storageProvider.getApplicableChannel((PropertyData)propertyImpl.getData(), i);
+ if (channel != null)
+ {
+ channels.put(i, (FileIOChannel)channel);
+ }
}
- }
- for (int i = 0; i < count; i++)
- {
- try
+ for (int i = 0; i < count; i++)
{
- channels.get(i).read(propertyId, i, 2100 * 1024);
+ try
+ {
+ channels.get(i).read(propertyId, i, 2100 * 1024);
+ }
+ catch (IOException e)
+ {
+ fail("Poperty value " + i + " can't be read!");
+ }
}
- catch (Exception e)
- {
- fail("Poperty value " + i + " can't be read!");
- }
- }
- prop.remove();
- mySession.save();
+ prop.remove();
+ mySession.save();
- // checking whether values are still in value storage.
- for (int i = 0; i < count; i++)
- {
- try
+ // checking whether values are still in value storage.
+ for (int i = 0; i < count; i++)
{
- // TreeFileIOChannel always returns a File. But if this file doesn't
- // really exists is size is 0.
- File value = channels.get(i).getFile(propertyId, i);
- if (value.length() == 0)
+ try
{
- throw new Exception("");
+ // TreeFileIOChannel always returns a File. But if this file doesn't
+ // really exists is size is 0.
+ File value = channels.get(i).getFile(propertyId, i);
+ if (value.length() != 0)
+ {
+ fail("Poperty value still can be found in value-storage but should have been already deleted!");
+ }
}
- fail("Poperty value still can be found in value-storage but should have been already deleted!");
+ catch (IOException e)
+ {
+ // ok
+ }
}
- catch (Exception e)
- {
- // ok
- }
}
+ else
+ {
+ log.warn("Value storages are not configured, test skipped.");
+ }
}
13 years, 10 months
exo-jcr SVN: r2740 - jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/storage/value/fs.
by do-not-reply@jboss.org
Author: nzamosenchuk
Date: 2010-07-05 05:48:12 -0400 (Mon, 05 Jul 2010)
New Revision: 2740
Modified:
jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/storage/value/fs/TestRemoveFromValueStorage.java
Log:
EXOJCR-810: Added check if value storages are configured.
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-07-02 08:02:30 UTC (rev 2739)
+++ jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/storage/value/fs/TestRemoveFromValueStorage.java 2010-07-05 09:48:12 UTC (rev 2740)
@@ -19,6 +19,8 @@
package org.exoplatform.services.jcr.impl.storage.value.fs;
import org.exoplatform.services.jcr.BaseStandaloneTest;
+import org.exoplatform.services.jcr.config.WorkspaceEntry;
+import org.exoplatform.services.jcr.core.WorkspaceContainerFacade;
import org.exoplatform.services.jcr.datamodel.PropertyData;
import org.exoplatform.services.jcr.impl.core.PropertyImpl;
import org.exoplatform.services.jcr.impl.core.SessionImpl;
@@ -27,6 +29,7 @@
import java.io.ByteArrayInputStream;
import java.io.File;
+import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import java.util.Random;
@@ -98,7 +101,7 @@
generator.nextBytes(smallValue);
values[i] = testRoot.getSession().getValueFactory().createValue(new ByteArrayInputStream(smallValue));
}
-
+
if (values.length == 1)
{
prop = testRoot.setProperty("binaryProperty", values[0]);
@@ -112,59 +115,68 @@
public void testRemoveValue() throws Exception
{
- // reading values directly from value storage
- PropertyImpl propertyImpl = (PropertyImpl)prop;
- ValueStoragePluginProvider storageProvider =
- (ValueStoragePluginProvider)mySession.getContainer().getComponentInstanceOfType(
- ValueStoragePluginProvider.class);
+ WorkspaceContainerFacade containerFacade = repository.getWorkspaceContainer(mySession.getWorkspace().getName());
+ WorkspaceEntry wsConfig = (WorkspaceEntry)containerFacade.getComponent(WorkspaceEntry.class);
- String propertyId = propertyImpl.getInternalIdentifier();
- int count = prop.getValues().length;
- Map<Integer, FileIOChannel> channels = new HashMap<Integer, FileIOChannel>();
+ if (wsConfig.getContainer().getValueStorages() != null && wsConfig.getContainer().getValueStorages().size() > 0)
+ {
- for (int i = 0; i < count; i++)
- {
- ValueIOChannel channel = storageProvider.getApplicableChannel((PropertyData)propertyImpl.getData(), i);
- if (channel != null)
+ // reading values directly from value storage
+ PropertyImpl propertyImpl = (PropertyImpl)prop;
+ ValueStoragePluginProvider storageProvider =
+ (ValueStoragePluginProvider)containerFacade.getComponent(ValueStoragePluginProvider.class);
+
+ String propertyId = propertyImpl.getInternalIdentifier();
+ int count = prop.getValues().length;
+ Map<Integer, FileIOChannel> channels = new HashMap<Integer, FileIOChannel>();
+
+ for (int i = 0; i < count; i++)
{
- channels.put(i, (FileIOChannel)channel);
+ ValueIOChannel channel = storageProvider.getApplicableChannel((PropertyData)propertyImpl.getData(), i);
+ if (channel != null)
+ {
+ channels.put(i, (FileIOChannel)channel);
+ }
}
- }
- for (int i = 0; i < count; i++)
- {
- try
+ for (int i = 0; i < count; i++)
{
- channels.get(i).read(propertyId, i, 2100 * 1024);
+ try
+ {
+ channels.get(i).read(propertyId, i, 2100 * 1024);
+ }
+ catch (IOException e)
+ {
+ fail("Poperty value " + i + " can't be read!");
+ }
}
- catch (Exception e)
- {
- fail("Poperty value " + i + " can't be read!");
- }
- }
- prop.remove();
- mySession.save();
+ prop.remove();
+ mySession.save();
- // checking whether values are still in value storage.
- for (int i = 0; i < count; i++)
- {
- try
+ // checking whether values are still in value storage.
+ for (int i = 0; i < count; i++)
{
- // TreeFileIOChannel always returns a File. But if this file doesn't
- // really exists is size is 0.
- File value = channels.get(i).getFile(propertyId, i);
- if (value.length() == 0)
+ try
{
- throw new Exception("");
+ // TreeFileIOChannel always returns a File. But if this file doesn't
+ // really exists is size is 0.
+ File value = channels.get(i).getFile(propertyId, i);
+ if (value.length() != 0)
+ {
+ fail("Poperty value still can be found in value-storage but should have been already deleted!");
+ }
}
- fail("Poperty value still can be found in value-storage but should have been already deleted!");
+ catch (IOException e)
+ {
+ // ok
+ }
}
- catch (Exception e)
- {
- // ok
- }
}
+ else
+ {
+ log.warn("Value storages are not configured, test skipped.");
+ }
}
13 years, 10 months
exo-jcr SVN: r2739 - jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc.
by do-not-reply@jboss.org
Author: sergiykarpenko
Date: 2010-07-02 04:02:30 -0400 (Fri, 02 Jul 2010)
New Revision: 2739
Modified:
jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCWorkspaceDataContainer.java
Log:
EXOJCR-781: InitialContextInitializer.recall() executed on begin of JDBCWorkspaceDataContainer constructor
Modified: jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCWorkspaceDataContainer.java
===================================================================
--- jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCWorkspaceDataContainer.java 2010-07-01 15:20:43 UTC (rev 2738)
+++ jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCWorkspaceDataContainer.java 2010-07-02 08:02:30 UTC (rev 2739)
@@ -206,6 +206,10 @@
throws RepositoryConfigurationException, NamingException, RepositoryException, IOException
{
+ // This recall is workaround for tenants creation. There is a trouble in visibility datasource
+ // binded in one tomcat context from another tomcat context.
+ contextInit.recall();
+
checkIntegrity(wsConfig, repConfig);
this.containerName = wsConfig.getName();
13 years, 10 months
exo-jcr SVN: r2738 - jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc.
by do-not-reply@jboss.org
Author: sergiykarpenko
Date: 2010-07-01 11:20:43 -0400 (Thu, 01 Jul 2010)
New Revision: 2738
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCWorkspaceDataContainer.java
Log:
EXOJCR-781: InitialContextInitializer.recall() executed on begin of JDBCWorkspaceDataContainer constructor
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCWorkspaceDataContainer.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCWorkspaceDataContainer.java 2010-07-01 13:51:27 UTC (rev 2737)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCWorkspaceDataContainer.java 2010-07-01 15:20:43 UTC (rev 2738)
@@ -209,8 +209,11 @@
throws RepositoryConfigurationException, NamingException, RepositoryException, IOException
{
+ // This recall is workaround for tenants creation. There is a trouble in visibility datasource
+ // binded in one tomcat context from another tomcat context.
+ contextInit.recall();
+
checkIntegrity(wsConfig, repConfig);
-
this.containerName = wsConfig.getName();
this.multiDb = Boolean.parseBoolean(wsConfig.getContainer().getParameterValue(MULTIDB));
this.valueStorageProvider = valueStorageProvider;
13 years, 10 months
exo-jcr SVN: r2737 - in jcr/trunk/exo.jcr.component.ext/src: test/java/org/exoplatform/services/jcr/ext/backup and 1 other directory.
by do-not-reply@jboss.org
Author: tolusha
Date: 2010-07-01 09:51:27 -0400 (Thu, 01 Jul 2010)
New Revision: 2737
Modified:
jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/BackupManagerImpl.java
jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/JobRepositoryRestore.java
jcr/trunk/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/backup/TestBackupManager.java
Log:
EXOJCR-819: HTTPBackupAgent can provide information about last successfully restored repositories if restore was launched in synchronous mode
Modified: jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/BackupManagerImpl.java
===================================================================
--- jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/BackupManagerImpl.java 2010-07-01 10:08:10 UTC (rev 2736)
+++ jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/BackupManagerImpl.java 2010-07-01 13:51:27 UTC (rev 2737)
@@ -162,7 +162,7 @@
private final WorkspaceBackupAutoStopper workspaceBackupStopper;
private final RepositoryBackupAutoStopper repositoryBackupStopper;
-
+
/**
* Temporary directory;
*/
@@ -284,6 +284,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public void run()
{
while (true)
@@ -331,6 +332,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public void run()
{
while (true)
@@ -1364,16 +1366,16 @@
BackupConfigurationException, RepositoryException, RepositoryConfigurationException
{
// Checking repository exists.
- try
+ try
{
repoService.getRepository(repositoryEntry.getName());
throw new BackupConfigurationException("Repository \"" + repositoryEntry.getName() + "\" is already exists.");
- }
- catch (RepositoryException e)
+ }
+ catch (RepositoryException e)
{
//OK. Repository with "repositoryEntry.getName" is not exists.
- }
-
+ }
+
Map<String, BackupChainLog> workspacesMapping = new HashedMap();
Map<String, BackupChainLog> backups = new HashedMap();
@@ -1469,9 +1471,9 @@
JobRepositoryRestore jobRepositoryRestore =
new JobRepositoryRestore(repoService, this, repositoryEntry, workspacesMapping, rblog);
+ restoreRepositoryJobs.add(jobRepositoryRestore);
if (asynchronous)
{
- restoreRepositoryJobs.add(jobRepositoryRestore);
jobRepositoryRestore.start();
}
else
Modified: jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/JobRepositoryRestore.java
===================================================================
--- jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/JobRepositoryRestore.java 2010-07-01 10:08:10 UTC (rev 2736)
+++ jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/JobRepositoryRestore.java 2010-07-01 13:51:27 UTC (rev 2737)
@@ -119,13 +119,40 @@
}
/**
+ * Restore repository. Provide information about start and finish process.
+ *
+ * @throws RepositoryRestoreExeption
+ * if exception occurred during restore
+ */
+ protected void restore() throws RepositoryRestoreExeption
+ {
+ try
+ {
+ stateRestore = REPOSITORY_RESTORE_STARTED;
+ startTime = Calendar.getInstance();
+
+ restoreRepository();
+
+ stateRestore = REPOSITORY_RESTORE_SUCCESSFUL;
+ endTime = Calendar.getInstance();
+ }
+ catch (Throwable t)
+ {
+ stateRestore = REPOSITORY_RESTORE_FAIL;
+ restoreException = t;
+
+ throw new RepositoryRestoreExeption(t.getMessage(), t);
+ }
+ }
+
+ /**
* Will be restored the workspace.
* @throws RepositoryRestoreExeption
*
* @throws Throwable
* will be generated the Throwable
*/
- protected void restore() throws RepositoryRestoreExeption
+ protected void restoreRepository() throws RepositoryRestoreExeption
{
List<WorkspaceEntry> originalWorkspaceEntrys = repositoryEntry.getWorkspaceEntries();
@@ -187,28 +214,31 @@
{
currennWorkspaceName = wsEntry.getName();
backupManager.restore(workspacesMapping.get(wsEntry.getName()), repositoryEntry.getName(), wsEntry,
- false);
+ false);
}
}
}
catch (InvalidItemStateException e)
{
restored = false;
-
- log.error("Can not restore workspace \"" + currennWorkspaceName + " in repository \"" + repositoryEntry.getName() + "\".", e);
-
- throw new RepositoryRestoreExeption("Can not restore workspace \"" + currennWorkspaceName + " in repository \"" + repositoryEntry.getName() + "\"."
- + " There was database error.", e);
+ log.error("Can not restore workspace \"" + currennWorkspaceName + " in repository \""
+ + repositoryEntry.getName() + "\".", e);
+
+ throw new RepositoryRestoreExeption("Can not restore workspace \"" + currennWorkspaceName
+ + " in repository \"" + repositoryEntry.getName() + "\"." + " There was database error.", e);
+
}
catch (Throwable t)
{
restored = false;
-
- log.error("Can not restore workspace \"" + currennWorkspaceName + " in repository \"" + repositoryEntry.getName() + "\".", t);
-
- throw new RepositoryRestoreExeption("Can not restore workspace \"" + currennWorkspaceName + " in repository \"" + repositoryEntry.getName() + "\".", t);
+ log.error("Can not restore workspace \"" + currennWorkspaceName + " in repository \""
+ + repositoryEntry.getName() + "\".", t);
+
+ throw new RepositoryRestoreExeption("Can not restore workspace \"" + currennWorkspaceName
+ + " in repository \"" + repositoryEntry.getName() + "\".", t);
+
}
finally
{
@@ -236,7 +266,8 @@
}
catch (Throwable thr)
{
- log.error("The partly restored repository \"" + repositoryEntry.getName() + "\" can not be removed.", thr);
+ log.error("The partly restored repository \"" + repositoryEntry.getName() + "\" can not be removed.",
+ thr);
}
}
}
@@ -265,15 +296,15 @@
/**
* {@inheritDoc}
*/
+ @Override
public void run()
{
-
try
{
stateRestore = REPOSITORY_RESTORE_STARTED;
startTime = Calendar.getInstance();
- restore();
+ restoreRepository();
stateRestore = REPOSITORY_RESTORE_SUCCESSFUL;
endTime = Calendar.getInstance();
Modified: jcr/trunk/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/backup/TestBackupManager.java
===================================================================
--- jcr/trunk/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/backup/TestBackupManager.java 2010-07-01 10:08:10 UTC (rev 2736)
+++ jcr/trunk/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/backup/TestBackupManager.java 2010-07-01 13:51:27 UTC (rev 2737)
@@ -502,8 +502,8 @@
{
SessionImpl sessionWS1 = (SessionImpl)repository.login(credentials, "ws3");
- sessionWS1.getRootNode().addNode("asdasdasda", "nt:unstructured")
- .setProperty("data", new FileInputStream(createBLOBTempFile(1024)));
+ sessionWS1.getRootNode().addNode("asdasdasda", "nt:unstructured").setProperty("data",
+ new FileInputStream(createBLOBTempFile(1024)));
sessionWS1.save();
// 1-st backup
@@ -540,8 +540,8 @@
assertNotNull(back1.getRootNode().getNode("asdasdasda").getProperty("data"));
// add date to restored workspace
- back1.getRootNode().addNode("gdfgrghfhf", "nt:unstructured")
- .setProperty("data", new FileInputStream(createBLOBTempFile(1024)));
+ back1.getRootNode().addNode("gdfgrghfhf", "nt:unstructured").setProperty("data",
+ new FileInputStream(createBLOBTempFile(1024)));
back1.save();
}
else
@@ -739,8 +739,7 @@
else
fail("There are no backup files in " + backDir.getAbsolutePath());
}
-
-
+
public void testRepositoryFullBackupRestore() throws Exception
{
// backup
@@ -767,13 +766,13 @@
// stop fullBackup
backup.stopBackup(bch);
-
// restore
RepositoryEntry re = (RepositoryEntry)ws1Session.getContainer().getComponentInstanceOfType(RepositoryEntry.class);
-
+
String newRepositoryName = "repo_restored_1";
- RepositoryEntry newRepositoryEntry = makeRepositoryEntry(newRepositoryName, re, "jdbcjcr_to_repository_restore_1", null);
+ RepositoryEntry newRepositoryEntry =
+ makeRepositoryEntry(newRepositoryName, re, "jdbcjcr_to_repository_restore_1", null);
File backLog = new File(bch.getLogFilePath());
if (backLog.exists())
@@ -784,6 +783,8 @@
assertNotNull(bchLog.getFinishedTime());
backup.restore(bchLog, newRepositoryEntry, false);
+ assertEquals(JobWorkspaceRestore.RESTORE_SUCCESSFUL, backup.getLastRepositoryRestore(
+ newRepositoryEntry.getName()).getStateRestore());
// check
ManageableRepository restoredRepository = repositoryService.getRepository(newRepositoryName);
@@ -813,7 +814,7 @@
else
fail("There are no backup files in " + backDir.getAbsolutePath());
}
-
+
public void testRepositoryFullAndIncrementalBackupRestore() throws Exception
{
// backup
@@ -844,9 +845,10 @@
// restore
RepositoryEntry re = (RepositoryEntry)ws1Session.getContainer().getComponentInstanceOfType(RepositoryEntry.class);
-
+
String newRepositoryName = "repo_restored_4";
- RepositoryEntry newRepositoryEntry = makeRepositoryEntry(newRepositoryName, re, "jdbcjcr_to_repository_restore_4", null);
+ RepositoryEntry newRepositoryEntry =
+ makeRepositoryEntry(newRepositoryName, re, "jdbcjcr_to_repository_restore_4", null);
File backLog = new File(bch.getLogFilePath());
if (backLog.exists())
@@ -886,7 +888,7 @@
else
fail("There are no backup files in " + backDir.getAbsolutePath());
}
-
+
public void testRepositoryFullBackupAsynchronusRestore() throws Exception
{
// backup
@@ -916,9 +918,10 @@
// restore
RepositoryEntry re = (RepositoryEntry)ws1Session.getContainer().getComponentInstanceOfType(RepositoryEntry.class);
-
+
String newRepositoryName = "repo_restored_2";
- RepositoryEntry newRepositoryEntry = makeRepositoryEntry(newRepositoryName, re, "jdbcjcr_to_repository_restore_2", null);
+ RepositoryEntry newRepositoryEntry =
+ makeRepositoryEntry(newRepositoryName, re, "jdbcjcr_to_repository_restore_2", null);
File backLog = new File(bch.getLogFilePath());
if (backLog.exists())
@@ -929,11 +932,11 @@
assertNotNull(bchLog.getFinishedTime());
backup.restore(bchLog, newRepositoryEntry, true);
-
+
JobRepositoryRestore job = backup.getLastRepositoryRestore(newRepositoryName);
-
+
while (job.getStateRestore() != JobRepositoryRestore.REPOSITORY_RESTORE_SUCCESSFUL
- || job.getStateRestore() == JobRepositoryRestore.REPOSITORY_RESTORE_FAIL)
+ || job.getStateRestore() == JobRepositoryRestore.REPOSITORY_RESTORE_FAIL)
{
Thread.yield();
Thread.sleep(50);
@@ -967,7 +970,7 @@
else
fail("There are no backup files in " + backDir.getAbsolutePath());
}
-
+
public void testRepositoryFullBackupAsynchronusRestoreWorkspaceMapping() throws Exception
{
// backup
@@ -994,21 +997,21 @@
// stop fullBackup
backup.stopBackup(bch);
-
// restore
RepositoryEntry re = (RepositoryEntry)ws1Session.getContainer().getComponentInstanceOfType(RepositoryEntry.class);
-
+
String newRepositoryName = "repo_restored_3";
- RepositoryEntry newRepositoryEntry = makeRepositoryEntry(newRepositoryName, re, "jdbcjcr_to_repository_restore_3", null);
-
+ RepositoryEntry newRepositoryEntry =
+ makeRepositoryEntry(newRepositoryName, re, "jdbcjcr_to_repository_restore_3", null);
+
// create workspace mappingS
- Map<String, String> workspaceMapping = new HashedMap();
+ Map<String, String> workspaceMapping = new HashedMap();
for (WorkspaceEntry we : newRepositoryEntry.getWorkspaceEntries())
{
workspaceMapping.put(we.getName(), we.getName() + "_mapped");
}
-
+
// Change workspaeNames
for (WorkspaceEntry we : newRepositoryEntry.getWorkspaceEntries())
{
@@ -1017,7 +1020,7 @@
newRepositoryEntry.setSystemWorkspaceName(workspaceMapping.get(we.getName()));
newRepositoryEntry.setDefaultWorkspaceName(workspaceMapping.get(we.getName()));
}
-
+
we.setName(workspaceMapping.get(we.getName()));
we.setUniqueName(we.getUniqueName() + workspaceMapping.get(we.getName()));
}
@@ -1030,12 +1033,12 @@
assertNotNull(bchLog.getStartedTime());
assertNotNull(bchLog.getFinishedTime());
- backup.restore(bchLog, newRepositoryEntry, workspaceMapping,true);
-
+ backup.restore(bchLog, newRepositoryEntry, workspaceMapping, true);
+
JobRepositoryRestore job = backup.getLastRepositoryRestore(newRepositoryName);
-
+
while (job.getStateRestore() != JobRepositoryRestore.REPOSITORY_RESTORE_SUCCESSFUL
- || job.getStateRestore() == JobRepositoryRestore.REPOSITORY_RESTORE_FAIL)
+ || job.getStateRestore() == JobRepositoryRestore.REPOSITORY_RESTORE_FAIL)
{
Thread.yield();
Thread.sleep(50);
@@ -1093,26 +1096,28 @@
if (bch.getBackupId().equals(chain.getBackupId()))
fail("The backup with id '" + chain.getBackupId() + "' should not be active");
}
-
+
public void testRepositoryRestoreFail() throws Exception
{
// restore
RepositoryEntry re = (RepositoryEntry)ws1Session.getContainer().getComponentInstanceOfType(RepositoryEntry.class);
-
+
String newRepositoryName = "repo_restored_5";
- RepositoryEntry newRepositoryEntry = makeRepositoryEntry(newRepositoryName, re, "jdbcjcr_to_repository_restore_5", null);
-
+ RepositoryEntry newRepositoryEntry =
+ makeRepositoryEntry(newRepositoryName, re, "jdbcjcr_to_repository_restore_5", null);
+
//create broken system workspaceEntry
newRepositoryEntry.getWorkspaceEntries().get(0).getQueryHandler().setType("gg");
File backLog = new File(backup.getRepositoryBackupsLogs()[0].getLogFilePath());
-
+
RepositoryBackupChainLog bchLog = new RepositoryBackupChainLog(backLog);
- try {
+ try
+ {
backup.restore(bchLog, newRepositoryEntry, false);
- fail("The backup " + backLog.getAbsolutePath() + "shoulde not restored.");
- }
+ fail("The backup " + backLog.getAbsolutePath() + "shoulde not restored.");
+ }
catch (RepositoryRestoreExeption e)
{
// ok.
@@ -1130,7 +1135,7 @@
// ok.
}
}
-
+
public void testIncrementalBackupRestoreEXOJCR_737() throws Exception
{
// full backup with BLOBs & incremental with BLOBs
@@ -1159,7 +1164,7 @@
Thread.yield();
Thread.sleep(50);
}
-
+
// add data
ws1Session.getRootNode().addNode("node_101").setProperty("exo:data", new FileInputStream(tempf));
ws1Session.getRootNode().addNode("node_102").setProperty("exo:extraData", new FileInputStream(tempf));
@@ -1170,7 +1175,7 @@
backup.stopBackup(bch);
else
fail("Can't get fullBackup chain");
-
+
//remove data
ws1Session.getRootNode().getNode("node_101").remove();
ws1Session.getRootNode().getNode("node_102").remove();
@@ -1200,12 +1205,12 @@
assertNotNull(node_101);
assertEquals(tempf.length(), node_101.getProperty("exo:data").getStream().available());
compareStream(new FileInputStream(tempf), node_101.getProperty("exo:data").getStream());
-
+
Node node_102 = back1.getRootNode().getNode("node_102");
assertNotNull(node_102);
assertEquals(tempf.length(), node_102.getProperty("exo:extraData").getStream().available());
compareStream(new FileInputStream(tempf), node_102.getProperty("exo:extraData").getStream());
-
+
}
catch (Exception e)
{
13 years, 10 months