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 2008/03/19 10:40:59 UTC

svn commit: r638762 - in /cocoon/trunk/core/cocoon-webapp: ./ src/test/java/org/apache/cocoon/it/sitemap/

Author: reinhard
Date: Wed Mar 19 02:40:52 2008
New Revision: 638762

URL: http://svn.apache.org/viewvc?rev=638762&view=rev
Log:
. add dependency on cocoon-it
. add integration tests for sitemap and pipeline usage

Added:
    cocoon/trunk/core/cocoon-webapp/src/test/java/org/apache/cocoon/it/sitemap/
    cocoon/trunk/core/cocoon-webapp/src/test/java/org/apache/cocoon/it/sitemap/AggregationTest.java   (with props)
    cocoon/trunk/core/cocoon-webapp/src/test/java/org/apache/cocoon/it/sitemap/CachingOfPipelinesTest.java   (with props)
    cocoon/trunk/core/cocoon-webapp/src/test/java/org/apache/cocoon/it/sitemap/ControllerTest.java   (with props)
    cocoon/trunk/core/cocoon-webapp/src/test/java/org/apache/cocoon/it/sitemap/ErrorHandlingTest.java   (with props)
    cocoon/trunk/core/cocoon-webapp/src/test/java/org/apache/cocoon/it/sitemap/ExpressionLanguageTest.java   (with props)
    cocoon/trunk/core/cocoon-webapp/src/test/java/org/apache/cocoon/it/sitemap/ObjectModelTest.java   (with props)
    cocoon/trunk/core/cocoon-webapp/src/test/java/org/apache/cocoon/it/sitemap/ParameterPassing.java   (with props)
    cocoon/trunk/core/cocoon-webapp/src/test/java/org/apache/cocoon/it/sitemap/ReaderTest.java   (with props)
    cocoon/trunk/core/cocoon-webapp/src/test/java/org/apache/cocoon/it/sitemap/RedirectTest.java   (with props)
    cocoon/trunk/core/cocoon-webapp/src/test/java/org/apache/cocoon/it/sitemap/SaxPipelineTest.java   (with props)
    cocoon/trunk/core/cocoon-webapp/src/test/java/org/apache/cocoon/it/sitemap/SerletScopeTest.java   (with props)
    cocoon/trunk/core/cocoon-webapp/src/test/java/org/apache/cocoon/it/sitemap/ServletServiceTest.java   (with props)
    cocoon/trunk/core/cocoon-webapp/src/test/java/org/apache/cocoon/it/sitemap/XSLTTest.java   (with props)
Modified:
    cocoon/trunk/core/cocoon-webapp/pom.xml

Modified: cocoon/trunk/core/cocoon-webapp/pom.xml
URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-webapp/pom.xml?rev=638762&r1=638761&r2=638762&view=diff
==============================================================================
--- cocoon/trunk/core/cocoon-webapp/pom.xml (original)
+++ cocoon/trunk/core/cocoon-webapp/pom.xml Wed Mar 19 02:40:52 2008
@@ -110,6 +110,12 @@
     <!-- Integration Tests -->
     <dependency>
       <groupId>org.apache.cocoon</groupId>
+      <artifactId>cocoon-it</artifactId>
+    </dependency>
+
+    <!-- Integration Test Framework -->
+    <dependency>
+      <groupId>org.apache.cocoon</groupId>
       <artifactId>cocoon-it-fw</artifactId>
       <scope>test</scope>
     </dependency>

Added: cocoon/trunk/core/cocoon-webapp/src/test/java/org/apache/cocoon/it/sitemap/AggregationTest.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-webapp/src/test/java/org/apache/cocoon/it/sitemap/AggregationTest.java?rev=638762&view=auto
==============================================================================
--- cocoon/trunk/core/cocoon-webapp/src/test/java/org/apache/cocoon/it/sitemap/AggregationTest.java (added)
+++ cocoon/trunk/core/cocoon-webapp/src/test/java/org/apache/cocoon/it/sitemap/AggregationTest.java Wed Mar 19 02:40:52 2008
@@ -0,0 +1,38 @@
+package org.apache.cocoon.it.sitemap;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.apache.cocoon.tools.it.HtmlUnitTestCase;
+
+/**
+ * Test aggregation.
+ */
+public class AggregationTest extends HtmlUnitTestCase {
+
+    /**
+     * A pipeline that uses the IncludeTransformer.
+     */
+    public void testIncludeTransformer() throws Exception {
+        this.loadXmlPage("/cocoon-it/aggregation/include-transformer");
+        assertTrue(this.response.getStatusCode() == 200);
+        assertEquals("text/xml", this.response.getContentType());
+        assertXPath("/sample/sub/text()", "sub");
+    }
+
+
+}

Propchange: cocoon/trunk/core/cocoon-webapp/src/test/java/org/apache/cocoon/it/sitemap/AggregationTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cocoon/trunk/core/cocoon-webapp/src/test/java/org/apache/cocoon/it/sitemap/AggregationTest.java
------------------------------------------------------------------------------
    svn:keywords = Id

Propchange: cocoon/trunk/core/cocoon-webapp/src/test/java/org/apache/cocoon/it/sitemap/AggregationTest.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: cocoon/trunk/core/cocoon-webapp/src/test/java/org/apache/cocoon/it/sitemap/CachingOfPipelinesTest.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-webapp/src/test/java/org/apache/cocoon/it/sitemap/CachingOfPipelinesTest.java?rev=638762&view=auto
==============================================================================
--- cocoon/trunk/core/cocoon-webapp/src/test/java/org/apache/cocoon/it/sitemap/CachingOfPipelinesTest.java (added)
+++ cocoon/trunk/core/cocoon-webapp/src/test/java/org/apache/cocoon/it/sitemap/CachingOfPipelinesTest.java Wed Mar 19 02:40:52 2008
@@ -0,0 +1,53 @@
+package org.apache.cocoon.it.sitemap;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.apache.cocoon.tools.it.HtmlUnitTestCase;
+
+/**
+ * Test pipeline caching
+ */
+public class CachingOfPipelinesTest extends HtmlUnitTestCase {
+
+    /**
+     * A non-caching pipeline mustn't produce the same result twice.
+     */
+    public void testNonCachingPipeline() throws Exception {
+        this.loadResponse("/cocoon-it/caching-pipeline/off");
+        String content1 = this.response.getContentAsString();
+        assertNotNull(content1);
+        this.loadResponse("/cocoon-it/caching-pipeline/off");
+        String content2 = this.response.getContentAsString();
+        assertNotNull(content2);
+        assertFalse("The response has to change with every request.", content1.equals(content2));
+    }
+
+    /**
+     * This caching pipeline always returns the same.
+     */
+    public void testCachingPipeline() throws Exception {
+        this.loadResponse("/cocoon-it/caching-pipeline/on");
+        String content1 = this.response.getContentAsString();
+        assertNotNull(content1);
+        this.loadResponse("/cocoon-it/caching-pipeline/on");
+        String content2 = this.response.getContentAsString();
+        assertNotNull(content2);
+        assertTrue("The response has to be always the same.", content1.equals(content2));
+    }
+
+}

Propchange: cocoon/trunk/core/cocoon-webapp/src/test/java/org/apache/cocoon/it/sitemap/CachingOfPipelinesTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cocoon/trunk/core/cocoon-webapp/src/test/java/org/apache/cocoon/it/sitemap/CachingOfPipelinesTest.java
------------------------------------------------------------------------------
    svn:keywords = Id

Propchange: cocoon/trunk/core/cocoon-webapp/src/test/java/org/apache/cocoon/it/sitemap/CachingOfPipelinesTest.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: cocoon/trunk/core/cocoon-webapp/src/test/java/org/apache/cocoon/it/sitemap/ControllerTest.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-webapp/src/test/java/org/apache/cocoon/it/sitemap/ControllerTest.java?rev=638762&view=auto
==============================================================================
--- cocoon/trunk/core/cocoon-webapp/src/test/java/org/apache/cocoon/it/sitemap/ControllerTest.java (added)
+++ cocoon/trunk/core/cocoon-webapp/src/test/java/org/apache/cocoon/it/sitemap/ControllerTest.java Wed Mar 19 02:40:52 2008
@@ -0,0 +1,43 @@
+package org.apache.cocoon.it.sitemap;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.apache.cocoon.tools.it.HtmlUnitTestCase;
+
+/**
+ * Test controller.
+ */
+public class ControllerTest extends HtmlUnitTestCase {
+
+    /**
+     * Passing on to a controller.
+     */
+    public void testControllerInvocation() throws Exception {
+        this.loadResponse("/cocoon-it/controller/invoke");
+        assertTrue(this.response.getStatusCode() == 201);
+    }
+
+    /**
+     * Continue controller execution.
+     */
+    public void testContinuingController() throws Exception {
+        this.loadResponse("/cocoon-it/controller/continue");
+        assertTrue(this.response.getStatusCode() == 202);
+    }
+
+}

Propchange: cocoon/trunk/core/cocoon-webapp/src/test/java/org/apache/cocoon/it/sitemap/ControllerTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cocoon/trunk/core/cocoon-webapp/src/test/java/org/apache/cocoon/it/sitemap/ControllerTest.java
------------------------------------------------------------------------------
    svn:keywords = Id

Propchange: cocoon/trunk/core/cocoon-webapp/src/test/java/org/apache/cocoon/it/sitemap/ControllerTest.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: cocoon/trunk/core/cocoon-webapp/src/test/java/org/apache/cocoon/it/sitemap/ErrorHandlingTest.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-webapp/src/test/java/org/apache/cocoon/it/sitemap/ErrorHandlingTest.java?rev=638762&view=auto
==============================================================================
--- cocoon/trunk/core/cocoon-webapp/src/test/java/org/apache/cocoon/it/sitemap/ErrorHandlingTest.java (added)
+++ cocoon/trunk/core/cocoon-webapp/src/test/java/org/apache/cocoon/it/sitemap/ErrorHandlingTest.java Wed Mar 19 02:40:52 2008
@@ -0,0 +1,60 @@
+package org.apache.cocoon.it.sitemap;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.apache.cocoon.tools.it.HtmlUnitTestCase;
+
+/**
+ * Test error handling of sitemaps.
+ */
+public class ErrorHandlingTest extends HtmlUnitTestCase {
+
+    /**
+     * If no pipeline matches, the error handling section gets activated.
+     */
+    public void testPerSitemap404() throws Exception {
+        // load this resource twice because the first time when a pipeline that
+        // doesn't set the status code 200, is being invoked, 200 is returned
+        this.loadResponse("/cocoon-it/12345678901234567890");
+        this.loadResponse("/cocoon-it/12345678901234567890");
+        int statusCode = this.response.getStatusCode();
+        assertTrue(statusCode == 404);
+        assertTrue(this.response.getContentAsString().indexOf("404 Resource Not Available (Cocoon Integration Tests)") > 0);
+    }
+
+    public void testPerSitemapCustomError() throws Exception {
+        // load this resource twice because the first time when a pipeline that
+        // doesn't set the status code 200, is being invoked, 200 is returned
+        this.loadResponse("/cocoon-it/error-handling/custom-error");
+        this.loadResponse("/cocoon-it/error-handling/custom-error");
+        int statusCode = this.response.getStatusCode();
+        assertTrue(statusCode == 500);
+        assertTrue(this.response.getContentAsString().indexOf("Error 500 (Cocoon Integration Tests)") > 0);
+    }
+
+    public void testPerPipelineCustomError() throws Exception {
+        // load this resource twice because the first time when a pipeline that
+        // doesn't set the status code 200, is being invoked, 200 is returned
+        this.loadResponse("/cocoon-it/error-handling/custom-error-per-pipeline-error-handling");
+        this.loadResponse("/cocoon-it/error-handling/custom-error-per-pipeline-error-handling");
+        int statusCode = this.response.getStatusCode();
+        assertTrue(statusCode == 501);
+        assertTrue(this.response.getContentAsString().indexOf("Error 501 (Cocoon Integration Tests)") > 0);
+    }
+
+}

Propchange: cocoon/trunk/core/cocoon-webapp/src/test/java/org/apache/cocoon/it/sitemap/ErrorHandlingTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cocoon/trunk/core/cocoon-webapp/src/test/java/org/apache/cocoon/it/sitemap/ErrorHandlingTest.java
------------------------------------------------------------------------------
    svn:keywords = Id

Propchange: cocoon/trunk/core/cocoon-webapp/src/test/java/org/apache/cocoon/it/sitemap/ErrorHandlingTest.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: cocoon/trunk/core/cocoon-webapp/src/test/java/org/apache/cocoon/it/sitemap/ExpressionLanguageTest.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-webapp/src/test/java/org/apache/cocoon/it/sitemap/ExpressionLanguageTest.java?rev=638762&view=auto
==============================================================================
--- cocoon/trunk/core/cocoon-webapp/src/test/java/org/apache/cocoon/it/sitemap/ExpressionLanguageTest.java (added)
+++ cocoon/trunk/core/cocoon-webapp/src/test/java/org/apache/cocoon/it/sitemap/ExpressionLanguageTest.java Wed Mar 19 02:40:52 2008
@@ -0,0 +1,67 @@
+package org.apache.cocoon.it.sitemap;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.apache.cocoon.tools.it.HtmlUnitTestCase;
+
+/**
+ * Test expression language usage
+ */
+public class ExpressionLanguageTest extends HtmlUnitTestCase {
+
+    /**
+     * JEXL test
+     */
+    public void testJexl() throws Exception {
+        this.loadXmlPage("/cocoon-it/expression-language/jexl?fileName=simple");
+        assertTrue(this.response.getStatusCode() == 200);
+        assertEquals("text/xml", this.response.getContentType());
+        assertXPath("/simple", "simple-text");
+    }
+
+    /**
+     * JXPath test
+     */
+    public void testJXPath() throws Exception {
+        this.loadXmlPage("/cocoon-it/expression-language/jxpath?fileName=simple");
+        assertTrue(this.response.getStatusCode() == 200);
+        assertEquals("text/xml", this.response.getContentType());
+        assertXPath("/simple", "simple-text");
+    }
+
+    /**
+     * Map language test
+     */
+    public void testMap() throws Exception {
+        this.loadXmlPage("/cocoon-it/expression-language/map/simple");
+        assertTrue(this.response.getStatusCode() == 200);
+        assertEquals("text/xml", this.response.getContentType());
+        assertXPath("/simple", "simple-text");
+    }
+
+    /**
+     * Nested matchers/maps
+     */
+    public void testNextedMap() throws Exception {
+        this.loadXmlPage("/cocoon-it/expression-language/nested/simple");
+        assertTrue(this.response.getStatusCode() == 200);
+        assertEquals("text/xml", this.response.getContentType());
+        assertXPath("/simple", "simple-text");
+    }
+
+}

Propchange: cocoon/trunk/core/cocoon-webapp/src/test/java/org/apache/cocoon/it/sitemap/ExpressionLanguageTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cocoon/trunk/core/cocoon-webapp/src/test/java/org/apache/cocoon/it/sitemap/ExpressionLanguageTest.java
------------------------------------------------------------------------------
    svn:keywords = Id

Propchange: cocoon/trunk/core/cocoon-webapp/src/test/java/org/apache/cocoon/it/sitemap/ExpressionLanguageTest.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: cocoon/trunk/core/cocoon-webapp/src/test/java/org/apache/cocoon/it/sitemap/ObjectModelTest.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-webapp/src/test/java/org/apache/cocoon/it/sitemap/ObjectModelTest.java?rev=638762&view=auto
==============================================================================
--- cocoon/trunk/core/cocoon-webapp/src/test/java/org/apache/cocoon/it/sitemap/ObjectModelTest.java (added)
+++ cocoon/trunk/core/cocoon-webapp/src/test/java/org/apache/cocoon/it/sitemap/ObjectModelTest.java Wed Mar 19 02:40:52 2008
@@ -0,0 +1,39 @@
+package org.apache.cocoon.it.sitemap;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.apache.cocoon.tools.it.HtmlUnitTestCase;
+import org.custommonkey.xmlunit.Diff;
+
+/**
+ * Test accessing the object model.
+ */
+public class ObjectModelTest extends HtmlUnitTestCase {
+
+    /**
+     * Accessing all request parameters from within a generator.
+     */
+    public void testTemporaryRedirect() throws Exception {
+        this.loadResponse("/cocoon-it/object-model/request-parameters?a=1&b=2&c=3");
+        assertEquals(200, this.response.getStatusCode());
+        String content = this.response.getContentAsString();
+        String expectedContent = "<?xml version=\"1.0\"?><request-paramters><a>1</a><c>3</c><b>2</b></request-paramters>";
+        assertTrue(new Diff(expectedContent, content).similar());
+    }
+
+}

Propchange: cocoon/trunk/core/cocoon-webapp/src/test/java/org/apache/cocoon/it/sitemap/ObjectModelTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cocoon/trunk/core/cocoon-webapp/src/test/java/org/apache/cocoon/it/sitemap/ObjectModelTest.java
------------------------------------------------------------------------------
    svn:keywords = Id

Propchange: cocoon/trunk/core/cocoon-webapp/src/test/java/org/apache/cocoon/it/sitemap/ObjectModelTest.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: cocoon/trunk/core/cocoon-webapp/src/test/java/org/apache/cocoon/it/sitemap/ParameterPassing.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-webapp/src/test/java/org/apache/cocoon/it/sitemap/ParameterPassing.java?rev=638762&view=auto
==============================================================================
--- cocoon/trunk/core/cocoon-webapp/src/test/java/org/apache/cocoon/it/sitemap/ParameterPassing.java (added)
+++ cocoon/trunk/core/cocoon-webapp/src/test/java/org/apache/cocoon/it/sitemap/ParameterPassing.java Wed Mar 19 02:40:52 2008
@@ -0,0 +1,47 @@
+package org.apache.cocoon.it.sitemap;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.apache.cocoon.tools.it.HtmlUnitTestCase;
+
+/**
+ * Test passing parameters.
+ */
+public class ParameterPassing extends HtmlUnitTestCase {
+
+    /**
+     * Passing parameters from a matcher to the sitemap.
+     */
+    public void testPassingParamatersFromMatcherToSitemap() throws Exception {
+        this.loadXmlPage("/cocoon-it/parameter-passing/working");
+        assertTrue(this.response.getStatusCode() == 200);
+        assertEquals("text/xml", this.response.getContentType());
+        assertXPath("/simple", "simple-text");
+    }
+
+    /**
+     * Passing null from a matcher to the sitemap (-> doesn't match)
+     */
+    public void testPassingNullMatcherToSitemap() throws Exception {
+        this.webClient.setThrowExceptionOnFailingStatusCode(false);
+        this.loadResponse("/cocoon-it/parameter-passing/failing");
+        this.loadResponse("/cocoon-it/parameter-passing/failing");
+        assertTrue(this.response.getStatusCode() == 404);
+    }
+
+}

Propchange: cocoon/trunk/core/cocoon-webapp/src/test/java/org/apache/cocoon/it/sitemap/ParameterPassing.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cocoon/trunk/core/cocoon-webapp/src/test/java/org/apache/cocoon/it/sitemap/ParameterPassing.java
------------------------------------------------------------------------------
    svn:keywords = Id

Propchange: cocoon/trunk/core/cocoon-webapp/src/test/java/org/apache/cocoon/it/sitemap/ParameterPassing.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: cocoon/trunk/core/cocoon-webapp/src/test/java/org/apache/cocoon/it/sitemap/ReaderTest.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-webapp/src/test/java/org/apache/cocoon/it/sitemap/ReaderTest.java?rev=638762&view=auto
==============================================================================
--- cocoon/trunk/core/cocoon-webapp/src/test/java/org/apache/cocoon/it/sitemap/ReaderTest.java (added)
+++ cocoon/trunk/core/cocoon-webapp/src/test/java/org/apache/cocoon/it/sitemap/ReaderTest.java Wed Mar 19 02:40:52 2008
@@ -0,0 +1,57 @@
+package org.apache.cocoon.it.sitemap;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.apache.cocoon.tools.it.HtmlUnitTestCase;
+
+/**
+ * Test readers
+ */
+public class ReaderTest extends HtmlUnitTestCase {
+
+	/**
+	 * Call a pipeline that explicitly sets the mime-type of the resource.
+	 */
+    public void testReadingResourceWithExplicitMimeType() throws Exception {
+        this.loadResponse("/cocoon-it/read/javascript-resource-explicit");
+        assertTrue(this.response.getStatusCode() == 200);
+        assertEquals("text/javascript", this.response.getContentType());
+        assertEquals("853", this.response.getResponseHeaderValue("Content-Length"));
+    }
+
+    /**
+     * Call a pipeline that automatically sets the mime-type of the resource.
+     */
+    public void testReadingResourceWithImplicitMimeType() throws Exception {
+    	this.loadResponse("/cocoon-it/read/javascript-resource-implicit");
+    	assertTrue(this.response.getStatusCode() == 200);
+    	assertEquals("application/x-javascript", this.response.getContentType());
+    }
+
+    /**
+     * A resource reader supports conditional gets.
+     */
+    public void testConditionalGet() throws Exception {
+    	this.loadResponse("/cocoon-it/read/javascript-resource-implicit");
+    	String lastModified = this.response.getResponseHeaderValue("Last-Modified");
+    	this.webClient.addRequestHeader("If-Modified-Since", lastModified);
+    	this.loadResponse("/cocoon-it/read/javascript-resource-implicit");
+    	assertEquals(304, this.response.getStatusCode());
+    }
+
+}

Propchange: cocoon/trunk/core/cocoon-webapp/src/test/java/org/apache/cocoon/it/sitemap/ReaderTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cocoon/trunk/core/cocoon-webapp/src/test/java/org/apache/cocoon/it/sitemap/ReaderTest.java
------------------------------------------------------------------------------
    svn:keywords = Id

Propchange: cocoon/trunk/core/cocoon-webapp/src/test/java/org/apache/cocoon/it/sitemap/ReaderTest.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: cocoon/trunk/core/cocoon-webapp/src/test/java/org/apache/cocoon/it/sitemap/RedirectTest.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-webapp/src/test/java/org/apache/cocoon/it/sitemap/RedirectTest.java?rev=638762&view=auto
==============================================================================
--- cocoon/trunk/core/cocoon-webapp/src/test/java/org/apache/cocoon/it/sitemap/RedirectTest.java (added)
+++ cocoon/trunk/core/cocoon-webapp/src/test/java/org/apache/cocoon/it/sitemap/RedirectTest.java Wed Mar 19 02:40:52 2008
@@ -0,0 +1,36 @@
+package org.apache.cocoon.it.sitemap;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.apache.cocoon.tools.it.HtmlUnitTestCase;
+
+/**
+ * Test redirecting
+ */
+public class RedirectTest extends HtmlUnitTestCase {
+
+    /**
+     * A temporary redirect
+     */
+    public void testTemporaryRedirect() throws Exception {
+        this.loadResponse("/cocoon-it/redirect/www.orf.at");
+        assertEquals(302, this.response.getStatusCode());
+        assertEquals("http://www.orf.at", this.response.getResponseHeaderValue("Location"));
+    }
+
+}

Propchange: cocoon/trunk/core/cocoon-webapp/src/test/java/org/apache/cocoon/it/sitemap/RedirectTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cocoon/trunk/core/cocoon-webapp/src/test/java/org/apache/cocoon/it/sitemap/RedirectTest.java
------------------------------------------------------------------------------
    svn:keywords = Id

Propchange: cocoon/trunk/core/cocoon-webapp/src/test/java/org/apache/cocoon/it/sitemap/RedirectTest.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: cocoon/trunk/core/cocoon-webapp/src/test/java/org/apache/cocoon/it/sitemap/SaxPipelineTest.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-webapp/src/test/java/org/apache/cocoon/it/sitemap/SaxPipelineTest.java?rev=638762&view=auto
==============================================================================
--- cocoon/trunk/core/cocoon-webapp/src/test/java/org/apache/cocoon/it/sitemap/SaxPipelineTest.java (added)
+++ cocoon/trunk/core/cocoon-webapp/src/test/java/org/apache/cocoon/it/sitemap/SaxPipelineTest.java Wed Mar 19 02:40:52 2008
@@ -0,0 +1,73 @@
+package org.apache.cocoon.it.sitemap;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.apache.cocoon.tools.it.HtmlUnitTestCase;
+
+/**
+ * Test SAX Pipelines
+ */
+public class SaxPipelineTest extends HtmlUnitTestCase {
+
+    /**
+     * A simple pipeline that produces an HTML document.
+     */
+    public void testSimplePipeline() throws Exception {
+        this.loadResponse("/cocoon-it/sax-pipeline/simple");
+        assertTrue(this.response.getStatusCode() == 200);
+        assertEquals("text/html", this.response.getContentType());
+        assertTrue(this.response.getContentAsString().indexOf("-//W3C//DTD XHTML 1.0 Strict//EN") == -1);
+    }
+
+    /**
+     * A simple pipeline that produces an XHTML 1.0 document. This implicitly
+     * tests if the configuration of serializers works properly.
+     */
+    public void testSimplePipelineXhtml() throws Exception {
+        this.loadResponse("/cocoon-it/sax-pipeline/simple-xhtml");
+        assertTrue(this.response.getStatusCode() == 200);
+        assertEquals("text/html", this.response.getContentType());
+        assertTrue(this.response.getContentAsString().indexOf("-//W3C//DTD XHTML 1.0 Strict//EN") > 0);
+    }
+
+    /**
+     * A parameter is passed to an XSLT transformer.
+     */
+    public void testSimplePipelineParameterPassingToTransformer() throws Exception {
+        this.loadXmlPage("/cocoon-it/sax-pipeline/simple-xml");
+        assertTrue(this.response.getStatusCode() == 200);
+        assertEquals("text/xml", this.response.getContentType());
+        assertXPath("/html/body/p", "3");
+    }
+
+    /**
+     * A status code is set explicitly at a serializer.
+     */
+    public void testSettingStatusCode() throws Exception {
+        // load this resource twice because the first time when a pipeline that
+        // doesn't set the status code 200, is being invoked, 200 is returned
+        this.loadResponse("/cocoon-it/sax-pipeline/unauthorized");
+        this.loadResponse("/cocoon-it/sax-pipeline/unauthorized");
+        int statusCode = this.response.getStatusCode();
+        assertTrue(statusCode == 401);
+        String lastModified = this.response.getResponseHeaderValue("Last-Modified");
+        assertNotNull(lastModified);
+        assertFalse(lastModified.equals(""));
+    }
+
+}

Propchange: cocoon/trunk/core/cocoon-webapp/src/test/java/org/apache/cocoon/it/sitemap/SaxPipelineTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cocoon/trunk/core/cocoon-webapp/src/test/java/org/apache/cocoon/it/sitemap/SaxPipelineTest.java
------------------------------------------------------------------------------
    svn:keywords = Id

Propchange: cocoon/trunk/core/cocoon-webapp/src/test/java/org/apache/cocoon/it/sitemap/SaxPipelineTest.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: cocoon/trunk/core/cocoon-webapp/src/test/java/org/apache/cocoon/it/sitemap/SerletScopeTest.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-webapp/src/test/java/org/apache/cocoon/it/sitemap/SerletScopeTest.java?rev=638762&view=auto
==============================================================================
--- cocoon/trunk/core/cocoon-webapp/src/test/java/org/apache/cocoon/it/sitemap/SerletScopeTest.java (added)
+++ cocoon/trunk/core/cocoon-webapp/src/test/java/org/apache/cocoon/it/sitemap/SerletScopeTest.java Wed Mar 19 02:40:52 2008
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.cocoon.it.sitemap;
+
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.cocoon.tools.it.HtmlUnitTestCase;
+
+public class SerletScopeTest extends HtmlUnitTestCase {
+
+    public void testServletScope() throws Exception {
+        this.loadResponse("/cocoon-it/demo1/setCode?code=300");
+        assertEquals(HttpServletResponse.SC_OK, this.response.getStatusCode());
+        this.loadResponse("/cocoon-it/demo2/setCode?code=301");
+        assertEquals(HttpServletResponse.SC_OK, this.response.getStatusCode());
+
+        this.loadResponse("/cocoon-it/demo1/getCode");
+        assertEquals(300, this.response.getStatusCode());
+        this.loadResponse("/cocoon-it/demo2/getCode");
+        assertEquals(301, this.response.getStatusCode());
+    }
+}

Propchange: cocoon/trunk/core/cocoon-webapp/src/test/java/org/apache/cocoon/it/sitemap/SerletScopeTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cocoon/trunk/core/cocoon-webapp/src/test/java/org/apache/cocoon/it/sitemap/SerletScopeTest.java
------------------------------------------------------------------------------
    svn:keywords = Id

Propchange: cocoon/trunk/core/cocoon-webapp/src/test/java/org/apache/cocoon/it/sitemap/SerletScopeTest.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: cocoon/trunk/core/cocoon-webapp/src/test/java/org/apache/cocoon/it/sitemap/ServletServiceTest.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-webapp/src/test/java/org/apache/cocoon/it/sitemap/ServletServiceTest.java?rev=638762&view=auto
==============================================================================
--- cocoon/trunk/core/cocoon-webapp/src/test/java/org/apache/cocoon/it/sitemap/ServletServiceTest.java (added)
+++ cocoon/trunk/core/cocoon-webapp/src/test/java/org/apache/cocoon/it/sitemap/ServletServiceTest.java Wed Mar 19 02:40:52 2008
@@ -0,0 +1,37 @@
+package org.apache.cocoon.it.sitemap;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.apache.cocoon.tools.it.HtmlUnitTestCase;
+
+/**
+ * Test the usage of servlet services in Cocoon sitemaps.
+ */
+public class ServletServiceTest extends HtmlUnitTestCase {
+
+    /**
+     * A parameter is passed to an XSLT transformer.
+     */
+    public void testSimplePipelineParameterPassingToTransformer() throws Exception {
+        this.loadXmlPage("/cocoon-it/ssf/local");
+        assertTrue(this.response.getStatusCode() == 200);
+        assertEquals("text/xml", this.response.getContentType());
+        assertXPath("/html/body/p", "3");
+    }
+
+}

Propchange: cocoon/trunk/core/cocoon-webapp/src/test/java/org/apache/cocoon/it/sitemap/ServletServiceTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cocoon/trunk/core/cocoon-webapp/src/test/java/org/apache/cocoon/it/sitemap/ServletServiceTest.java
------------------------------------------------------------------------------
    svn:keywords = Id

Propchange: cocoon/trunk/core/cocoon-webapp/src/test/java/org/apache/cocoon/it/sitemap/ServletServiceTest.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: cocoon/trunk/core/cocoon-webapp/src/test/java/org/apache/cocoon/it/sitemap/XSLTTest.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-webapp/src/test/java/org/apache/cocoon/it/sitemap/XSLTTest.java?rev=638762&view=auto
==============================================================================
--- cocoon/trunk/core/cocoon-webapp/src/test/java/org/apache/cocoon/it/sitemap/XSLTTest.java (added)
+++ cocoon/trunk/core/cocoon-webapp/src/test/java/org/apache/cocoon/it/sitemap/XSLTTest.java Wed Mar 19 02:40:52 2008
@@ -0,0 +1,39 @@
+package org.apache.cocoon.it.sitemap;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.apache.cocoon.tools.it.HtmlUnitTestCase;
+
+/**
+ * Test XSLT transformation.
+ */
+public class XSLTTest extends HtmlUnitTestCase {
+
+    /**
+     * Use an XSLT that includes sub stylesheets using the file and the servlet
+     * protocol.
+     */
+    public void testXSLTTransformation() throws Exception {
+        this.loadXmlPage("/cocoon-it/xslt/main");
+        assertTrue(this.response.getStatusCode() == 200);
+        assertEquals("text/xml", this.response.getContentType());
+        assertXPath("/xslt/servlet", "servlet");
+        assertXPath("/xslt/file", "file");
+    }
+
+}

Propchange: cocoon/trunk/core/cocoon-webapp/src/test/java/org/apache/cocoon/it/sitemap/XSLTTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cocoon/trunk/core/cocoon-webapp/src/test/java/org/apache/cocoon/it/sitemap/XSLTTest.java
------------------------------------------------------------------------------
    svn:keywords = Id

Propchange: cocoon/trunk/core/cocoon-webapp/src/test/java/org/apache/cocoon/it/sitemap/XSLTTest.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain