[exo-jcr-commits] exo-jcr SVN: r5087 - in jcr/trunk/exo.jcr.component.ext: src/test/java/org/exoplatform/services/jcr/ext/backup and 2 other directories.

do-not-reply at jboss.org do-not-reply at jboss.org
Wed Oct 26 05:19:43 EDT 2011


Author: tolusha
Date: 2011-10-26 05:19:43 -0400 (Wed, 26 Oct 2011)
New Revision: 5087

Added:
   jcr/trunk/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/backup/usecase/
   jcr/trunk/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/backup/usecase/BaseStandaloneBackupRestoreTest.java
   jcr/trunk/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/backup/usecase/TestBackupRestore.java
   jcr/trunk/exo.jcr.component.ext/src/test/resources/conf/standalone/test-configuration-backup.xml
   jcr/trunk/exo.jcr.component.ext/src/test/resources/conf/standalone/test-jcr-ext-config-backup.xml
Removed:
   jcr/trunk/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/backup/load/
Modified:
   jcr/trunk/exo.jcr.component.ext/pom.xml
Log:
EXOJCR-1585: add unit tests for HSQLDB

Modified: jcr/trunk/exo.jcr.component.ext/pom.xml
===================================================================
--- jcr/trunk/exo.jcr.component.ext/pom.xml	2011-10-25 13:35:38 UTC (rev 5086)
+++ jcr/trunk/exo.jcr.component.ext/pom.xml	2011-10-26 09:19:43 UTC (rev 5087)
@@ -29,6 +29,9 @@
   <artifactId>exo.jcr.component.ext</artifactId>
   <name>eXo JCR :: Component :: Extension Service</name>
   <description>eXo JCR Services extension</description>
+  <properties>
+      <jcr.test.configuration.file>/conf/standalone/test-configuration.xml</jcr.test.configuration.file>
+  </properties>
   <dependencies>
     <dependency>
       <groupId>org.exoplatform.kernel</groupId>
@@ -177,6 +180,12 @@
           <artifactId>maven-surefire-plugin</artifactId>
           <configuration>
             <argLine>${env.MAVEN_OPTS} -Djava.security.manager=org.exoplatform.commons.test.TestSecurityManager -Djava.security.policy=${project.build.directory}/test-classes/test.policy</argLine>
+            <systemProperties>
+               <property>
+                  <name>jcr.test.configuration.file</name>
+                  <value>${jcr.test.configuration.file}</value>
+               </property>
+            </systemProperties>
             <includes>
               <include>org/exoplatform/services/jcr/ext/**/Test*.java</include>
               <include>org/exoplatform/services/jcr/ext/**/*Test.java</include>
@@ -189,7 +198,7 @@
               <exclude>**/backup/TestBackupRestart.java</exclude>
               <exclude>**/backup/load/TestLoadBackup.java*</exclude>
               <exclude>**/replication/**</exclude>
-              <include>**/repository/creation/cluster/**</include>
+              <exclude>**/repository/creation/cluster/**</exclude>
             </excludes>
           </configuration>
         </plugin>
@@ -232,4 +241,176 @@
          </plugin>
       </plugins>
   </build>
+  <profiles>
+     <profile>
+         <id>backup</id>
+           <properties>
+              <jcr.test.configuration.file>/conf/standalone/test-configuration-backup.xml</jcr.test.configuration.file>
+           </properties>
+           <build>
+              <plugins>
+                <plugin>
+                   <groupId>org.apache.maven.plugins</groupId>
+                   <artifactId>maven-jar-plugin</artifactId>
+                   <configuration>
+                     <archive>
+                       <manifest>
+                         <addClasspath>true</addClasspath>
+                       </manifest>
+                     </archive>
+                   </configuration>
+                 </plugin>
+                 <plugin>
+                   <groupId>org.apache.maven.plugins</groupId>
+                   <artifactId>maven-surefire-plugin</artifactId>
+                   <configuration>
+                     <argLine>${env.MAVEN_OPTS} -Djava.security.manager=org.exoplatform.commons.test.TestSecurityManager -Djava.security.policy=${project.build.directory}/test-classes/test.policy</argLine>
+                     <systemProperties>
+                        <property>
+                           <name>jcr.test.configuration.file</name>
+                           <value>${jcr.test.configuration.file}</value>
+                        </property>
+                     </systemProperties>
+                     <includes>
+                       <include>org/exoplatform/services/jcr/ext/backup/usecase/TestBackupRestore.java</include>
+                     </includes>
+                   </configuration>
+                 </plugin>
+                  <plugin>
+                     <artifactId>maven-antrun-plugin</artifactId>
+                     <executions>
+                        <execution>
+                           <id>prepare-test-policy</id>
+                           <phase>process-test-resources</phase>
+                           <configuration>
+                              <tasks>
+                                 <echo>Creating Access Policy for tests</echo>
+                                 <makeurl file="${settings.localRepository}" property="localRepositoryURL" />
+                                 <makeurl file="${project.build.outputDirectory}" property="outputDirectoryURL" />
+                                 <makeurl file="${project.build.testOutputDirectory}" property="testOutputDirectoryURL" />
+                                 <copy todir="${project.build.testOutputDirectory}" overwrite="true">
+                                    <fileset dir="${project.basedir}/src/test/resources/">
+                                       <include name="test.policy" />
+                                    </fileset>
+                                    <filterset>
+                                       <filter token="MAVEN_REPO" value="${localRepositoryURL}" />
+                                       <filter token="MAIN_CLASSES" value="${outputDirectoryURL}" />
+                                       <filter token="TEST_CLASSES" value="${testOutputDirectoryURL}" />
+                                    </filterset>
+                                 </copy>
+                              </tasks>                     
+                           </configuration>
+                           <goals>
+                              <goal>run</goal>
+                           </goals>
+                        </execution>
+                     </executions>
+                     <dependencies>
+                        <dependency>
+                           <groupId>ant</groupId>
+                           <artifactId>ant-optional</artifactId>
+                           <version>1.5.3-1</version>
+                        </dependency>
+                     </dependencies>
+                  </plugin>
+               </plugins>
+           </build>
+     </profile>
+     <profile>
+         <id>oracle</id>
+         <properties>
+            <jcr.test.configuration.file>/conf/standalone/test-configuration-backup-oracle.xml</jcr.test.configuration.file>
+         </properties>
+         <dependencies>
+            <dependency>
+               <groupId>ojdbc</groupId>
+               <artifactId>ojdbc</artifactId>
+               <version>14</version>
+               <scope>test</scope>
+            </dependency>
+            <dependency>
+               <groupId>ojdbc</groupId>
+               <artifactId>orai18n</artifactId>
+               <version>14</version>
+               <scope>test</scope>
+            </dependency>
+         </dependencies>
+      </profile>
+      <profile>
+         <id>mysql</id>
+         <properties>
+            <jcr.test.configuration.file>/conf/standalone/test-configuration-backup-mysql.xml</jcr.test.configuration.file>
+         </properties>
+         <dependencies>
+            <dependency>
+               <groupId>mysql</groupId>
+               <artifactId>mysql-connector-java</artifactId>
+               <version>5.1.14</version>
+               <scope>test</scope>
+            </dependency>
+         </dependencies>
+      </profile>
+      <profile>
+         <id>mssql</id>
+         <properties>
+            <jcr.test.configuration.file>/conf/standalone/test-configuration-backup-mssql.xml</jcr.test.configuration.file>
+         </properties>
+         <dependencies>
+            <dependency>
+               <groupId>com.microsoft</groupId>
+               <artifactId>sqljdbc</artifactId>
+               <version>3.0.1301.101</version>
+               <scope>test</scope>
+            </dependency>
+         </dependencies>
+      </profile>
+      <profile>
+         <id>db2</id>
+         <properties>
+            <jcr.test.configuration.file>/conf/standalone/test-configuration-backup-db2.xml</jcr.test.configuration.file>
+         </properties>
+         <dependencies>
+            <dependency>
+               <groupId>com.ibm.db2</groupId>
+               <artifactId>db2jcc</artifactId>
+               <version>9.7</version>
+               <scope>test</scope>
+            </dependency>
+            <dependency>
+               <groupId>com.ibm.db2</groupId>
+               <artifactId>db2jcc_license_cu</artifactId>
+               <version>9.7</version>
+               <scope>test</scope>
+            </dependency>            
+         </dependencies>
+      </profile>
+      <profile>
+         <id>sybase</id>
+         <properties>
+            <jcr.test.configuration.file>/conf/standalone/test-configuration-backup-sybase.xml</jcr.test.configuration.file>
+         </properties>
+         <dependencies>
+            <dependency>
+               <groupId>com.sybase.jdbc4.jdbc</groupId>
+               <artifactId>jconn4</artifactId>
+               <version>26502</version>
+               <scope>test</scope>
+            </dependency>
+         </dependencies>
+      </profile>
+      <profile>
+         <id>pgsql</id>
+         <properties>
+            <jcr.test.configuration.file>/conf/standalone/test-configuration-backup-pgsql.xml</jcr.test.configuration.file>
+         </properties>
+         <dependencies>
+            <dependency>
+               <groupId>postgresql</groupId>
+               <artifactId>postgresql</artifactId>
+               <version>8.3-606.jdbc3</version>
+               <scope>test</scope>
+            </dependency>
+         </dependencies>
+      </profile>
+  </profiles>
 </project>

Added: jcr/trunk/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/backup/usecase/BaseStandaloneBackupRestoreTest.java
===================================================================
--- jcr/trunk/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/backup/usecase/BaseStandaloneBackupRestoreTest.java	                        (rev 0)
+++ jcr/trunk/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/backup/usecase/BaseStandaloneBackupRestoreTest.java	2011-10-26 09:19:43 UTC (rev 5087)
@@ -0,0 +1,66 @@
+/*
+ * Copyright (C) 2009 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.exoplatform.services.jcr.ext.backup.usecase;
+
+import junit.framework.TestCase;
+
+import org.exoplatform.container.StandaloneContainer;
+import org.exoplatform.services.jcr.RepositoryService;
+import org.exoplatform.services.jcr.core.CredentialsImpl;
+import org.exoplatform.services.log.ExoLogger;
+import org.exoplatform.services.log.Log;
+
+/**
+ * Created by The eXo Platform SAS .
+ * 
+ * @author <a href="mailto:geaz at users.sourceforge.net">Gennady Azarenkov </a>
+ * @version $Id: BaseStandaloneBackupRestoreTest.java 12004 2007-01-17 12:03:57Z geaz $
+ */
+public abstract class BaseStandaloneBackupRestoreTest extends TestCase
+{
+   protected static final Log log = ExoLogger.getLogger("exo.jcr.component.ext.BaseStandaloneBackupRestoreTest");
+
+   protected CredentialsImpl credentials;
+
+   protected RepositoryService repositoryService;
+
+   protected StandaloneContainer container;
+
+   @Override
+   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 = getClass().getResource(configPath).toString();
+      StandaloneContainer.addConfigurationURL(containerConf);
+      container = StandaloneContainer.getInstance();
+
+      if (System.getProperty("java.security.auth.login.config") == null)
+         System.setProperty("java.security.auth.login.config", Thread.currentThread().getContextClassLoader()
+            .getResource("login.conf").toString());
+
+      credentials = new CredentialsImpl("root", "exo".toCharArray());
+
+      repositoryService = (RepositoryService)container.getComponentInstanceOfType(RepositoryService.class);
+   }
+}

Added: jcr/trunk/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/backup/usecase/TestBackupRestore.java
===================================================================
--- jcr/trunk/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/backup/usecase/TestBackupRestore.java	                        (rev 0)
+++ jcr/trunk/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/backup/usecase/TestBackupRestore.java	2011-10-26 09:19:43 UTC (rev 5087)
@@ -0,0 +1,162 @@
+/*
+ * Copyright (C) 2003-2010 eXo Platform SAS.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Affero General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see<http://www.gnu.org/licenses/>.
+ */
+package org.exoplatform.services.jcr.ext.backup.usecase;
+
+import org.exoplatform.container.xml.InitParams;
+import org.exoplatform.container.xml.PropertiesParam;
+import org.exoplatform.services.jcr.core.ManageableRepository;
+import org.exoplatform.services.jcr.ext.backup.BackupJob;
+import org.exoplatform.services.jcr.ext.backup.BackupManager;
+import org.exoplatform.services.jcr.ext.backup.ExtendedBackupManager;
+import org.exoplatform.services.jcr.ext.backup.RepositoryBackupChain;
+import org.exoplatform.services.jcr.ext.backup.RepositoryBackupChainLog;
+import org.exoplatform.services.jcr.ext.backup.RepositoryBackupConfig;
+import org.exoplatform.services.jcr.ext.backup.impl.BackupManagerImpl;
+import org.exoplatform.services.jcr.ext.backup.impl.JobRepositoryRestore;
+import org.exoplatform.services.jcr.impl.core.SessionImpl;
+
+import java.io.File;
+
+import javax.jcr.Node;
+
+/**
+ * Created by The eXo Platform SAS.
+ * 
+ * <br/>Date: 
+ *
+ * @author <a href="karpenko.sergiy at gmail.com">Karpenko Sergiy</a> 
+ * @version $Id: TestLoadBackup.java 111 2008-11-11 11:11:11Z serg $
+ */
+public class TestBackupRestore extends BaseStandaloneBackupRestoreTest
+{
+   public void testBackupRestoreExistingRepositorySingleDB() throws Exception
+   {
+      repositoryBackupRestore("db1");
+   }
+
+   public void testBackupRestoreExistingRepositoryMultiDB() throws Exception
+   {
+      repositoryBackupRestore("db2");
+   }
+
+   protected void repositoryBackupRestore(String repositoryName) throws Exception
+   {
+      addConent(repositoryName);
+
+      BackupManagerImpl backupManagerImpl = (BackupManagerImpl)getBackupManager();
+      backupManagerImpl.start();
+
+      File backDir = new File("target/backup/" + repositoryName);
+      backDir.mkdirs();
+
+      RepositoryBackupConfig config = new RepositoryBackupConfig();
+      config.setRepository(repositoryName);
+      config.setBackupType(BackupManager.FULL_BACKUP_ONLY);
+      config.setBackupDir(backDir);
+
+      RepositoryBackupChain bch = backupManagerImpl.startBackup(config);
+
+      // wait till full backup will stop
+      while (bch.getState() != BackupJob.FINISHED)
+      {
+         Thread.yield();
+         Thread.sleep(30);
+      }
+
+      if (bch != null)
+      {
+         backupManagerImpl.stopBackup(bch);
+      }
+
+      // restore
+      File backLog = new File(bch.getLogFilePath());
+      if (backLog.exists())
+      {
+         RepositoryBackupChainLog bchLog = new RepositoryBackupChainLog(backLog);
+
+         assertNotNull(bchLog.getStartedTime());
+         assertNotNull(bchLog.getFinishedTime());
+
+         backupManagerImpl.restoreExistingRepository(bchLog, repositoryService.getRepository(repositoryName)
+            .getConfiguration(), false);
+
+         JobRepositoryRestore restore = backupManagerImpl.getLastRepositoryRestore(repositoryName);
+         if (restore != null)
+         {
+            if (restore.getStateRestore() != JobRepositoryRestore.REPOSITORY_RESTORE_SUCCESSFUL)
+            {
+               fail(restore.getRestoreException().getMessage());
+            }
+         }
+      }
+      else
+      {
+         fail("There are no backup files in " + backDir.getAbsolutePath());
+      }
+
+      checkConent(repositoryName);
+   }
+
+   protected ExtendedBackupManager getBackupManager()
+   {
+      InitParams initParams = new InitParams();
+      PropertiesParam pps = new PropertiesParam();
+
+      pps.setProperty(BackupManagerImpl.FULL_BACKUP_TYPE,
+         "org.exoplatform.services.jcr.ext.backup.impl.rdbms.FullBackupJob");
+      pps.setProperty(BackupManagerImpl.BACKUP_DIR, "target/backup");
+      initParams.put(BackupManagerImpl.BACKUP_PROPERTIES, pps);
+
+      return new BackupManagerImpl(initParams, repositoryService);
+   }
+
+   protected void addConent(String repositoryName) throws Exception
+   {
+      ManageableRepository repository = repositoryService.getRepository(repositoryName);
+      String wsName = repository.getConfiguration().getSystemWorkspaceName();
+
+      SessionImpl session = (SessionImpl)repository.login(credentials, wsName);
+      try
+      {
+         Node rootNode = session.getRootNode().addNode("test");
+
+         rootNode.addNode("node1").setProperty("prop1", "value1");
+         session.save();
+      }
+      finally
+      {
+         session.logout();
+      }
+   }
+
+   protected void checkConent(String repositoryName) throws Exception
+   {
+      ManageableRepository repository = repositoryService.getRepository(repositoryName);
+      String wsName = repository.getConfiguration().getSystemWorkspaceName();
+
+      SessionImpl session = (SessionImpl)repository.login(credentials, wsName);
+      try
+      {
+         Node rootNode = session.getRootNode().getNode("test");
+         assertEquals(rootNode.getNode("node1").getProperty("prop1").getString(), "value1");
+      }
+      finally
+      {
+         session.logout();
+      }
+   }
+}

Added: jcr/trunk/exo.jcr.component.ext/src/test/resources/conf/standalone/test-configuration-backup.xml
===================================================================
--- jcr/trunk/exo.jcr.component.ext/src/test/resources/conf/standalone/test-configuration-backup.xml	                        (rev 0)
+++ jcr/trunk/exo.jcr.component.ext/src/test/resources/conf/standalone/test-configuration-backup.xml	2011-10-26 09:19:43 UTC (rev 5087)
@@ -0,0 +1,267 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+
+    Copyright (C) 2009 eXo Platform SAS.
+
+    This is free software; you can redistribute it and/or modify it
+    under the terms of the GNU Lesser General Public License as
+    published by the Free Software Foundation; either version 2.1 of
+    the License, or (at your option) any later version.
+
+    This software is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this software; if not, write to the Free
+    Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+    02110-1301 USA, or see the FSF site: http://www.fsf.org.
+
+-->
+<configuration xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.exoplatform.org/xml/ns/kernel_1_2.xsd http://www.exoplatform.org/xml/ns/kernel_1_2.xsd"
+   xmlns="http://www.exoplatform.org/xml/ns/kernel_1_2.xsd">
+
+   <component>
+      <key>org.exoplatform.services.log.LogConfigurationInitializer</key>
+      <type>org.exoplatform.services.log.LogConfigurationInitializer</type>
+      <init-params>
+         <value-param>
+            <name>logger</name>
+            <value>org.exoplatform.services.log.impl.BufferedLog4JLogger</value>
+         </value-param>
+         <value-param>
+            <name>configurator</name>
+            <value>org.exoplatform.services.log.impl.Log4JConfigurator</value>
+         </value-param>
+         <properties-param>
+            <name>properties</name>
+            <description>Log4J properties</description>
+            <property name="log4j.rootLogger" value="INFO, stdout, file" />
+
+            <property name="log4j.appender.stdout" value="org.apache.log4j.ConsoleAppender" />
+            <property name="log4j.appender.stdout.threshold" value="DEBUG" />
+
+            <property name="log4j.appender.stdout.layout" value="org.apache.log4j.PatternLayout" />
+            <property name="log4j.appender.stdout.layout.ConversionPattern" value="%d{dd.MM.yyyy HH:mm:ss} *%-5p* [%t] %c{1}: %m (%F, line %L) %n" />
+
+            <property name="log4j.appender.file" value="org.apache.log4j.FileAppender" />
+            <property name="log4j.appender.file.File" value="target/jcr.log" />
+
+            <property name="log4j.appender.file.layout" value="org.apache.log4j.PatternLayout" />
+            <property name="log4j.appender.file.layout.ConversionPattern" value="%d{dd.MM.yyyy HH:mm:ss} *%-5p* [%t] %c{1}: %m (%F, line %L) %n" />
+
+            <!-- property name="log4j.category.ext.BackupScheduler" value="DEBUG"/>
+            <property name="log4j.category.ext.BackupManagerImpl" value="DEBUG"/ -->
+            <property name="log4j.category.jcr.ext.RestRepositoryService" value="DEBUG"/>
+
+            <!-- property name="log4j.category.org.exoplatform.services.jcr.ext.script.groovy.JcrGroovyResourceLoader" value="DEBUG" / -->
+
+         </properties-param>
+      </init-params>
+   </component>
+
+   <component>
+      <key>org.exoplatform.services.jcr.RepositoryService</key>
+      <type>org.exoplatform.services.jcr.impl.RepositoryServiceImpl</type>
+      <component-plugins>
+         <component-plugin>
+            <name>add.namespaces</name>
+            <set-method>addPlugin</set-method>
+            <type>org.exoplatform.services.jcr.impl.AddNamespacesPlugin</type>
+            <init-params>
+               <properties-param>
+                  <name>namespaces</name>
+                  <property name="dc" value="http://purl.org/dc/elements/1.1/" />
+               </properties-param>
+            </init-params>
+         </component-plugin>
+         <component-plugin>
+            <name>add.nodeType</name>
+            <set-method>addPlugin</set-method>
+            <type>org.exoplatform.services.jcr.impl.AddNodeTypePlugin</type>
+            <init-params>
+               <values-param>
+                  <name>autoCreatedInNewRepository</name>
+                  <description>Node types configuration file</description>
+                  <value>jar:/conf/ext-nodetypes-config.xml</value>
+               </values-param>
+            </init-params>
+         </component-plugin>
+      </component-plugins>
+   </component>
+
+   <component>
+      <key>org.exoplatform.services.jcr.config.RepositoryServiceConfiguration</key>
+      <type>org.exoplatform.services.jcr.impl.config.RepositoryServiceConfigurationImpl</type>
+      <init-params>
+         <value-param>
+            <name>conf-path</name>
+            <description>JCR configuration file</description>
+            <value>jar:/conf/standalone/test-jcr-ext-config-backup.xml</value>
+         </value-param>
+         <properties-param>
+            <name>working-conf</name>
+            <description>working-conf</description>
+            <property name="persister-class-name"
+               value="org.exoplatform.services.jcr.impl.config.JDBCConfigurationPersister" />
+            <property name="source-name" value="jdbcjcr" />
+         </properties-param>
+      </init-params>
+   </component>
+   
+   <component>
+    <type>org.exoplatform.services.jcr.ext.repository.RestRepositoryService</type>
+  </component>
+
+   <!--  backup -->
+   <component>
+      <key>org.exoplatform.services.jcr.ext.backup.BackupManager</key>
+      <type>org.exoplatform.services.jcr.ext.backup.impl.BackupManagerImpl</type>
+      <init-params>
+         <properties-param>
+            <name>backup-properties</name>
+            <property name="default-incremental-job-period" value="3600" />
+            <property name="full-backup-type" value="org.exoplatform.services.jcr.ext.backup.impl.fs.FullBackupJob" />
+            <property name="incremental-backup-type" value="org.exoplatform.services.jcr.ext.backup.impl.fs.IncrementalBackupJob" />
+            <property name="backup-dir" value="target/backup" />
+         </properties-param>
+      </init-params>
+   </component>
+
+   <!-- HTTPBackupAgent -->
+   <component>
+      <type>org.exoplatform.services.jcr.ext.backup.server.HTTPBackupAgent</type>
+   </component>
+
+   <component>
+      <type>org.exoplatform.services.jcr.ext.app.ThreadLocalSessionProviderService</type>
+   </component>
+
+   <component>
+      <key>org.exoplatform.services.security.Authenticator</key>
+      <type>org.exoplatform.services.organization.auth.OrganizationAuthenticatorImpl</type>
+   </component>
+
+   <component>
+      <type>org.exoplatform.services.jcr.ext.resource.NodeRepresentationService</type>
+   </component>
+
+   <component>
+      <type>org.exoplatform.services.jcr.ext.resource.XMLViewNodeRepresentationRenderer</type>
+   </component>
+
+   <component>
+      <type>org.exoplatform.services.jcr.ext.resource.jcr.Handler</type>
+   </component>
+
+   <component>
+      <type>org.exoplatform.services.organization.impl.mock.DummyOrganizationService</type>
+   </component>
+
+   <component>
+      <key>org.exoplatform.services.security.Authenticator</key>
+      <type>org.exoplatform.services.organization.auth.OrganizationAuthenticatorImpl</type>
+   </component>
+
+   <component>
+      <key>org.exoplatform.services.jcr.ext.distribution.DataDistributionManager</key>
+      <type>org.exoplatform.services.jcr.ext.distribution.impl.DataDistributionManagerImpl</type>     
+   </component>
+
+   <component>
+      <key>org.exoplatform.services.jcr.ext.hierarchy.NodeHierarchyCreator</key>
+      <type>org.exoplatform.services.jcr.ext.hierarchy.impl.NodeHierarchyCreatorImpl</type>
+      <init-params>
+         <value-param>
+            <name>auto-migrate</name>
+            <value>false</value>
+         </value-param>
+      </init-params>
+   </component>
+
+   <external-component-plugins>
+      <target-component>org.exoplatform.services.naming.InitialContextInitializer</target-component>
+      <component-plugin>
+         <name>bind.datasource</name>
+         <set-method>addPlugin</set-method>
+         <type>org.exoplatform.services.naming.BindReferencePlugin</type>
+         <init-params>
+            <value-param>
+               <name>bind-name</name>
+               <value>jdbcjcr</value>
+            </value-param>
+            <value-param>
+               <name>class-name</name>
+               <value>javax.sql.DataSource</value>
+            </value-param>
+            <value-param>
+               <name>factory</name>
+               <value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
+            </value-param>
+            <properties-param>
+               <name>ref-addresses</name>
+               <description>ref-addresses</description>
+               <property name="driverClassName" value="org.hsqldb.jdbcDriver" />
+               <property name="url" value="jdbc:hsqldb:file:target/temp/data/db1" />
+               <property name="username" value="sa" />
+               <property name="password" value="" />
+            </properties-param>
+         </init-params>
+      </component-plugin>
+      <component-plugin>
+         <name>bind.datasource</name>
+         <set-method>addPlugin</set-method>
+         <type>org.exoplatform.services.naming.BindReferencePlugin</type>
+         <init-params>
+            <value-param>
+               <name>bind-name</name>
+               <value>jdbcjcr1</value>
+            </value-param>
+            <value-param>
+               <name>class-name</name>
+               <value>javax.sql.DataSource</value>
+            </value-param>
+            <value-param>
+               <name>factory</name>
+               <value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
+            </value-param>
+            <properties-param>
+               <name>ref-addresses</name>
+               <description>ref-addresses</description>
+               <property name="driverClassName" value="org.hsqldb.jdbcDriver" />
+               <property name="url" value="jdbc:hsqldb:file:target/temp/data/db2ws" />
+               <property name="username" value="sa" />
+               <property name="password" value="" />
+            </properties-param>
+         </init-params>
+      </component-plugin>
+      <component-plugin>
+         <name>bind.datasource</name>
+         <set-method>addPlugin</set-method>
+         <type>org.exoplatform.services.naming.BindReferencePlugin</type>
+         <init-params>
+            <value-param>
+               <name>bind-name</name>
+               <value>jdbcjcr2</value>
+            </value-param>
+            <value-param>
+               <name>class-name</name>
+               <value>javax.sql.DataSource</value>
+            </value-param>
+            <value-param>
+               <name>factory</name>
+               <value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
+            </value-param>
+            <properties-param>
+               <name>ref-addresses</name>
+               <description>ref-addresses</description>
+               <property name="driverClassName" value="org.hsqldb.jdbcDriver" />
+               <property name="url" value="jdbc:hsqldb:file:target/temp/data/db2ws2" />
+               <property name="username" value="sa" />
+               <property name="password" value="" />
+            </properties-param>
+         </init-params>
+      </component-plugin>
+   </external-component-plugins> 
+</configuration>

Added: jcr/trunk/exo.jcr.component.ext/src/test/resources/conf/standalone/test-jcr-ext-config-backup.xml
===================================================================
--- jcr/trunk/exo.jcr.component.ext/src/test/resources/conf/standalone/test-jcr-ext-config-backup.xml	                        (rev 0)
+++ jcr/trunk/exo.jcr.component.ext/src/test/resources/conf/standalone/test-jcr-ext-config-backup.xml	2011-10-26 09:19:43 UTC (rev 5087)
@@ -0,0 +1,201 @@
+<!--
+
+    Copyright (C) 2009 eXo Platform SAS.
+
+    This is free software; you can redistribute it and/or modify it
+    under the terms of the GNU Lesser General Public License as
+    published by the Free Software Foundation; either version 2.1 of
+    the License, or (at your option) any later version.
+
+    This software is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this software; if not, write to the Free
+    Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+    02110-1301 USA, or see the FSF site: http://www.fsf.org.
+
+-->
+<repository-service default-repository="db1">
+   <repositories>
+      <repository name="db1" system-workspace="ws" default-workspace="ws">
+         <security-domain>exo-domain</security-domain>
+         <access-control>optional</access-control>
+         <authentication-policy>org.exoplatform.services.jcr.impl.core.access.JAASAuthenticator</authentication-policy>
+         <workspaces>
+            <workspace name="ws">
+               <container class="org.exoplatform.services.jcr.impl.storage.jdbc.optimisation.CQJDBCWorkspaceDataContainer">
+                  <properties>
+                     <property name="source-name" value="jdbcjcr" />
+                     <property name="multi-db" value="false" />
+                     <property name="update-storage" value="false" />
+                     <property name="max-buffer-size" value="200k" />
+                     <property name="swap-directory" value="target/temp/swap/db1ws" />
+                  </properties>
+                  <value-storages>
+                     <value-storage id="ws" class="org.exoplatform.services.jcr.impl.storage.value.fs.TreeFileValueStorage">
+                        <properties>
+                           <property name="path" value="target/temp/values/db1ws" />
+                        </properties>
+                        <filters>
+                           <filter property-type="Binary" />
+                        </filters>
+                     </value-storage>
+                  </value-storages>
+               </container>
+               <initializer class="org.exoplatform.services.jcr.impl.core.ScratchWorkspaceInitializer">
+                  <properties>
+                     <property name="root-nodetype" value="nt:unstructured" />
+                  </properties>
+               </initializer>
+               <cache enabled="true" class="org.exoplatform.services.jcr.impl.dataflow.persistent.LinkedWorkspaceStorageCacheImpl">
+                  <properties>
+                     <property name="max-size" value="10k" />
+                     <property name="live-time" value="1h" />
+                  </properties>
+               </cache>
+               <query-handler class="org.exoplatform.services.jcr.impl.core.query.lucene.SearchIndex">
+                  <properties>
+                     <property name="index-dir" value="target/temp/jcrlucenedb/db1ws" />
+                  </properties>
+               </query-handler>
+               <lock-manager>
+                  <time-out>54000</time-out>
+               </lock-manager>
+            </workspace>
+
+            <workspace name="ws1">
+               <container class="org.exoplatform.services.jcr.impl.storage.jdbc.optimisation.CQJDBCWorkspaceDataContainer">
+                  <properties>
+                     <property name="source-name" value="jdbcjcr" />
+                     <property name="multi-db" value="false" />
+                     <property name="update-storage" value="false" />
+                     <property name="max-buffer-size" value="200k" />
+                     <property name="swap-directory" value="target/temp/swap/db1ws1" />
+                  </properties>
+                  <value-storages>
+                     <value-storage id="ws1" class="org.exoplatform.services.jcr.impl.storage.value.fs.TreeFileValueStorage">
+                        <properties>
+                           <property name="path" value="target/temp/values/db1ws1" />
+                        </properties>
+                        <filters>
+                           <filter property-type="Binary" />
+                        </filters>
+                     </value-storage>
+                  </value-storages>
+               </container>
+               <initializer class="org.exoplatform.services.jcr.impl.core.ScratchWorkspaceInitializer">
+                  <properties>
+                     <property name="root-nodetype" value="nt:unstructured" />
+                  </properties>
+               </initializer>
+               <cache enabled="true" class="org.exoplatform.services.jcr.impl.dataflow.persistent.LinkedWorkspaceStorageCacheImpl">
+                  <properties>
+                     <property name="max-size" value="10k" />
+                     <property name="live-time" value="1h" />
+                  </properties>
+               </cache>
+               <query-handler class="org.exoplatform.services.jcr.impl.core.query.lucene.SearchIndex">
+                  <properties>
+                     <property name="index-dir" value="target/temp/jcrlucenedb/db1ws1" />
+                  </properties>
+               </query-handler>
+               <lock-manager>
+                  <time-out>54000</time-out>
+               </lock-manager>               
+            </workspace>
+         </workspaces>
+      </repository>
+
+      <repository name="db2" system-workspace="ws" default-workspace="ws">
+         <security-domain>exo-domain</security-domain>
+         <access-control>optional</access-control>
+         <authentication-policy>org.exoplatform.services.jcr.impl.core.access.JAASAuthenticator</authentication-policy>
+         <workspaces>
+            <workspace name="ws">
+               <container class="org.exoplatform.services.jcr.impl.storage.jdbc.optimisation.CQJDBCWorkspaceDataContainer">
+                  <properties>
+                     <property name="source-name" value="jdbcjcr1" />
+                     <property name="multi-db" value="true" />
+                     <property name="update-storage" value="false" />
+                     <property name="max-buffer-size" value="200k" />
+                     <property name="swap-directory" value="target/temp/swap/db2ws" />
+                  </properties>
+                  <value-storages>
+                     <value-storage id="ws" class="org.exoplatform.services.jcr.impl.storage.value.fs.TreeFileValueStorage">
+                        <properties>
+                           <property name="path" value="target/temp/values/db2ws" />
+                        </properties>
+                        <filters>
+                           <filter property-type="Binary" />
+                        </filters>
+                     </value-storage>
+                  </value-storages>
+               </container>
+               <initializer class="org.exoplatform.services.jcr.impl.core.ScratchWorkspaceInitializer">
+                  <properties>
+                     <property name="root-nodetype" value="nt:unstructured" />
+                  </properties>
+               </initializer>
+               <cache enabled="true" class="org.exoplatform.services.jcr.impl.dataflow.persistent.LinkedWorkspaceStorageCacheImpl">
+                  <properties>
+                     <property name="max-size" value="10k" />
+                     <property name="live-time" value="1h" />
+                  </properties>
+               </cache>
+               <query-handler class="org.exoplatform.services.jcr.impl.core.query.lucene.SearchIndex">
+                  <properties>
+                     <property name="index-dir" value="target/temp/jcrlucenedb/db2ws" />
+                  </properties>
+               </query-handler>
+               <lock-manager>
+                  <time-out>15m</time-out>
+               </lock-manager>
+            </workspace>
+
+            <workspace name="ws1">
+               <container class="org.exoplatform.services.jcr.impl.storage.jdbc.optimisation.CQJDBCWorkspaceDataContainer">
+                  <properties>
+                     <property name="source-name" value="jdbcjcr2" />
+                     <property name="multi-db" value="true" />
+                     <property name="update-storage" value="false" />
+                     <property name="max-buffer-size" value="200k" />
+                     <property name="swap-directory" value="target/temp/swap/db2ws1" />
+                  </properties>
+                  <value-storages>
+                     <value-storage id="ws1" class="org.exoplatform.services.jcr.impl.storage.value.fs.TreeFileValueStorage">
+                        <properties>
+                           <property name="path" value="target/temp/values/db2ws1" />
+                        </properties>
+                        <filters>
+                           <filter property-type="Binary" />
+                        </filters>
+                     </value-storage>
+                  </value-storages>
+               </container>
+               <initializer class="org.exoplatform.services.jcr.impl.core.ScratchWorkspaceInitializer">
+                  <properties>
+                     <property name="root-nodetype" value="nt:unstructured" />
+                  </properties>
+               </initializer>
+               <cache enabled="true" class="org.exoplatform.services.jcr.impl.dataflow.persistent.LinkedWorkspaceStorageCacheImpl">
+                  <properties>
+                     <property name="max-size" value="10k" />
+                     <property name="live-time" value="1h" />
+                  </properties>
+               </cache>
+               <query-handler class="org.exoplatform.services.jcr.impl.core.query.lucene.SearchIndex">
+                  <properties>
+                     <property name="index-dir" value="target/temp/jcrlucenedb/db2ws1" />
+                  </properties>
+               </query-handler>
+               <lock-manager>
+                  <time-out>15m</time-out>
+               </lock-manager>               
+            </workspace>
+         </workspaces>
+      </repository>
+   </repositories>
+</repository-service>



More information about the exo-jcr-commits mailing list