Package org.exoplatform.services.rest.impl

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


      assertEquals(200, cres.getStatus());
   }

   public void testValidateNoname() throws Exception
   {
      MultivaluedMap<String, String> headers = new MultivaluedMapImpl();
      headers.putSingle("Content-Type", "script/groovy");
      String script = "public class Test { def a = 0\ndef =\n}\n";

      ContainerResponse cres =
         launcher.service("POST", "/script/groovy/validate/", "", headers, script.getBytes(), null);
      assertEquals(400, cres.getStatus());
View Full Code Here


      assertEquals(200, cres.getStatus());
   }

   public void testValidateNoExtClassPath() throws Exception
   {
      MultivaluedMap<String, String> headers = new MultivaluedMapImpl();
      headers.putSingle("Content-Type", "script/groovy");
      String script = "import test.validate.User000\n" + //
         "@javax.ws.rs.Path('test/validate') class Test {\n" + //
         "def user = new User000(name:'test')\n" + //
         "@javax.ws.rs.GET def m() {user}" + //
         " }\n";
View Full Code Here

      System.out.println(cres.getEntity());
   }

   public void testValidateExtClassPath_File() throws Exception
   {
      MultivaluedMap<String, String> headers = new MultivaluedMapImpl();
      headers.putSingle("Content-Type", "script/groovy");
      String script = "import test.validate.User001\n" + //
         "@javax.ws.rs.Path('test/validate') class Test {\n" + //
         "def user = new User001(name:'test')\n" + //
         "@javax.ws.rs.GET def m() {user}" + //
         " }\n";
View Full Code Here

      assertEquals(200, cres.getStatus());
   }

   public void testValidateExtClassPath_SourceFolder() throws Exception
   {
      MultivaluedMap<String, String> headers = new MultivaluedMapImpl();
      headers.putSingle("Content-Type", "script/groovy");
      String script = "import test.validate.User002\n" + //
         "@javax.ws.rs.Path('test/validate') class Test {\n" + //
         "def user = new User002(name:'test')\n" + //
         "@javax.ws.rs.GET def m() {user}" + //
         " }\n";
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

      sessionProviderService.setSessionProvider(null, new SessionProvider(new ConversationState(new Identity("root"))));
   }

   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));
View Full Code Here

   public void testWorkspacesList() throws Exception
   {
      String repoName = repositoryService.getConfig().getDefaultRepositoryName();

      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));
View Full Code Here

   public void testGetDefaultWorkspaceConfig() throws Exception
   {
      String repoName = repositoryService.getConfig().getDefaultRepositoryName();

      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));
View Full Code Here

         workspaceEntry.getName());
   }

   public void testGetRepositoryServiceConfiguration() throws Exception
   {
      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));
View Full Code Here

TOP

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

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.