Package org.exoplatform.services.rest.impl

Examples of org.exoplatform.services.rest.impl.InputHeadersMap


      if (writer == null)
         writer = new DummyContainerResponseWriter();

      SecurityContext sctx = (SecurityContext)env.get(SecurityContext.class);
      ContainerRequest request =
         new SecurityContextRequest(method, new URI(requestURI), new URI(baseURI), in, new InputHeadersMap(headers),
            sctx);
      ContainerResponse response = new ContainerResponse(writer);
      try
      {
         RequestLifeCycle.begin(ExoContainerContext.getCurrentContainer());
View Full Code Here


      repositoryService.setCurrentRepositoryName("db1");
      DummyContainerResponseWriter wr = new DummyContainerResponseWriter();
      URI reqUri = new URI(baseUri.toString() + "/registry/");
      ContainerResponse cres =
         request(handler, wr, "GET", reqUri, baseUri, null, new InputHeadersMap(new MultivaluedMapImpl()));
      assertEquals(200, cres.getStatus());
      log.info(new String(wr.getBody()));

      // request to exo:services/exo_service
      // response status should be 404 (NOT_FOUND)
      wr.reset();
      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/" + RegistryService.EXO_SERVICES);
      cres =
         request(handler, wr, "POST", reqUri, baseUri, SERVICE_XML.getBytes(), new InputHeadersMap(
            new MultivaluedMapImpl()));
      assertEquals(201, cres.getStatus());
      assertEquals(new URI(reqUri + "/exo_service"), wr.getHeaders().getFirst(HttpHeaders.LOCATION));

      // request to exo:services/exo_service
      wr.reset();
      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/" + RegistryService.EXO_SERVICES);
      cres =
         request(handler, wr, "PUT", reqUri, baseUri, SERVICE_XML.getBytes(), new InputHeadersMap(
            new MultivaluedMapImpl()));
      assertEquals(201, cres.getStatus());
      assertEquals(new URI(reqUri + "/exo_service"), wr.getHeaders().getFirst(HttpHeaders.LOCATION));

      // delete exo:services/exo_service
      wr.reset();
      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/" + RegistryService.EXO_SERVICES + "/exo_service");
      cres = request(handler, wr, "GET", reqUri, baseUri, null, new InputHeadersMap(new MultivaluedMapImpl()));
      assertEquals(404, cres.getStatus());
      assertNull(wr.getBody());

   }
View Full Code Here

      repositoryService.setCurrentRepositoryName("db1");
      // check for exo:services/group/test
      // response status should be 404 (NOT_FOUND)
      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/" + 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/" + 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/" + 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/" + RegistryService.EXO_SERVICES + "/group/test");
      cres = request(handler, wr, "GET", reqUri, baseUri, null, new InputHeadersMap(new MultivaluedMapImpl()));
      assertEquals(404, cres.getStatus());
      assertNull(wr.getBody());

   }
View Full Code Here

   public void testRepositoriesList() throws Exception
   {
      MultivaluedMap<String, String> headers = new MultivaluedMapImpl();
      ContainerRequestUserRole creq =
         new ContainerRequestUserRole("GET", new URI(REST_REPOSITORY_SERVICE_PATH
            + RestRepositoryService.Constants.OperationType.REPOSITORIES_LIST), new URI(""), null, new InputHeadersMap(
            headers));

      ByteArrayContainerResponseWriter responseWriter = new ByteArrayContainerResponseWriter();
      ContainerResponse cres = new ContainerResponse(responseWriter);
      handler.handleRequest(creq, cres);
View Full Code Here

      MultivaluedMap<String, String> headers = new MultivaluedMapImpl();
      ContainerRequestUserRole creq =
         new ContainerRequestUserRole("GET", new URI(REST_REPOSITORY_SERVICE_PATH
            + RestRepositoryService.Constants.OperationType.WORKSPACES_LIST + "/" + repoName + "/"), new URI(""), null,
            new InputHeadersMap(headers));

      ByteArrayContainerResponseWriter responseWriter = new ByteArrayContainerResponseWriter();
      ContainerResponse cres = new ContainerResponse(responseWriter);
      handler.handleRequest(creq, cres);
View Full Code Here

      MultivaluedMap<String, String> headers = new MultivaluedMapImpl();
      ContainerRequestUserRole creq =
         new ContainerRequestUserRole("GET", new URI(REST_REPOSITORY_SERVICE_PATH
            + RestRepositoryService.Constants.OperationType.DEFAULT_WS_CONFIG + "/" + repoName + "/"), new URI(""),
            null, new InputHeadersMap(headers));

      ByteArrayContainerResponseWriter responseWriter = new ByteArrayContainerResponseWriter();
      ContainerResponse cres = new ContainerResponse(responseWriter);
      handler.handleRequest(creq, cres);
View Full Code Here

   {
      MultivaluedMap<String, String> headers = new MultivaluedMapImpl();
      ContainerRequestUserRole creq =
         new ContainerRequestUserRole("GET", new URI(REST_REPOSITORY_SERVICE_PATH
            + RestRepositoryService.Constants.OperationType.REPOSITORY_SERVICE_CONFIGURATION), new URI(""), null,
            new InputHeadersMap(headers));

      ByteArrayContainerResponseWriter responseWriter = new ByteArrayContainerResponseWriter();
      ContainerResponse cres = new ContainerResponse(responseWriter);
      handler.handleRequest(creq, cres);
View Full Code Here

      headers.putSingle("Content-Type", "application/json; charset=UTF-8");

      ContainerRequestUserRole creq =
         new ContainerRequestUserRole("POST", new URI(REST_REPOSITORY_SERVICE_PATH
            + RestRepositoryService.Constants.OperationType.CREATE_REPOSITORY), new URI(""), new ByteArrayInputStream(
            json.toString().getBytes("UTF-8")), new InputHeadersMap(headers));

      System.out.print("testCreateRepository  : " + json.toString());

      ByteArrayContainerResponseWriter responseWriter = new ByteArrayContainerResponseWriter();
      ContainerResponse cres = new ContainerResponse(responseWriter);
View Full Code Here

      headers.putSingle("Content-Type", "application/json; charset=UTF-8");

      ContainerRequestUserRole creq =
         new ContainerRequestUserRole("POST", new URI(REST_REPOSITORY_SERVICE_PATH
            + RestRepositoryService.Constants.OperationType.CREATE_REPOSITORY), new URI(""), new ByteArrayInputStream(
            json.toString().getBytes("UTF-8")), new InputHeadersMap(headers));

      System.out.print("testCreateRepository  : " + json.toString());

      ByteArrayContainerResponseWriter responseWriter = new ByteArrayContainerResponseWriter();
      ContainerResponse cres = new ContainerResponse(responseWriter);
View Full Code Here

      headers.putSingle("Content-Type", "application/json; charset=UTF-8");

      ContainerRequestUserRole creq =
         new ContainerRequestUserRole("POST", new URI(REST_REPOSITORY_SERVICE_PATH
            + RestRepositoryService.Constants.OperationType.CREATE_WORKSPACE + "/" + rName), new URI(""),
            new ByteArrayInputStream(json.toString().getBytes("UTF-8")), new InputHeadersMap(headers));

      System.out.print("testCreateWorkspace  : " + json.toString());

      ByteArrayContainerResponseWriter responseWriter = new ByteArrayContainerResponseWriter();
      ContainerResponse cres = new ContainerResponse(responseWriter);
View Full Code Here

TOP

Related Classes of org.exoplatform.services.rest.impl.InputHeadersMap

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.