[exo-jcr-commits] exo-jcr SVN: r4625 - jcr/trunk/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/backup.

do-not-reply at jboss.org do-not-reply at jboss.org
Wed Jul 13 10:15:42 EDT 2011


Author: sergiykarpenko
Date: 2011-07-13 10:15:42 -0400 (Wed, 13 Jul 2011)
New Revision: 4625

Modified:
   jcr/trunk/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/backup/AbstractBackupUseCasesTest.java
Log:
EXOJCR-1435 : Unit test was fixed (for working on OS Windows)

Modified: jcr/trunk/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/backup/AbstractBackupUseCasesTest.java
===================================================================
--- jcr/trunk/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/backup/AbstractBackupUseCasesTest.java	2011-07-13 13:25:27 UTC (rev 4624)
+++ jcr/trunk/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/backup/AbstractBackupUseCasesTest.java	2011-07-13 14:15:42 UTC (rev 4625)
@@ -1221,9 +1221,15 @@
 
       String backupDitEnv = backDir.getCanonicalPath();
 
-      String newBackupDir =
-         "\\${java.io.tmpdir}" + bch.getBackupConfig().getBackupDir().getCanonicalPath().replace(backupDitEnv, "");
+      String relativePath = bch.getBackupConfig().getBackupDir().getCanonicalPath().replace(backupDitEnv, "");
+      String relativePathForWrite = relativePath;
+      if (File.separator.equals("\\"))
+      {
+         relativePathForWrite = relativePath.replaceAll("\\\\", "\\\\\\\\");
+      }
 
+      String newBackupDir = "\\${java.io.tmpdir}" + relativePathForWrite;
+
       File dest = new File(repositoryBackupChainLogPath + ".xml");
       dest.createNewFile();
 
@@ -1231,10 +1237,9 @@
       try
       {
          String sConfig =
-                  setNewBackupDirInRepositoryBackupChainLog(new File(repositoryBackupChainLogPath), dest, newBackupDir);
+            setNewBackupDirInRepositoryBackupChainLog(new File(repositoryBackupChainLogPath), dest, newBackupDir);
 
-         assertTrue(sConfig.contains("${java.io.tmpdir}"
-            + bch.getBackupConfig().getBackupDir().getCanonicalPath().replace(backupDitEnv, "")));
+         assertTrue(sConfig.contains("${java.io.tmpdir}" + relativePath));
 
          // check
          newRepositoryBackupChainLog = new RepositoryBackupChainLog(dest);
@@ -1277,6 +1282,11 @@
 
       String newBackupDir =
          bch.getBackupConfig().getBackupDir().getCanonicalPath().replace(relativePrefixBackupDir, "");
+      String newBackupDirForWrite = newBackupDir;
+      if (File.separator.equals("\\"))
+      {
+         newBackupDirForWrite = newBackupDir.replaceAll("\\\\", "\\\\\\\\");
+      }
 
       File dest = new File(repositoryBackupChainLogPath + ".xml");
       dest.createNewFile();
@@ -1284,7 +1294,7 @@
       RepositoryBackupChainLog newRepositoryBackupChainLog = null;
 
       String sConfig =
-               setNewBackupDirInRepositoryBackupChainLog(new File(repositoryBackupChainLogPath), dest, newBackupDir);
+         setNewBackupDirInRepositoryBackupChainLog(new File(repositoryBackupChainLogPath), dest, newBackupDirForWrite);
 
       assertTrue(sConfig.contains(newBackupDir));
 



More information about the exo-jcr-commits mailing list