Author: andrew.plotnikov
Date: 2012-02-07 03:05:23 -0500 (Tue, 07 Feb 2012)
New Revision: 5571
Modified:
jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/registry/RESTRegistryService.java
jcr/trunk/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/registry/RESTRegistryTest.java
Log:
EXOJCR-1746: Removed Deprecated methods from RestRegistryService
Modified:
jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/registry/RESTRegistryService.java
===================================================================
---
jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/registry/RESTRegistryService.java 2012-02-06
13:36:29 UTC (rev 5570)
+++
jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/registry/RESTRegistryService.java 2012-02-07
08:05:23 UTC (rev 5571)
@@ -93,98 +93,6 @@
@GET
@Produces(MediaType.APPLICATION_XML)
- @Path("/{repository}/")
- @Deprecated
- public Response getRegistry(@PathParam("repository") String repository,
@Context UriInfo uriInfo)
- {
- try
- {
- regService.getRepositoryService().setCurrentRepositoryName(repository);
- return getRegistry(uriInfo);
- }
- catch (Exception e)
- {
- log.error("Get registry failed", e);
- throw new WebApplicationException(e);
- }
- }
-
- @GET
- @Path("/{repository}/{entryPath:.+}/")
- @Produces(MediaType.APPLICATION_XML)
- @Deprecated
- public Response getEntry(@PathParam("repository") String repository,
@PathParam("entryPath") String entryPath)
- {
- try
- {
- regService.getRepositoryService().setCurrentRepositoryName(repository);
- return getEntry(entryPath);
- }
- catch (Exception e)
- {
- log.error("Get registry entry failed", e);
- throw new WebApplicationException(e);
- }
- }
-
- @POST
- @Path("/{repository}/{groupName:.+}/")
- @Consumes(MediaType.APPLICATION_XML)
- @Deprecated
- public Response createEntry(InputStream entryStream,
@PathParam("repository") String repository,
- @PathParam("groupName") String groupName, @Context UriInfo uriInfo)
- {
- try
- {
- regService.getRepositoryService().setCurrentRepositoryName(repository);
- return createEntry(entryStream, groupName, uriInfo);
- }
- catch (Exception e)
- {
- log.error("Create registry entry failed", e);
- throw new WebApplicationException(e);
- }
- }
-
- @PUT
- @Path("/{repository}/{groupName:.+}/")
- @Consumes(MediaType.APPLICATION_XML)
- @Deprecated
- public Response recreateEntry(InputStream entryStream,
@PathParam("repository") String repository,
- @PathParam("groupName") String groupName, @Context UriInfo
uriInfo,
- @QueryParam("createIfNotExist") boolean createIfNotExist)
- {
- try
- {
- regService.getRepositoryService().setCurrentRepositoryName(repository);
- return recreateEntry(entryStream, groupName, uriInfo, createIfNotExist);
- }
- catch (Exception e)
- {
- log.error("Re-create registry entry failed", e);
- throw new WebApplicationException(e);
- }
- }
-
- @DELETE
- @Path("/{repository}/{entryPath:.+}/")
- @Deprecated
- public Response removeEntry(@PathParam("repository") String repository,
@PathParam("entryPath") String entryPath)
- {
- try
- {
- regService.getRepositoryService().setCurrentRepositoryName(repository);
- return removeEntry(entryPath);
- }
- catch (Exception e)
- {
- log.error("Remove registry entry failed", e);
- throw new WebApplicationException(e);
- }
- }
-
- @GET
- @Produces(MediaType.APPLICATION_XML)
public Response getRegistry(@Context UriInfo uriInfo)
{
SessionProvider sessionProvider = sessionProviderService.getSessionProvider(null);
Modified:
jcr/trunk/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/registry/RESTRegistryTest.java
===================================================================
---
jcr/trunk/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/registry/RESTRegistryTest.java 2012-02-06
13:36:29 UTC (rev 5570)
+++
jcr/trunk/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/registry/RESTRegistryTest.java 2012-02-07
08:05:23 UTC (rev 5571)
@@ -90,8 +90,9 @@
log.info("-----REST-----");
+ repositoryService.setCurrentRepositoryName("db1");
DummyContainerResponseWriter wr = new DummyContainerResponseWriter();
- URI reqUri = new URI(baseUri.toString() + "/registry/db1/");
+ URI reqUri = new URI(baseUri.toString() + "/registry/");
ContainerResponse cres =
request(handler, wr, "GET", reqUri, baseUri, null, new
InputHeadersMap(new MultivaluedMapImpl()));
assertEquals(200, cres.getStatus());
@@ -100,14 +101,14 @@
// request to exo:services/exo_service
// response status should be 404 (NOT_FOUND)
wr.reset();
- reqUri = new URI(baseUri.toString() + "/registry/db1/" +
RegistryService.EXO_SERVICES + "/exo_service");
+ reqUri = new URI(baseUri.toString() + "/registry/" +
RegistryService.EXO_SERVICES + "/exo_service");
cres = request(handler, wr, "GET", reqUri, baseUri, null, new
InputHeadersMap(new MultivaluedMapImpl()));
assertEquals(404, cres.getStatus());
assertNull(wr.getBody());
// create exo:services/exo_service
wr.reset();
- reqUri = new URI(baseUri.toString() + "/registry/db1/" +
RegistryService.EXO_SERVICES);
+ reqUri = new URI(baseUri.toString() + "/registry/" +
RegistryService.EXO_SERVICES);
cres =
request(handler, wr, "POST", reqUri, baseUri, SERVICE_XML.getBytes(),
new InputHeadersMap(
new MultivaluedMapImpl()));
@@ -116,14 +117,14 @@
// request to exo:services/exo_service
wr.reset();
- reqUri = new URI(baseUri.toString() + "/registry/db1/" +
RegistryService.EXO_SERVICES + "/exo_service");
+ reqUri = new URI(baseUri.toString() + "/registry/" +
RegistryService.EXO_SERVICES + "/exo_service");
cres = request(handler, wr, "GET", reqUri, baseUri, null, new
InputHeadersMap(new MultivaluedMapImpl()));
assertEquals(200, cres.getStatus());
log.info(new String(wr.getBody()));
// recreate exo:services/exo_service
wr.reset();
- reqUri = new URI(baseUri.toString() + "/registry/db1/" +
RegistryService.EXO_SERVICES);
+ reqUri = new URI(baseUri.toString() + "/registry/" +
RegistryService.EXO_SERVICES);
cres =
request(handler, wr, "PUT", reqUri, baseUri, SERVICE_XML.getBytes(),
new InputHeadersMap(
new MultivaluedMapImpl()));
@@ -132,14 +133,14 @@
// delete exo:services/exo_service
wr.reset();
- reqUri = new URI(baseUri.toString() + "/registry/db1/" +
RegistryService.EXO_SERVICES + "/exo_service");
+ reqUri = new URI(baseUri.toString() + "/registry/" +
RegistryService.EXO_SERVICES + "/exo_service");
cres = request(handler, wr, "DELETE", reqUri, baseUri, null, new
InputHeadersMap(new MultivaluedMapImpl()));
assertEquals(204, cres.getStatus());
// request to exo:services/exo_service
// request status should be 404 (NOT_FOUND)
wr.reset();
- reqUri = new URI(baseUri.toString() + "/registry/db1/" +
RegistryService.EXO_SERVICES + "/exo_service");
+ reqUri = new URI(baseUri.toString() + "/registry/" +
RegistryService.EXO_SERVICES + "/exo_service");
cres = request(handler, wr, "GET", reqUri, baseUri, null, new
InputHeadersMap(new MultivaluedMapImpl()));
assertEquals(404, cres.getStatus());
assertNull(wr.getBody());
@@ -153,40 +154,43 @@
ByteArrayOutputStream out = new ByteArrayOutputStream();
int rd = -1;
while ((rd = in.read()) != -1)
+ {
out.write(rd);
+ }
byte[] data = out.toByteArray();
+ repositoryService.setCurrentRepositoryName("db1");
// check for exo:services/group/test
// response status should be 404 (NOT_FOUND)
- URI reqUri = new URI(baseUri.toString() + "/registry/db1/" +
RegistryService.EXO_SERVICES + "/group/test");
+ URI reqUri = new URI(baseUri.toString() + "/registry/" +
RegistryService.EXO_SERVICES + "/group/test");
ContainerResponse cres =
request(handler, wr, "GET", reqUri, baseUri, null, new
InputHeadersMap(new MultivaluedMapImpl()));
assertEquals(404, cres.getStatus());
assertNull(wr.getBody());
// create exo:services/group/test
wr.reset();
- reqUri = new URI(baseUri.toString() + "/registry/db1/" +
RegistryService.EXO_SERVICES + "/group/");
+ reqUri = new URI(baseUri.toString() + "/registry/" +
RegistryService.EXO_SERVICES + "/group/");
cres = request(handler, wr, "POST", reqUri, baseUri, data, new
InputHeadersMap(new MultivaluedMapImpl()));
assertEquals(201, cres.getStatus());
assertEquals(new URI(reqUri + "test"),
wr.getHeaders().getFirst(HttpHeaders.LOCATION));
// check again for exo:services/group/test
wr.reset();
- reqUri = new URI(baseUri.toString() + "/registry/db1/" +
RegistryService.EXO_SERVICES + "/group/test");
+ reqUri = new URI(baseUri.toString() + "/registry/" +
RegistryService.EXO_SERVICES + "/group/test");
cres = request(handler, wr, "GET", reqUri, baseUri, null, new
InputHeadersMap(new MultivaluedMapImpl()));
assertEquals(200, cres.getStatus());
log.info(new String(wr.getBody()));
// remove
wr.reset();
- reqUri = new URI(baseUri.toString() + "/registry/db1/" +
RegistryService.EXO_SERVICES + "/group/");
+ reqUri = new URI(baseUri.toString() + "/registry/" +
RegistryService.EXO_SERVICES + "/group/");
cres = request(handler, wr, "DELETE", reqUri, baseUri, null, new
InputHeadersMap(new MultivaluedMapImpl()));
assertEquals(204, cres.getStatus());
// check for exo:services/group/test
// response status should be 404 (NOT_FOUND)
wr.reset();
- reqUri = new URI(baseUri.toString() + "/registry/db1/" +
RegistryService.EXO_SERVICES + "/group/test");
+ reqUri = new URI(baseUri.toString() + "/registry/" +
RegistryService.EXO_SERVICES + "/group/test");
cres = request(handler, wr, "GET", reqUri, baseUri, null, new
InputHeadersMap(new MultivaluedMapImpl()));
assertEquals(404, cres.getStatus());
assertNull(wr.getBody());