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

do-not-reply at jboss.org do-not-reply at jboss.org
Wed Nov 24 08:08:12 EST 2010


Author: tolusha
Date: 2010-11-24 08:08:11 -0500 (Wed, 24 Nov 2010)
New Revision: 3535

Modified:
   jcr/trunk/exo.jcr.component.ext/pom.xml
   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/resources/conf/standalone/test-configuration.xml
   jcr/trunk/exo.jcr.component.ext/src/test/resources/conf/standalone/test-jcr-ext-config.xml
Log:
EXOJCR-852: add TestBackupManager to include list

Modified: jcr/trunk/exo.jcr.component.ext/pom.xml
===================================================================
--- jcr/trunk/exo.jcr.component.ext/pom.xml	2010-11-24 13:06:01 UTC (rev 3534)
+++ jcr/trunk/exo.jcr.component.ext/pom.xml	2010-11-24 13:08:11 UTC (rev 3535)
@@ -185,6 +185,7 @@
               <include>**/replication/*.java</include>
               <include>**/replication/external/*.java</include>
               <include>**/replication/async/**/*.java</include>
+              <include>**/**/TestBackupManager.java</include>
             </includes>
             <excludes>
               <exclude>**/BaseStandaloneTest.java</exclude>

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-11-24 13:06:01 UTC (rev 3534)
+++ jcr/trunk/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/backup/TestBackupManager.java	2010-11-24 13:08:11 UTC (rev 3535)
@@ -1473,19 +1473,33 @@
 
    public void testExistedRepositoryRestore() throws Exception
    {
+      RepositoryImpl repositoryDB8 = (RepositoryImpl)repositoryService.getRepository("db8");
+
+      for (String wsName : repositoryDB8.getWorkspaceNames())
+      {
+         SessionImpl sessionWS = (SessionImpl)repositoryDB8.login(credentials, wsName);
+
+         Node wsTestRoot = sessionWS.getRootNode().addNode("backupTest");
+         sessionWS.getRootNode().save();
+         addContent(wsTestRoot, 1, 10, 1);
+         sessionWS.getRootNode().save();
+      }
+
+      SessionImpl sessionWS = (SessionImpl)repositoryDB8.login(credentials, WS_NAME);
+
       // backup
       File backDir = new File("target/backup");
       backDir.mkdirs();
 
       RepositoryBackupConfig config = new RepositoryBackupConfig();
-      config.setRepository(repository.getName());
+      config.setRepository(repositoryDB8.getName());
       config.setBackupType(BackupManager.FULL_BACKUP_ONLY);
 
       config.setBackupDir(backDir);
 
       backup.startBackup(config);
 
-      RepositoryBackupChain bch = backup.findRepositoryBackup(repository.getName());
+      RepositoryBackupChain bch = backup.findRepositoryBackup(repositoryDB8.getName());
 
       // wait till full backup will be stopped
       while (bch.getState() != RepositoryBackupChain.FINISHED)
@@ -1500,7 +1514,7 @@
 
       // restore             
       RepositoryEntry baseRE =
-         (RepositoryEntry)ws1Session.getContainer().getComponentInstanceOfType(RepositoryEntry.class);
+         (RepositoryEntry)sessionWS.getContainer().getComponentInstanceOfType(RepositoryEntry.class);
       RepositoryEntry re = makeRepositoryEntry(baseRE.getName(), baseRE, null, null);
 
       File backLog = new File(bch.getLogFilePath());
@@ -1635,19 +1649,33 @@
 
    public void testExistedRepositoryRestoreAsync() throws Exception
    {
+      RepositoryImpl repositoryDB8 = (RepositoryImpl)repositoryService.getRepository("db8");
+
+      for (String wsName : repositoryDB8.getWorkspaceNames())
+      {
+         SessionImpl sessionWS = (SessionImpl)repositoryDB8.login(credentials, wsName);
+
+         Node wsTestRoot = sessionWS.getRootNode().addNode("backupTest");
+         sessionWS.getRootNode().save();
+         addContent(wsTestRoot, 1, 10, 1);
+         sessionWS.getRootNode().save();
+      }
+
+      SessionImpl sessionWS = (SessionImpl)repositoryDB8.login(credentials, "ws1");
+
       // backup
       File backDir = new File("target/backup");
       backDir.mkdirs();
 
       RepositoryBackupConfig config = new RepositoryBackupConfig();
-      config.setRepository(repository.getName());
+      config.setRepository(repositoryDB8.getName());
       config.setBackupType(BackupManager.FULL_BACKUP_ONLY);
 
       config.setBackupDir(backDir);
 
       backup.startBackup(config);
 
-      RepositoryBackupChain bch = backup.findRepositoryBackup(repository.getName());
+      RepositoryBackupChain bch = backup.findRepositoryBackup(repositoryDB8.getName());
 
       // wait till full backup will be stopped
       while (bch.getState() != RepositoryBackupChain.FINISHED)
@@ -1662,7 +1690,7 @@
 
       // restore
       RepositoryEntry baseRE =
-         (RepositoryEntry)ws1Session.getContainer().getComponentInstanceOfType(RepositoryEntry.class);
+         (RepositoryEntry)sessionWS.getContainer().getComponentInstanceOfType(RepositoryEntry.class);
       RepositoryEntry re = makeRepositoryEntry(baseRE.getName(), baseRE, null, null);
 
       File backLog = new File(bch.getLogFilePath());
@@ -1717,19 +1745,34 @@
 
    public void testExistedRepositoryRestoreAsync2() throws Exception
    {
+      RepositoryImpl repositoryDB8 = (RepositoryImpl)repositoryService.getRepository("db8");
+
+      for (String wsName : repositoryDB8.getWorkspaceNames())
+      {
+         SessionImpl sessionWS = (SessionImpl)repositoryDB8.login(credentials, wsName);
+
+         Node wsTestRoot = sessionWS.getRootNode().addNode("backupTest");
+         sessionWS.getRootNode().save();
+         addContent(wsTestRoot, 1, 10, 1);
+         sessionWS.getRootNode().save();
+      }
+
+      SessionImpl sessionWS = (SessionImpl)repositoryDB8.login(credentials, "ws1");
+
+
       // backup
       File backDir = new File("target/backup");
       backDir.mkdirs();
 
       RepositoryBackupConfig config = new RepositoryBackupConfig();
-      config.setRepository(repository.getName());
+      config.setRepository(repositoryDB8.getName());
       config.setBackupType(BackupManager.FULL_BACKUP_ONLY);
 
       config.setBackupDir(backDir);
 
       backup.startBackup(config);
 
-      RepositoryBackupChain bch = backup.findRepositoryBackup(repository.getName());
+      RepositoryBackupChain bch = backup.findRepositoryBackup(repositoryDB8.getName());
 
       // wait till full backup will be stopped
       while (bch.getState() != RepositoryBackupChain.FINISHED)
@@ -1744,7 +1787,7 @@
 
       // restore
       RepositoryEntry baseRE =
-         (RepositoryEntry)ws1Session.getContainer().getComponentInstanceOfType(RepositoryEntry.class);
+         (RepositoryEntry)sessionWS.getContainer().getComponentInstanceOfType(RepositoryEntry.class);
       RepositoryEntry re = makeRepositoryEntry(baseRE.getName(), baseRE, null, null);
 
       File backLog = new File(bch.getLogFilePath());

Modified: jcr/trunk/exo.jcr.component.ext/src/test/resources/conf/standalone/test-configuration.xml
===================================================================
--- jcr/trunk/exo.jcr.component.ext/src/test/resources/conf/standalone/test-configuration.xml	2010-11-24 13:06:01 UTC (rev 3534)
+++ jcr/trunk/exo.jcr.component.ext/src/test/resources/conf/standalone/test-configuration.xml	2010-11-24 13:08:11 UTC (rev 3535)
@@ -1955,7 +1955,6 @@
             </properties-param>
          </init-params>
       </component-plugin>
-      
       <component-plugin>
          <name>bind.datasource</name>
          <set-method>addPlugin</set-method>
@@ -1990,6 +1989,35 @@
          <init-params>
             <value-param>
                <name>bind-name</name>
+               <value>jdbcjcr28</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/jcr28" />
+               <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>jdbcjcr_to_rest_repo_1</value>
             </value-param>
             <value-param>

Modified: jcr/trunk/exo.jcr.component.ext/src/test/resources/conf/standalone/test-jcr-ext-config.xml
===================================================================
--- jcr/trunk/exo.jcr.component.ext/src/test/resources/conf/standalone/test-jcr-ext-config.xml	2010-11-24 13:06:01 UTC (rev 3534)
+++ jcr/trunk/exo.jcr.component.ext/src/test/resources/conf/standalone/test-jcr-ext-config.xml	2010-11-24 13:08:11 UTC (rev 3535)
@@ -421,6 +421,82 @@
                </query-handler>
             </workspace>
          </workspaces>
-      </repository>
+      </repository>
+      <repository name="db8" 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">
+               <!-- for system storage -->
+               <container class="org.exoplatform.services.jcr.impl.storage.jdbc.optimisation.CQJDBCWorkspaceDataContainer">
+                  <properties>
+                     <property name="source-name" value="jdbcjcr28" />
+                     <property name="dialect" value="hsqldb" />
+                     <property name="multi-db" value="false" />
+                     <property name="update-storage" value="true" />
+                     <property name="max-buffer-size" value="200k" />
+                     <property name="swap-directory" value="target/temp/swap/db8_ws" />
+                  </properties>
+                  <value-storages>
+                     <value-storage id="draft" class="org.exoplatform.services.jcr.impl.storage.value.fs.TreeFileValueStorage">
+                        <properties>
+                           <property name="path" value="../temp/values/db8_ws" />
+                        </properties>
+                        <filters>
+                           <filter property-type="Binary" />
+                        </filters>
+                     </value-storage>
+                  </value-storages>
+               </container>
+               <cache enabled="true">
+                  <properties>
+                     <property name="max-size" value="5k" />
+                     <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/index/db8_ws" />
+                  </properties>
+               </query-handler>
+            </workspace>
+            <workspace name="ws1">
+               <container class="org.exoplatform.services.jcr.impl.storage.jdbc.optimisation.CQJDBCWorkspaceDataContainer">
+                  <properties>
+                     <property name="source-name" value="jdbcjcr28" />
+                     <property name="dialect" value="hsqldb" />
+                     <property name="multi-db" value="false" />
+                     <property name="update-storage" value="true" />
+                     <property name="max-buffer-size" value="200k" />
+                     <property name="swap-directory" value="target/temp/swap/db8_ws1" />
+                  </properties>
+                  <value-storages>
+                     <value-storage id="draft" class="org.exoplatform.services.jcr.impl.storage.value.fs.TreeFileValueStorage">
+                        <properties>
+                           <property name="path" value="../temp/values/db8_ws1" />
+                        </properties>
+                        <filters>
+                           <filter property-type="Binary" />
+                        </filters>
+                     </value-storage>
+                  </value-storages>
+               </container>
+               <cache enabled="true">
+                  <properties>
+                     <property name="max-size" value="5k" />
+                     <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/index/db8_ws1" />
+                  </properties>
+               </query-handler>
+            </workspace>
+         </workspaces>
+      </repository>
+
+
    </repositories>
 </repository-service>



More information about the exo-jcr-commits mailing list