[seam-commits] Seam SVN: r11559 - in branches/enterprise/JBPAPP_4_3_FP01: src/test/ftest and 6 other directories.

seam-commits at lists.jboss.org seam-commits at lists.jboss.org
Thu Oct 8 10:43:22 EDT 2009


Author: jharting
Date: 2009-10-08 10:43:20 -0400 (Thu, 08 Oct 2009)
New Revision: 11559

Added:
   branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/src/main/org/jboss/seam/example/common/test/selenium/SeleniumFunctionalTestListener.java
Removed:
   branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/lib/
Modified:
   branches/enterprise/JBPAPP_4_3_FP01/build.xml
   branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/build.xml
   branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/examples/build.xml
   branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/examples/ui/build.xml
   branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/ftest.properties
   branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/seamgen/build.xml
   branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/seamgen/richfaces.xml
   branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/seamgen/src/main/org/jboss/seam/test/functional/seamgen/NewProjectTest.java
   branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/seamgen/src/main/org/jboss/seam/test/functional/seamgen/SeleniumSeamGenTest.java
   branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/seamgen/src/main/org/jboss/seam/test/functional/seamgen/VehicleTest.java
   branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/seamgen/src/main/org/jboss/seam/test/functional/seamgen/utils/SeamGenAdapter.java
   branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/src/main/org/jboss/seam/example/common/test/selenium/SeamSeleniumTest.java
Log:
JBPAPP-2895

Modified: branches/enterprise/JBPAPP_4_3_FP01/build.xml
===================================================================
--- branches/enterprise/JBPAPP_4_3_FP01/build.xml	2009-10-08 14:26:16 UTC (rev 11558)
+++ branches/enterprise/JBPAPP_4_3_FP01/build.xml	2009-10-08 14:43:20 UTC (rev 11559)
@@ -911,6 +911,16 @@
 	<target name="eclipseclasspath" depends="init, jargen" description="Update eclipse classpath">
 		<path id="seam-gen.path" path="${seam.dir}/lib/gen/jboss-seam-gen.jar" />
 
+		
+		<ant antfile="${seam.dir}/src/test/ftest/examples/build.xml" target="copy.selenium" />
+		<ant antfile="${seam.dir}/src/test/ftest/examples/build.xml" target="copy.testng" />
+		<ant antfile="${seam.dir}/src/test/ftest/examples/build.xml" target="copy.htmlunit">
+			<property name="depends.htmlunit" value="true" />
+		</ant>
+		<path id="ftest.path">
+			<fileset dir="${seam.dir}/lib/ftest" includes="*.jar" />
+		</path>
+		
 	    <taskdef name="eclipseClasspath" 
 	        classname="org.jboss.seam.tool.EclipseClasspathTask" 
 	        classpathref="seam-gen.path"/>
@@ -923,6 +933,7 @@
 		<dependencies id="remoting" scope="compile" pom="${remoting.pom}" />
 		<dependencies id="ui" scope="compile" pom="${ui.pom}" />
 		<eclipseClasspath tofile=".classpath" file="${build.dir}/classpath.tmpl" filterProperty="automagic.classpath.entries">
+			<path refid="ftest.path" />
 			<path refid="compile.core.path" />
 			<path refid="compile.debug.path" />
 			<path refid="compile.gen.path" />

Modified: branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/build.xml
===================================================================
--- branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/build.xml	2009-10-08 14:26:16 UTC (rev 11558)
+++ branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/build.xml	2009-10-08 14:43:20 UTC (rev 11559)
@@ -33,7 +33,7 @@
 	<property name="ftest.dir" value="${seam.dir}/src/test/ftest" />
 
 	<!-- TODO : should the libs be in seam/lib and managed with mvn? -->
-	<property name="lib.dir" value="${ftest.dir}/lib" />
+	<property name="lib.dir" value="${seam.dir}/lib/ftest" />
 	<property name="log.dir" value="${ftest.dir}/log" />
 
 	<!-- Build resources -->	
@@ -51,6 +51,7 @@
 
 	<target name="testall.jboss">
 		<property name="container" value="jboss" />
+		<ant antfile="${ftest.dir}/examples/build.xml" target="start.container.jboss" />
 		<antcall target="start.selenium.server" />
 		<!-- Execute tests for all examples jboss-->
 		<testexample name="blog" />
@@ -80,6 +81,7 @@
 		<testexample name="todo" />
 		<testexample name="ui" />
 		<antcall target="stop.selenium.server" />
+		<ant antfile="${ftest.dir}/examples/build.xml" target="stop.container.jboss" />
 	</target>
 
 
@@ -125,6 +127,7 @@
 		<cleanexample name="spring" />
 		<cleanexample name="todo" />
 		<cleanexample name="ui" />
+		<ant antfile="${ftest.dir}/seamgen/build.xml" target="clean" />
 	</target>
 
 	<target name="undeployall">
@@ -157,24 +160,27 @@
 		<undeployexample name="ui" />
 	</target>
 
+	<target name="copy.selenium">
+		<ant antfile="${ftest.dir}/examples/build.xml" target="copy.selenium" />
+	</target>
+	
+	<target name="start.selenium.server" depends="copy.selenium">
+			<java classpathref="selenium.server.classpath" classname="org.openqa.selenium.server.SeleniumServer" fork="true" spawn="true">
+				<arg line="-port ${selenium.server.port}" />
+				<arg line="${selenium.server.cmd.args}" />
+			</java>
 
-	<target name="start.selenium.server">
-		<java classpathref="selenium.server.classpath" classname="org.openqa.selenium.server.SeleniumServer" fork="true" spawn="true">
-			<arg line="-port ${selenium.server.port}" />
-			<arg line="${selenium.server.cmd.args}" />
-		</java>
-
-		<waitfor maxwait="30" maxwaitunit="second">
-			<and>
-				<socket server="${selenium.host}" port="${selenium.server.port}" />
-				<!-- this url will 403, so we say that it should start counting errors at 404 to skip -->
-				<http url="http://${selenium.host}:${selenium.server.port}/selenium-server/core/index.html" errorsBeginAt="404" />
-			</and>
-		</waitfor>
+			<waitfor maxwait="30" maxwaitunit="second">
+				<and>
+					<socket server="${selenium.host}" port="${selenium.server.port}" />
+					<!-- this url will start returning 404 once the server is up, we set errorsBeginAt to 405 for the 404 response to be considered correct -->
+					<http url="http://${selenium.host}:${selenium.server.port}/selenium-server/core/index.html" errorsBeginAt="405" />
+				</and>
+			</waitfor>
 	</target>
 
 	<target name="stop.selenium.server">
-		<get taskname="selenium-shutdown" src="http://${selenium.host}:${selenium.server.port}/selenium-server/driver/?cmd=shutDown" dest="${log.dir}/server.shutdown.dest.log" ignoreerrors="true" />
+		<get taskname="selenium-shutdown" src="http://${selenium.host}:${selenium.server.port}/selenium-server/driver/?cmd=shutDownSeleniumServer" dest="${log.dir}/server.shutdown.dest.log" ignoreerrors="true" />
 		<echo taskname="selenium-shutdown" message="DGF Errors during shutdown are expected" />
 	</target>
 
@@ -209,36 +215,10 @@
 		</sequential>
 	</macrodef>
 
-	<!-- Target for declaring needed libraries for ftest tests  -->
-	<target name="importlibraries">
-				<copyInlineDependencies id="allexamples" scope="compile" todir="${lib.dir}">
-					<dependency groupId="net.sourceforge.htmlunit" artifactId="htmlunit" version="2.3"/>
-					<dependency groupId="commons-httpclient" artifactId="commons-httpclient" version="3.1"/>
-					<dependency groupId="org.w3c" artifactId="sac" version="1.3"/>
-					<dependency groupId="commons-io" artifactId="commons-io" version="1.3.1"/>
-					<dependency groupId="commons-lang" artifactId="commons-lang" version="2.3"/>
-					<dependency groupId="apache-xerces" artifactId="xercesImpl" version="2.9.0"/>
-					<dependency groupId="commons-collections" artifactId="commons-collections" version="3.1"/>
-					<dependency groupId="commons-lang" artifactId="commons-lang" version="2.3"/>
-					<dependency groupId="apache-xalan" artifactId="xalan" version="j_2.7.0"/>
-					<dependency groupId="commons-codec" artifactId="commons-codec" version="1.3"/>
-					<dependency groupId="commons-logging" artifactId="commons-logging" version="1.1.1"/>
-					<dependency groupId="net.sourceforge.cssparser" artifactId="cssparser" version="0.9.5"/>
-					<dependency groupId="net.sourceforge.htmlunit" artifactId="htmlunit-core-js" version="2.4"/>
-					<dependency groupId="net.sourceforge.nekohtml" artifactId="nekohtml" version="1.9.9"/>
-					<dependency groupId="apache-xalan" artifactId="serializer" version="j_2.7.0"/>
-					<dependency groupId="xml-apis" artifactId="xml-apis" version="1.3.03"/>
-				</copyInlineDependencies>
-	</target>
-
 	<macrodef name="callExample">
 		<attribute name="path" />
 		<attribute name="target" />
 		<sequential>
-			
-			<!-- Added for downloading libraries   -->
-			<antcall target="importlibraries"> </antcall>
-
 			<ant dir="@{path}" target="@{target}" inheritall="false">
 				<property name="container" value="${container}">
 				</property>

Modified: branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/examples/build.xml
===================================================================
--- branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/examples/build.xml	2009-10-08 14:26:16 UTC (rev 11558)
+++ branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/examples/build.xml	2009-10-08 14:43:20 UTC (rev 11559)
@@ -31,12 +31,17 @@
 	<property name="ftest.dir" value="${seam.dir}/src/test/ftest" />
 	<property name="src.dir" value="src" />
 	<property name="common.src.dir" value="${ftest.dir}/src/main" />
-	<property name="build.dir" value="build" />
-	<property name="classes.dir" value="${build.dir}/classes" />
+	<property name="local.build.dir" value="build" />
+	<property name="classes.dir" value="${local.build.dir}/classes" />
 	<property name="test.output.dir" value="${seam.dir}/test-output" />
-	<property name="ftest.lib.dir" value="${ftest.dir}/lib" />
+	<property name="ftest.lib.dir" value="${seam.dir}/lib/ftest" />
+	<property name="root.lib.dir" value="${seam.dir}/lib" />
 	<property name="log.dir" value="log" />
 	<property name="test.report.dir" value="test-report" />
+	<property name="functional.listener" value="org.jboss.seam.example.common.test.selenium.SeleniumFunctionalTestListener"/>
+	
+	<!-- Build resources -->
+	<import file="${seam.dir}/build/common.build.xml" />
 
 	<!-- common path setup -->
 
@@ -52,7 +57,7 @@
 	<!-- common target definitions -->
 
 	<target name="clean" description="Delete all generated files">
-		<delete dir="${build.dir}" />
+		<delete dir="${local.build.dir}" />
 		<delete dir="${test.output.dir}" />
 		<delete dir="${report.dir}" />
 		<delete dir="${log.dir}" />
@@ -70,7 +75,7 @@
 	<!-- TODO we should compile this once to a common place not build for each example -->
 	<!-- TODO if needed we should allow examples to exclude/include src under 
         common dvd does not care about booking for example-->
-	<target name="build.common" description="Compiles the common selenium test code">
+	<target name="build.common" depends="copy.selenium,copy.htmlunit,copy.testng" description="Compiles the common selenium test code">
 		<mkdir dir="${classes.dir}" />
 		<javac srcdir="${common.src.dir}" destdir="${classes.dir}" classpathref="classpath.build" debug="true" />
 		<copy todir="${classes.dir}">
@@ -85,7 +90,7 @@
 		<mkdir dir="${test.output.dir}" />
 
 		<!-- execute testng tests -->
-		<testng haltonfailure="false" outputdir="${test.output.dir}" classpathref="classpath.test">
+		<testng haltonfailure="false" outputdir="${test.output.dir}" classpathref="classpath.test" listener="${functional.listener}">
 			<xmlfileset file="${container}.xml" />
 			<sysproperty key="selenium.server.port" value="${selenium.server.port}" />
 			<sysproperty key="selenium.host" value="${selenium.host}" />
@@ -93,6 +98,7 @@
 			<sysproperty key="selenium.browser.url" value="${selenium.browser.url}" />
 			<sysproperty key="selenium.speed" value="${selenium.speed}" />
 			<sysproperty key="selenium.timeout" value="${selenium.timeout}" />
+			<sysproperty key="seam.dir" value="${seam.dir}" />
 		</testng>
 	</target>
 
@@ -162,7 +168,10 @@
 		<attribute name="absolute.wait.url" default="${selenium.browser.url}/@{wait.url}"/>
 		<sequential>
 			<echo>Deploying ${example.name} example to ${container}</echo>
-			<ant antfile="${seam.dir}/examples/${example.name}/build.xml" target="@{target}" inheritall="false" dir="${seam.dir}/examples/${example.name}" />
+			<ant antfile="${seam.dir}/examples/${example.name}/build.xml" target="@{target}" inheritall="false" dir="${seam.dir}/examples/${example.name}" >
+				<property name="jboss.home" value="${jboss.home}" />
+				<property name="jboss.domain" value="${jboss.domain}" />
+			</ant>
 			<!-- wait for the application to be active -->
 			<!-- TODO is there a better way? -->
 			<echo>Waiting @{wait.time} seconds for @{absolute.wait.url}</echo>
@@ -181,5 +190,87 @@
 			<echo>Undeploying example ${example.name} from ${container}</echo>
 			<ant antfile="${seam.dir}/examples/${example.name}/build.xml" target="@{target}" inheritall="false" dir="${seam.dir}/examples/${example.name}" />
 		</sequential>
-	</macrodef>
+		</macrodef>
+	
+	<target name="start.container.jboss" if="run.container.per.suite">
+		<echo message="Starting JBoss server" />
+		<java classname="org.jboss.Main" fork="true" spawn="true" dir="${jboss.home}/bin">
+			<classpath>
+				<pathelement location="${jboss.home}/bin/run.jar" />				
+			</classpath>
+			<jvmarg line="${jboss.jvm.arguments}" />
+			<arg line="-c ${jboss.domain} -b ${jboss.host}" />
+		</java>
+		<waitfor maxwait="2" maxwaitunit="minute">
+			<socket server="localhost" port="8080" />
+		</waitfor>
+	</target>
+
+	<target name="stop.container.jboss" if="run.container.per.suite">
+		<sequential>
+			<echo message="Shutting down JBoss server"/>
+			<java classname="org.jboss.Shutdown" fork="false" dir="${jboss.home}/bin">
+				<classpath>
+					<pathelement location="${jboss.home}/bin/shutdown.jar" />
+					<!--<pathelement location="${container.home}/client/jbossall-client.jar" />-->
+				</classpath>
+				<arg value="--shutdown"/>
+				<arg value="-u"/>
+				<arg value="${jboss.jmx.username}"/>
+				<arg value="-p"/>
+				<arg value="${jboss.jmx.password}"/>
+			</java>
+			<waitfor maxwait="300" maxwaitunit="second">
+				<not>
+					<socket server="localhost" port="1099" />
+				</not>
+			</waitfor>
+			<sleep seconds="3"/>
+		</sequential>
+	</target>
+	
+	<!-- Target for obtaining htmlunit  -->
+	<target name="copy.htmlunit" if="depends.htmlunit" unless="copy.htmlunit.done">
+		<copyInlineDependencies id="allexamples" scope="compile" todir="${ftest.lib.dir}">
+			<dependency groupId="net.sourceforge.htmlunit" artifactId="htmlunit" version="2.3"/>
+			<dependency groupId="commons-httpclient" artifactId="commons-httpclient" version="3.1"/>
+			<dependency groupId="org.w3c" artifactId="sac" version="1.3"/>
+			<dependency groupId="commons-io" artifactId="commons-io" version="1.3.1"/>
+			<dependency groupId="commons-lang" artifactId="commons-lang" version="2.3"/>
+			<dependency groupId="apache-xerces" artifactId="xercesImpl" version="2.9.0"/>
+			<dependency groupId="commons-collections" artifactId="commons-collections" version="3.1"/>
+			<dependency groupId="commons-lang" artifactId="commons-lang" version="2.3"/>
+			<dependency groupId="apache-xalan" artifactId="xalan" version="j_2.7.0"/>
+			<dependency groupId="commons-codec" artifactId="commons-codec" version="1.3"/>
+			<dependency groupId="commons-logging" artifactId="commons-logging" version="1.1.1"/>
+			<dependency groupId="net.sourceforge.cssparser" artifactId="cssparser" version="0.9.5"/>
+			<dependency groupId="net.sourceforge.htmlunit" artifactId="htmlunit-core-js" version="2.4"/>
+			<dependency groupId="net.sourceforge.nekohtml" artifactId="nekohtml" version="1.9.9"/>
+			<dependency groupId="apache-xalan" artifactId="serializer" version="j_2.7.0"/>
+			<dependency groupId="xml-apis" artifactId="xml-apis" version="1.3.03"/>
+		</copyInlineDependencies>
+		<property name="copy.htmlunit.done" value="true" />
+	</target>
+	
+	<target name="copy.selenium" unless="copy.selenium.done">
+		<copyInlineDependencies id="selenium.server" scope="compile" todir="${ftest.lib.dir}">
+			<dependency groupId="org.seleniumhq.selenium.server" artifactId="selenium-server" version="1.0.1" classifier="standalone">
+				<exclusion groupId="org.seleniumhq.selenium.core" artifactId="selenium-core" />
+				<exclusion groupId="org.seleniumhq.selenium.server" artifactId="selenium-server-coreless" />
+				<exclusion groupId="org.apache.ant" artifactId="ant-trax" />
+				<exclusion groupId="org.apache.ant" artifactId="ant-nodeps" />
+			</dependency>
+			<dependency groupId="org.seleniumhq.selenium.client-drivers" artifactId="selenium-java-client-driver" version="1.0.1">
+				<exclusion groupId="org.codehaus.groovy.maven.runtime" artifactId="gmaven-runtime-default" />
+			</dependency>
+		</copyInlineDependencies>
+		<property name="copy.selenium.done" value="true" />
+	</target>
+	
+	<target name="copy.testng" unless="copy.testng.done">
+		<copyInlineDependencies id="selenium.server" scope="compile" todir="${ftest.lib.dir}">
+			<dependency groupId="org.testng" artifactId="testng" version="5.9" />
+		</copyInlineDependencies>
+		<property name="copy.testng.done" value="true" />
+	</target>
 </project>

Modified: branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/examples/ui/build.xml
===================================================================
--- branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/examples/ui/build.xml	2009-10-08 14:26:16 UTC (rev 11558)
+++ branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/examples/ui/build.xml	2009-10-08 14:43:20 UTC (rev 11559)
@@ -24,5 +24,7 @@
 	<property name="example.name" value="ui" />
 	<property name="jboss.example.ready.check.url" value="seam-ui/index.seam" />
 
+	<property name="depends.htmlunit" value="true"/>
+	
 	<import file="../build.xml" />
 </project>

Modified: branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/ftest.properties
===================================================================
--- branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/ftest.properties	2009-10-08 14:26:16 UTC (rev 11558)
+++ branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/ftest.properties	2009-10-08 14:43:20 UTC (rev 11559)
@@ -48,9 +48,15 @@
 # independent from ${seam.dir}/build.properties
 jboss.home=/home/mnovotny/apps/jboss-eap-4.3_fp/jboss-as
 
-# default wait urls
-jboss.example.ready.check.url=seam-${example.name}/
+#run.container.per.suite=true
+jboss.domain=default
+jboss.host=localhost
+jboss.jvm.arguments=-Xms128m -Xmx1024m -XX:MaxPermSize=512m -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000 -Dsun.lang.ClassLoader.allowArraySyntax=true
 
+# These credentials are needed for JBoss restart. See ${JBOSS_HOME}/server/${jboss.profile}/conf/props/jmx-console-users.properties
+jboss.jmx.username=admin
+jboss.jmx.password=admin
+
 # seam-gen specific properties
 seamgen.delete.project=true
 # workspace for new projects
@@ -75,5 +81,4 @@
 test.package=com.example.test
 richfaces.skin=classic
 jboss.domain=default
-seam.dir=/home/mnovotny/workspaces/jboss/jboss-seam-fp
 

Modified: branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/seamgen/build.xml
===================================================================
--- branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/seamgen/build.xml	2009-10-08 14:26:16 UTC (rev 11558)
+++ branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/seamgen/build.xml	2009-10-08 14:43:20 UTC (rev 11559)
@@ -29,16 +29,20 @@
 	<property name="ftest.dir" value="${seam.dir}/src/test/ftest" />
 	<property name="common.src.dir" value="${ftest.dir}/src/main" />
 	<property name="src.dir" value="src/main" />
-	<property name="build.dir" value="build" />
-	<property name="classes.dir" value="${build.dir}/classes" />
+	<property name="local.build.dir" value="${ftest.dir}/seamgen/build" />
+	<property name="classes.dir" value="${local.build.dir}/classes" />
 	<property name="test.output.dir" value="${seam.dir}/test-output" />
-	<property name="ftest.lib.dir" value="${ftest.dir}/lib" />
+	<property name="ftest.lib.dir" value="${seam.dir}/lib/ftest" />
+	<property name="root.lib.dir" value="${seam.dir}/lib" />
 
 	<property file="${seam.dir}/src/test/ftest/ftest.properties" />
 	
 	<!-- common path setup -->
 
 	<path id="classpath.build">
+		<fileset dir="${root.lib.dir}">
+					<include name="gen/ant.jar"/>
+		</fileset>
 		<fileset dir="${ftest.lib.dir}" includes="**/*.jar" />
 	</path>
 
@@ -53,12 +57,20 @@
 	</path>
 
 	<target name="clean" description="Delete all generated files">
-		<delete dir="${build.dir}" />
+		<delete dir="${local.build.dir}" />
 		<delete dir="${test.output.dir}" />
 		<delete dir="${report.dir}" />
 		<delete dir="${log.dir}" />
 	</target>
 
+	<target name="copy.selenium">
+			<ant antfile="${ftest.dir}/examples/build.xml" target="copy.selenium" />
+	</target>
+	
+	<target name="copy.testng">
+			<ant antfile="${ftest.dir}/examples/build.xml" target="copy.testng" />
+	</target>
+	
 	<target name="build" depends="build.common" description="Compiles the Test">
 		<mkdir dir="${classes.dir}" />
 		<javac srcdir="${src.dir}" destdir="${classes.dir}" classpathref="classpath.build" debug="true" />
@@ -69,7 +81,7 @@
 		</copy>
 	</target>
 
-	<target name="build.common" description="Compiles the common selenium test code">
+	<target name="build.common" depends="copy.selenium, copy.testng" description="Compiles the common selenium test code">
 		<mkdir dir="${classes.dir}" />
 		<javac srcdir="${common.src.dir}" destdir="${classes.dir}" classpathref="classpath.build" debug="true" />
 		<copy todir="${classes.dir}">

Modified: branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/seamgen/richfaces.xml
===================================================================
--- branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/seamgen/richfaces.xml	2009-10-08 14:26:16 UTC (rev 11558)
+++ branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/seamgen/richfaces.xml	2009-10-08 14:43:20 UTC (rev 11559)
@@ -36,22 +36,38 @@
 		<parameter name="type" value="ear" />
 		<parameter name="explode" value="false" />
 		<classes>
-			<class name="org.jboss.seam.test.functional.seamgen.NewProjectTest" />
+			<class name="org.jboss.seam.test.functional.seamgen.NewProjectTest" >
+				<methods>
+					<exclude name="explodeAndRestartDifferenceTest"></exclude>
+				</methods>
+			</class>
 			<class name="org.jboss.seam.test.functional.seamgen.NewActionTest" />
 			<class name="org.jboss.seam.test.functional.seamgen.NewFormTest" />
 			<class name="org.jboss.seam.test.functional.seamgen.PersonTest" />
-			<class name="org.jboss.seam.test.functional.seamgen.VehicleTest" />
+			<class name="org.jboss.seam.test.functional.seamgen.VehicleTest" >
+				<methods>
+					<exclude name="testForJBSEAM3866"></exclude>
+				</methods>
+			</class>
 		</classes>
 	</test>
 	<test name="RichFaces War Test">
 		<parameter name="type" value="war" />
 		<parameter name="explode" value="false" />
 		<classes>
-			<class name="org.jboss.seam.test.functional.seamgen.NewProjectTest" />
+			<class name="org.jboss.seam.test.functional.seamgen.NewProjectTest" >
+				<methods>
+					<exclude name="explodeAndRestartDifferenceTest"></exclude>
+				</methods>
+			</class>
 			<class name="org.jboss.seam.test.functional.seamgen.NewActionTest" />
 			<class name="org.jboss.seam.test.functional.seamgen.NewFormTest" />
 			<class name="org.jboss.seam.test.functional.seamgen.PersonTest" />
-			<class name="org.jboss.seam.test.functional.seamgen.VehicleTest" />
+			<class name="org.jboss.seam.test.functional.seamgen.VehicleTest" >
+				<methods>
+					<exclude name="testForJBSEAM3866"></exclude>
+				</methods>
+			</class>
 		</classes>
 	</test>
 </suite>

Modified: branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/seamgen/src/main/org/jboss/seam/test/functional/seamgen/NewProjectTest.java
===================================================================
--- branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/seamgen/src/main/org/jboss/seam/test/functional/seamgen/NewProjectTest.java	2009-10-08 14:26:16 UTC (rev 11558)
+++ branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/seamgen/src/main/org/jboss/seam/test/functional/seamgen/NewProjectTest.java	2009-10-08 14:43:20 UTC (rev 11559)
@@ -75,4 +75,37 @@
       assertTrue(browser.isElementPresent(LOGIN), "User should not be logged in.");
       assertTrue(browser.getText(MESSAGES).contains(LOGIN_FAILED_MESSAGE), LOGIN_FAILED_MESSAGE + " expected.");
    }*/
+   
+   /**
+    * This method tests a difference between ./seam explode and ./seam restart . Calling the former
+    * one should not cause application redeploy.
+    *  
+    */
+   @Test(groups = { "newProjectGroup" })
+   public void explodeAndRestartDifferenceTest()
+   {
+      login();
+      // verify login
+      assertTrue(browser.isElementPresent(LOGOUT), "Logout link expected.");
+      assertTrue(browser.getText(SIGNED_USER).contains(DEFAULT_USERNAME), "Username not found. " + browser.getText(SIGNED_USER) + " found instead.");
+      // logout
+      
+      boolean explode = seamGen.isExplode();
+      seamGen.setExplode(true);
+      seamGen.hotDeploy();
+      seamGen.setExplode(explode);
+      
+      try
+      {
+         Thread.sleep(HOTDEPLOY_TIMEOUT);
+      }
+      catch (InterruptedException ie)
+      {
+         throw new RuntimeException(ie);
+      }
+      
+      browser.refreshAndWait();
+      assertTrue(browser.isElementPresent(LOGOUT), 
+            "Logout link expected. This means that the application was redeployed and caused the user not to be logged in");      
+   }
 }

Modified: branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/seamgen/src/main/org/jboss/seam/test/functional/seamgen/SeleniumSeamGenTest.java
===================================================================
--- branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/seamgen/src/main/org/jboss/seam/test/functional/seamgen/SeleniumSeamGenTest.java	2009-10-08 14:26:16 UTC (rev 11558)
+++ branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/seamgen/src/main/org/jboss/seam/test/functional/seamgen/SeleniumSeamGenTest.java	2009-10-08 14:43:20 UTC (rev 11559)
@@ -54,6 +54,8 @@
 
    public static final String DEFAULT_USERNAME = "admin";
    public static final String DEFAULT_PASSWORD = "";
+   
+   protected static Long HOTDEPLOY_TIMEOUT = 30000L;
 
    public static SeamSelenium browser;
 

Modified: branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/seamgen/src/main/org/jboss/seam/test/functional/seamgen/VehicleTest.java
===================================================================
--- branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/seamgen/src/main/org/jboss/seam/test/functional/seamgen/VehicleTest.java	2009-10-08 14:26:16 UTC (rev 11558)
+++ branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/seamgen/src/main/org/jboss/seam/test/functional/seamgen/VehicleTest.java	2009-10-08 14:43:20 UTC (rev 11559)
@@ -43,6 +43,9 @@
    public static final String VIEW_MAKE = "xpath=id('make')/div/span[2]";
    public static final String VIEW_MODEL = "xpath=id('model')/div/span[2]";
    public static final String VIEW_YEAR = "xpath=id('year')/div/span[2]";
+   
+   protected static String REGISTRATION_TEXT = "Registration";
+   protected static String ERROR_TEXT = "An Error Occurred";
 
    @Test(groups = "generate-entitiesTest", dependsOnGroups = { "newProjectGroup" })
    public void newVehicleTest()
@@ -139,7 +142,39 @@
       assertTrue(browser.isElementPresent(String.format(VEHICLE_LIST_ROW_BY_OWNER_NAME, registration, username)), "Person not assigned to vehicle.");
    }
 
+   /**
+    * This method verifies that JBSEAM3866 issue is already resolved
+    */
    @Test(groups = "generate-entitiesTest", dependsOnGroups = { "newProjectGroup" })
+   public void testForJBSEAM3866()
+   {
+      login();
+      browser.clickAndWait(VEHICLE_LINK);
+      assertTrue(browser.isTextPresent(REGISTRATION_TEXT),
+            "Page should contain text Registration");
+      
+      boolean explode = seamGen.isExplode();
+      seamGen.setExplode(true);
+      seamGen.hotDeploy();
+      seamGen.setExplode(explode);
+      
+      try
+      {
+         Thread.sleep(HOTDEPLOY_TIMEOUT);
+      }
+      catch (InterruptedException ie)
+      {
+         throw new RuntimeException(ie);
+      }
+      
+      browser.refreshAndWait();
+      assertTrue(browser.isTextPresent(REGISTRATION_TEXT),
+            "Page should contain text Registration, which indicates that the error JBSEAM3866 is not present anymore");
+      assertTrue(!browser.isTextPresent(ERROR_TEXT),
+            "Page contains \"ERROR_TEXT\" which means that JBSEAM3866 error still exists");      
+   }
+   
+   @Test(groups = "generate-entitiesTest", dependsOnGroups = { "newProjectGroup" })
    public void searchTest()
    {
       final String searchString = "9999999"; // should return two Audis

Modified: branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/seamgen/src/main/org/jboss/seam/test/functional/seamgen/utils/SeamGenAdapter.java
===================================================================
--- branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/seamgen/src/main/org/jboss/seam/test/functional/seamgen/utils/SeamGenAdapter.java	2009-10-08 14:26:16 UTC (rev 11558)
+++ branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/seamgen/src/main/org/jboss/seam/test/functional/seamgen/utils/SeamGenAdapter.java	2009-10-08 14:43:20 UTC (rev 11559)
@@ -66,7 +66,7 @@
       Project ant = new Project();
       ant.init();
       ProjectHelper.configureProject(ant, new File(buildfile));
-      // ant.addBuildListener(log);
+      ant.addBuildListener(log);
       return ant;
    }
 

Modified: branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/src/main/org/jboss/seam/example/common/test/selenium/SeamSeleniumTest.java
===================================================================
--- branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/src/main/org/jboss/seam/example/common/test/selenium/SeamSeleniumTest.java	2009-10-08 14:26:16 UTC (rev 11558)
+++ branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/src/main/org/jboss/seam/example/common/test/selenium/SeamSeleniumTest.java	2009-10-08 14:43:20 UTC (rev 11559)
@@ -51,14 +51,19 @@
     private static Properties properties = new Properties();
     private static boolean propertiesLoaded = false;
 
-    protected SeamSelenium browser;
+    protected static String SEAM_DIR;
+    protected static String APP_NAME;
+    protected static String OUTPUT_DIR;
+    
+    //protected SeamSelenium
+    public static SeamSelenium browser;
 
     @BeforeClass
     @Parameters( { "selenium.host", "selenium.server.port", "selenium.browser",
             "selenium.browser.url", "selenium.speed", "selenium.timeout",
-            "PROPERTY_FILE", "CONTEXT_PATH" })
+            "PROPERTY_FILE", "CONTEXT_PATH", "seam.dir" })
     public void setParameters(String host, String port, String browser,
-            String browserUrl, String speed, String timeout, String propertyFile, @Optional("") String contextPath) {
+            String browserUrl, String speed, String timeout, String propertyFile, @Optional("") String contextPath, String seamDir) {
         HOST = host;
         PORT = Integer.parseInt(port);
         BROWSER = browser;
@@ -66,7 +71,9 @@
         SPEED = speed;
         TIMEOUT = timeout;
         PROPERTY_FILE = propertyFile;
-        CONTEXT_PATH = contextPath;
+        CONTEXT_PATH = APP_NAME = contextPath;
+        SEAM_DIR = seamDir;
+        OUTPUT_DIR = SEAM_DIR + "/test-output/functional-framework";
     }
 
     @BeforeMethod
@@ -76,7 +83,8 @@
 
     @AfterMethod
     public void tearDown() {
-        stopBrowser();
+       /*browser is being closed from SeleniumFunctionalTestListener class*/ 
+       //stopBrowser()
     }
 
     public SeamSelenium startBrowser() {
@@ -89,7 +97,9 @@
     }
     
     public void stopBrowser() {
-        browser.stop();
+       if (browser != null) {
+          browser.stop();
+       }
     }
 
     public String getProperty(String key) {

Added: branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/src/main/org/jboss/seam/example/common/test/selenium/SeleniumFunctionalTestListener.java
===================================================================
--- branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/src/main/org/jboss/seam/example/common/test/selenium/SeleniumFunctionalTestListener.java	                        (rev 0)
+++ branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/src/main/org/jboss/seam/example/common/test/selenium/SeleniumFunctionalTestListener.java	2009-10-08 14:43:20 UTC (rev 11559)
@@ -0,0 +1,76 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, 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.seam.example.common.test.selenium;
+
+import org.testng.ITestContext;
+import org.testng.ITestListener;
+import org.testng.ITestResult;
+
+/**
+ * This listener class is used for capturing snapshot of running web application and storing 
+ * html source of the html file.
+ * 
+ * @author Martin Gencur
+ *
+ */
+public class SeleniumFunctionalTestListener extends SeamSeleniumTest implements ITestListener
+{
+   
+   public void onFinish(ITestContext arg0)
+   {
+   }
+   
+   public void onStart(ITestContext arg0)
+   {
+   }
+   
+   public void onTestFailedButWithinSuccessPercentage(ITestResult arg0)
+   {
+   }
+   
+   public void onTestFailure(ITestResult arg0)
+   {
+      String logPath = OUTPUT_DIR + APP_NAME + "/" + arg0.getName();
+      try {
+         SeamSeleniumTest.browser.captureScreenshot(logPath + ".png");
+      } catch (Exception e) {
+         e.printStackTrace();
+      } finally {
+         SeamSeleniumTest.browser.logHTMLContext(logPath + ".html");
+         stopBrowser();   
+      }      
+   }
+   
+   public void onTestSkipped(ITestResult arg0)
+   {
+      stopBrowser();
+   }
+   
+   public void onTestStart(ITestResult arg0)
+   {
+   }
+   
+   public void onTestSuccess(ITestResult arg0)
+   {
+      stopBrowser();
+   }   
+}
\ No newline at end of file



More information about the seam-commits mailing list