[exo-jcr-commits] exo-jcr SVN: r497 - in ws/branches/2.2.x/exo.ws.rest.core/src: main/java/org/exoplatform/services/rest/tools and 4 other directories.
do-not-reply at jboss.org
do-not-reply at jboss.org
Sun Nov 8 08:19:26 EST 2009
Author: aparfonov
Date: 2009-11-08 08:19:25 -0500 (Sun, 08 Nov 2009)
New Revision: 497
Added:
ws/branches/2.2.x/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/tools/ResourceLauncher.java
Removed:
ws/branches/2.2.x/exo.ws.rest.core/src/test/java/org/exoplatform/services/rest/impl/AbstractResourceTest.java
Modified:
ws/branches/2.2.x/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl/provider/MultipartFormDataEntityProvider.java
ws/branches/2.2.x/exo.ws.rest.core/src/test/java/org/exoplatform/services/rest/impl/RequestDispatcherTest.java
ws/branches/2.2.x/exo.ws.rest.core/src/test/java/org/exoplatform/services/rest/impl/RequestFilterTest.java
ws/branches/2.2.x/exo.ws.rest.core/src/test/java/org/exoplatform/services/rest/impl/ResponseFilterTest.java
ws/branches/2.2.x/exo.ws.rest.core/src/test/java/org/exoplatform/services/rest/impl/method/HeadMethodTest.java
ws/branches/2.2.x/exo.ws.rest.core/src/test/java/org/exoplatform/services/rest/impl/method/MediaTypeTest.java
ws/branches/2.2.x/exo.ws.rest.core/src/test/java/org/exoplatform/services/rest/impl/method/MethodExceptionTest.java
ws/branches/2.2.x/exo.ws.rest.core/src/test/java/org/exoplatform/services/rest/impl/method/MethodInvokerFilterTest.java
ws/branches/2.2.x/exo.ws.rest.core/src/test/java/org/exoplatform/services/rest/impl/method/MethodReturnTypeTest.java
ws/branches/2.2.x/exo.ws.rest.core/src/test/java/org/exoplatform/services/rest/impl/method/OptionsMethodTest.java
ws/branches/2.2.x/exo.ws.rest.core/src/test/java/org/exoplatform/services/rest/impl/method/ParametersInjectionTest.java
ws/branches/2.2.x/exo.ws.rest.core/src/test/java/org/exoplatform/services/rest/impl/provider/ContextResolverTest.java
ws/branches/2.2.x/exo.ws.rest.core/src/test/java/org/exoplatform/services/rest/impl/provider/ExceptionMapperTest.java
ws/branches/2.2.x/exo.ws.rest.core/src/test/java/org/exoplatform/services/rest/impl/provider/FormEntityTest.java
ws/branches/2.2.x/exo.ws.rest.core/src/test/java/org/exoplatform/services/rest/impl/provider/JAXBEntityTest.java
ws/branches/2.2.x/exo.ws.rest.core/src/test/java/org/exoplatform/services/rest/impl/provider/JsonEntityTest.java
ws/branches/2.2.x/exo.ws.rest.core/src/test/java/org/exoplatform/services/rest/impl/provider/OtherEntityTest.java
ws/branches/2.2.x/exo.ws.rest.core/src/test/java/org/exoplatform/services/rest/impl/provider/ProviderContextParameterInjectionTest.java
ws/branches/2.2.x/exo.ws.rest.core/src/test/java/org/exoplatform/services/rest/impl/resource/AcceptResourceTest.java
ws/branches/2.2.x/exo.ws.rest.core/src/test/java/org/exoplatform/services/rest/impl/resource/AnnotationInheritanceTest.java
ws/branches/2.2.x/exo.ws.rest.core/src/test/java/org/exoplatform/services/rest/impl/resource/ApplicationTest.java
ws/branches/2.2.x/exo.ws.rest.core/src/test/java/org/exoplatform/services/rest/impl/resource/ContextParametersInjectionTest.java
ws/branches/2.2.x/exo.ws.rest.core/src/test/java/org/exoplatform/services/rest/impl/resource/MatchedURIsAndResourcesTest.java
Log:
EXOJCR-230 :
Modified: ws/branches/2.2.x/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl/provider/MultipartFormDataEntityProvider.java
===================================================================
--- ws/branches/2.2.x/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl/provider/MultipartFormDataEntityProvider.java 2009-11-06 17:08:38 UTC (rev 496)
+++ ws/branches/2.2.x/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl/provider/MultipartFormDataEntityProvider.java 2009-11-08 13:19:25 UTC (rev 497)
@@ -28,7 +28,6 @@
import org.exoplatform.services.rest.impl.FileCollector;
import org.exoplatform.services.rest.provider.EntityProvider;
-import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
Copied: ws/branches/2.2.x/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/tools/ResourceLauncher.java (from rev 496, ws/branches/2.2.x/exo.ws.rest.core/src/test/java/org/exoplatform/services/rest/impl/AbstractResourceTest.java)
===================================================================
--- ws/branches/2.2.x/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/tools/ResourceLauncher.java (rev 0)
+++ ws/branches/2.2.x/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/tools/ResourceLauncher.java 2009-11-08 13:19:25 UTC (rev 497)
@@ -0,0 +1,103 @@
+/*
+ * Copyright (C) 2009 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.exoplatform.services.rest.tools;
+
+import java.io.ByteArrayInputStream;
+import java.net.URI;
+import java.util.List;
+import java.util.Map;
+
+import javax.ws.rs.core.MultivaluedMap;
+
+import org.exoplatform.services.rest.ContainerResponseWriter;
+import org.exoplatform.services.rest.RequestHandler;
+import org.exoplatform.services.rest.impl.ContainerRequest;
+import org.exoplatform.services.rest.impl.ContainerResponse;
+import org.exoplatform.services.rest.impl.EnvironmentContext;
+import org.exoplatform.services.rest.impl.InputHeadersMap;
+import org.exoplatform.services.rest.impl.MultivaluedMapImpl;
+
+/**
+ * This class may be useful for running test and should not be used for launching
+ * services in real environment, Servlet Container for example.
+ *
+ * @author <a href="mailto:andrew00x at gmail.com">Andrey Parfonov</a>
+ * @version $Id$
+ */
+public class ResourceLauncher
+{
+
+ private final RequestHandler requestHandler;
+
+ public ResourceLauncher(RequestHandler requestHandler)
+ {
+ this.requestHandler = requestHandler;
+ }
+
+ /**
+ * @param method HTTP method
+ * @param requestURI full requested URI
+ * @param baseURI base requested URI
+ * @param headers HTTP headers
+ * @param data data
+ * @param writer response writer
+ * @param env environment context
+ * @return response
+ * @throws Exception if any error occurs
+ */
+ public ContainerResponse service(String method, String requestURI, String baseURI,
+ Map<String, List<String>> headers, byte[] data, ContainerResponseWriter writer, EnvironmentContext env)
+ throws Exception
+ {
+
+ if (headers == null)
+ headers = new MultivaluedMapImpl();
+
+ ByteArrayInputStream in = null;
+ if (data != null)
+ in = new ByteArrayInputStream(data);
+
+ if (env == null)
+ env = new EnvironmentContext();
+ EnvironmentContext.setCurrent(env);
+
+ ContainerRequest request =
+ new ContainerRequest(method, new URI(requestURI), new URI(baseURI), in, new InputHeadersMap(headers));
+ ContainerResponse response = new ContainerResponse(writer);
+ requestHandler.handleRequest(request, response);
+ return response;
+ }
+
+ /**
+ * @param method HTTP method
+ * @param requestURI full requested URI
+ * @param baseURI base requested URI
+ * @param headers HTTP headers
+ * @param data data
+ * @param env environment context
+ * @return response
+ * @throws Exception if any error occurs
+ */
+ public ContainerResponse service(String method, String requestURI, String baseURI,
+ MultivaluedMap<String, String> headers, byte[] data, EnvironmentContext env) throws Exception
+ {
+ return service(method, requestURI, baseURI, headers, data, new DummyContainerResponseWriter(), env);
+ }
+
+}
Property changes on: ws/branches/2.2.x/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/tools/ResourceLauncher.java
___________________________________________________________________
Name: svn:keywords
+ Id
Deleted: ws/branches/2.2.x/exo.ws.rest.core/src/test/java/org/exoplatform/services/rest/impl/AbstractResourceTest.java
===================================================================
--- ws/branches/2.2.x/exo.ws.rest.core/src/test/java/org/exoplatform/services/rest/impl/AbstractResourceTest.java 2009-11-06 17:08:38 UTC (rev 496)
+++ ws/branches/2.2.x/exo.ws.rest.core/src/test/java/org/exoplatform/services/rest/impl/AbstractResourceTest.java 2009-11-08 13:19:25 UTC (rev 497)
@@ -1,79 +0,0 @@
-/*
- * Copyright (C) 2009 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.exoplatform.services.rest.impl;
-
-import org.exoplatform.services.rest.ContainerResponseWriter;
-import org.exoplatform.services.rest.impl.ContainerRequest;
-import org.exoplatform.services.rest.impl.ContainerResponse;
-import org.exoplatform.services.rest.impl.EnvironmentContext;
-import org.exoplatform.services.rest.impl.InputHeadersMap;
-import org.exoplatform.services.rest.impl.MultivaluedMapImpl;
-import org.exoplatform.services.rest.tools.DummyContainerResponseWriter;
-import org.exoplatform.services.test.mock.MockHttpServletRequest;
-
-import java.io.ByteArrayInputStream;
-import java.net.URI;
-import java.util.List;
-import java.util.Map;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.ws.rs.core.MultivaluedMap;
-
-/**
- * @author <a href="mailto:andrew00x at gmail.com">Andrey Parfonov</a>
- * @version $Id: $
- */
-public abstract class AbstractResourceTest extends BaseTest
-{
-
- // public void setUp() throws Exception {
- // super.setUp();
- // }
-
- public ContainerResponse service(String method, String requestURI, String baseURI,
- Map<String, List<String>> headers, byte[] data, ContainerResponseWriter writer) throws Exception
- {
-
- if (headers == null)
- headers = new MultivaluedMapImpl();
-
- ByteArrayInputStream in = null;
- if (data != null)
- in = new ByteArrayInputStream(data);
-
- EnvironmentContext envctx = new EnvironmentContext();
- HttpServletRequest httpRequest =
- new MockHttpServletRequest("", in, in != null ? in.available() : 0, method, headers);
- envctx.put(HttpServletRequest.class, httpRequest);
- EnvironmentContext.setCurrent(envctx);
- ContainerRequest request =
- new ContainerRequest(method, new URI(requestURI), new URI(baseURI), in, new InputHeadersMap(headers));
- ContainerResponse response = new ContainerResponse(writer);
- requestHandler.handleRequest(request, response);
- return response;
- }
-
- public ContainerResponse service(String method, String requestURI, String baseURI,
- MultivaluedMap<String, String> headers, byte[] data) throws Exception
- {
- return service(method, requestURI, baseURI, headers, data, new DummyContainerResponseWriter());
-
- }
-
-}
Modified: ws/branches/2.2.x/exo.ws.rest.core/src/test/java/org/exoplatform/services/rest/impl/RequestDispatcherTest.java
===================================================================
--- ws/branches/2.2.x/exo.ws.rest.core/src/test/java/org/exoplatform/services/rest/impl/RequestDispatcherTest.java 2009-11-06 17:08:38 UTC (rev 496)
+++ ws/branches/2.2.x/exo.ws.rest.core/src/test/java/org/exoplatform/services/rest/impl/RequestDispatcherTest.java 2009-11-08 13:19:25 UTC (rev 497)
@@ -18,6 +18,10 @@
*/
package org.exoplatform.services.rest.impl;
+import java.io.ByteArrayInputStream;
+import java.util.HashMap;
+import java.util.List;
+
import javax.servlet.http.HttpServletRequest;
import javax.ws.rs.Encoded;
import javax.ws.rs.GET;
@@ -34,14 +38,18 @@
import org.exoplatform.services.rest.GenericContainerResponse;
import org.exoplatform.services.rest.Inject;
import org.exoplatform.services.rest.Property;
+import org.exoplatform.services.rest.tools.ResourceLauncher;
+import org.exoplatform.services.test.mock.MockHttpServletRequest;
/**
* @author <a href="mailto:andrew00x at gmail.com">Andrey Parfonov</a>
- * @version $Id: $
+ * @version $Id$
*/
-public class RequestDispatcherTest extends AbstractResourceTest
+public class RequestDispatcherTest extends BaseTest
{
+ private ResourceLauncher launcher;
+
public void setUp() throws Exception
{
resources = new ResourceBinderImpl();
@@ -50,12 +58,13 @@
depInjector.put(InjectableComponent2.class, new InjectableComponent2());
requestHandler = new RequestHandlerImpl(resources, depInjector);
-
+
// reset providers to be sure it is clean
ProviderBinder.setInstance(new ProviderBinder());
providers = ProviderBinder.getInstance();
+ this.launcher = new ResourceLauncher(requestHandler);
}
-
+
@Path("/a")
public static class Resource1
{
@@ -121,12 +130,12 @@
{
Resource1 r1 = new Resource1();
registry(r1);
- assertEquals("m0", service("POST", "/a", "", null, null).getEntity());
- assertEquals("m1", service("POST", "/a/b", "", null, null).getEntity());
- assertEquals("m2.0", service("POST", "/a/b/c", "", null, null).getEntity());
- assertEquals("m2.1", service("POST", "/a/b/c/d", "", null, null).getEntity());
- assertEquals("m3.0", service("POST", "/a/b/c/d/e", "", null, null).getEntity());
- assertEquals("m3.1", service("POST", "/a/b/c/d/e/f", "", null, null).getEntity());
+ assertEquals("m0", launcher.service("POST", "/a", "", null, null, null).getEntity());
+ assertEquals("m1", launcher.service("POST", "/a/b", "", null, null, null).getEntity());
+ assertEquals("m2.0", launcher.service("POST", "/a/b/c", "", null, null, null).getEntity());
+ assertEquals("m2.1", launcher.service("POST", "/a/b/c/d", "", null, null, null).getEntity());
+ assertEquals("m3.0", launcher.service("POST", "/a/b/c/d/e", "", null, null, null).getEntity());
+ assertEquals("m3.1", launcher.service("POST", "/a/b/c/d/e/f", "", null, null, null).getEntity());
unregistry(r1);
}
@@ -167,10 +176,11 @@
{
Resource2 r2 = new Resource2();
registry(r2);
- assertEquals("m0", service("POST", "/", "", null, null).getEntity());
- assertEquals("m1", service("POST", "/a", "", null, null).getEntity());
- assertEquals("#x y", service("POST", "/1/a/b%20/c/%23x%20y", "", null, null).getEntity());
- assertEquals("%23x%20y", service("POST", "/2/a/b%20/c/%23x%20y", "", null, null).getEntity());
+ assertEquals("m0", launcher.service("POST", "/", "", null, null, null).getEntity());
+ assertEquals("m1", launcher.service("POST", "/a", "", null, null, null).getEntity());
+ assertEquals("#x y", launcher.service("POST", "/1/a/b%20/c/%23x%20y", "", null, null, null).getEntity());
+ assertEquals("%23x%20y", launcher.service("POST", "/2/a/b%20/c/%23x%20y", "", null, null, null)
+ .getEntity());
unregistry(r2);
}
@@ -222,9 +232,9 @@
public void testResourceConstructorAndFields() throws Exception
{
registry(Resource3.class);
- assertEquals("/a/b/c/d/m0", service("GET", "/a/b/c/d/m0", "", null, null).getEntity());
- assertEquals("c", service("GET", "/a/b/c/d/m1", "", null, null).getEntity());
- assertEquals("d", service("GET", "/a/b/c/d/m2", "", null, null).getEntity());
+ assertEquals("/a/b/c/d/m0", launcher.service("GET", "/a/b/c/d/m0", "", null, null, null).getEntity());
+ assertEquals("c", launcher.service("GET", "/a/b/c/d/m1", "", null, null, null).getEntity());
+ assertEquals("d", launcher.service("GET", "/a/b/c/d/m2", "", null, null, null).getEntity());
unregistry(Resource3.class);
}
@@ -248,7 +258,7 @@
private HttpServletRequest request;
private InjectableComponent1 ic1;
-
+
@Inject
private InjectableComponent2 ic2;
@@ -279,7 +289,10 @@
public void testResourceConstructorsDependencyInjection() throws Exception
{
registry(Resource4.class);
- assertEquals(204, service("GET", "/aaa/bbb", "", null, null).getStatus());
+ EnvironmentContext env = new EnvironmentContext();
+ env.put(HttpServletRequest.class, new MockHttpServletRequest("", new ByteArrayInputStream(new byte[0]), 0, "GET",
+ new HashMap<String, List<String>>()));
+ assertEquals(204, launcher.service("GET", "/aaa/bbb", "", null, null, env).getStatus());
unregistry(Resource4.class);
}
@@ -308,7 +321,7 @@
public void testResourceConstructorDependencyInjectionFail() throws Exception
{
registry(ResourceFail.class);
- GenericContainerResponse resp = service("GET", "/_a/b/c/d/m0", "", null, null);
+ GenericContainerResponse resp = launcher.service("GET", "/_a/b/c/d/m0", "", null, null, null);
String entity = (String)resp.getEntity();
assertTrue(entity.startsWith("Can't instantiate resource "));
assertEquals(javax.ws.rs.core.Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), resp.getStatus());
@@ -350,7 +363,7 @@
public void testQuery() throws Exception
{
registry(Resource5.class);
- service("GET", "/a/b/c/d?q1=q1&q2=q2", "", null, null);
+ launcher.service("GET", "/a/b/c/d?q1=q1&q2=q2", "", null, null, null);
unregistry(Resource5.class);
}
@@ -359,7 +372,7 @@
public void testFieldSuperClass() throws Exception
{
registry(EndResource.class);
- service("GET", "/a", "", null, null);
+ launcher.service("GET", "/a", "", null, null, null);
unregistry(EndResource.class);
}
@@ -412,7 +425,7 @@
registry(Resource6.class);
RequestHandlerImpl.setProperty("prop1", "hello");
RequestHandlerImpl.setProperty("prop2", "test");
- service("GET", "/a", "", null, null);
+ launcher.service("GET", "/a", "", null, null, null);
unregistry(Resource6.class);
}
Property changes on: ws/branches/2.2.x/exo.ws.rest.core/src/test/java/org/exoplatform/services/rest/impl/RequestDispatcherTest.java
___________________________________________________________________
Name: svn:keywords
+ Id
Modified: ws/branches/2.2.x/exo.ws.rest.core/src/test/java/org/exoplatform/services/rest/impl/RequestFilterTest.java
===================================================================
--- ws/branches/2.2.x/exo.ws.rest.core/src/test/java/org/exoplatform/services/rest/impl/RequestFilterTest.java 2009-11-06 17:08:38 UTC (rev 496)
+++ ws/branches/2.2.x/exo.ws.rest.core/src/test/java/org/exoplatform/services/rest/impl/RequestFilterTest.java 2009-11-08 13:19:25 UTC (rev 497)
@@ -18,9 +18,15 @@
*/
package org.exoplatform.services.rest.impl;
+import java.io.ByteArrayInputStream;
+import java.util.HashMap;
+import java.util.List;
+
import org.exoplatform.services.rest.Filter;
import org.exoplatform.services.rest.GenericContainerRequest;
import org.exoplatform.services.rest.RequestFilter;
+import org.exoplatform.services.rest.tools.ResourceLauncher;
+import org.exoplatform.services.test.mock.MockHttpServletRequest;
import javax.servlet.http.HttpServletRequest;
import javax.ws.rs.DELETE;
@@ -34,11 +40,19 @@
/**
* @author <a href="mailto:andrew00x at gmail.com">Andrey Parfonov</a>
- * @version $Id: $
+ * @version $Id$
*/
-public class RequestFilterTest extends AbstractResourceTest
+public class RequestFilterTest extends BaseTest
{
+ private ResourceLauncher launcher;
+
+ public void setUp() throws Exception
+ {
+ super.setUp();
+ this.launcher = new ResourceLauncher(requestHandler);
+ }
+
@Filter
public static class RequestFilter1 implements RequestFilter
{
@@ -53,18 +67,15 @@
private HttpServletRequest httpRequest;
-// private ResourceBinder binder; // exo container component
-
- public RequestFilter1(@Context Providers providers, @Context HttpServletRequest httpRequest/*, ResourceBinder binder*/)
+ public RequestFilter1(@Context Providers providers, @Context HttpServletRequest httpRequest)
{
this.providers = providers;
this.httpRequest = httpRequest;
-// this.binder = binder;
}
public void doFilter(GenericContainerRequest request)
{
- if (uriInfo != null && httpHeaders != null && providers != null && httpRequest != null/* && binder != null*/)
+ if (uriInfo != null && httpHeaders != null && providers != null && httpRequest != null)
request.setMethod("POST");
}
@@ -109,7 +120,7 @@
public void testWithoutFilter1() throws Exception
{
registry(Resource1.class);
- ContainerResponse resp = service("GET", "/a", "", null, null);
+ ContainerResponse resp = launcher.service("GET", "/a", "", null, null, null);
assertEquals(405, resp.getStatus());
assertEquals(1, resp.getHttpHeaders().get("allow").size());
assertTrue(resp.getHttpHeaders().get("allow").get(0).toString().contains("POST"));
@@ -122,9 +133,12 @@
// add filter that can change method
providers.addRequestFilter(RequestFilter1.class);
+ EnvironmentContext env = new EnvironmentContext();
+ env.put(HttpServletRequest.class, new MockHttpServletRequest("", new ByteArrayInputStream(new byte[0]), 0,
+ "GET", new HashMap<String, List<String>>()));
// should get status 204
- ContainerResponse resp = service("GET", "/a", "", null, null);
+ ContainerResponse resp = launcher.service("GET", "/a", "", null, null, env);
assertEquals(204, resp.getStatus());
unregistry(Resource1.class);
@@ -134,7 +148,7 @@
public void testFilter2() throws Exception
{
registry(Resource1.class);
- ContainerResponse resp = service("GET", "/a/b/c/d/e", "", null, null);
+ ContainerResponse resp = launcher.service("GET", "/a/b/c/d/e", "", null, null, null);
assertEquals(405, resp.getStatus());
assertEquals(1, resp.getHttpHeaders().get("allow").size());
assertTrue(resp.getHttpHeaders().get("allow").get(0).toString().contains("DELETE"));
@@ -143,7 +157,7 @@
providers.addRequestFilter(new RequestFilter2());
// not should get status 204
- resp = service("GET", "/a/b/c/d/e", "", null, null);
+ resp = launcher.service("GET", "/a/b/c/d/e", "", null, null, null);
assertEquals(204, resp.getStatus());
unregistry(Resource1.class);
Property changes on: ws/branches/2.2.x/exo.ws.rest.core/src/test/java/org/exoplatform/services/rest/impl/RequestFilterTest.java
___________________________________________________________________
Name: svn:keywords
+ Id
Modified: ws/branches/2.2.x/exo.ws.rest.core/src/test/java/org/exoplatform/services/rest/impl/ResponseFilterTest.java
===================================================================
--- ws/branches/2.2.x/exo.ws.rest.core/src/test/java/org/exoplatform/services/rest/impl/ResponseFilterTest.java 2009-11-06 17:08:38 UTC (rev 496)
+++ ws/branches/2.2.x/exo.ws.rest.core/src/test/java/org/exoplatform/services/rest/impl/ResponseFilterTest.java 2009-11-08 13:19:25 UTC (rev 497)
@@ -18,9 +18,15 @@
*/
package org.exoplatform.services.rest.impl;
+import java.io.ByteArrayInputStream;
+import java.util.HashMap;
+import java.util.List;
+
import org.exoplatform.services.rest.Filter;
import org.exoplatform.services.rest.GenericContainerResponse;
import org.exoplatform.services.rest.ResponseFilter;
+import org.exoplatform.services.rest.tools.ResourceLauncher;
+import org.exoplatform.services.test.mock.MockHttpServletRequest;
import javax.servlet.http.HttpServletRequest;
import javax.ws.rs.POST;
@@ -34,11 +40,19 @@
/**
* @author <a href="mailto:andrew00x at gmail.com">Andrey Parfonov</a>
- * @version $Id: $
+ * @version $Id$
*/
-public class ResponseFilterTest extends AbstractResourceTest
+public class ResponseFilterTest extends BaseTest
{
+ private ResourceLauncher launcher;
+
+ public void setUp() throws Exception
+ {
+ super.setUp();
+ this.launcher = new ResourceLauncher(requestHandler);
+ }
+
@Filter
public static class ResponseFilter1 implements ResponseFilter
{
@@ -53,19 +67,15 @@
private HttpServletRequest httpRequest;
-// private ResourceBinder binder; // exo container component
-
- public ResponseFilter1(@Context Providers providers, @Context HttpServletRequest httpRequest/*,
- ResourceBinder binder*/)
+ public ResponseFilter1(@Context Providers providers, @Context HttpServletRequest httpRequest)
{
this.providers = providers;
this.httpRequest = httpRequest;
-// this.binder = binder;
}
public void doFilter(GenericContainerResponse response)
{
- if (uriInfo != null && httpHeaders != null && providers != null && httpRequest != null /*&& binder != null*/)
+ if (uriInfo != null && httpHeaders != null && providers != null && httpRequest != null)
response.setResponse(Response.status(200).entity("to be or not to be").type("text/plain").build());
}
@@ -110,18 +120,21 @@
{
Resource1 r = new Resource1();
registry(r);
- ContainerResponse resp = service("POST", "/a", "", null, null);
+ ContainerResponse resp = launcher.service("POST", "/a", "", null, null, null);
assertEquals(204, resp.getStatus());
// should not be any changes after add this
providers.addResponseFilter(new ResponseFilter2());
- resp = service("POST", "/a", "", null, null);
+ resp = launcher.service("POST", "/a", "", null, null, null);
assertEquals(204, resp.getStatus());
// add response filter and try again
providers.addResponseFilter(ResponseFilter1.class);
- resp = service("POST", "/a", "", null, null);
+ EnvironmentContext env = new EnvironmentContext();
+ env.put(HttpServletRequest.class, new MockHttpServletRequest("", new ByteArrayInputStream(new byte[0]), 0,
+ "POST", new HashMap<String, List<String>>()));
+ resp = launcher.service("POST", "/a", "", null, null, env);
assertEquals(200, resp.getStatus());
assertEquals("text/plain", resp.getContentType().toString());
assertEquals("to be or not to be", resp.getEntity());
@@ -133,7 +146,7 @@
{
Resource1 r = new Resource1();
registry(r);
- ContainerResponse resp = service("POST", "/a/b/c/d/e", "", null, null);
+ ContainerResponse resp = launcher.service("POST", "/a/b/c/d/e", "", null, null, null);
assertEquals(200, resp.getStatus());
assertEquals("text/plain", resp.getContentType().toString());
assertEquals("{\"name\":\"andrew\", \"password\":\"hello\"}", resp.getEntity());
@@ -141,7 +154,7 @@
// add response filter and try again
providers.addResponseFilter(new ResponseFilter2());
- resp = service("POST", "/a/b/c/d/e", "", null, null);
+ resp = launcher.service("POST", "/a/b/c/d/e", "", null, null, null);
assertEquals(200, resp.getStatus());
assertEquals("application/json", resp.getContentType().toString());
assertEquals("{\"name\":\"andrew\", \"password\":\"hello\"}", resp.getEntity());
Property changes on: ws/branches/2.2.x/exo.ws.rest.core/src/test/java/org/exoplatform/services/rest/impl/ResponseFilterTest.java
___________________________________________________________________
Name: svn:keywords
+ Id
Modified: ws/branches/2.2.x/exo.ws.rest.core/src/test/java/org/exoplatform/services/rest/impl/method/HeadMethodTest.java
===================================================================
--- ws/branches/2.2.x/exo.ws.rest.core/src/test/java/org/exoplatform/services/rest/impl/method/HeadMethodTest.java 2009-11-06 17:08:38 UTC (rev 496)
+++ ws/branches/2.2.x/exo.ws.rest.core/src/test/java/org/exoplatform/services/rest/impl/method/HeadMethodTest.java 2009-11-08 13:19:25 UTC (rev 497)
@@ -18,7 +18,8 @@
*/
package org.exoplatform.services.rest.impl.method;
-import org.exoplatform.services.rest.impl.AbstractResourceTest;
+import org.exoplatform.services.rest.impl.BaseTest;
+import org.exoplatform.services.rest.tools.ResourceLauncher;
import javax.ws.rs.GET;
import javax.ws.rs.HEAD;
@@ -31,7 +32,7 @@
* @author <a href="mailto:dmitry.kataev at exoplatform.com.ua">Dmytro Katayev</a>
* @version $Id: HeadMethodTest.java
*/
-public class HeadMethodTest extends AbstractResourceTest
+public class HeadMethodTest extends BaseTest
{
@Path("/a")
@@ -64,13 +65,21 @@
}
+ private ResourceLauncher launcher;
+
+ public void setUp() throws Exception
+ {
+ super.setUp();
+ this.launcher = new ResourceLauncher(requestHandler);
+ }
+
public void testHeadMethod() throws Exception
{
Resource1 resource1 = new Resource1();
registry(resource1);
- assertEquals("get", service("GET", "/a", "", null, null).getEntity());
- assertEquals(200, service("HEAD", "/a", "", null, null).getStatus());
+ assertEquals("get", launcher.service("GET", "/a", "", null, null, null).getEntity());
+ assertEquals(200, launcher.service("HEAD", "/a", "", null, null, null).getStatus());
unregistry(resource1);
@@ -78,9 +87,9 @@
registry(resource2);
- assertEquals("get", service("GET", "/b", "", null, null).getEntity());
- assertEquals(200, service("HEAD", "/b", "", null, null).getStatus());
- assertNull(service("HEAD", "/b", "", null, null).getEntity());
+ assertEquals("get", launcher.service("GET", "/b", "", null, null, null).getEntity());
+ assertEquals(200, launcher.service("HEAD", "/b", "", null, null, null).getStatus());
+ assertNull(launcher.service("HEAD", "/b", "", null, null, null).getEntity());
unregistry(resource2);
}
Modified: ws/branches/2.2.x/exo.ws.rest.core/src/test/java/org/exoplatform/services/rest/impl/method/MediaTypeTest.java
===================================================================
--- ws/branches/2.2.x/exo.ws.rest.core/src/test/java/org/exoplatform/services/rest/impl/method/MediaTypeTest.java 2009-11-06 17:08:38 UTC (rev 496)
+++ ws/branches/2.2.x/exo.ws.rest.core/src/test/java/org/exoplatform/services/rest/impl/method/MediaTypeTest.java 2009-11-08 13:19:25 UTC (rev 497)
@@ -18,8 +18,9 @@
*/
package org.exoplatform.services.rest.impl.method;
-import org.exoplatform.services.rest.impl.AbstractResourceTest;
+import org.exoplatform.services.rest.impl.BaseTest;
import org.exoplatform.services.rest.impl.MultivaluedMapImpl;
+import org.exoplatform.services.rest.tools.ResourceLauncher;
import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
@@ -38,9 +39,17 @@
* @author <a href="mailto:dmitry.kataev at exoplatform.com.ua">Dmytro Katayev</a>
* @version $Id: MediaTypeTest.java
*/
-public class MediaTypeTest extends AbstractResourceTest
+public class MediaTypeTest extends BaseTest
{
+ private ResourceLauncher launcher;
+
+ public void setUp() throws Exception
+ {
+ super.setUp();
+ this.launcher = new ResourceLauncher(requestHandler);
+ }
+
@Path("/a")
public static class Resource1
{
@@ -90,21 +99,25 @@
registry(resource1);
registry(resource2);
- assertEquals(200, service("GET", "/a", "", null, null).getStatus());
- assertEquals("m0", service("GET", "/a", "", null, null).getEntity());
- assertEquals(MediaType.WILDCARD_TYPE, service("GET", "/a", "", null, null).getContentType());
+ assertEquals(200, launcher.service("GET", "/a", "", null, null, null).getStatus());
+ assertEquals("m0", launcher.service("GET", "/a", "", null, null, null).getEntity());
+ assertEquals(MediaType.WILDCARD_TYPE, launcher.service("GET", "/a", "", null, null, null)
+ .getContentType());
- assertEquals(200, service("GET", "/b/c", "", null, null).getStatus());
- assertEquals(MediaType.TEXT_PLAIN_TYPE, service("GET", "/b/c", "", null, null).getContentType());
+ assertEquals(200, launcher.service("GET", "/b/c", "", null, null, null).getStatus());
+ assertEquals(MediaType.TEXT_PLAIN_TYPE, launcher.service("GET", "/b/c", "", null, null, null)
+ .getContentType());
- assertEquals(200, service("GET", "/b/d", "", null, null).getStatus());
- assertEquals(MediaType.TEXT_XML_TYPE, service("GET", "/b/d", "", null, null).getContentType());
+ assertEquals(200, launcher.service("GET", "/b/d", "", null, null, null).getStatus());
+ assertEquals(MediaType.TEXT_XML_TYPE, launcher.service("GET", "/b/d", "", null, null, null)
+ .getContentType());
MultivaluedMap<String, String> headers = new MultivaluedMapImpl();
headers.add(HttpHeaders.ACCEPT, MediaType.APPLICATION_JSON);
- assertEquals(406, service("GET", "/b/d", "", headers, null).getStatus());
- assertEquals(MediaType.TEXT_XML_TYPE, service("GET", "/b/d", "", null, null).getContentType());
+ assertEquals(406, launcher.service("GET", "/b/d", "", headers, null, null).getStatus());
+ assertEquals(MediaType.TEXT_XML_TYPE, launcher.service("GET", "/b/d", "", null, null, null)
+ .getContentType());
unregistry(resource1);
unregistry(resource2);
@@ -144,19 +157,19 @@
MultivaluedMap<String, String> headers = new MultivaluedMapImpl();
headers.add(HttpHeaders.CONTENT_TYPE, MediaType.TEXT_PLAIN);
- assertEquals(200, service("GET", "/d/e", "", headers, null).getStatus());
- assertEquals("m0", service("GET", "/d/e", "", headers, null).getEntity());
+ assertEquals(200, launcher.service("GET", "/d/e", "", headers, null, null).getStatus());
+ assertEquals("m0", launcher.service("GET", "/d/e", "", headers, null, null).getEntity());
headers = new MultivaluedMapImpl();
headers.add(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON);
- assertEquals(200, service("GET", "/d/f", "", headers, null).getStatus());
- assertEquals("m1", service("GET", "/d/f", "", headers, null).getEntity());
+ assertEquals(200, launcher.service("GET", "/d/f", "", headers, null, null).getStatus());
+ assertEquals("m1", launcher.service("GET", "/d/f", "", headers, null, null).getEntity());
headers = new MultivaluedMapImpl();
headers.add(HttpHeaders.CONTENT_TYPE, MediaType.TEXT_HTML);
- assertEquals(415, service("GET", "/d/f", "", headers, null).getStatus());
+ assertEquals(415, launcher.service("GET", "/d/f", "", headers, null, null).getStatus());
unregistry(resource4);
Modified: ws/branches/2.2.x/exo.ws.rest.core/src/test/java/org/exoplatform/services/rest/impl/method/MethodExceptionTest.java
===================================================================
--- ws/branches/2.2.x/exo.ws.rest.core/src/test/java/org/exoplatform/services/rest/impl/method/MethodExceptionTest.java 2009-11-06 17:08:38 UTC (rev 496)
+++ ws/branches/2.2.x/exo.ws.rest.core/src/test/java/org/exoplatform/services/rest/impl/method/MethodExceptionTest.java 2009-11-08 13:19:25 UTC (rev 497)
@@ -18,8 +18,9 @@
*/
package org.exoplatform.services.rest.impl.method;
-import org.exoplatform.services.rest.impl.AbstractResourceTest;
+import org.exoplatform.services.rest.impl.BaseTest;
import org.exoplatform.services.rest.impl.UnhandledException;
+import org.exoplatform.services.rest.tools.ResourceLauncher;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
@@ -33,7 +34,7 @@
* @author <a href="mailto:dmitry.kataev at exoplatform.com.ua">Dmytro Katayev</a>
* @version $Id: TestMethodException.java
*/
-public class MethodExceptionTest extends AbstractResourceTest
+public class MethodExceptionTest extends BaseTest
{
@SuppressWarnings("serial")
@@ -79,16 +80,24 @@
}
+ private ResourceLauncher launcher;
+
+ public void setUp() throws Exception
+ {
+ super.setUp();
+ this.launcher = new ResourceLauncher(requestHandler);
+ }
+
public void testExceptionProcessing() throws Exception
{
Resource1 resource = new Resource1();
registry(resource);
- assertEquals(500, service("GET", "/a/0", "", null, null).getStatus());
- assertEquals(500, service("GET", "/a/1", "", null, null).getStatus());
+ assertEquals(500, launcher.service("GET", "/a/0", "", null, null, null).getStatus());
+ assertEquals(500, launcher.service("GET", "/a/1", "", null, null, null).getStatus());
try
{
- assertEquals(500, service("GET", "/a/2", "", null, null).getStatus());
+ assertEquals(500, launcher.service("GET", "/a/2", "", null, null, null).getStatus());
fail();
}
catch (UnhandledException e)
Modified: ws/branches/2.2.x/exo.ws.rest.core/src/test/java/org/exoplatform/services/rest/impl/method/MethodInvokerFilterTest.java
===================================================================
--- ws/branches/2.2.x/exo.ws.rest.core/src/test/java/org/exoplatform/services/rest/impl/method/MethodInvokerFilterTest.java 2009-11-06 17:08:38 UTC (rev 496)
+++ ws/branches/2.2.x/exo.ws.rest.core/src/test/java/org/exoplatform/services/rest/impl/method/MethodInvokerFilterTest.java 2009-11-08 13:19:25 UTC (rev 497)
@@ -18,12 +18,19 @@
*/
package org.exoplatform.services.rest.impl.method;
+import java.io.ByteArrayInputStream;
+import java.util.HashMap;
+import java.util.List;
+
import org.exoplatform.services.rest.Filter;
-import org.exoplatform.services.rest.impl.AbstractResourceTest;
+import org.exoplatform.services.rest.impl.BaseTest;
+import org.exoplatform.services.rest.impl.EnvironmentContext;
import org.exoplatform.services.rest.method.MethodInvokerFilter;
import org.exoplatform.services.rest.resource.GenericMethodResource;
import org.exoplatform.services.rest.resource.ResourceMethodDescriptor;
import org.exoplatform.services.rest.resource.SubResourceMethodDescriptor;
+import org.exoplatform.services.rest.tools.ResourceLauncher;
+import org.exoplatform.services.test.mock.MockHttpServletRequest;
import javax.servlet.http.HttpServletRequest;
import javax.ws.rs.GET;
@@ -39,7 +46,7 @@
* @author <a href="mailto:andrew00x at gmail.com">Andrey Parfonov</a>
* @version $Id: $
*/
-public class MethodInvokerFilterTest extends AbstractResourceTest
+public class MethodInvokerFilterTest extends BaseTest
{
@Filter
@@ -56,18 +63,15 @@
@Context
private HttpServletRequest httpRequest;
-// private ResourceBinder binder; // exo container component
-
- public MethodInvokerFilter1(@Context UriInfo uriInfo, @Context HttpHeaders httpHeaders/*, ResourceBinder binder*/)
+ public MethodInvokerFilter1(@Context UriInfo uriInfo, @Context HttpHeaders httpHeaders)
{
this.uriInfo = uriInfo;
this.httpHeaders = httpHeaders;
-// this.binder = binder;
}
public void accept(GenericMethodResource genericMethodResource)
{
- if (uriInfo != null && httpHeaders != null && providers != null && httpRequest != null/* && binder != null*/)
+ if (uriInfo != null && httpHeaders != null && providers != null && httpRequest != null)
{
if (genericMethodResource instanceof SubResourceMethodDescriptor)
// not invoke sub-resource method
@@ -127,15 +131,26 @@
}
}
+ private ResourceLauncher launcher;
+
+ public void setUp() throws Exception
+ {
+ super.setUp();
+ this.launcher = new ResourceLauncher(requestHandler);
+ }
+
public void testInvokerFilter() throws Exception
{
Resource1 r = new Resource1();
registry(r);
- assertEquals(204, service("GET", "/a/b", "", null, null).getStatus());
- assertEquals(204, service("GET", "/a", "", null, null).getStatus());
+ assertEquals(204, launcher.service("GET", "/a/b", "", null, null, null).getStatus());
+ assertEquals(204, launcher.service("GET", "/a", "", null, null, null).getStatus());
providers.addMethodInvokerFilter(MethodInvokerFilter1.class);
- assertEquals(400, service("GET", "/a/b", "", null, null).getStatus());
- assertEquals(204, service("GET", "/a", "", null, null).getStatus());
+ EnvironmentContext env = new EnvironmentContext();
+ env.put(HttpServletRequest.class, new MockHttpServletRequest("", new ByteArrayInputStream(new byte[0]), 0,
+ "GET", new HashMap<String, List<String>>()));
+ assertEquals(400, launcher.service("GET", "/a/b", "", null, null, env).getStatus());
+ assertEquals(204, launcher.service("GET", "/a", "", null, null, env).getStatus());
unregistry(r);
}
@@ -143,11 +158,11 @@
{
Resource2 r = new Resource2();
registry(r);
- assertEquals(204, service("GET", "/b/c", "", null, null).getStatus());
- assertEquals(204, service("GET", "/b/d", "", null, null).getStatus());
+ assertEquals(204, launcher.service("GET", "/b/c", "", null, null, null).getStatus());
+ assertEquals(204, launcher.service("GET", "/b/d", "", null, null, null).getStatus());
providers.addMethodInvokerFilter(new MethodInvokerFilter2());
- assertEquals(400, service("GET", "/b/c", "", null, null).getStatus());
- assertEquals(204, service("GET", "/b/d", "", null, null).getStatus());
+ assertEquals(400, launcher.service("GET", "/b/c", "", null, null, null).getStatus());
+ assertEquals(204, launcher.service("GET", "/b/d", "", null, null, null).getStatus());
unregistry(r);
}
Modified: ws/branches/2.2.x/exo.ws.rest.core/src/test/java/org/exoplatform/services/rest/impl/method/MethodReturnTypeTest.java
===================================================================
--- ws/branches/2.2.x/exo.ws.rest.core/src/test/java/org/exoplatform/services/rest/impl/method/MethodReturnTypeTest.java 2009-11-06 17:08:38 UTC (rev 496)
+++ ws/branches/2.2.x/exo.ws.rest.core/src/test/java/org/exoplatform/services/rest/impl/method/MethodReturnTypeTest.java 2009-11-08 13:19:25 UTC (rev 497)
@@ -18,7 +18,8 @@
*/
package org.exoplatform.services.rest.impl.method;
-import org.exoplatform.services.rest.impl.AbstractResourceTest;
+import org.exoplatform.services.rest.impl.BaseTest;
+import org.exoplatform.services.rest.tools.ResourceLauncher;
import java.util.List;
@@ -34,7 +35,7 @@
* @author <a href="mailto:dmitry.kataev at exoplatform.com.ua">Dmytro Katayev</a>
* @version $Id: ResourceReturnTypeTest.java
*/
-public class MethodReturnTypeTest extends AbstractResourceTest
+public class MethodReturnTypeTest extends BaseTest
{
@Path("/a")
@@ -86,36 +87,44 @@
}
+ private ResourceLauncher launcher;
+
+ public void setUp() throws Exception
+ {
+ super.setUp();
+ this.launcher = new ResourceLauncher(requestHandler);
+ }
+
public void testResourceMethodReturnType() throws Exception
{
Resource1 r = new Resource1();
registry(r);
// void Results in an empty entity body with a 204 status code.
- assertEquals(204, service("GET", "/a/0", "", null, null).getStatus());
- assertNull(service("GET", "/a/o", "", null, null).getEntity());
+ assertEquals(204, launcher.service("GET", "/a/0", "", null, null, null).getStatus());
+ assertNull(launcher.service("GET", "/a/o", "", null, null, null).getEntity());
// Response Results in an entity body mapped from the entity property of the
// Response
// with the status code specified by the status property of the Response.
- assertEquals(200, service("GET", "/a/1", "", null, null).getStatus());
- assertEquals("body", service("GET", "/a/1", "", null, null).getEntity());
+ assertEquals(200, launcher.service("GET", "/a/1", "", null, null, null).getStatus());
+ assertEquals("body", launcher.service("GET", "/a/1", "", null, null, null).getEntity());
// GenericEntity Results: null return value results in a 204 status code
- assertEquals(204, service("GET", "/a/2", "", null, null).getStatus());
- assertNull(service("GET", "/a/2", "", null, null).getEntity());
+ assertEquals(204, launcher.service("GET", "/a/2", "", null, null, null).getStatus());
+ assertNull(launcher.service("GET", "/a/2", "", null, null, null).getEntity());
// a null return value results in a 204 status code.
- assertEquals(204, service("GET", "/a/3", "", null, null).getStatus());
- assertNull(service("GET", "/a/3", "", null, null).getEntity());
+ assertEquals(204, launcher.service("GET", "/a/3", "", null, null, null).getStatus());
+ assertNull(launcher.service("GET", "/a/3", "", null, null, null).getEntity());
// Other Results: null return value results in a 204 status code
- assertEquals(204, service("GET", "/a/5", "", null, null).getStatus());
- assertNull(service("GET", "/a/5", "", null, null).getEntity());
+ assertEquals(204, launcher.service("GET", "/a/5", "", null, null, null).getStatus());
+ assertNull(launcher.service("GET", "/a/5", "", null, null, null).getEntity());
// Other Results: null return value results in a 204 status code
- assertEquals(200, service("GET", "/a/6", "", null, null).getStatus());
- assertNotNull(service("GET", "/a/6", "", null, null).getEntity());
+ assertEquals(200, launcher.service("GET", "/a/6", "", null, null, null).getStatus());
+ assertNotNull(launcher.service("GET", "/a/6", "", null, null, null).getEntity());
unregistry(r);
}
Modified: ws/branches/2.2.x/exo.ws.rest.core/src/test/java/org/exoplatform/services/rest/impl/method/OptionsMethodTest.java
===================================================================
--- ws/branches/2.2.x/exo.ws.rest.core/src/test/java/org/exoplatform/services/rest/impl/method/OptionsMethodTest.java 2009-11-06 17:08:38 UTC (rev 496)
+++ ws/branches/2.2.x/exo.ws.rest.core/src/test/java/org/exoplatform/services/rest/impl/method/OptionsMethodTest.java 2009-11-08 13:19:25 UTC (rev 497)
@@ -18,7 +18,8 @@
*/
package org.exoplatform.services.rest.impl.method;
-import org.exoplatform.services.rest.impl.AbstractResourceTest;
+import org.exoplatform.services.rest.impl.BaseTest;
+import org.exoplatform.services.rest.tools.ResourceLauncher;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
@@ -36,7 +37,7 @@
* @author <a href="mailto:dmitry.kataev at exoplatform.com.ua">Dmytro Katayev</a>
* @version $Id: OptionsMethodTest.java
*/
-public class OptionsMethodTest extends AbstractResourceTest
+public class OptionsMethodTest extends BaseTest
{
@Target(ElementType.METHOD)
@@ -70,17 +71,25 @@
}
+ private ResourceLauncher launcher;
+
+ public void setUp() throws Exception
+ {
+ super.setUp();
+ this.launcher = new ResourceLauncher(requestHandler);
+ }
+
public void testOptionsMethod() throws Exception
{
Resource1 resource1 = new Resource1();
registry(resource1);
- assertEquals("options", service("OPTIONS", "/a", "", null, null).getEntity());
+ assertEquals("options", launcher.service("OPTIONS", "/a", "", null, null, null).getEntity());
unregistry(resource1);
Resource2 resource2 = new Resource2();
registry(resource2);
- assertEquals(200, service("OPTIONS", "/b", "", null, null).getStatus());
- assertNotNull(service("OPTIONS", "/b", "", null, null).getResponse().getMetadata());
+ assertEquals(200, launcher.service("OPTIONS", "/b", "", null, null, null).getStatus());
+ assertNotNull(launcher.service("OPTIONS", "/b", "", null, null, null).getResponse().getMetadata());
}
Modified: ws/branches/2.2.x/exo.ws.rest.core/src/test/java/org/exoplatform/services/rest/impl/method/ParametersInjectionTest.java
===================================================================
--- ws/branches/2.2.x/exo.ws.rest.core/src/test/java/org/exoplatform/services/rest/impl/method/ParametersInjectionTest.java 2009-11-06 17:08:38 UTC (rev 496)
+++ ws/branches/2.2.x/exo.ws.rest.core/src/test/java/org/exoplatform/services/rest/impl/method/ParametersInjectionTest.java 2009-11-08 13:19:25 UTC (rev 497)
@@ -19,9 +19,10 @@
package org.exoplatform.services.rest.impl.method;
import org.exoplatform.services.rest.Property;
-import org.exoplatform.services.rest.impl.AbstractResourceTest;
+import org.exoplatform.services.rest.impl.BaseTest;
import org.exoplatform.services.rest.impl.MultivaluedMapImpl;
import org.exoplatform.services.rest.impl.RequestHandlerImpl;
+import org.exoplatform.services.rest.tools.ResourceLauncher;
import java.util.List;
import java.util.Set;
@@ -46,7 +47,7 @@
* @author <a href="mailto:andrew00x at gmail.com">Andrey Parfonov</a>
* @version $Id: $
*/
-public class ParametersInjectionTest extends AbstractResourceTest
+public class ParametersInjectionTest extends BaseTest
{
@Path("/a/{x}")
@@ -218,50 +219,58 @@
}
}
+ private ResourceLauncher launcher;
+
+ public void setUp() throws Exception
+ {
+ super.setUp();
+ this.launcher = new ResourceLauncher(requestHandler);
+ }
+
public void testParameterTypes() throws Exception
{
Resource1 r1 = new Resource1();
registry(r1);
- assertEquals(204, service("GET", "/a/test/0/test", "", null, null).getStatus());
- assertEquals(204, service("GET", "/a/test/1/test", "", null, null).getStatus());
- assertEquals(204, service("GET", "/a/test/2/test", "", null, null).getStatus());
- assertEquals(204, service("GET", "/a/test/3/test", "", null, null).getStatus());
- assertEquals(204, service("GET", "/a/3333/4/2222", "", null, null).getStatus());
- assertEquals(204, service("GET", "/a/5555/5/4444", "", null, null).getStatus());
- assertEquals(204, service("GET", "/a/test/6/test", "", null, null).getStatus());
- assertEquals(204, service("GET", "/a/test/7/test?x=1&y=2&x=3&y=4&x=5", "", null, null).getStatus());
+ assertEquals(204, launcher.service("GET", "/a/test/0/test", "", null, null, null).getStatus());
+ assertEquals(204, launcher.service("GET", "/a/test/1/test", "", null, null, null).getStatus());
+ assertEquals(204, launcher.service("GET", "/a/test/2/test", "", null, null, null).getStatus());
+ assertEquals(204, launcher.service("GET", "/a/test/3/test", "", null, null, null).getStatus());
+ assertEquals(204, launcher.service("GET", "/a/3333/4/2222", "", null, null, null).getStatus());
+ assertEquals(204, launcher.service("GET", "/a/5555/5/4444", "", null, null, null).getStatus());
+ assertEquals(204, launcher.service("GET", "/a/test/6/test", "", null, null, null).getStatus());
+ assertEquals(204, launcher.service("GET", "/a/test/7/test?x=1&y=2&x=3&y=4&x=5", "", null, null, null).getStatus());
MultivaluedMap<String, String> h = new MultivaluedMapImpl();
h.putSingle("foo", "to be or not to be");
h.putSingle("bar", "to be or not to be");
- assertEquals(204, service("GET", "/a/test/8/test", "", h, null).getStatus());
+ assertEquals(204, launcher.service("GET", "/a/test/8/test", "", h, null, null).getStatus());
h.clear();
h.putSingle("Content-Type", "application/x-www-form-urlencoded");
- assertEquals(204, service("POST", "/a/test/9/test", "", h,
- "bar=to%20be%20or%20not%20to%20be&foo=to%20be%20or%20not%20to%20be".getBytes("UTF-8")).getStatus());
+ assertEquals(204, launcher.service("POST", "/a/test/9/test", "", h,
+ "bar=to%20be%20or%20not%20to%20be&foo=to%20be%20or%20not%20to%20be".getBytes("UTF-8"), null).getStatus());
h.clear();
h.putSingle("Cookie",
"$Version=1;foo=foo;$Domain=exo.com;$Path=/exo,$Version=1;bar=ar;$Domain=exo.com;$Path=/exo");
- assertEquals(204, service("GET", "/a/test/11/test", "", h, null).getStatus());
+ assertEquals(204, launcher.service("GET", "/a/test/11/test", "", h, null, null).getStatus());
- assertEquals(204, service("GET", "/a/111/12/222", "", null, null).getStatus());
+ assertEquals(204, launcher.service("GET", "/a/111/12/222", "", null, null, null).getStatus());
- assertEquals("111", service("GET", "/a/111/13", "", null, null).getEntity());
- assertEquals("222", service("GET", "/a/111/13?query=222", "", null, null).getEntity());
+ assertEquals("111", launcher.service("GET", "/a/111/13", "", null, null, null).getEntity());
+ assertEquals("222", launcher.service("GET", "/a/111/13?query=222", "", null, null, null).getEntity());
try
{
- assertEquals("hello", service("GET", "/a/111/14", "", null, null).getEntity());
+ assertEquals("hello", launcher.service("GET", "/a/111/14", "", null, null, null).getEntity());
RequestHandlerImpl.setProperty("prop1", "to be or not to be");
- assertEquals("to be or not to be", service("GET", "/a/111/14", "", null, null).getEntity());
+ assertEquals("to be or not to be", launcher.service("GET", "/a/111/14", "", null, null, null).getEntity());
}
finally
{
RequestHandlerImpl.setProperty("prop1", null);
}
-
+
unregistry(r1);
}
Modified: ws/branches/2.2.x/exo.ws.rest.core/src/test/java/org/exoplatform/services/rest/impl/provider/ContextResolverTest.java
===================================================================
--- ws/branches/2.2.x/exo.ws.rest.core/src/test/java/org/exoplatform/services/rest/impl/provider/ContextResolverTest.java 2009-11-06 17:08:38 UTC (rev 496)
+++ ws/branches/2.2.x/exo.ws.rest.core/src/test/java/org/exoplatform/services/rest/impl/provider/ContextResolverTest.java 2009-11-08 13:19:25 UTC (rev 497)
@@ -22,11 +22,13 @@
import javax.ws.rs.core.MediaType;
import javax.ws.rs.ext.Provider;
+import org.exoplatform.services.rest.impl.BaseTest;
+
/**
* @author <a href="mailto:andrew00x at gmail.com">Andrey Parfonov</a>
- * @version $Id: $
+ * @version $Id$
*/
-public class ContextResolverTest extends org.exoplatform.services.rest.impl.AbstractResourceTest
+public class ContextResolverTest extends BaseTest
{
@Provider
Property changes on: ws/branches/2.2.x/exo.ws.rest.core/src/test/java/org/exoplatform/services/rest/impl/provider/ContextResolverTest.java
___________________________________________________________________
Name: svn:keywords
+ Id
Modified: ws/branches/2.2.x/exo.ws.rest.core/src/test/java/org/exoplatform/services/rest/impl/provider/ExceptionMapperTest.java
===================================================================
--- ws/branches/2.2.x/exo.ws.rest.core/src/test/java/org/exoplatform/services/rest/impl/provider/ExceptionMapperTest.java 2009-11-06 17:08:38 UTC (rev 496)
+++ ws/branches/2.2.x/exo.ws.rest.core/src/test/java/org/exoplatform/services/rest/impl/provider/ExceptionMapperTest.java 2009-11-08 13:19:25 UTC (rev 497)
@@ -18,8 +18,9 @@
*/
package org.exoplatform.services.rest.impl.provider;
-import org.exoplatform.services.rest.impl.AbstractResourceTest;
+import org.exoplatform.services.rest.impl.BaseTest;
import org.exoplatform.services.rest.impl.ContainerResponse;
+import org.exoplatform.services.rest.tools.ResourceLauncher;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
@@ -29,9 +30,9 @@
/**
* @author <a href="mailto:andrew00x at gmail.com">Andrey Parfonov</a>
- * @version $Id: $
+ * @version $Id$
*/
-public class ExceptionMapperTest extends AbstractResourceTest
+public class ExceptionMapperTest extends BaseTest
{
public static class ExceptionMapper1 implements ExceptionMapper<IllegalArgumentException>
@@ -81,6 +82,8 @@
}
+ private ResourceLauncher launcher;
+
public void setUp() throws Exception
{
super.setUp();
@@ -88,6 +91,7 @@
providers.addExceptionMapper(ExceptionMapper2.class);
providers.addExceptionMapper(ExceptionMapper3.class);
providers.addExceptionMapper(ExceptionMapper4.class);
+ this.launcher = new ResourceLauncher(requestHandler);
}
@Path("a")
@@ -136,24 +140,24 @@
{
registry(Resource1.class);
- ContainerResponse resp = service("GET", "/a/1", "", null, null);
+ ContainerResponse resp = launcher.service("GET", "/a/1", "", null, null, null);
assertEquals(200, resp.getStatus());
assertEquals("IllegalArgumentException", resp.getEntity());
- resp = service("GET", "/a/2", "", null, null);
+ resp = launcher.service("GET", "/a/2", "", null, null, null);
assertEquals(200, resp.getStatus());
assertEquals("RuntimeException", resp.getEntity());
- resp = service("GET", "/a/3", "", null, null);
+ resp = launcher.service("GET", "/a/3", "", null, null, null);
assertEquals(200, resp.getStatus());
assertEquals("WebApplicationException", resp.getEntity());
- resp = service("GET", "/a/4", "", null, null);
+ resp = launcher.service("GET", "/a/4", "", null, null, null);
// WebApplicationException with entity - must not be overridden
assertEquals(500, resp.getStatus());
assertEquals("this exception must not be hidden by any ExceptionMapper", resp.getEntity());
- resp = service("GET", "/a/5", "", null, null);
+ resp = launcher.service("GET", "/a/5", "", null, null, null);
assertEquals(200, resp.getStatus());
assertEquals("MockException", resp.getEntity());
Property changes on: ws/branches/2.2.x/exo.ws.rest.core/src/test/java/org/exoplatform/services/rest/impl/provider/ExceptionMapperTest.java
___________________________________________________________________
Name: svn:keywords
+ Id
Modified: ws/branches/2.2.x/exo.ws.rest.core/src/test/java/org/exoplatform/services/rest/impl/provider/FormEntityTest.java
===================================================================
--- ws/branches/2.2.x/exo.ws.rest.core/src/test/java/org/exoplatform/services/rest/impl/provider/FormEntityTest.java 2009-11-06 17:08:38 UTC (rev 496)
+++ ws/branches/2.2.x/exo.ws.rest.core/src/test/java/org/exoplatform/services/rest/impl/provider/FormEntityTest.java 2009-11-08 13:19:25 UTC (rev 497)
@@ -19,15 +19,21 @@
package org.exoplatform.services.rest.impl.provider;
import org.apache.commons.fileupload.FileItem;
-import org.exoplatform.services.rest.impl.AbstractResourceTest;
+import org.exoplatform.services.rest.impl.BaseTest;
+import org.exoplatform.services.rest.impl.EnvironmentContext;
import org.exoplatform.services.rest.impl.MultivaluedMapImpl;
+import org.exoplatform.services.rest.tools.ResourceLauncher;
+import org.exoplatform.services.test.mock.MockHttpServletRequest;
+import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
+import java.util.Map;
+import javax.servlet.http.HttpServletRequest;
import javax.ws.rs.Consumes;
import javax.ws.rs.FormParam;
import javax.ws.rs.POST;
@@ -36,11 +42,19 @@
/**
* @author <a href="mailto:andrew00x at gmail.com">Andrey Parfonov</a>
- * @version $Id: $
+ * @version $Id$
*/
-public class FormEntityTest extends AbstractResourceTest
+public class FormEntityTest extends BaseTest
{
+ private ResourceLauncher launcher;
+
+ public void setUp() throws Exception
+ {
+ super.setUp();
+ this.launcher = new ResourceLauncher(requestHandler);
+ }
+
@Path("/")
public static class Resource1
{
@@ -72,8 +86,8 @@
MultivaluedMap<String, String> h = new MultivaluedMapImpl();
h.putSingle("content-type", "application/x-www-form-urlencoded");
h.putSingle("content-length", "" + data.length);
- assertEquals(204, service("POST", "/a", "", h, data).getStatus());
- assertEquals(204, service("POST", "/b", "", h, data).getStatus());
+ assertEquals(204, launcher.service("POST", "/a", "", h, data, null).getStatus());
+ assertEquals(204, launcher.service("POST", "/b", "", h, data, null).getStatus());
unregistry(r1);
}
@@ -190,7 +204,12 @@
h.putSingle("content-type", "multipart/form-data; boundary=abcdef");
byte[] data = out.toByteArray();
- assertEquals(204, service("POST", "/", "", h, data).getStatus());
+ // NOTE In this test data will be red from HttpServletRequest, not from
+ // byte array. See MultipartFormDataEntityProvider.
+ EnvironmentContext env = new EnvironmentContext();
+ env.put(HttpServletRequest.class, new MockHttpServletRequest("", new ByteArrayInputStream(data), data.length,
+ "POST", (Map<String, List<String>>)h));
+ assertEquals(204, launcher.service("POST", "/", "", h, data, env).getStatus());
unregistry(r2);
}
Property changes on: ws/branches/2.2.x/exo.ws.rest.core/src/test/java/org/exoplatform/services/rest/impl/provider/FormEntityTest.java
___________________________________________________________________
Name: svn:keywords
+ Id
Modified: ws/branches/2.2.x/exo.ws.rest.core/src/test/java/org/exoplatform/services/rest/impl/provider/JAXBEntityTest.java
===================================================================
--- ws/branches/2.2.x/exo.ws.rest.core/src/test/java/org/exoplatform/services/rest/impl/provider/JAXBEntityTest.java 2009-11-06 17:08:38 UTC (rev 496)
+++ ws/branches/2.2.x/exo.ws.rest.core/src/test/java/org/exoplatform/services/rest/impl/provider/JAXBEntityTest.java 2009-11-08 13:19:25 UTC (rev 497)
@@ -19,10 +19,11 @@
package org.exoplatform.services.rest.impl.provider;
import org.exoplatform.services.rest.generated.Book;
-import org.exoplatform.services.rest.impl.AbstractResourceTest;
+import org.exoplatform.services.rest.impl.BaseTest;
import org.exoplatform.services.rest.impl.ContainerResponse;
import org.exoplatform.services.rest.impl.MultivaluedMapImpl;
import org.exoplatform.services.rest.tools.ByteArrayContainerResponseWriter;
+import org.exoplatform.services.rest.tools.ResourceLauncher;
import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
@@ -34,11 +35,19 @@
/**
* @author <a href="mailto:andrew00x at gmail.com">Andrey Parfonov</a>
- * @version $Id: $
+ * @version $Id$
*/
-public class JAXBEntityTest extends AbstractResourceTest
+public class JAXBEntityTest extends BaseTest
{
+ private ResourceLauncher launcher;
+
+ public void setUp() throws Exception
+ {
+ super.setUp();
+ this.launcher = new ResourceLauncher(requestHandler);
+ }
+
@Path("/")
public static class Resource1
{
@@ -111,10 +120,10 @@
h.putSingle("content-type", "application/xml");
byte[] data = XML_DATA.getBytes("UTF-8");
h.putSingle("content-length", "" + data.length);
- assertEquals(204, service("POST", "/a", "", h, data).getStatus());
+ assertEquals(204, launcher.service("POST", "/a", "", h, data, null).getStatus());
// Object transfered via XML (JAXB)
- assertEquals(204, service("POST", "/b", "", h, data).getStatus());
+ assertEquals(204, launcher.service("POST", "/b", "", h, data, null).getStatus());
unregistry(r1);
}
@@ -127,7 +136,7 @@
// Resource2#m1()
h.putSingle("accept", "application/xml");
ByteArrayContainerResponseWriter writer = new ByteArrayContainerResponseWriter();
- ContainerResponse response = service("GET", "/", "", h, null, writer);
+ ContainerResponse response = launcher.service("GET", "/", "", h, null, writer, null);
assertEquals(200, response.getStatus());
assertEquals("application/xml", response.getContentType().toString());
Book book = (Book)response.getEntity();
@@ -137,7 +146,7 @@
// Resource2#m2()
writer = new ByteArrayContainerResponseWriter();
- response = service("POST", "/", "", h, null, writer);
+ response = launcher.service("POST", "/", "", h, null, writer, null);
assertEquals(200, response.getStatus());
assertEquals("application/xml", response.getContentType().toString());
book = (Book)response.getEntity();
Property changes on: ws/branches/2.2.x/exo.ws.rest.core/src/test/java/org/exoplatform/services/rest/impl/provider/JAXBEntityTest.java
___________________________________________________________________
Name: svn:keywords
+ Id
Modified: ws/branches/2.2.x/exo.ws.rest.core/src/test/java/org/exoplatform/services/rest/impl/provider/JsonEntityTest.java
===================================================================
--- ws/branches/2.2.x/exo.ws.rest.core/src/test/java/org/exoplatform/services/rest/impl/provider/JsonEntityTest.java 2009-11-06 17:08:38 UTC (rev 496)
+++ ws/branches/2.2.x/exo.ws.rest.core/src/test/java/org/exoplatform/services/rest/impl/provider/JsonEntityTest.java 2009-11-08 13:19:25 UTC (rev 497)
@@ -19,10 +19,11 @@
package org.exoplatform.services.rest.impl.provider;
import org.exoplatform.services.rest.generated.Book;
-import org.exoplatform.services.rest.impl.AbstractResourceTest;
+import org.exoplatform.services.rest.impl.BaseTest;
import org.exoplatform.services.rest.impl.ContainerResponse;
import org.exoplatform.services.rest.impl.MultivaluedMapImpl;
import org.exoplatform.services.rest.tools.ByteArrayContainerResponseWriter;
+import org.exoplatform.services.rest.tools.ResourceLauncher;
import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
@@ -33,9 +34,9 @@
/**
* @author <a href="mailto:andrew00x at gmail.com">Andrey Parfonov</a>
- * @version $Id: $
+ * @version $Id$
*/
-public class JsonEntityTest extends AbstractResourceTest
+public class JsonEntityTest extends BaseTest
{
@Path("/")
@@ -79,11 +80,14 @@
private byte[] jsonData;
+ private ResourceLauncher launcher;
+
public void setUp() throws Exception
{
super.setUp();
jsonData =
("{\"title\":\"Hamlet\"," + "\"author\":\"William Shakespeare\"," + "\"sendByPost\":true}").getBytes("UTF-8");
+ this.launcher = new ResourceLauncher(requestHandler);
}
public void testJsonEntityParameter() throws Exception
@@ -96,7 +100,7 @@
// with JSON transformation for Book have restriction can't pass BigDecimal
// (has not simple constructor and it is not in JSON known types)
h.putSingle("content-length", "" + jsonData.length);
- assertEquals(204, service("POST", "/", "", h, jsonData).getStatus());
+ assertEquals(204, launcher.service("POST", "/", "", h, jsonData, null).getStatus());
unregistry(r1);
}
@@ -109,7 +113,7 @@
ByteArrayContainerResponseWriter writer = new ByteArrayContainerResponseWriter();
// Resource2#m1()
- ContainerResponse response = service("GET", "/", "", h, null, writer);
+ ContainerResponse response = launcher.service("GET", "/", "", h, null, writer, null);
assertEquals(200, response.getStatus());
assertEquals("application/json", response.getContentType().toString());
Book book = (Book)response.getEntity();
@@ -118,7 +122,7 @@
assertTrue(book.isSendByPost());
// Resource2#m2()
- response = service("POST", "/", "", h, null, writer);
+ response = launcher.service("POST", "/", "", h, null, writer, null);
assertEquals(200, response.getStatus());
assertEquals("application/json", response.getContentType().toString());
book = (Book)response.getEntity();
Property changes on: ws/branches/2.2.x/exo.ws.rest.core/src/test/java/org/exoplatform/services/rest/impl/provider/JsonEntityTest.java
___________________________________________________________________
Name: svn:keywords
+ Id
Modified: ws/branches/2.2.x/exo.ws.rest.core/src/test/java/org/exoplatform/services/rest/impl/provider/OtherEntityTest.java
===================================================================
--- ws/branches/2.2.x/exo.ws.rest.core/src/test/java/org/exoplatform/services/rest/impl/provider/OtherEntityTest.java 2009-11-06 17:08:38 UTC (rev 496)
+++ ws/branches/2.2.x/exo.ws.rest.core/src/test/java/org/exoplatform/services/rest/impl/provider/OtherEntityTest.java 2009-11-08 13:19:25 UTC (rev 497)
@@ -18,10 +18,11 @@
*/
package org.exoplatform.services.rest.impl.provider;
-import org.exoplatform.services.rest.impl.AbstractResourceTest;
+import org.exoplatform.services.rest.impl.BaseTest;
import org.exoplatform.services.rest.impl.ContainerResponse;
import org.exoplatform.services.rest.impl.MultivaluedMapImpl;
import org.exoplatform.services.rest.tools.ByteArrayContainerResponseWriter;
+import org.exoplatform.services.rest.tools.ResourceLauncher;
import org.w3c.dom.Document;
import org.xml.sax.InputSource;
@@ -50,11 +51,19 @@
/**
* @author <a href="mailto:andrew00x at gmail.com">Andrey Parfonov</a>
- * @version $Id: $
+ * @version $Id$
*/
-public class OtherEntityTest extends AbstractResourceTest
+public class OtherEntityTest extends BaseTest
{
+ private ResourceLauncher launcher;
+
+ public void setUp() throws Exception
+ {
+ super.setUp();
+ this.launcher = new ResourceLauncher(requestHandler);
+ }
+
@Path("/")
public static class Resource1
{
@@ -136,24 +145,24 @@
// next types allowed for any content-type
// h.putSingle("content-type", "application/octet-stream");
- assertEquals(204, service("POST", "/bytes", "", h, data).getStatus());
+ assertEquals(204, launcher.service("POST", "/bytes", "", h, data, null).getStatus());
- assertEquals(204, service("POST", "/string", "", h, data).getStatus());
+ assertEquals(204, launcher.service("POST", "/string", "", h, data, null).getStatus());
- assertEquals(204, service("POST", "/stream", "", h, data).getStatus());
+ assertEquals(204, launcher.service("POST", "/stream", "", h, data, null).getStatus());
- assertEquals(204, service("POST", "/reader", "", h, data).getStatus());
+ assertEquals(204, launcher.service("POST", "/reader", "", h, data, null).getStatus());
// next types required application/xml, text/xml or
// application/xhtml+xml content-type
h.putSingle("content-type", "application/xml");
data = XML_DATA.getBytes("UTF-8");
h.putSingle("content-length", "" + data.length);
- assertEquals(204, service("POST", "/dom", "", h, data).getStatus());
+ assertEquals(204, launcher.service("POST", "/dom", "", h, data, null).getStatus());
- assertEquals(204, service("POST", "/sax", "", h, data).getStatus());
+ assertEquals(204, launcher.service("POST", "/sax", "", h, data, null).getStatus());
- assertEquals(204, service("POST", "/ss", "", h, data).getStatus());
+ assertEquals(204, launcher.service("POST", "/ss", "", h, data, null).getStatus());
unregistry(r1);
}
@@ -249,24 +258,24 @@
ByteArrayContainerResponseWriter writer = new ByteArrayContainerResponseWriter();
h.putSingle("accept", "text/plain");
- ContainerResponse response = service("GET", "/bytes", "", h, null, writer);
+ ContainerResponse response = launcher.service("GET", "/bytes", "", h, null, writer, null);
assertEquals(200, response.getStatus());
assertEquals("application/octet-stream", response.getContentType().toString());
assertEquals("to be or not to be".getBytes("UTF-8").length + "", response.getHttpHeaders().getFirst(
HttpHeaders.CONTENT_LENGTH).toString());
assertEquals("to be or not to be", new String(writer.getBody()));
- response = service("GET", "/string", "", h, null, writer);
+ response = launcher.service("GET", "/string", "", h, null, writer, null);
assertEquals(200, response.getStatus());
assertEquals("text/plain", response.getContentType().toString());
assertEquals("to be or not to be", new String(writer.getBody()));
- response = service("GET", "/stream", "", h, null, writer);
+ response = launcher.service("GET", "/stream", "", h, null, writer, null);
assertEquals(200, response.getStatus());
assertEquals("application/octet-stream", response.getContentType().toString());
assertEquals("to be or not to be", new String(writer.getBody()));
- response = service("GET", "/reader", "", h, null, writer);
+ response = launcher.service("GET", "/reader", "", h, null, writer, null);
assertEquals(200, response.getStatus());
assertEquals("text/plain", response.getContentType().toString());
assertEquals("to be or not to be", new String(writer.getBody()));
@@ -275,33 +284,33 @@
String xml = pattern.matcher(XML_DATA).replaceFirst("");
h.putSingle("accept", "application/xml");
- response = service("GET", "/dom", "", h, null, writer);
+ response = launcher.service("GET", "/dom", "", h, null, writer, null);
assertEquals(200, response.getStatus());
assertEquals("application/xml", response.getContentType().toString());
String result = new String(writer.getBody());
result = pattern.matcher(result).replaceFirst("");
assertEquals(xml, result);
- response = service("GET", "/sax", "", h, null, writer);
+ response = launcher.service("GET", "/sax", "", h, null, writer, null);
assertEquals(200, response.getStatus());
assertEquals("application/xml", response.getContentType().toString());
result = new String(writer.getBody());
result = pattern.matcher(result).replaceFirst("");
assertEquals(xml, result);
- response = service("GET", "/ss", "", h, null, writer);
+ response = launcher.service("GET", "/ss", "", h, null, writer, null);
assertEquals(200, response.getStatus());
assertEquals("application/xml", response.getContentType().toString());
result = new String(writer.getBody());
result = pattern.matcher(result).replaceFirst("");
assertEquals(xml, result);
- response = service("GET", "/so", "", h, null, writer);
+ response = launcher.service("GET", "/so", "", h, null, writer, null);
assertEquals(200, response.getStatus());
assertEquals("application/octet-stream", response.getContentType().toString());
assertEquals("to be or not to be", new String(writer.getBody()));
- response = service("GET", "/response", "", h, null, writer);
+ response = launcher.service("GET", "/response", "", h, null, writer, null);
assertEquals(200, response.getStatus());
assertEquals("text/plain", response.getContentType().toString());
assertEquals("to be or not to be".getBytes("UTF-8").length + "", response.getHttpHeaders().getFirst(
Property changes on: ws/branches/2.2.x/exo.ws.rest.core/src/test/java/org/exoplatform/services/rest/impl/provider/OtherEntityTest.java
___________________________________________________________________
Name: svn:keywords
+ Id
Modified: ws/branches/2.2.x/exo.ws.rest.core/src/test/java/org/exoplatform/services/rest/impl/provider/ProviderContextParameterInjectionTest.java
===================================================================
--- ws/branches/2.2.x/exo.ws.rest.core/src/test/java/org/exoplatform/services/rest/impl/provider/ProviderContextParameterInjectionTest.java 2009-11-06 17:08:38 UTC (rev 496)
+++ ws/branches/2.2.x/exo.ws.rest.core/src/test/java/org/exoplatform/services/rest/impl/provider/ProviderContextParameterInjectionTest.java 2009-11-08 13:19:25 UTC (rev 497)
@@ -18,15 +18,21 @@
*/
package org.exoplatform.services.rest.impl.provider;
-import org.exoplatform.services.rest.impl.AbstractResourceTest;
+import org.exoplatform.services.rest.impl.BaseTest;
+import org.exoplatform.services.rest.impl.EnvironmentContext;
import org.exoplatform.services.rest.impl.ContainerResponse;
import org.exoplatform.services.rest.provider.EntityProvider;
+import org.exoplatform.services.rest.tools.ResourceLauncher;
+import org.exoplatform.services.test.mock.MockHttpServletRequest;
+import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.lang.annotation.Annotation;
import java.lang.reflect.Type;
+import java.util.HashMap;
+import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.ws.rs.GET;
@@ -47,9 +53,9 @@
/**
* @author <a href="mailto:andrew00x at gmail.com">Andrey Parfonov</a>
- * @version $Id: $
+ * @version $Id$
*/
-public class ProviderContextParameterInjectionTest extends AbstractResourceTest
+public class ProviderContextParameterInjectionTest extends BaseTest
{
public static class MockEntity
@@ -170,6 +176,8 @@
}
+ private ResourceLauncher launcher;
+
public void setUp() throws Exception
{
super.setUp();
@@ -177,6 +185,7 @@
providers.addMessageBodyWriter(EntityProviderChecker.class);
providers.addExceptionMapper(ExceptionMapperChecker.class);
providers.addContextResolver(ContextResolverChecker.class);
+ this.launcher = new ResourceLauncher(requestHandler);
}
public void tearDown() throws Exception
@@ -217,17 +226,20 @@
}
}
- public void test0() throws Exception
+ public void testParameterInjection() throws Exception
{
registry(Resource1.class);
- ContainerResponse resp = service("GET", "/a/1", "", null, "to be or not to be".getBytes());
+ EnvironmentContext env = new EnvironmentContext();
+ env.put(HttpServletRequest.class, new MockHttpServletRequest("", new ByteArrayInputStream(new byte[0]), 0, "GET",
+ new HashMap<String, List<String>>()));
+ ContainerResponse resp = launcher.service("GET", "/a/1", "", null, "to be or not to be".getBytes(), env);
assertEquals("to be", ((MockEntity)resp.getEntity()).entity);
- resp = service("GET", "/a/2", "", null, null);
+ resp = launcher.service("GET", "/a/2", "", null, null, env);
assertEquals(200, resp.getStatus());
- resp = service("GET", "/a/3", "", null, null);
+ resp = launcher.service("GET", "/a/3", "", null, null, env);
assertEquals(200, resp.getStatus());
assertEquals("to be to not to be", resp.getEntity());
Property changes on: ws/branches/2.2.x/exo.ws.rest.core/src/test/java/org/exoplatform/services/rest/impl/provider/ProviderContextParameterInjectionTest.java
___________________________________________________________________
Name: svn:keywords
+ Id
Modified: ws/branches/2.2.x/exo.ws.rest.core/src/test/java/org/exoplatform/services/rest/impl/resource/AcceptResourceTest.java
===================================================================
--- ws/branches/2.2.x/exo.ws.rest.core/src/test/java/org/exoplatform/services/rest/impl/resource/AcceptResourceTest.java 2009-11-06 17:08:38 UTC (rev 496)
+++ ws/branches/2.2.x/exo.ws.rest.core/src/test/java/org/exoplatform/services/rest/impl/resource/AcceptResourceTest.java 2009-11-08 13:19:25 UTC (rev 497)
@@ -18,8 +18,9 @@
*/
package org.exoplatform.services.rest.impl.resource;
-import org.exoplatform.services.rest.impl.AbstractResourceTest;
+import org.exoplatform.services.rest.impl.BaseTest;
import org.exoplatform.services.rest.impl.MultivaluedMapImpl;
+import org.exoplatform.services.rest.tools.ResourceLauncher;
import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
@@ -30,9 +31,9 @@
/**
* @author <a href="mailto:andrew00x at gmail.com">Andrey Parfonov</a>
- * @version $Id: $
+ * @version $Id$
*/
-public class AcceptResourceTest extends AbstractResourceTest
+public class AcceptResourceTest extends BaseTest
{
@Path("/a")
@@ -146,6 +147,14 @@
}
+ private ResourceLauncher launcher;
+
+ public void setUp() throws Exception
+ {
+ super.setUp();
+ this.launcher = new ResourceLauncher(requestHandler);
+ }
+
public void testContentType() throws Exception
{
Resource1 r1 = new Resource1();
@@ -204,14 +213,14 @@
{
MultivaluedMap<String, String> h = new MultivaluedMapImpl();
h.putSingle("content-type", contentType);
- return (String)service("POST", "/a", "", h, null).getEntity();
+ return (String)launcher.service("POST", "/a", "", h, null, null).getEntity();
}
private String testAcceptedMediaType(String acceptMediaType) throws Exception
{
MultivaluedMap<String, String> h = new MultivaluedMapImpl();
h.putSingle("accept", acceptMediaType);
- return (String)service("GET", "/a", "", h, null).getEntity();
+ return (String)launcher.service("GET", "/a", "", h, null, null).getEntity();
}
private String testComplex(String contentType, String acceptMediaType) throws Exception
@@ -219,6 +228,6 @@
MultivaluedMap<String, String> h = new MultivaluedMapImpl();
h.putSingle("content-type", contentType);
h.putSingle("accept", acceptMediaType);
- return (String)service("POST", "/a", "", h, null).getEntity();
+ return (String)launcher.service("POST", "/a", "", h, null, null).getEntity();
}
}
Property changes on: ws/branches/2.2.x/exo.ws.rest.core/src/test/java/org/exoplatform/services/rest/impl/resource/AcceptResourceTest.java
___________________________________________________________________
Name: svn:keywords
+ Id
Modified: ws/branches/2.2.x/exo.ws.rest.core/src/test/java/org/exoplatform/services/rest/impl/resource/AnnotationInheritanceTest.java
===================================================================
--- ws/branches/2.2.x/exo.ws.rest.core/src/test/java/org/exoplatform/services/rest/impl/resource/AnnotationInheritanceTest.java 2009-11-06 17:08:38 UTC (rev 496)
+++ ws/branches/2.2.x/exo.ws.rest.core/src/test/java/org/exoplatform/services/rest/impl/resource/AnnotationInheritanceTest.java 2009-11-08 13:19:25 UTC (rev 497)
@@ -19,7 +19,8 @@
package org.exoplatform.services.rest.impl.resource;
import org.exoplatform.services.rest.ComponentLifecycleScope;
-import org.exoplatform.services.rest.impl.AbstractResourceTest;
+import org.exoplatform.services.rest.impl.BaseTest;
+import org.exoplatform.services.rest.tools.ResourceLauncher;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
@@ -33,7 +34,7 @@
* @author <a href="mailto:dmitry.kataev at exoplatform.com.ua">Dmytro Katayev</a>
* @version $Id: AnnotationInheritanceTest.java
*/
-public class AnnotationInheritanceTest extends AbstractResourceTest
+public class AnnotationInheritanceTest extends BaseTest
{
public static interface ResourceInterface
@@ -84,6 +85,14 @@
}
}
+ private ResourceLauncher launcher;
+
+ public void setUp() throws Exception
+ {
+ super.setUp();
+ this.launcher = new ResourceLauncher(requestHandler);
+ }
+
public void testFailedInheritance()
{
try
@@ -103,16 +112,18 @@
registry(resource1);
- assertEquals(200, service("GET", "/a", "", null, null).getStatus());
- assertEquals("m0", service("GET", "/a", "", null, null).getEntity());
- assertEquals(MediaType.TEXT_XML_TYPE, service("GET", "/a", "", null, null).getContentType());
+ assertEquals(200, launcher.service("GET", "/a", "", null, null, null).getStatus());
+ assertEquals("m0", launcher.service("GET", "/a", "", null, null, null).getEntity());
+ assertEquals(MediaType.TEXT_XML_TYPE, launcher.service("GET", "/a", "", null, null, null)
+ .getContentType());
unregistry(resource1);
registry(resource2);
- assertEquals(200, service("GET", "/a", "", null, null).getStatus());
- assertEquals("m0", service("GET", "/a", "", null, null).getEntity());
- assertEquals(MediaType.APPLICATION_ATOM_XML_TYPE, service("GET", "/a", "", null, null).getContentType());
+ assertEquals(200, launcher.service("GET", "/a", "", null, null, null).getStatus());
+ assertEquals("m0", launcher.service("GET", "/a", "", null, null, null).getEntity());
+ assertEquals(MediaType.APPLICATION_ATOM_XML_TYPE, launcher.service("GET", "/a", "", null, null, null)
+ .getContentType());
unregistry(resource2);
}
Property changes on: ws/branches/2.2.x/exo.ws.rest.core/src/test/java/org/exoplatform/services/rest/impl/resource/AnnotationInheritanceTest.java
___________________________________________________________________
Name: svn:keywords
+ Id
Modified: ws/branches/2.2.x/exo.ws.rest.core/src/test/java/org/exoplatform/services/rest/impl/resource/ApplicationTest.java
===================================================================
--- ws/branches/2.2.x/exo.ws.rest.core/src/test/java/org/exoplatform/services/rest/impl/resource/ApplicationTest.java 2009-11-06 17:08:38 UTC (rev 496)
+++ ws/branches/2.2.x/exo.ws.rest.core/src/test/java/org/exoplatform/services/rest/impl/resource/ApplicationTest.java 2009-11-08 13:19:25 UTC (rev 497)
@@ -23,11 +23,12 @@
import org.exoplatform.services.rest.GenericContainerResponse;
import org.exoplatform.services.rest.RequestFilter;
import org.exoplatform.services.rest.ResponseFilter;
-import org.exoplatform.services.rest.impl.AbstractResourceTest;
+import org.exoplatform.services.rest.impl.BaseTest;
import org.exoplatform.services.rest.impl.ApplicationPublisher;
import org.exoplatform.services.rest.impl.ContainerResponse;
import org.exoplatform.services.rest.method.MethodInvokerFilter;
import org.exoplatform.services.rest.resource.GenericMethodResource;
+import org.exoplatform.services.rest.tools.ResourceLauncher;
import java.util.HashSet;
import java.util.Set;
@@ -40,9 +41,9 @@
/**
* @author <a href="mailto:andrew00x at gmail.com">Andrey Parfonov</a>
- * @version $Id: $
+ * @version $Id$
*/
-public class ApplicationTest extends AbstractResourceTest
+public class ApplicationTest extends BaseTest
{
public static class Application1 extends javax.ws.rs.core.Application
@@ -202,36 +203,44 @@
private static boolean responseFilter = false;
private static boolean invFilter = false;
+ private ResourceLauncher launcher;
+
+ public void setUp() throws Exception
+ {
+ super.setUp();
+ this.launcher = new ResourceLauncher(requestHandler);
+ }
+
public void testAsResources() throws Exception
{
ApplicationPublisher deployer = new ApplicationPublisher(resources, providers);
deployer.publish(new Application1());
// per-request
- ContainerResponse resp = service("GET", "/a", "", null, null);
+ ContainerResponse resp = launcher.service("GET", "/a", "", null, null, null);
assertEquals(200, resp.getStatus());
String hash10 = (String)resp.getEntity();
- resp = service("GET", "/a", "", null, null);
+ resp = launcher.service("GET", "/a", "", null, null, null);
String hash11 = (String)resp.getEntity();
// new instance of resource for each request
assertFalse(hash10.equals(hash11));
// singleton
- resp = service("GET", "/c", "", null, null);
+ resp = launcher.service("GET", "/c", "", null, null, null);
assertEquals(200, resp.getStatus());
String hash20 = (String)resp.getEntity();
- resp = service("GET", "/c", "", null, null);
+ resp = launcher.service("GET", "/c", "", null, null, null);
String hash21 = (String)resp.getEntity();
// singleton resource
assertTrue(hash20.equals(hash21));
// check per-request ExceptionMapper as example of provider
- resp = service("GET", "/b", "", null, null);
+ resp = launcher.service("GET", "/b", "", null, null, null);
// should be 200 status instead 500 if ExceptionMapper works correct
assertEquals(200, resp.getStatus());
assertEquals("test Runtime Exception", resp.getEntity());
// check singleton ExceptionMapper as example of provider
- resp = service("GET", "/d", "", null, null);
+ resp = launcher.service("GET", "/d", "", null, null, null);
// should be 200 status instead 500 if ExceptionMapper works correct
assertEquals(200, resp.getStatus());
assertEquals("test Illegal State Exception", resp.getEntity());
Property changes on: ws/branches/2.2.x/exo.ws.rest.core/src/test/java/org/exoplatform/services/rest/impl/resource/ApplicationTest.java
___________________________________________________________________
Name: svn:keywords
+ Id
Modified: ws/branches/2.2.x/exo.ws.rest.core/src/test/java/org/exoplatform/services/rest/impl/resource/ContextParametersInjectionTest.java
===================================================================
--- ws/branches/2.2.x/exo.ws.rest.core/src/test/java/org/exoplatform/services/rest/impl/resource/ContextParametersInjectionTest.java 2009-11-06 17:08:38 UTC (rev 496)
+++ ws/branches/2.2.x/exo.ws.rest.core/src/test/java/org/exoplatform/services/rest/impl/resource/ContextParametersInjectionTest.java 2009-11-08 13:19:25 UTC (rev 497)
@@ -19,9 +19,10 @@
package org.exoplatform.services.rest.impl.resource;
import org.exoplatform.services.rest.InitialProperties;
-import org.exoplatform.services.rest.impl.AbstractResourceTest;
+import org.exoplatform.services.rest.impl.BaseTest;
import org.exoplatform.services.rest.impl.MultivaluedMapImpl;
import org.exoplatform.services.rest.impl.header.HeaderHelper;
+import org.exoplatform.services.rest.tools.ResourceLauncher;
import java.util.List;
@@ -36,11 +37,19 @@
/**
* @author <a href="mailto:andrew00x at gmail.com">Andrey Parfonov</a>
- * @version $Id: $
+ * @version $Id$
*/
-public class ContextParametersInjectionTest extends AbstractResourceTest
+public class ContextParametersInjectionTest extends BaseTest
{
+ private ResourceLauncher launcher;
+
+ public void setUp() throws Exception
+ {
+ super.setUp();
+ this.launcher = new ResourceLauncher(requestHandler);
+ }
+
@Path("/a/b")
public static class Resource1
{
@@ -231,17 +240,19 @@
private void injectionTest() throws Exception
{
- assertEquals("http://localhost/test/a/b/c", service("GET", "http://localhost/test/a/b/c",
- "http://localhost/test", null, null).getEntity());
+ assertEquals("http://localhost/test/a/b/c", launcher.service("GET", "http://localhost/test/a/b/c",
+ "http://localhost/test", null, null, null).getEntity());
MultivaluedMap<String, String> h = new MultivaluedMapImpl();
h.add("Accept", "text/xml");
h.add("Accept", "text/plain;q=0.7");
- assertEquals("text/xml,text/plain;q=0.7", service("GET", "http://localhost/test/a/b/d", "http://localhost/test",
- h, null).getEntity());
- assertEquals("GET", service("GET", "http://localhost/test/a/b/e", "http://localhost/test", null, null)
- .getEntity());
- assertEquals(204, service("GET", "http://localhost/test/a/b/f", "http://localhost/test", null, null).getStatus());
- assertEquals(204, service("GET", "http://localhost/test/a/b/g", "http://localhost/test", null, null).getStatus());
+ assertEquals("text/xml,text/plain;q=0.7", launcher.service("GET", "http://localhost/test/a/b/d",
+ "http://localhost/test", h, null, null).getEntity());
+ assertEquals("GET", launcher.service("GET", "http://localhost/test/a/b/e", "http://localhost/test", null, null,
+ null).getEntity());
+ assertEquals(204, launcher.service("GET", "http://localhost/test/a/b/f", "http://localhost/test", null, null,
+ null).getStatus());
+ assertEquals(204, launcher.service("GET", "http://localhost/test/a/b/g", "http://localhost/test", null, null,
+ null).getStatus());
}
}
Property changes on: ws/branches/2.2.x/exo.ws.rest.core/src/test/java/org/exoplatform/services/rest/impl/resource/ContextParametersInjectionTest.java
___________________________________________________________________
Name: svn:keywords
+ Id
Modified: ws/branches/2.2.x/exo.ws.rest.core/src/test/java/org/exoplatform/services/rest/impl/resource/MatchedURIsAndResourcesTest.java
===================================================================
--- ws/branches/2.2.x/exo.ws.rest.core/src/test/java/org/exoplatform/services/rest/impl/resource/MatchedURIsAndResourcesTest.java 2009-11-06 17:08:38 UTC (rev 496)
+++ ws/branches/2.2.x/exo.ws.rest.core/src/test/java/org/exoplatform/services/rest/impl/resource/MatchedURIsAndResourcesTest.java 2009-11-08 13:19:25 UTC (rev 497)
@@ -18,8 +18,9 @@
*/
package org.exoplatform.services.rest.impl.resource;
-import org.exoplatform.services.rest.impl.AbstractResourceTest;
+import org.exoplatform.services.rest.impl.BaseTest;
import org.exoplatform.services.rest.impl.header.HeaderHelper;
+import org.exoplatform.services.rest.tools.ResourceLauncher;
import java.util.ArrayList;
import java.util.List;
@@ -31,9 +32,9 @@
/**
* @author <a href="mailto:andrew00x at gmail.com">Andrey Parfonov</a>
- * @version $Id: $
+ * @version $Id$
*/
-public class MatchedURIsAndResourcesTest extends AbstractResourceTest
+public class MatchedURIsAndResourcesTest extends BaseTest
{
@Path("/a/b")
@@ -110,14 +111,22 @@
}
}
+ private ResourceLauncher launcher;
+
+ public void setUp() throws Exception
+ {
+ super.setUp();
+ this.launcher = new ResourceLauncher(requestHandler);
+ }
+
public void testLevel1() throws Exception
{
Resource1 r1 = new Resource1();
registry(r1);
- assertEquals("/1,/a/b", service("GET", "http://localhost/test/a/b/1", "http://localhost/test", null, null)
- .getEntity());
- assertEquals("Resource1", service("GET", "http://localhost/test/a/b/2", "http://localhost/test", null, null)
- .getEntity());
+ assertEquals("/1,/a/b", launcher.service("GET", "http://localhost/test/a/b/1", "http://localhost/test", null,
+ null, null).getEntity());
+ assertEquals("Resource1", launcher.service("GET", "http://localhost/test/a/b/2", "http://localhost/test", null,
+ null, null).getEntity());
unregistry(r1);
}
@@ -125,10 +134,10 @@
{
Resource1 r1 = new Resource1();
registry(r1);
- assertEquals("/1,/sub,/a/b", service("GET", "http://localhost/test/a/b/sub/1", "http://localhost/test", null,
- null).getEntity());
- assertEquals("SubResource1,Resource1", service("GET", "http://localhost/test/a/b/sub/2", "http://localhost/test",
- null, null).getEntity());
+ assertEquals("/1,/sub,/a/b", launcher.service("GET", "http://localhost/test/a/b/sub/1", "http://localhost/test",
+ null, null, null).getEntity());
+ assertEquals("SubResource1,Resource1", launcher.service("GET", "http://localhost/test/a/b/sub/2",
+ "http://localhost/test", null, null, null).getEntity());
unregistry(r1);
}
@@ -136,10 +145,10 @@
{
Resource1 r1 = new Resource1();
registry(r1);
- assertEquals("/1,/sub-sub,/sub,/a/b", service("GET", "http://localhost/test/a/b/sub/sub-sub/1",
- "http://localhost/test", null, null).getEntity());
- assertEquals("SubResource2,SubResource1,Resource1", service("GET", "http://localhost/test/a/b/sub/sub-sub/2",
- "http://localhost/test", null, null).getEntity());
+ assertEquals("/1,/sub-sub,/sub,/a/b", launcher.service("GET", "http://localhost/test/a/b/sub/sub-sub/1",
+ "http://localhost/test", null, null, null).getEntity());
+ assertEquals("SubResource2,SubResource1,Resource1", launcher.service("GET",
+ "http://localhost/test/a/b/sub/sub-sub/2", "http://localhost/test", null, null, null).getEntity());
unregistry(r1);
}
}
Property changes on: ws/branches/2.2.x/exo.ws.rest.core/src/test/java/org/exoplatform/services/rest/impl/resource/MatchedURIsAndResourcesTest.java
___________________________________________________________________
Name: svn:keywords
+ Id
More information about the exo-jcr-commits
mailing list