Examples of ContainerResponse


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

         new ContainerRequestUserRole("POST", new URI(REST_REPOSITORY_SERVICE_PATH
            + RestRepositoryService.Constants.OperationType.REMOVE_WORKSPACE + "/" + rName + "/" + wsName + "/false/"),
            new URI(""), null, new InputHeadersMap(headers));

      ByteArrayContainerResponseWriter responseWriter = new ByteArrayContainerResponseWriter();
      ContainerResponse cres = new ContainerResponse(responseWriter);
      handler.handleRequest(creq, cres);

      assertEquals(409, cres.getStatus());

      //remove with prepare close sessions
      creq =
         new ContainerRequestUserRole("POST", new URI(REST_REPOSITORY_SERVICE_PATH
            + RestRepositoryService.Constants.OperationType.REMOVE_WORKSPACE + "/" + rName + "/" + wsName + "/true/"),
            new URI(""), null, new InputHeadersMap(headers));

      responseWriter = new ByteArrayContainerResponseWriter();
      cres = new ContainerResponse(responseWriter);
      handler.handleRequest(creq, cres);

      assertEquals(200, cres.getStatus());

      try
      {
         repositoryService.getRepository(rName).login(new CredentialsImpl("root", "exo".toCharArray()), wsName);
         fail("The workspace /" + rName + "/" + wsName + "should be removed. ");
View Full Code Here

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

         new ContainerRequestUserRole("GET", new URI(REST_REPOSITORY_SERVICE_PATH
            + RestRepositoryService.Constants.OperationType.REMOVE_REPOSITORY + "/" + repoName + "/false/"),
            new URI(""), null, new InputHeadersMap(headers));

      ByteArrayContainerResponseWriter responseWriter = new ByteArrayContainerResponseWriter();
      ContainerResponse cres = new ContainerResponse(responseWriter);
      handler.handleRequest(creq, cres);

      assertEquals(409, cres.getStatus());

      //remove with prepare close sessions
      creq =
         new ContainerRequestUserRole("GET", new URI(REST_REPOSITORY_SERVICE_PATH
            + RestRepositoryService.Constants.OperationType.REMOVE_REPOSITORY + "/" + repoName + "/true/"),
            new URI(""), null, new InputHeadersMap(headers));

      responseWriter = new ByteArrayContainerResponseWriter();
      cres = new ContainerResponse(responseWriter);
      handler.handleRequest(creq, cres);

      assertEquals(200, cres.getStatus());

      try
      {
         repositoryService.getRepository(repoName);
         fail("The repository /" + repoName + "should be removed. ");
View Full Code Here

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

      InputStream inputStream = new ByteArrayInputStream(content.getBytes());
      TestUtils.addContent(session, filename, inputStream, defaultFileNodeType, "");
      String destFilename = TestUtils.getFileName();
      MultivaluedMap<String, String> headers = new MultivaluedMapImpl();
      headers.add(ExtHttpHeaders.DESTINATION, host + getPathWS() + destFilename);
      ContainerResponse response = service(WebDAVMethods.MOVE, getPathWS() + filename, host, headers, null);
      assertEquals(HTTPStatus.CREATED, response.getStatus());
      assertTrue(session.getRootNode().hasNode(TextUtil.relativizePath(destFilename)));
      Node nodeDest = session.getRootNode().getNode(TextUtil.relativizePath(destFilename));
      assertTrue(nodeDest.hasNode("jcr:content"));
      Node nodeDestContent = nodeDest.getNode("jcr:content");
      assertTrue(nodeDestContent.hasProperty("jcr:data"));
View Full Code Here

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

      InputStream inputStream = new ByteArrayInputStream(content.getBytes());
      TestUtils.addContent(session, filename, inputStream, defaultFileNodeType, "");
      String destFilename = TestUtils.getFileName();
      MultivaluedMap<String, String> headers = new MultivaluedMapImpl();
      headers.add(ExtHttpHeaders.DESTINATION, host + getPathDestWS() + destFilename);
      ContainerResponse response = service(WebDAVMethods.MOVE, getPathWS() + filename, host, headers, null);
      assertEquals(HTTPStatus.CREATED, response.getStatus());
      assertTrue(destSession.getRootNode().hasNode(TextUtil.relativizePath(destFilename)));
      Node nodeDest = destSession.getRootNode().getNode(TextUtil.relativizePath(destFilename));
      assertTrue(nodeDest.hasNode("jcr:content"));
      Node nodeDestContent = nodeDest.getNode("jcr:content");
      assertTrue(nodeDestContent.hasProperty("jcr:data"));
View Full Code Here

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

      // prepare headers
      MultivaluedMap<String, String> headers = new MultivaluedMapImpl();
      headers.add(ExtHttpHeaders.DESTINATION, host + getPathWS() + destFilename);

      // execute the query
      ContainerResponse response = service(WebDAVMethods.MOVE, getPathWS() + filename, host, headers, null);
      // check if operation completed successfully, we expect a new resource to be created
      assertEquals(HTTPStatus.CREATED, response.getStatus());

      // check if 'CREATED' response contains 'LOCATION' header
      assertTrue(response.getHttpHeaders().containsKey(ExtHttpHeaders.LOCATION));
      // check if 'CREATED' response 'LOCATION' header contains correct location path
      assertEquals(host + getPathWS() + destFilename,
         response.getHttpHeaders().getFirst(ExtHttpHeaders.LOCATION).toString());
   }
View Full Code Here

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

      // prepare headers
      MultivaluedMap<String, String> headers = new MultivaluedMapImpl();
      headers.add(ExtHttpHeaders.DESTINATION, host + getPathWS() + destFilename);

      // execute the query
      ContainerResponse response = service(WebDAVMethods.MOVE, getPathWS() + filename, host, headers, null);
      // check if operation completed successfully, we expect a new resource to be created
      assertEquals(HTTPStatus.CREATED, response.getStatus());

      filename = destFilename;

      destFilename = TestUtils.getFileName() + "%20'test";

      // prepare headers
      headers = new MultivaluedMapImpl();
      headers.add(ExtHttpHeaders.DESTINATION, host + getPathWS() + destFilename);

      // execute the query
      response = service(WebDAVMethods.MOVE, getPathWS() + filename, host, headers, null);
      // check if operation completed successfully, we expect a new resource to be created
      assertEquals(HTTPStatus.CREATED, response.getStatus());

   }
View Full Code Here

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

      MultivaluedMap<String, String> headers = new MultivaluedMapImpl();
      headers.add(ExtHttpHeaders.DESTINATION, host + getPathWS() + destFilename);
      headers.add(ExtHttpHeaders.OVERWRITE, "T");

      // execute the query
      ContainerResponse response = service(WebDAVMethods.MOVE, getPathWS() + filename, host, headers, null);
      // check if operation completed successfully, we expect a new resource to be created
      assertEquals(HTTPStatus.NO_CONTENT, response.getStatus());

   }
View Full Code Here

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

      // prepare headers
      MultivaluedMap<String, String> headers = new MultivaluedMapImpl();
      headers.add(ExtHttpHeaders.DESTINATION, httpsHost + getPathWS() + destFilename);

      // execute the query
      ContainerResponse response = service(WebDAVMethods.MOVE, getPathWS() + filename, host, headers, null);
      // check if operation completed successfully, we expect a new resource to be created
      assertEquals(HTTPStatus.CREATED, response.getStatus());

   }
View Full Code Here

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

      String destFilename = TestUtils.getFileName();

      MultivaluedMap<String, String> headers = new MultivaluedMapImpl();

      headers.add(ExtHttpHeaders.DESTINATION, WORKSPACE + destFilename);
      ContainerResponse response = service(WebDAVMethods.MOVE, getPathWS() + filename, host, headers, null);

      assertEquals(HTTPStatus.CREATED, response.getStatus());
      assertTrue(session.getRootNode().hasNode(TextUtil.relativizePath(destFilename)));

      Node nodeDest = session.getRootNode().getNode(TextUtil.relativizePath(destFilename));
      assertTrue(nodeDest.hasNode("jcr:content"));
View Full Code Here

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

      String destFilename = "/" + folderNameWithSpace + TestUtils.getFileName();

      MultivaluedMap<String, String> headers = new MultivaluedMapImpl();

      headers.add(ExtHttpHeaders.DESTINATION, WORKSPACE + destFilename);
      ContainerResponse response = service(WebDAVMethods.MOVE, getPathWS() + filename, host, headers, null);

      assertEquals(HTTPStatus.CREATED, response.getStatus());
      assertTrue(session.getRootNode().hasNode(TextUtil.relativizePath(destFilename)));

      Node nodeDest = session.getRootNode().getNode(TextUtil.relativizePath(destFilename));
      assertTrue(nodeDest.hasNode("jcr:content"));
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.