[jboss-cvs] JBossAS SVN: r112107 - in branches/JBPAPP_5_1/testsuite: src/main/org/jboss/test/web/test and 7 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue Aug 23 11:42:02 EDT 2011


Author: bmaxwell
Date: 2011-08-23 11:42:02 -0400 (Tue, 23 Aug 2011)
New Revision: 112107

Added:
   branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/web/test/JBPAPP6414UnitTestCase.java
   branches/JBPAPP_5_1/testsuite/src/resources/org/jboss/test/web/
   branches/JBPAPP_5_1/testsuite/src/resources/org/jboss/test/web/jbpapp6414/
   branches/JBPAPP_5_1/testsuite/src/resources/org/jboss/test/web/jbpapp6414/jbpapp6414-xerces-2.9.0.war/
   branches/JBPAPP_5_1/testsuite/src/resources/org/jboss/test/web/jbpapp6414/jbpapp6414-xerces-2.9.0.war/META-INF/
   branches/JBPAPP_5_1/testsuite/src/resources/org/jboss/test/web/jbpapp6414/jbpapp6414-xerces-2.9.0.war/META-INF/MANIFEST.MF
   branches/JBPAPP_5_1/testsuite/src/resources/org/jboss/test/web/jbpapp6414/jbpapp6414-xerces-2.9.0.war/WEB-INF/
   branches/JBPAPP_5_1/testsuite/src/resources/org/jboss/test/web/jbpapp6414/jbpapp6414-xerces-2.9.0.war/WEB-INF/classes/
   branches/JBPAPP_5_1/testsuite/src/resources/org/jboss/test/web/jbpapp6414/jbpapp6414-xerces-2.9.0.war/WEB-INF/lib/
   branches/JBPAPP_5_1/testsuite/src/resources/org/jboss/test/web/jbpapp6414/jbpapp6414-xerces-2.9.0.war/WEB-INF/lib/xercesImpl.jar
   branches/JBPAPP_5_1/testsuite/src/resources/org/jboss/test/web/jbpapp6414/jbpapp6414-xerces-2.9.0.war/WEB-INF/web.xml
   branches/JBPAPP_5_1/testsuite/src/resources/org/jboss/test/web/jbpapp6414/jbpapp6414-xerces-2.9.0.war/index.jsp
Modified:
   branches/JBPAPP_5_1/testsuite/imports/sections/web.xml
Log:
[JBPAPP-6414] adding testcase

Modified: branches/JBPAPP_5_1/testsuite/imports/sections/web.xml
===================================================================
--- branches/JBPAPP_5_1/testsuite/imports/sections/web.xml	2011-08-23 15:41:06 UTC (rev 112106)
+++ branches/JBPAPP_5_1/testsuite/imports/sections/web.xml	2011-08-23 15:42:02 UTC (rev 112107)
@@ -954,5 +954,12 @@
 
       </war>
 
+      <!-- JBPAPP-6414 -->
+      <jar destfile="${build.lib}/jbpapp6414-xerces-2.9.0.war">
+         <fileset dir="${build.resources}/org/jboss/test/web/jbpapp6414/jbpapp6414-xerces-2.9.0.war">
+            <include name="**/*"/>
+         </fileset>
+      </jar>
+
    </target>
 </project>

Added: branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/web/test/JBPAPP6414UnitTestCase.java
===================================================================
--- branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/web/test/JBPAPP6414UnitTestCase.java	                        (rev 0)
+++ branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/web/test/JBPAPP6414UnitTestCase.java	2011-08-23 15:42:02 UTC (rev 112107)
@@ -0,0 +1,149 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2011, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt 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.io.BufferedReader;
+
+import java.io.InputStreamReader;
+import java.net.URL;
+import java.net.URLConnection;
+
+import org.jboss.test.JBossTestCase;
+
+/**
+ * @author bmaxwell
+ * https://issues.jboss.org/browse/JBPAPP-6414
+ */
+public class JBPAPP6414UnitTestCase extends JBossTestCase
+{ 
+   private String host; 
+   private static String TEST_EXT = ".war";
+         
+   public JBPAPP6414UnitTestCase(String name)
+   {
+      super(name);
+   }
+   
+   @Override
+   protected void setUp() throws Exception
+   {    
+      super.setUp();
+      host = System.getProperty("jbosstest.server.host");
+   }
+   
+   public void testPackagingXerces()
+   {  
+      // The test war jbpapp6414-xerces-2.9.0 has an index.jsp whose output should match the string below.  
+      // This tests the implementation versions for several things, it tests the Xerces version via the Version Class
+      // The last ClassLoader at the end tests to make sure the classloader is not null, if it were null that would mean JBoss is not using xerces classes packaged in the test war.
+      
+      String XERCES_TEST_VERSION = "org.apache.xerces.jaxp.datatype.DatatypeFactoryImpl|org.apache.xerces.jaxp.DocumentBuilderFactoryImpl|org.apache.xerces.jaxp.SAXParserFactoryImpl|Xerces-J 2.9.0|true";
+      testDeployment("jbpapp6414-xerces-2.9.0", XERCES_TEST_VERSION);
+   }
+      
+   private String readURL(URL url)
+   {                
+      BufferedReader in = null;
+      try
+      {
+         URLConnection uc = url.openConnection();  
+         in = new BufferedReader( new InputStreamReader(uc.getInputStream()));
+         
+         String inputLine = in.readLine();            
+         return inputLine;
+      }
+      catch (Exception e)
+      {
+         e.printStackTrace();
+         fail("Unable to read url: " + url);
+         return null;
+      }
+      finally
+      {
+         if ( in != null )
+         {
+            try
+            {
+               in.close();   
+            }
+            catch (Exception e)
+            {
+               // eat it
+            }
+         }            
+      }
+   }
+   
+   // try to deploy the test file and undeploy after testing
+   private void testDeployment(String filename, String validVersion)
+   {
+      String file = filename + TEST_EXT;
+      try
+      {
+         deployFailOnError(file);
+         String version = readURL(new URL("http://"+ host +":8080/"+ filename + "/index.jsp"));
+                  
+         if ( version == null || validVersion.compareTo(version) != 0 )
+         {
+            fail("Version: " + version + " did not match expected version: " + validVersion);
+         }
+      }
+      catch (Exception e) 
+      {
+         e.printStackTrace();
+         fail("Failed to deploy test deployment: " + filename);
+      }
+      finally
+      {
+         undeployFailOnError(file);
+      }
+   }
+   
+   // Use the main deployer to deploy the test file
+   private void deployFailOnError(String file)
+   {
+      try
+      {
+         log.info("Deploying : " + file);
+         super.deploy(file);
+      }
+      catch ( Exception e )
+      {
+         e.printStackTrace();
+         fail("Failed to deploy: " + file);
+      }
+   }
+   
+   // Use the main deployer to undeploy the test file
+   private void undeployFailOnError(String file)
+   {
+      try
+      {
+         log.info("Undeploying : " + file);
+         super.undeploy(file);
+      }
+      catch ( Exception e )
+      {
+         fail("Failed to undeploy: " + file);
+      }
+   }
+}

Added: branches/JBPAPP_5_1/testsuite/src/resources/org/jboss/test/web/jbpapp6414/jbpapp6414-xerces-2.9.0.war/META-INF/MANIFEST.MF
===================================================================
--- branches/JBPAPP_5_1/testsuite/src/resources/org/jboss/test/web/jbpapp6414/jbpapp6414-xerces-2.9.0.war/META-INF/MANIFEST.MF	                        (rev 0)
+++ branches/JBPAPP_5_1/testsuite/src/resources/org/jboss/test/web/jbpapp6414/jbpapp6414-xerces-2.9.0.war/META-INF/MANIFEST.MF	2011-08-23 15:42:02 UTC (rev 112107)
@@ -0,0 +1,5 @@
+Manifest-Version: 1.0
+Ant-Version: Apache Ant 1.7.0
+Created-By: 1.5.0_17-b04 (Sun Microsystems Inc.)
+Class-Path: 
+

Added: branches/JBPAPP_5_1/testsuite/src/resources/org/jboss/test/web/jbpapp6414/jbpapp6414-xerces-2.9.0.war/WEB-INF/lib/xercesImpl.jar
===================================================================
(Binary files differ)


Property changes on: branches/JBPAPP_5_1/testsuite/src/resources/org/jboss/test/web/jbpapp6414/jbpapp6414-xerces-2.9.0.war/WEB-INF/lib/xercesImpl.jar
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Added: branches/JBPAPP_5_1/testsuite/src/resources/org/jboss/test/web/jbpapp6414/jbpapp6414-xerces-2.9.0.war/WEB-INF/web.xml
===================================================================
--- branches/JBPAPP_5_1/testsuite/src/resources/org/jboss/test/web/jbpapp6414/jbpapp6414-xerces-2.9.0.war/WEB-INF/web.xml	                        (rev 0)
+++ branches/JBPAPP_5_1/testsuite/src/resources/org/jboss/test/web/jbpapp6414/jbpapp6414-xerces-2.9.0.war/WEB-INF/web.xml	2011-08-23 15:42:02 UTC (rev 112107)
@@ -0,0 +1,51 @@
+<?xml version='1.0' encoding='UTF-8'?>
+
+<web-app version="2.5"
+         xmlns="http://java.sun.com/xml/ns/javaee"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" >
+
+    <context-param>
+        <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
+        <param-value>client</param-value>
+    </context-param>
+
+    <context-param>
+        <param-name>com.sun.faces.validateXml</param-name>
+        <param-value>true</param-value>
+    </context-param>
+
+    <context-param>
+        <param-name>com.sun.faces.verifyObjects</param-name>
+        <param-value>false</param-value>
+    </context-param>
+    
+    <!-- Faces Servlet -->
+    <servlet>
+        <servlet-name>Faces Servlet</servlet-name>
+        <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
+        <load-on-startup> 1 </load-on-startup>
+    </servlet>
+    
+	<!-- Faces Servlet Mapping -->
+    <servlet-mapping>
+        <servlet-name>Faces Servlet</servlet-name>
+        <url-pattern>*.faces</url-pattern>
+	 <!-- <url-pattern>/faces/*</url-pattern> -->
+    </servlet-mapping>
+   
+		<welcome-file-list>
+		<welcome-file>/index.faces</welcome-file>
+	</welcome-file-list>
+
+    <error-page>
+    	<exception-type>java.lang.Exception</exception-type>
+    	<location>/error.jsp</location>
+	</error-page>
+
+    
+	<login-config>        
+        <auth-method>BASIC</auth-method>
+        <realm-name>Test Logon</realm-name>
+    </login-config>
+</web-app>

Added: branches/JBPAPP_5_1/testsuite/src/resources/org/jboss/test/web/jbpapp6414/jbpapp6414-xerces-2.9.0.war/index.jsp
===================================================================
--- branches/JBPAPP_5_1/testsuite/src/resources/org/jboss/test/web/jbpapp6414/jbpapp6414-xerces-2.9.0.war/index.jsp	                        (rev 0)
+++ branches/JBPAPP_5_1/testsuite/src/resources/org/jboss/test/web/jbpapp6414/jbpapp6414-xerces-2.9.0.war/index.jsp	2011-08-23 15:42:02 UTC (rev 112107)
@@ -0,0 +1,2 @@
+<%= javax.xml.datatype.DatatypeFactory.newInstance().getClass().getName() + "|" + javax.xml.parsers.DocumentBuilderFactory.newInstance().getClass().getName() + "|" + javax.xml.parsers.SAXParserFactory.newInstance().getClass().getName() + "|" + new org.apache.xerces.impl.Version().getVersion() + "|" + (new org.apache.xerces.impl.Version().getClass().getClassLoader() != null) %>
+



More information about the jboss-cvs-commits mailing list