You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by re...@apache.org on 2009/06/17 13:23:01 UTC

svn commit: r785560 - /cocoon/cocoon3/trunk/cocoon-sample-webapp/src/test/java/org/apache/cocoon/it/JAXRSTest.java

Author: reinhard
Date: Wed Jun 17 11:23:01 2009
New Revision: 785560

URL: http://svn.apache.org/viewvc?rev=785560&view=rev
Log:
the ssf-1.2 makes these test cases work

Modified:
    cocoon/cocoon3/trunk/cocoon-sample-webapp/src/test/java/org/apache/cocoon/it/JAXRSTest.java

Modified: cocoon/cocoon3/trunk/cocoon-sample-webapp/src/test/java/org/apache/cocoon/it/JAXRSTest.java
URL: http://svn.apache.org/viewvc/cocoon/cocoon3/trunk/cocoon-sample-webapp/src/test/java/org/apache/cocoon/it/JAXRSTest.java?rev=785560&r1=785559&r2=785560&view=diff
==============================================================================
--- cocoon/cocoon3/trunk/cocoon-sample-webapp/src/test/java/org/apache/cocoon/it/JAXRSTest.java (original)
+++ cocoon/cocoon3/trunk/cocoon-sample-webapp/src/test/java/org/apache/cocoon/it/JAXRSTest.java Wed Jun 17 11:23:01 2009
@@ -17,59 +17,56 @@
 package org.apache.cocoon.it;
 
 /**
- * Test the usage of servlet services in Cocoon sitemaps.
+ * Test the usage of JAX-RS services.
  */
 public class JAXRSTest extends CocoonHtmlUnitTestCase {
 
-    public void testDummy() {
+     public void test401StatusCode() throws Exception {
+        this.loadResponse("/jax-rs/sample/sax-pipeline/unauthorized");
+        int statusCode = this.response.getStatusCode();
+        assertTrue(statusCode == 401);
+
+        String lastModified = this.response.getResponseHeaderValue("Last-Modified");
+        assertNotNull(lastModified);
+        assertFalse(lastModified.equals(""));
+
+        String cocoonVersion = this.response.getResponseHeaderValue("X-Cocoon-Version");
+        assertNotNull(cocoonVersion);
+        assertFalse(cocoonVersion.equals(""));
+    }
+
+    public void test404() throws Exception {
+        this.loadResponse("/jax-rs/sample/not-exisiting");
+        int statusCode = this.response.getStatusCode();
+        assertTrue(statusCode == 404);
     }
 
-    // public void test401StatusCode() throws Exception {
-    // this.loadResponse("/jax-rs/sample/sax-pipeline/unauthorized");
-    // int statusCode = this.response.getStatusCode();
-    // assertTrue(statusCode == 401);
-    //
-    // String lastModified = this.response.getResponseHeaderValue("Last-Modified");
-    // assertNotNull(lastModified);
-    // assertFalse(lastModified.equals(""));
-    //
-    // String cocoonVersion = this.response.getResponseHeaderValue("X-Cocoon-Version");
-    // assertNotNull(cocoonVersion);
-    // assertFalse(cocoonVersion.equals(""));
-    // }
-    //
-    // public void test404() throws Exception {
-    // this.loadResponse("/jax-rs/sample/not-exisiting");
-    // int statusCode = this.response.getStatusCode();
-    // assertTrue(statusCode == 404);
-    // }
-    //
-    // public void testPassingParameters() throws Exception {
-    // this.loadXmlPage("/jax-rs/sample/parameter-passing/1?req-param=1");
-    // int statusCode = this.response.getStatusCode();
-    // assertTrue(statusCode == 200);
-    // assertEquals("text/xml", this.response.getContentType());
-    //
-    // this.assertXPath("/html/body/p[1]", "name=Donald Duck");
-    // this.assertXPath("/html/body/p[2]", "id=1");
-    // this.assertXPath("/html/body/p[3]", "reqparam=1");
-    // this.assertXPath("/html/body/p[4]", "testProperty=test");
-    // }
-    //
-    // public void testAnotherResource() throws Exception {
-    // this.loadResponse("jax-rs/sample2/read/javascript-resource-implicit.js");
-    // assertTrue(this.response.getStatusCode() == 200);
-    // assertEquals(this.response.getContentType(), "application/x-javascript");
-    // }
-    //
-    // public void testConditionalGet() throws Exception {
-    // this.loadResponse("jax-rs/sample2/read/javascript-resource-implicit.js");
-    // String lastModified = this.response.getResponseHeaderValue("Last-Modified");
-    // assertNotNull("Last-Modified has to be set at this point!", lastModified);
-    // assertFalse("Last-Modified has to be set at this point!", "".equals(lastModified));
-    //
-    // this.webClient.addRequestHeader("If-Modified-Since", lastModified);
-    // this.loadResponse("read/javascript-resource-implicit.js");
-    // assertEquals(304, this.response.getStatusCode());
-    // }
+    public void testPassingParameters() throws Exception {
+        this.loadXmlPage("/jax-rs/sample/parameter-passing/1?req-param=1");
+        int statusCode = this.response.getStatusCode();
+        assertTrue(statusCode == 202);
+        assertEquals("text/xml", this.response.getContentType());
+
+        this.assertXPath("/html/body/p[1]", "name=Donald Duck");
+        this.assertXPath("/html/body/p[2]", "id=1");
+        this.assertXPath("/html/body/p[3]", "reqparam=1");
+        this.assertXPath("/html/body/p[4]", "testProperty=test");
+    }
+
+    public void testAnotherResource() throws Exception {
+        this.loadResponse("jax-rs/sample2/read/javascript-resource-implicit.js");
+        assertTrue(this.response.getStatusCode() == 200);
+        assertEquals(this.response.getContentType(), "application/x-javascript");
+    }
+
+    public void testConditionalGet() throws Exception {
+        this.loadResponse("jax-rs/sample2/read/javascript-resource-implicit.js");
+        String lastModified = this.response.getResponseHeaderValue("Last-Modified");
+        assertNotNull("Last-Modified has to be set at this point!", lastModified);
+        assertFalse("Last-Modified has to be set at this point!", "".equals(lastModified));
+
+        this.webClient.addRequestHeader("If-Modified-Since", lastModified);
+        this.loadResponse("read/javascript-resource-implicit.js");
+        assertEquals(304, this.response.getStatusCode());
+    }
 }