[jboss-cvs] JBossAS SVN: r114709 - in branches/JBPAPP_5/testsuite: src/main/org/jboss/test/web/test and 2 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Thu Feb 6 12:20:51 EST 2014
Author: rhatlapa
Date: 2014-02-06 12:20:51 -0500 (Thu, 06 Feb 2014)
New Revision: 114709
Added:
branches/JBPAPP_5/testsuite/src/main/org/jboss/test/web/test/PageContextTestCase.java
branches/JBPAPP_5/testsuite/src/resources/web/page-context/
branches/JBPAPP_5/testsuite/src/resources/web/page-context/invalidate-context.jsp
branches/JBPAPP_5/testsuite/src/resources/web/page-context/web.xml
Modified:
branches/JBPAPP_5/testsuite/imports/sections/web.xml
Log:
Test for PageContext invalidation JBWEB-284 (JBPAPP-10891)
Modified: branches/JBPAPP_5/testsuite/imports/sections/web.xml
===================================================================
--- branches/JBPAPP_5/testsuite/imports/sections/web.xml 2014-02-06 13:35:13 UTC (rev 114708)
+++ branches/JBPAPP_5/testsuite/imports/sections/web.xml 2014-02-06 17:20:51 UTC (rev 114709)
@@ -980,5 +980,14 @@
</fileset>
</jar>
+ <!-- JBWEB-284 (JBPAPP-10891) -->
+ <war destfile="${build.lib}/page-context.war"
+ webxml="${build.resources}/web/page-context/web.xml">
+ <fileset dir="${build.resources}/web/page-context">
+ <include name="*.jsp"/>
+ </fileset>
+ </war>
+
+
</target>
</project>
Added: branches/JBPAPP_5/testsuite/src/main/org/jboss/test/web/test/PageContextTestCase.java
===================================================================
--- branches/JBPAPP_5/testsuite/src/main/org/jboss/test/web/test/PageContextTestCase.java (rev 0)
+++ branches/JBPAPP_5/testsuite/src/main/org/jboss/test/web/test/PageContextTestCase.java 2014-02-06 17:20:51 UTC (rev 114709)
@@ -0,0 +1,89 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * 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.jboss.test.web.test;
+
+import java.net.URL;
+
+import junit.framework.Test;
+
+import junit.framework.TestSuite;
+
+import org.apache.commons.httpclient.HttpClient;
+import org.apache.commons.httpclient.HttpMethodBase;
+import org.apache.commons.httpclient.methods.GetMethod;
+import org.jboss.test.JBossTestCase;
+import org.jboss.test.JBossTestSetup;
+import org.jboss.test.util.web.HttpUtils;
+/**
+ * @author rhatlapa at redhat.com
+ */
+public class PageContextTestCase extends JBossTestCase
+{
+ public PageContextTestCase(String name)
+ {
+ super(name);
+ }
+
+
+ public static Test suite() throws Exception
+ {
+ TestSuite suite = new TestSuite();
+ suite.addTest(new TestSuite(PageContextTestCase.class));
+
+ // Create an initializer for the test suite
+ Test wrapper = new JBossTestSetup(suite)
+ {
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+ deploy("page-context.war");
+ }
+ protected void tearDown() throws Exception
+ {
+ undeploy("page-context.war");
+ super.tearDown();
+ }
+ };
+ return wrapper;
+
+ }
+
+
+ /**
+ * Test a jsp page that checks whether page context is properly destroyed and put to appripriate state
+ * see: JBWEB-284 one-off: PageContextImpl.doFindAttribute can improperly throw IllegalStateException
+ */
+ public void testActiveRequestCaching() throws Exception
+ {
+ URL url = new URL(HttpUtils.getBaseURL() + "page-context/invalidate-context.jsp");
+ HttpClient client = new HttpClient();
+ HttpMethodBase request = new GetMethod(url.toString());
+ client.executeMethod(request);
+
+ String response = request.getResponseBodyAsString();
+ if (response == null)
+ {
+ throw new Exception("Unable to get response from server.");
+ }
+ assertTrue("Response expected to contain String 'PASSED, page contains: " + response, response.contains("PASSED"));
+ }
+}
\ No newline at end of file
Property changes on: branches/JBPAPP_5/testsuite/src/main/org/jboss/test/web/test/PageContextTestCase.java
___________________________________________________________________
Added: svn:keywords
+ Date LastChangedDate Revision LastChangedRevision Rev Author LastChangedBy HeadURL URL Id
Added: svn:eol-style
+ native
Added: branches/JBPAPP_5/testsuite/src/resources/web/page-context/invalidate-context.jsp
===================================================================
--- branches/JBPAPP_5/testsuite/src/resources/web/page-context/invalidate-context.jsp (rev 0)
+++ branches/JBPAPP_5/testsuite/src/resources/web/page-context/invalidate-context.jsp 2014-02-06 17:20:51 UTC (rev 114709)
@@ -0,0 +1,18 @@
+<%
+ session.setAttribute("foo", "foovalue");
+ out.print("Before invalidating session value of attribute foo: " + pageContext.findAttribute("foo") + "<br />");
+ session.invalidate();
+ Object obj = null;
+ try {
+ obj = pageContext.findAttribute("foo");
+ out.print("After invalidating sesssion value of attribute foo: " + obj + "<br />");
+ if (obj == null) {
+ out.print("<b>PASSED</b> Session correctly invalidated => Issue with PageContextImpl.doFindAttribute is fixed");
+ } else {
+ out.print("<b>FAILED</b> Session wasn't correctly invalidated, attribute should be null");
+ }
+ } catch (Exception ex) {
+ out.print("<b>FAILED</b> Issue with PageContextImplDoFindAttribute is not fixed (unexpected exception detected): " + ex.toString());
+
+ }
+%>
Added: branches/JBPAPP_5/testsuite/src/resources/web/page-context/web.xml
===================================================================
--- branches/JBPAPP_5/testsuite/src/resources/web/page-context/web.xml (rev 0)
+++ branches/JBPAPP_5/testsuite/src/resources/web/page-context/web.xml 2014-02-06 17:20:51 UTC (rev 114709)
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
+ version="2.4">
+
+</web-app>
Property changes on: branches/JBPAPP_5/testsuite/src/resources/web/page-context/web.xml
___________________________________________________________________
Added: svn:mime-type
+ text/xml
Added: svn:keywords
+ Date LastChangedDate Revision LastChangedRevision Rev Author LastChangedBy HeadURL URL Id
Added: svn:eol-style
+ native
More information about the jboss-cvs-commits
mailing list