[seam-commits] Seam SVN: r10815 - in branches/community/Seam_2_1/src/test/ftest: lib and 2 other directories.

seam-commits at lists.jboss.org seam-commits at lists.jboss.org
Wed May 6 05:58:08 EDT 2009


Author: jharting
Date: 2009-05-06 05:58:08 -0400 (Wed, 06 May 2009)
New Revision: 10815

Added:
   branches/community/Seam_2_1/src/test/ftest/ftest.ci.properties
   branches/community/Seam_2_1/src/test/ftest/lib/cargo-core-uberjar-1.0.jar
Modified:
   branches/community/Seam_2_1/src/test/ftest/seamgen/build.xml
   branches/community/Seam_2_1/src/test/ftest/seamgen/src/main/org/jboss/seam/test/functional/seamgen/SeamGenTest.java
Log:
JBQA-2232 prepare seam-gen tests to run in CI

Added: branches/community/Seam_2_1/src/test/ftest/ftest.ci.properties
===================================================================
--- branches/community/Seam_2_1/src/test/ftest/ftest.ci.properties	                        (rev 0)
+++ branches/community/Seam_2_1/src/test/ftest/ftest.ci.properties	2009-05-06 09:58:08 UTC (rev 10815)
@@ -0,0 +1,81 @@
+ #
+ # 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.
+ # 
+
+#Build properties for running and executing functional tests in continuous integration environment
+
+selenium.server.port=14444
+selenium.host=localhost
+selenium.browser=*firefoxproxy
+#selenium.browser=*iexploreproxy
+selenium.browser.port=8080
+selenium.browser.url=http://127.0.0.1:8080
+selenium.speed=0
+selenium.timeout=120000
+selenium.icefaces.wait.time=2000
+
+# default max wait times in seconds
+jboss4.deploy.waittime=300
+jboss5.deploy.waittime=300
+tomcat6.deploy.waittime=60
+jboss-embedded.deploy.waittime=60
+
+# container locations - must be set
+# independent from ${seam.dir}/build.properties
+jboss4.home=jboss-4.2.3.GA
+jboss5.home=jboss-5.0.1.GA
+tomcat6.home=
+jboss-embedded.home=
+
+# container settings
+jboss4.profile=default
+jboss4.jvm.arguments=-Xms512m -Xmx1024m -XX:PermSize=256m -XX:MaxPermSize=512 -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000
+
+jboss5.profile=default
+jboss5.jvm.arguments=-Xms512m -Xmx1024m -XX:PermSize=256m -XX:MaxPermSize=512 -Dorg.jboss.resolver.warning=true -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000
+
+# seam-gen specific properties
+seamgen.delete.project=true
+
+# workspace for new projects
+workspace.home=projects
+
+# seam-gen project properties
+database.type=mysql
+database.exists=y
+database.drop=n
+driver.jar=mysql-connector-java-5.1.6-bin.jar
+driver.license.jar=
+hibernate.connection.username=seam
+hibernate.connection.password=seam
+hibernate.connection.driver_class=com.mysql.jdbc.Driver
+hibernate.connection.dataSource_class=com.mysql.jdbc.jdbc2.optional.MysqlDataSource
+hibernate.cache.provider_class=org.hibernate.cache.HashtableCacheProvider
+hibernate.default_catalog.null=
+hibernate.default_schema.null=
+hibernate.dialect=org.hibernate.dialect.MySQLDialect
+hibernate.connection.url=jdbc\:mysql\:///seam
+model.package=com.example
+action.package=com.example
+test.package=com.example.test
+richfaces.skin=classic
+icefaces.home=
+jboss.domain=default


Property changes on: branches/community/Seam_2_1/src/test/ftest/ftest.ci.properties
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: branches/community/Seam_2_1/src/test/ftest/lib/cargo-core-uberjar-1.0.jar
===================================================================
(Binary files differ)


Property changes on: branches/community/Seam_2_1/src/test/ftest/lib/cargo-core-uberjar-1.0.jar
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Modified: branches/community/Seam_2_1/src/test/ftest/seamgen/build.xml
===================================================================
--- branches/community/Seam_2_1/src/test/ftest/seamgen/build.xml	2009-05-06 08:44:30 UTC (rev 10814)
+++ branches/community/Seam_2_1/src/test/ftest/seamgen/build.xml	2009-05-06 09:58:08 UTC (rev 10815)
@@ -87,7 +87,7 @@
 		<run.selenium.test suite="icefaces" />
 	</target>
 
-	<target name="seam-gen.smoke.testsuite" description="Run smoke testsuite">
+	<target name="seam-gen.smoke.testsuite" depends="build" description="Run smoke testsuite">
 		<run.selenium.test suite="smoke" />
 	</target>
 
@@ -100,6 +100,7 @@
 			<testng haltonfailure="false" outputdir="${test.output.dir}" classpathref="classpath.test">
 				<xmlfileset file="@{suite}.xml" />
 				<sysproperty key="seam.dir" value="${seam.dir}" />
+				<sysproperty key="ftest.config.location" value="${ftest.config.location}" />
 			</testng>
 		</sequential>
 	</macrodef>

Modified: branches/community/Seam_2_1/src/test/ftest/seamgen/src/main/org/jboss/seam/test/functional/seamgen/SeamGenTest.java
===================================================================
--- branches/community/Seam_2_1/src/test/ftest/seamgen/src/main/org/jboss/seam/test/functional/seamgen/SeamGenTest.java	2009-05-06 08:44:30 UTC (rev 10814)
+++ branches/community/Seam_2_1/src/test/ftest/seamgen/src/main/org/jboss/seam/test/functional/seamgen/SeamGenTest.java	2009-05-06 09:58:08 UTC (rev 10815)
@@ -27,6 +27,18 @@
 import java.io.IOException;
 import java.util.Properties;
 
+import org.codehaus.cargo.container.ContainerType;
+import org.codehaus.cargo.container.InstalledLocalContainer;
+import org.codehaus.cargo.container.LocalContainer;
+import org.codehaus.cargo.container.configuration.ConfigurationType;
+import org.codehaus.cargo.container.configuration.LocalConfiguration;
+import org.codehaus.cargo.container.jboss.JBoss42xInstalledLocalContainer;
+import org.codehaus.cargo.container.jboss.JBoss5xInstalledLocalContainer;
+import org.codehaus.cargo.container.jboss.JBossExistingLocalConfiguration;
+import org.codehaus.cargo.container.jboss.JBossStandaloneLocalConfiguration;
+import org.codehaus.cargo.generic.DefaultContainerFactory;
+import org.codehaus.cargo.generic.configuration.ConfigurationFactory;
+import org.codehaus.cargo.generic.configuration.DefaultConfigurationFactory;
 import org.jboss.seam.test.functional.seamgen.utils.SeamGenAdapter;
 import org.openqa.selenium.server.RemoteControlConfiguration;
 import org.openqa.selenium.server.SeleniumServer;
@@ -39,6 +51,7 @@
 
 /**
  * Base class for seam-gen functional tests.
+ * 
  * @author Jozef Hartinger
  */
 public class SeamGenTest
@@ -83,34 +96,53 @@
 
    // Selenium server instance
    protected static SeleniumServer seleniumServer;
+   // Container instance
+   protected static LocalContainer container;
 
    @BeforeSuite
    @Parameters("seam.dir")
-   public void beforeSuite(@Optional(".") String seamDir) throws Exception {
+   public void beforeSuite(@Optional(".") String seamDir) throws Exception
+   {
       // Seam location
       SEAM_DIR = seamDir;
-      SEAM_FTEST_PROPERTIES_FILE = SEAM_DIR + "/src/test/ftest/ftest.properties";
+
+      // ftest configuration file
+      String relativeLocation = System.getProperty("ftest.config.location");
+      if (relativeLocation.equals("${ftest.config.location}"))
+      {
+         SEAM_FTEST_PROPERTIES_FILE = SEAM_DIR + "/src/test/ftest/ftest.properties";
+      }
+      else
+      {
+         SEAM_FTEST_PROPERTIES_FILE = SEAM_DIR + "/" + relativeLocation;
+      }
       SEAMGEN_BUILDFILE = SEAM_DIR + "/seam-gen/build.xml";
       SEAMGEN_PROPERTIES_FILE = SEAM_DIR + "/seam-gen/build.properties";
-      OUTPUT_DIR =  SEAM_DIR + "/test-output/functional-framework/";
-      
+      OUTPUT_DIR = SEAM_DIR + "/test-output/functional-framework/";
+
       loadFtestProperties();
       createOutputDir();
       startSeleniumServer();
+      container = startContainer(CONTAINER, CONTAINER_LOCATION);
    }
-   
+
    @AfterSuite
-   public void afterSuite() {
+   public void afterSuite()
+   {
       seleniumServer.stop();
+      if (container != null)
+      {
+         stopContainer(container);
+      }
    }
-   
+
    @BeforeTest
    @Parameters( { "icefaces", "type", "suffix", "explode" })
    public void setUp(@Optional("false") boolean icefaces, @Optional("ear") String type, @Optional("") String suffix, @Optional("true") boolean explode) throws Exception
    {
       ICEFACES = icefaces;
       WAR = type.equalsIgnoreCase("war");
-      APP_NAME = "seamGenTestApp" + (ICEFACES ? "Ice" : "Rich") + (WAR ? "War" : "Ear") + (explode? "E" : "D") + suffix;
+      APP_NAME = "seamGenTestApp" + (ICEFACES ? "Ice" : "Rich") + (WAR ? "War" : "Ear") + (explode ? "E" : "D") + suffix;
       HOME_PAGE = "/" + APP_NAME + "/home.seam";
 
       setSeamGenProperties();
@@ -159,9 +191,9 @@
    private void setSeamGenProperties()
    {
       seamGenProperties = new Properties();
-      
-      String[] propertiesToCopy = { "database.type", "database.exists", "database.drop", "driver.jar", "driver.license.jar", "hibernate.connection.username", "hibernate.connection.password", "hibernate.connection.driver_class", "hibernate.connection.dataSource_class", "hibernate.cache.provider_class", "hibernate.default_catalog.null", "hibernate.default_schema.null", "hibernate.dialect", "hibernate.connection.url", "model.package", "action.package", "test.package", "richfaces.skin", "icefaces.home", "jboss.home" };
 
+      String[] propertiesToCopy = { "database.type", "database.exists", "database.drop", "driver.jar", "driver.license.jar", "hibernate.connection.username", "hibernate.connection.password", "hibernate.connection.driver_class", "hibernate.connection.dataSource_class", "hibernate.cache.provider_class", "hibernate.default_catalog.null", "hibernate.default_schema.null", "hibernate.dialect", "hibernate.connection.url", "model.package", "action.package", "test.package", "richfaces.skin", "icefaces.home", "jboss.domain" };
+
       for (String property : propertiesToCopy)
       {
          if (ftestProperties.get(property) != null)
@@ -195,4 +227,35 @@
          dir.mkdir();
       }
    }
-}
+
+   public LocalContainer startContainer(String containerName, String containerHome)
+   {
+
+      LocalConfiguration configuration = new JBossExistingLocalConfiguration(containerHome + "/server/default");
+
+      InstalledLocalContainer container;
+
+      if (containerName.equals("jboss4"))
+      {
+         container = new JBoss42xInstalledLocalContainer(configuration);
+
+      }
+      else if (containerName.equals("jboss5"))
+      {
+         container = new JBoss5xInstalledLocalContainer(configuration);
+      }
+      else
+      {
+         throw new RuntimeException("Unknown container");
+      }
+      container.setHome(containerHome);
+
+      container.start();
+      return container;
+   }
+
+   public void stopContainer(LocalContainer container)
+   {
+      container.stop();
+   }
+}
\ No newline at end of file




More information about the seam-commits mailing list