Author: jharting
Date: 2009-12-11 08:18:27 -0500 (Fri, 11 Dec 2009)
New Revision: 11810
Added:
branches/community/Seam_2_2/examples/restbay/src/org/jboss/seam/example/restbay/resteasy/subresource/
branches/community/Seam_2_2/examples/restbay/src/org/jboss/seam/example/restbay/resteasy/subresource/Garage.java
branches/community/Seam_2_2/examples/restbay/src/org/jboss/seam/example/restbay/resteasy/subresource/Vehicle.java
branches/community/Seam_2_2/examples/restbay/src/org/jboss/seam/example/restbay/test/SubresourceTest.java
Modified:
branches/community/Seam_2_2/examples/restbay/src/org/jboss/seam/example/restbay/test/testng.xml
Log:
Testcase for JBSEAM-4039
Added:
branches/community/Seam_2_2/examples/restbay/src/org/jboss/seam/example/restbay/resteasy/subresource/Garage.java
===================================================================
---
branches/community/Seam_2_2/examples/restbay/src/org/jboss/seam/example/restbay/resteasy/subresource/Garage.java
(rev 0)
+++
branches/community/Seam_2_2/examples/restbay/src/org/jboss/seam/example/restbay/resteasy/subresource/Garage.java 2009-12-11
13:18:27 UTC (rev 11810)
@@ -0,0 +1,24 @@
+package org.jboss.seam.example.restbay.resteasy.subresource;
+
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+
+import org.jboss.seam.Component;
+import org.jboss.seam.annotations.Name;
+
+@Path("/garage")
+@Produces("text/plain")
+@Name("garage")
+public class Garage
+{
+ @GET
+ public String getInfo() {
+ return "garage";
+ }
+
+ @Path("/1")
+ public Vehicle getVehicle() {
+ return (Vehicle) Component.getInstance(Vehicle.class);
+ }
+}
Added:
branches/community/Seam_2_2/examples/restbay/src/org/jboss/seam/example/restbay/resteasy/subresource/Vehicle.java
===================================================================
---
branches/community/Seam_2_2/examples/restbay/src/org/jboss/seam/example/restbay/resteasy/subresource/Vehicle.java
(rev 0)
+++
branches/community/Seam_2_2/examples/restbay/src/org/jboss/seam/example/restbay/resteasy/subresource/Vehicle.java 2009-12-11
13:18:27 UTC (rev 11810)
@@ -0,0 +1,16 @@
+package org.jboss.seam.example.restbay.resteasy.subresource;
+
+import javax.ws.rs.GET;
+import javax.ws.rs.Produces;
+
+import org.jboss.seam.annotations.Name;
+
+@Name("vehicle")
+@Produces("text/plain")
+public class Vehicle
+{
+ @GET
+ public String getInfo() {
+ return "Honda";
+ }
+}
Added:
branches/community/Seam_2_2/examples/restbay/src/org/jboss/seam/example/restbay/test/SubresourceTest.java
===================================================================
---
branches/community/Seam_2_2/examples/restbay/src/org/jboss/seam/example/restbay/test/SubresourceTest.java
(rev 0)
+++
branches/community/Seam_2_2/examples/restbay/src/org/jboss/seam/example/restbay/test/SubresourceTest.java 2009-12-11
13:18:27 UTC (rev 11810)
@@ -0,0 +1,39 @@
+package org.jboss.seam.example.restbay.test;
+
+import static org.testng.Assert.assertEquals;
+
+import org.jboss.seam.mock.EnhancedMockHttpServletRequest;
+import org.jboss.seam.mock.EnhancedMockHttpServletResponse;
+import org.jboss.seam.mock.ResourceRequestEnvironment;
+import org.jboss.seam.mock.SeamTest;
+import org.jboss.seam.mock.ResourceRequestEnvironment.Method;
+import org.jboss.seam.mock.ResourceRequestEnvironment.ResourceRequest;
+import org.testng.annotations.Test;
+
+public class SubresourceTest extends SeamTest
+{
+ @Test
+ public void testResourceHomeRead() throws Exception
+ {
+ final String path = "/restv1/garage/1";
+
+ new ResourceRequest(new ResourceRequestEnvironment(this), Method.GET, path)
+ {
+
+ @Override
+ protected void prepareRequest(EnhancedMockHttpServletRequest request)
+ {
+ super.prepareRequest(request);
+ request.addHeader("Accept", "text/plain");
+ }
+
+ @Override
+ protected void onResponse(EnhancedMockHttpServletResponse response)
+ {
+ assertEquals(response.getStatus(), 200, "Unexpected response
code.");
+ assertEquals(response.getContentAsString(), "Honda",
"Unexpected response.");
+ }
+
+ }.run();
+ }
+}
Modified:
branches/community/Seam_2_2/examples/restbay/src/org/jboss/seam/example/restbay/test/testng.xml
===================================================================
---
branches/community/Seam_2_2/examples/restbay/src/org/jboss/seam/example/restbay/test/testng.xml 2009-12-11
11:25:57 UTC (rev 11809)
+++
branches/community/Seam_2_2/examples/restbay/src/org/jboss/seam/example/restbay/test/testng.xml 2009-12-11
13:18:27 UTC (rev 11810)
@@ -31,6 +31,14 @@
<class name="org.jboss.seam.example.restbay.test.SecurityTest"/>
</classes>
</test>
+
+ <!-- JBSEAM-4039
+ <test name="RestBay Subresources">
+ <classes>
+ <class
name="org.jboss.seam.example.restbay.test.SubresourceTest"/>
+ </classes>
+ </test>
+ -->
<test name="RestBay DBUnit Integration">