Author: areshetnyak
Date: 2011-04-11 04:35:21 -0400 (Mon, 11 Apr 2011)
New Revision: 4220
Modified:
jcr/trunk/applications/exo.jcr.applications.backupconsole/src/main/java/org/exoplatform/jcr/backupconsole/BackupClientImpl.java
jcr/trunk/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/backup/server/HTTPBackupAgentTest.java
Log:
JCR-1563 : The parameter "backup-set-path" was used QueryPqram in
HTTPBackupAgent.
Modified:
jcr/trunk/applications/exo.jcr.applications.backupconsole/src/main/java/org/exoplatform/jcr/backupconsole/BackupClientImpl.java
===================================================================
---
jcr/trunk/applications/exo.jcr.applications.backupconsole/src/main/java/org/exoplatform/jcr/backupconsole/BackupClientImpl.java 2011-04-08
14:36:25 UTC (rev 4219)
+++
jcr/trunk/applications/exo.jcr.applications.backupconsole/src/main/java/org/exoplatform/jcr/backupconsole/BackupClientImpl.java 2011-04-11
08:35:21 UTC (rev 4220)
@@ -52,6 +52,7 @@
import java.io.IOException;
import java.io.InputStream;
import java.io.UnsupportedEncodingException;
+import java.net.URLEncoder;
import javax.ws.rs.core.Response;
@@ -469,6 +470,13 @@
BackupAgentResponse response = null;
String sURL = null;
+ String backupSetPathEncoded = null;
+
+ if (backupSetPath != null)
+ {
+ backupSetPathEncoded = URLEncoder.encode(backupSetPath, "UTF-8");
+ }
+
if (workspaceName != null)
{
if (config != null)
@@ -484,7 +492,8 @@
sURL =
path + HTTPBackupAgent.Constants.BASE_URL
+
HTTPBackupAgent.Constants.OperationType.RESTORE_BACKUP_SET + "/"
- + repositoryName + "/" + backupSetPath +
"/" + removeExists;
+ + repositoryName
+ + "/" + removeExists +
"?backup-set-path=" + backupSetPathEncoded;
}
WorkspaceEntry wEntry = null;
@@ -529,8 +538,7 @@
sURL =
path + HTTPBackupAgent.Constants.BASE_URL
+
HTTPBackupAgent.Constants.OperationType.RESTORE_REPOSITORY_BACKUP_SET + "/"
- + backupSetPath + "/"
- + removeExists;
+ + removeExists + "?backup-set-path=" +
backupSetPathEncoded;
}
RepositoryEntry wEntry = null;
@@ -613,8 +621,8 @@
{
sURL =
path + HTTPBackupAgent.Constants.BASE_URL
- +
HTTPBackupAgent.Constants.OperationType.RESTORE_BACKUP_SET + "/" + backupSetPath
+ "/"
- + removeExists;
+ +
HTTPBackupAgent.Constants.OperationType.RESTORE_BACKUP_SET + "/" + removeExists
+ + "?backup-set-path=" + backupSetPathEncoded;
}
response = transport.executeGET(sURL);
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 2011-04-08
14:36:25 UTC (rev 4219)
+++
jcr/trunk/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/backup/server/HTTPBackupAgentTest.java 2011-04-11
08:35:21 UTC (rev 4220)
@@ -3161,4 +3161,35 @@
}
}
}
+
+ public void testStartBackupRepository_OnWin() throws Exception
+ {
+ Session session_db6_ws2 =
repositoryService.getRepository("db6").login(credentials, "ws2");
+ assertNotNull(session_db6_ws2);
+
+ session_db6_ws2.getRootNode().addNode("NODE_NAME_TO_TEST");
+ session_db6_ws2.save();
+
+ File f = new File("E:\\data\\exo-working\\temp\\backup");
+
+ BackupConfigBean configBean = new
BackupConfigBean(BackupManager.FULL_AND_INCREMENTAL, f.getPath(), 10000l);
+
+ JsonGeneratorImpl generatorImpl = new JsonGeneratorImpl();
+ JsonValue json = generatorImpl.createJsonObject(configBean);
+
+ MultivaluedMap<String, String> headers = new MultivaluedMapImpl();
+ headers.putSingle("Content-Type", "application/json;
charset=UTF-8");
+ ContainerRequestUserRole creq =
+ new ContainerRequestUserRole("POST", new
URI(HTTP_BACKUP_AGENT_PATH
+ + HTTPBackupAgent.Constants.OperationType.START_BACKUP_REPOSITORY
+ "/db6"), new URI(""),
+ new
ByteArrayInputStream(json.toString().getBytes("UTF-8")), new
InputHeadersMap(headers));
+
+ ByteArrayContainerResponseWriter responseWriter = new
ByteArrayContainerResponseWriter();
+ ContainerResponse cres = new ContainerResponse(responseWriter);
+ handler.handleRequest(creq, cres);
+
+ assertEquals(200, cres.getStatus());
+
+ Thread.sleep(10000);
+ }
}
Show replies by date