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/07/30 12:19:04 UTC
svn commit: r680959 - in /cocoon/trunk/core/cocoon-webapp: pom.xml
src/test/java/org/apache/cocoon/it/blocks/jms/
src/test/java/org/apache/cocoon/it/blocks/jms/JMSTest.java
Author: reinhard
Date: Wed Jul 30 03:19:03 2008
New Revision: 680959
URL: http://svn.apache.org/viewvc?rev=680959&view=rev
Log:
COCOON-2230
. provide integration tests for the JMS block
Added:
cocoon/trunk/core/cocoon-webapp/src/test/java/org/apache/cocoon/it/blocks/jms/
cocoon/trunk/core/cocoon-webapp/src/test/java/org/apache/cocoon/it/blocks/jms/JMSTest.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=680959&r1=680958&r2=680959&view=diff
==============================================================================
--- cocoon/trunk/core/cocoon-webapp/pom.xml (original)
+++ cocoon/trunk/core/cocoon-webapp/pom.xml Wed Jul 30 03:19:03 2008
@@ -186,14 +186,18 @@
</plugins>
</build>
</profile>
- <profile>
- <id>eventcache</id>
- <dependencies>
- <dependency>
- <groupId>org.apache.cocoon</groupId>
- <artifactId>cocoon-eventcache-sample</artifactId>
- </dependency>
- </dependencies>
+ <profile>
+ <id>eventcache-jms</id>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.cocoon</groupId>
+ <artifactId>cocoon-eventcache-sample</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cocoon</groupId>
+ <artifactId>cocoon-jms-sample</artifactId>
+ </dependency>
+ </dependencies>
</profile>
<profile>
<id>allblocks</id>
@@ -250,6 +254,10 @@
<groupId>org.apache.cocoon</groupId>
<artifactId>cocoon-eventcache-sample</artifactId>
</dependency>
+ <dependency>
+ <groupId>org.apache.cocoon</groupId>
+ <artifactId>cocoon-jms-sample</artifactId>
+ </dependency>
<!-- Breaks currently cocoon-webapp
<dependency>
<groupId>org.apache.cocoon</groupId>
Added: cocoon/trunk/core/cocoon-webapp/src/test/java/org/apache/cocoon/it/blocks/jms/JMSTest.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-webapp/src/test/java/org/apache/cocoon/it/blocks/jms/JMSTest.java?rev=680959&view=auto
==============================================================================
--- cocoon/trunk/core/cocoon-webapp/src/test/java/org/apache/cocoon/it/blocks/jms/JMSTest.java (added)
+++ cocoon/trunk/core/cocoon-webapp/src/test/java/org/apache/cocoon/it/blocks/jms/JMSTest.java Wed Jul 30 03:19:03 2008
@@ -0,0 +1,54 @@
+/*
+ * 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.blocks.jms;
+
+import org.apache.cocoon.tools.it.HtmlUnitTestCase;
+
+/**
+ * Runs various component and integration tests on the JMS block.
+ */
+public class JMSTest extends HtmlUnitTestCase {
+
+ public void testGetCachedContent() throws Exception {
+ this.loadXmlPage("cocoon-jms-sample/it/demo?pageKey=one");
+ assertEquals(200, this.response.getStatusCode());
+ assertXPath("/eventcache/key", "one");
+ String firstLoaded = this.response.getContentAsString();
+ this.loadXmlPage("cocoon-jms-sample/it/demo?pageKey=one");
+ assertEquals(200, this.response.getStatusCode());
+ assertEquals(this.response.getContentAsString(), firstLoaded);
+ }
+
+ /**
+ * Verifies a key to be invalidated by invoking an action.
+ *
+ * @throws Exception In case of environmental errors.
+ */
+ public void testUncacheWithJMSAction() throws Exception {
+ this.loadXmlPage("cocoon-jms-sample/it/demo?pageKey=two");
+ assertEquals(200, this.response.getStatusCode());
+ assertXPath("/eventcache/key", "two");
+ String firstLoaded = this.response.getContentAsString();
+ this.loadResponse("cocoon-jms-sample/it/action?event=two&pageKey=two");
+ // Check for correct redirect
+ assertEquals(302, this.response.getStatusCode());
+ // Check, whether the response has changed
+ assertNotSame(this.response.getContentAsString(), firstLoaded);
+ this.loadXmlPage("cocoon-jms-sample/it/demo?pageKey=two");
+ assertXPath("/eventcache/key", "two");
+ }
+}
\ No newline at end of file
Propchange: cocoon/trunk/core/cocoon-webapp/src/test/java/org/apache/cocoon/it/blocks/jms/JMSTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: cocoon/trunk/core/cocoon-webapp/src/test/java/org/apache/cocoon/it/blocks/jms/JMSTest.java
------------------------------------------------------------------------------
svn:keywords = Id
Propchange: cocoon/trunk/core/cocoon-webapp/src/test/java/org/apache/cocoon/it/blocks/jms/JMSTest.java
------------------------------------------------------------------------------
svn:mime-type = text/plain