Package org.exoplatform.services.rest.impl

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


         "/script/groovy/load/db1/ws" + scriptPath //
            + "?sources=" //
            + URLEncoder.encode(new UnifiedNodeReference(repository.getName(), workspace.getName(), testRoot.getPath())
               .getURL().toString(), "UTF-8");
      int before = binder.getSize();
      ContainerResponse cres = launcher.service("POST", path, "", null, null, ctx);
      assertEquals(204, cres.getStatus());
      int after = binder.getSize();
      assertEquals(before + 1, after);
   }
View Full Code Here


      assertEquals(before + 1, after);
   }

   public void testDelete() throws Exception
   {
      ContainerResponse cres =
         launcher.service("POST", "/script/groovy/delete/db1/ws/testRoot/script", "", null, null, null);

      assertEquals(204, cres.getStatus());
      assertEquals(resourceNumber, binder.getSize());
   }
View Full Code Here

   public void testGetScript() throws Exception
   {
      MultivaluedMap<String, String> headers = new MultivaluedMapImpl();
      headers.putSingle("Accept", "script/groovy");
      ByteArrayContainerResponseWriter wr = new ByteArrayContainerResponseWriter();
      ContainerResponse cres =
         launcher.service("POST", "/script/groovy/src/db1/ws/testRoot/script", "", headers, null, wr, null);
      assertEquals(200, cres.getStatus());
      compareStream(script.getProperty("jcr:data").getStream(), new ByteArrayInputStream(wr.getBody()));
   }
View Full Code Here

      script.getParent().remove();
      session.save();
      MultivaluedMap<String, String> headers = new MultivaluedMapImpl();
      headers.putSingle("Content-type", "script/groovy");

      ContainerResponse cres =
         launcher.service("POST", "/script/groovy/add/db1/ws/testRoot/script", "", headers,
            getResourceAsBytes("test1.groovy"), null, null);

      assertEquals(201, cres.getStatus());
   }
View Full Code Here

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

   public void testDispatchScript() throws Exception
   {
      ContainerResponse cres = launcher.service("GET", "/groovy-test/groovy1/test", "", null, null, null);

      assertEquals(200, cres.getStatus());
      assertEquals("Hello from groovy to test", cres.getEntity());

      // change script source code
      script
         .setProperty("jcr:data", Thread.currentThread().getContextClassLoader().getResourceAsStream("test2.groovy"));
      session.save();

      // must be rebounded , not created other one
      assertEquals(resourceNumber + 1, binder.getSize());

      cres = new ContainerResponse(new DummyContainerResponseWriter());
      cres = launcher.service("GET", "/groovy-test/groovy2/test", "", null, null, null);
      assertEquals(200, cres.getStatus());
      assertEquals("Hello from groovy to >>>>> test", cres.getEntity());
   }
View Full Code Here

   {
      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/%5Bno-name%5D", "", headers, script.getBytes(), null);
      assertEquals(400, cres.getStatus());
      System.out.println(cres.getEntity());

      script = "public class Test { def a = 0\ndef b = 1\n }\n";
      cres = launcher.service("POST", "/script/groovy/validate/%5Bno-name%5D", "", headers, script.getBytes(), null);
      assertEquals(200, cres.getStatus());
   }
View Full Code Here

   {
      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());
      System.out.println(cres.getEntity());

      script = "public class Test { def a = 0\ndef b = 1\n }\n";
      cres = launcher.service("POST", "/script/groovy/validate/", "", headers, script.getBytes(), null);
      assertEquals(200, cres.getStatus());
   }
View Full Code Here

      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";
      ContainerResponse cres =
         launcher.service("POST", "/script/groovy/validate/Test", "", headers, script.getBytes(), null);
      assertEquals(400, cres.getStatus());
      System.out.println(cres.getEntity());
   }
View Full Code Here

      // Specify source file location.
      String path =
         "/script/groovy/validate/Test?file=" //
            + URLEncoder.encode(new UnifiedNodeReference(repository.getName(), workspace.getName(), user).getURL()
               .toString(), "UTF-8");
      ContainerResponse cres = launcher.service("POST", path, "", headers, script.getBytes(), null);
      assertEquals(200, cres.getStatus());
   }
View Full Code Here

      // Specify source folder location.
      String path =
         "/script/groovy/validate/Test?sources=" //
            + URLEncoder.encode(new UnifiedNodeReference(repository.getName(), workspace.getName(), testRoot.getPath())
               .getURL().toString(), "UTF-8");
      ContainerResponse cres = launcher.service("POST", path, "", headers, script.getBytes(), null);
      assertEquals(200, cres.getStatus());
   }
View Full Code Here

TOP

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

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.