[exo-jcr-commits] exo-jcr SVN: r2151 - 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 04:51:57 EDT 2010
Author: tolusha
Date: 2010-03-26 04:51:55 -0400 (Fri, 26 Mar 2010)
New Revision: 2151
Modified:
jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/server/HTTPBackupAgent.java
jcr/trunk/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/backup/server/HTTPBackupAgentTest.java
Log:
EXOJCR-549: rename methods
Modified: jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/server/HTTPBackupAgent.java
===================================================================
--- jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/server/HTTPBackupAgent.java 2010-03-26 08:17:27 UTC (rev 2150)
+++ jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/server/HTTPBackupAgent.java 2010-03-26 08:51:55 UTC (rev 2151)
@@ -109,6 +109,11 @@
public static final String START_BACKUP = "/start";
/**
+ * Start backup repository operation.
+ */
+ public static final String START_BACKUP_REPOSITORY = "/start-backup-repository";
+
+ /**
* Restore operations.
*/
public static final String RESTORE = "/restore";
@@ -126,7 +131,7 @@
/**
* Stop repository backup operations.
*/
- public static final String STOP_BACKUP_REPOSITORY = "/stop-repository-backup";
+ public static final String STOP_BACKUP_REPOSITORY = "/stop-backup-repository";
/**
* The current and completed backups info operation.
@@ -146,7 +151,7 @@
/**
* The current repository backups info operations.
*/
- public static final String CURRENT_BACKUPS_REPOSITORY_INFO = "/info/backup-repository/current";
+ public static final String CURRENT_BACKUP_REPOSITORY_INFO = "/info/backup-repository/current";
/**
* The current or completed backup info operations.
@@ -381,8 +386,8 @@
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
@RolesAllowed("administrators")
- @Path("/start/{repo}")
- public Response start(BackupConfigBean bConfigBeen, @PathParam("repo") String repository)
+ @Path("/start-backup-repository/{repo}")
+ public Response startBackupRepository(BackupConfigBean bConfigBeen, @PathParam("repo") String repository)
{
String failMessage;
Response.Status status;
@@ -648,7 +653,7 @@
@Produces(MediaType.APPLICATION_JSON)
@RolesAllowed("administrators")
@Path("/restore-repository/{id}")
- public Response restore(RepositoryEntry rEntry, @PathParam("id") String backupId)
+ public Response restoreRepository(RepositoryEntry rEntry, @PathParam("id") String backupId)
{
String failMessage;
Response.Status status;
@@ -793,8 +798,8 @@
@GET
@Produces(MediaType.APPLICATION_JSON)
@RolesAllowed("administrators")
- @Path("/stop-repository-backup/{id}")
- public Response stopRepositoryBackup(@PathParam("id") String backupId)
+ @Path("/stop-backup-repository/{id}")
+ public Response stopBackupRepository(@PathParam("id") String backupId)
{
String failMessage;
Response.Status status;
@@ -1001,7 +1006,7 @@
@Produces(MediaType.APPLICATION_JSON)
@RolesAllowed("administrators")
@Path("/info/backup-repository-id/{id}")
- public Response infoRepositoryBackupId(@PathParam("id") String id)
+ public Response infoBackupRepositoryId(@PathParam("id") String id)
{
try
{
@@ -1080,7 +1085,7 @@
@Produces(MediaType.APPLICATION_JSON)
@RolesAllowed("administrators")
@Path("/info/backup-repository/current")
- public Response infoRepositoryBackupCurrent()
+ public Response infoBackupRepositoryCurrent()
{
try
{
@@ -1145,7 +1150,7 @@
@Produces(MediaType.APPLICATION_JSON)
@RolesAllowed("administrators")
@Path("/info/backup-repository/completed")
- public Response infoRepositoryBackupCompleted()
+ public Response infoBackupRepositoryCompleted()
{
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 08:17:27 UTC (rev 2150)
+++ jcr/trunk/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/backup/server/HTTPBackupAgentTest.java 2010-03-26 08:51:55 UTC (rev 2151)
@@ -212,8 +212,8 @@
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 + "/db6"), new URI(""), new ByteArrayInputStream(
- json.toString().getBytes("UTF-8")), new InputHeadersMap(headers));
+ + 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);
@@ -230,7 +230,7 @@
headers = new MultivaluedMapImpl();
creq =
new ContainerRequestUserRole("GET", new URI(HTTP_BACKUP_AGENT_PATH
- + HTTPBackupAgent.Constants.OperationType.CURRENT_BACKUPS_REPOSITORY_INFO), new URI(""), null,
+ + HTTPBackupAgent.Constants.OperationType.CURRENT_BACKUP_REPOSITORY_INFO), new URI(""), null,
new InputHeadersMap(headers));
responseWriter = new ByteArrayContainerResponseWriter();
@@ -357,6 +357,37 @@
assertEquals("ws2", info.getWorkspaceName());
}
+ public void testInfoBackupRepositoryCurrent() throws Exception
+ {
+ MultivaluedMap<String, String> headers = new MultivaluedMapImpl();
+ ContainerRequestUserRole creq =
+ new ContainerRequestUserRole("GET", new URI(HTTP_BACKUP_AGENT_PATH
+ + HTTPBackupAgent.Constants.OperationType.CURRENT_BACKUP_REPOSITORY_INFO), new URI(""), null,
+ new InputHeadersMap(headers));
+
+ ByteArrayContainerResponseWriter responseWriter = new ByteArrayContainerResponseWriter();
+ ContainerResponse cres = new ContainerResponse(responseWriter);
+ handler.handleRequest(creq, cres);
+
+ assertEquals(200, cres.getStatus());
+
+ ShortInfoList infoList = (ShortInfoList)getObject(ShortInfoList.class, responseWriter.getBody());
+ List<ShortInfo> list = new ArrayList<ShortInfo>(infoList.getBackups());
+
+ assertEquals(1, list.size());
+
+ ShortInfo info = list.get(0);
+
+ assertNotNull(info);
+ assertEquals(BackupManager.FULL_AND_INCREMENTAL, info.getBackupType().intValue());
+ assertNotNull(info.getStartedTime());
+ assertNotNull(info.getFinishedTime());
+ assertEquals(ShortInfo.CURRENT, info.getType().intValue());
+ assertEquals(BackupJob.FINISHED, info.getState().intValue());
+ assertEquals("db6", info.getRepositoryName());
+ assertEquals("ws2", info.getWorkspaceName());
+ }
+
public void testInfoBackupCurrentById() throws Exception
{
// Get backup id for backup on workspace /db6/ws2
@@ -488,6 +519,37 @@
assertEquals("ws2", info.getWorkspaceName());
}
+ public void testInfoBackupRepositoryCompleted() throws Exception
+ {
+ MultivaluedMap<String, String> headers = new MultivaluedMapImpl();
+ ContainerRequestUserRole creq =
+ new ContainerRequestUserRole("GET", new URI(HTTP_BACKUP_AGENT_PATH
+ + HTTPBackupAgent.Constants.OperationType.COMPLETED_BACKUPS_REPOSITORY_INFO), new URI(""), null,
+ new InputHeadersMap(headers));
+
+ ByteArrayContainerResponseWriter responseWriter = new ByteArrayContainerResponseWriter();
+ ContainerResponse cres = new ContainerResponse(responseWriter);
+ handler.handleRequest(creq, cres);
+
+ assertEquals(200, cres.getStatus());
+
+ ShortInfoList infoList = (ShortInfoList)getObject(ShortInfoList.class, responseWriter.getBody());
+ List<ShortInfo> list = new ArrayList<ShortInfo>(infoList.getBackups());
+
+ assertEquals(1, list.size());
+
+ ShortInfo info = list.get(0);
+
+ assertNotNull(info);
+ assertEquals(BackupManager.FULL_AND_INCREMENTAL, info.getBackupType().intValue());
+ assertNotNull(info.getStartedTime());
+ assertNotNull(info.getFinishedTime());
+ assertEquals(ShortInfo.COMPLETED, info.getType().intValue());
+ assertEquals(0, info.getState().intValue());
+ assertEquals("db6", info.getRepositoryName());
+ assertEquals("ws2", info.getWorkspaceName());
+ }
+
public void testInfoBackupCompletedById() throws Exception
{
// Get backup id for backup on workspace /db6/ws2
@@ -769,7 +831,7 @@
MultivaluedMap<String, String> headers = new MultivaluedMapImpl();
ContainerRequestUserRole creq =
new ContainerRequestUserRole("GET", new URI(HTTP_BACKUP_AGENT_PATH
- + HTTPBackupAgent.Constants.OperationType.CURRENT_BACKUPS_REPOSITORY_INFO), new URI(""), null,
+ + HTTPBackupAgent.Constants.OperationType.CURRENT_BACKUP_REPOSITORY_INFO), new URI(""), null,
new InputHeadersMap(headers));
ByteArrayContainerResponseWriter responseWriter = new ByteArrayContainerResponseWriter();
More information about the exo-jcr-commits
mailing list