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

do-not-reply at jboss.org do-not-reply at jboss.org
Fri Mar 26 07:24:58 EDT 2010


Author: tolusha
Date: 2010-03-26 07:24:57 -0400 (Fri, 26 Mar 2010)
New Revision: 2164

Modified:
   jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/RepositoryBackupChainLog.java
   jcr/trunk/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/backup/server/HTTPBackupAgentTest.java
Log:
EXOJCR-549: fix backupType

Modified: jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/RepositoryBackupChainLog.java
===================================================================
--- jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/RepositoryBackupChainLog.java	2010-03-26 10:33:19 UTC (rev 2163)
+++ jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/RepositoryBackupChainLog.java	2010-03-26 11:24:57 UTC (rev 2164)
@@ -97,47 +97,51 @@
 
          writer.flush();
       }
-      
+
       public synchronized void write(RepositoryBackupConfig config, String fullBackupType, String incrementalBackupType)
-      throws XMLStreamException
-   {
-      writer.writeStartElement("repository-backup-config");
+         throws XMLStreamException
+      {
+         writer.writeStartElement("repository-backup-config");
 
-      writer.writeStartElement("full-backup-type");
-      writer.writeCharacters(fullBackupType);
-      writer.writeEndElement();
+         writer.writeStartElement("backup-type");
+         writer.writeCharacters(String.valueOf(config.getBackupType()));
+         writer.writeEndElement();
 
-      writer.writeStartElement("incremental-backup-type");
-      writer.writeCharacters(incrementalBackupType);
-      writer.writeEndElement();
+         writer.writeStartElement("full-backup-type");
+         writer.writeCharacters(fullBackupType);
+         writer.writeEndElement();
 
-      if (config.getBackupDir() != null)
-      {
-         writer.writeStartElement("backup-dir");
-         writer.writeCharacters(config.getBackupDir().getAbsolutePath());
+         writer.writeStartElement("incremental-backup-type");
+         writer.writeCharacters(incrementalBackupType);
          writer.writeEndElement();
-      }
 
-      if (config.getRepository() != null)
-      {
-         writer.writeStartElement("repository");
-         writer.writeCharacters(config.getRepository());
+         if (config.getBackupDir() != null)
+         {
+            writer.writeStartElement("backup-dir");
+            writer.writeCharacters(config.getBackupDir().getAbsolutePath());
+            writer.writeEndElement();
+         }
+
+         if (config.getRepository() != null)
+         {
+            writer.writeStartElement("repository");
+            writer.writeCharacters(config.getRepository());
+            writer.writeEndElement();
+         }
+
+         writer.writeStartElement("incremental-job-period");
+         writer.writeCharacters(Long.toString(config.getIncrementalJobPeriod()));
          writer.writeEndElement();
-      }
 
-      writer.writeStartElement("incremental-job-period");
-      writer.writeCharacters(Long.toString(config.getIncrementalJobPeriod()));
-      writer.writeEndElement();
+         writer.writeStartElement("incremental-job-number");
+         writer.writeCharacters(Integer.toString(config.getIncrementalJobNumber()));
+         writer.writeEndElement();
 
-      writer.writeStartElement("incremental-job-number");
-      writer.writeCharacters(Integer.toString(config.getIncrementalJobNumber()));
-      writer.writeEndElement();
+         writer.writeEndElement();
 
-      writer.writeEndElement();
+         writer.flush();
+      }
 
-      writer.flush();
-   }
-
       public synchronized void writeEndLog()
       {
          try
@@ -186,7 +190,7 @@
 
                   if (name.equals("repository-backup-config"))
                      config = readBackupConfig();
-                  
+
                   if (name.equals("system-workspace"))
                      workspaceSystem = readContent();
 
@@ -242,7 +246,7 @@
 
          return wsBackupInfo;
       }
-      
+
       private BackupConfig readBackupConfig() throws XMLStreamException
       {
          BackupConfig conf = new BackupConfig();
@@ -261,6 +265,9 @@
                   if (name.equals("backup-dir"))
                      conf.setBackupDir(new File(readContent()));
 
+                  if (name.equals("backup-type"))
+                     conf.setBackupType(Integer.valueOf(readContent()));
+
                   if (name.equals("repository"))
                      conf.setRepository(readContent());
 
@@ -272,13 +279,13 @@
 
                   if (name.equals("incremental-job-number"))
                      conf.setIncrementalJobNumber(Integer.valueOf(readContent()).intValue());
-                  
+
                   if (name.equals("full-backup-type"))
                      fullBackupType = readContent();
-                  
-                  if (name.equals("full-backup-type"))
-                     fullBackupType = readContent();
 
+                  if (name.equals("incremental-backup-type"))
+                     increnetalBackupType = readContent();
+
                   break;
 
                case StartElement.END_ELEMENT :
@@ -418,14 +425,9 @@
     * @param startTime
     * @throws BackupOperationException
     */
-   public RepositoryBackupChainLog(File logDirectory, 
-            RepositoryBackupConfig config,
-            String fullBackupType, 
-            String incrementalBackupType,
-            String systemWorkspace, 
-            List<String> wsLogFilePathList,
-            String backupId, 
-            Calendar startTime) throws BackupOperationException
+   public RepositoryBackupChainLog(File logDirectory, RepositoryBackupConfig config, String fullBackupType,
+      String incrementalBackupType, String systemWorkspace, List<String> wsLogFilePathList, String backupId,
+      Calendar startTime) throws BackupOperationException
    {
       try
       {

Modified: jcr/trunk/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/backup/server/HTTPBackupAgentTest.java
===================================================================
--- jcr/trunk/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/backup/server/HTTPBackupAgentTest.java	2010-03-26 10:33:19 UTC (rev 2163)
+++ jcr/trunk/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/backup/server/HTTPBackupAgentTest.java	2010-03-26 11:24:57 UTC (rev 2164)
@@ -193,9 +193,6 @@
 
    public void testStartBackupRepository() throws Exception
    {
-      // login to workspace '/db6/ws2'
-      // Start repository backup
-
       Session session_db6_ws2 = repositoryService.getRepository("db6").login(credentials, "ws2");
       assertNotNull(session_db6_ws2);
 
@@ -1062,12 +1059,12 @@
 
       Thread.sleep(2000);
 
-      // Get restore info to workspace /db6/ws3
+      // Get restore info
       {
          MultivaluedMap<String, String> headers = new MultivaluedMapImpl();
          ContainerRequestUserRole creq =
             new ContainerRequestUserRole("GET", new URI(HTTP_BACKUP_AGENT_PATH
-               + HTTPBackupAgent.Constants.OperationType.CURRENT_RESTORE_INFO_ON_REPOSITORY + "/" + "db6"),
+               + HTTPBackupAgent.Constants.OperationType.CURRENT_RESTORE_INFO_ON_REPOSITORY + "/" + "db7"),
                new URI(""), null, new InputHeadersMap(headers));
 
          ByteArrayContainerResponseWriter responseWriter = new ByteArrayContainerResponseWriter();
@@ -1084,13 +1081,13 @@
          assertNotNull(info.getFinishedTime());
          assertEquals(ShortInfo.RESTORE, info.getType().intValue());
          assertEquals(JobWorkspaceRestore.RESTORE_SUCCESSFUL, info.getState().intValue());
-         assertEquals("db6", info.getRepositoryName());
-         assertEquals("ws3", info.getWorkspaceName());
+         assertEquals("db7", info.getRepositoryName());
          assertNotNull(info.getBackupConfig());
 
-         Session sessin_ws3 = repositoryService.getRepository("db6").login(credentials, "ws3");
-         assertNotNull(sessin_ws3);
-         assertNotNull(sessin_ws3.getRootNode());
+         assertNotNull(repositoryService.getRepository("db7"));
+         Session sessin_ws = repositoryService.getRepository("db7").login(credentials, "ws");
+         assertNotNull(sessin_ws);
+         assertNotNull(sessin_ws.getRootNode());
       }
 
       // Get restores info
@@ -1118,13 +1115,13 @@
          assertNotNull(info.getFinishedTime());
          assertEquals(ShortInfo.RESTORE, info.getType().intValue());
          assertEquals(JobWorkspaceRestore.RESTORE_SUCCESSFUL, info.getState().intValue());
-         assertEquals("db6", info.getRepositoryName());
-         assertEquals("ws3", info.getWorkspaceName());
+         assertEquals("db7", info.getRepositoryName());
          assertNotNull(info.getBackupId());
 
-         Session sessin_ws3 = repositoryService.getRepository("db6").login(credentials, "ws3");
-         assertNotNull(sessin_ws3);
-         assertNotNull(sessin_ws3.getRootNode());
+         assertNotNull(repositoryService.getRepository("db7"));
+         Session sessin_ws = repositoryService.getRepository("db7").login(credentials, "ws");
+         assertNotNull(sessin_ws);
+         assertNotNull(sessin_ws.getRootNode());
       }
    }
 



More information about the exo-jcr-commits mailing list