Author: sohil.shah(a)jboss.com
Date: 2008-04-08 01:26:51 -0400 (Tue, 08 Apr 2008)
New Revision: 10515
Added:
modules/test/trunk/remote/src/main/java/org/jboss/unit/remote/driver/webpage/SeleniumConfiguration.java
modules/test/trunk/remote/src/main/java/org/jboss/unit/remote/web/
modules/test/trunk/remote/src/main/java/org/jboss/unit/remote/web/deployment/
modules/test/trunk/remote/src/main/java/org/jboss/unit/remote/web/deployment/ActualBootstrap.java
modules/test/trunk/remote/src/main/java/org/jboss/unit/remote/web/deployment/WebBootstrap.java
Removed:
modules/test/trunk/remote/src/test/java/org/jboss/unit/test/remote/ActualBootstrap.java
modules/test/trunk/remote/src/test/java/org/jboss/unit/test/remote/WebBootstrap.java
Modified:
modules/test/trunk/remote/pom.xml
modules/test/trunk/remote/src/main/java/org/jboss/unit/remote/driver/webpage/ClickLinkCommand.java
modules/test/trunk/remote/src/main/java/org/jboss/unit/remote/driver/webpage/GetPageCommand.java
modules/test/trunk/remote/src/main/java/org/jboss/unit/remote/driver/webpage/WebPageConversation.java
modules/test/trunk/remote/src/main/java/org/jboss/unit/remote/driver/webpage/WebPageDriverCommand.java
modules/test/trunk/remote/src/test/build.xml
modules/test/trunk/remote/src/test/java/org/jboss/unit/test/remote/webpage/ClickLinkCommandTestCase.java
modules/test/trunk/remote/src/test/java/org/jboss/unit/test/remote/webpage/GetPageCommandTestCase.java
modules/test/trunk/remote/src/test/resources/remote-jboss-unit.xml
modules/test/trunk/remote/src/test/resources/server-beans.xml
modules/test/trunk/remote/src/test/resources/war/WEB-INF/web.xml
Log:
* browser paramaterization of selenium integration
* test suite disabled in remote/pom.xml since hudson's browser environment is not yet
setup
Modified: modules/test/trunk/remote/pom.xml
===================================================================
--- modules/test/trunk/remote/pom.xml 2008-04-07 12:55:25 UTC (rev 10514)
+++ modules/test/trunk/remote/pom.xml 2008-04-08 05:26:51 UTC (rev 10515)
@@ -100,7 +100,7 @@
</dependency>
</dependencies>
- <!-- DeActivating Selenium integration test until the Selenium Tests are
parametrized with proper pointers to firefox -->
+ <!-- DeActivating Selenium integration test until proper browser environment is
setup on hudson. otherwise the test suite fails -->
<!--
<build>
<plugins>
@@ -126,6 +126,9 @@
<goals>
<goal>stop-server</goal>
</goals>
+ <configuration>
+ <port>12345</port>
+ </configuration>
</execution>
</executions>
</plugin>
@@ -174,8 +177,8 @@
<property name="dependency.jboss-dependency.jar"
value="${maven.dependency.org.jboss.microcontainer.jboss-dependency.jar.path}"/>
<property name="dependency.jboss-common-core.jar"
value="${maven.dependency.org.jboss.jboss-common-core.jar.path}"/>
<property name="dependency.jboss-remoting.jar"
value="${maven.dependency.jboss.jboss-remoting.jar.path}"/>
+
-
<ant antfile="${basedir}/src/test/build.xml">
<target name="run.test.remote"/>
</ant>
@@ -190,7 +193,8 @@
</plugins>
</build>
-->
-
+
+
<properties>
</properties>
</project>
Modified:
modules/test/trunk/remote/src/main/java/org/jboss/unit/remote/driver/webpage/ClickLinkCommand.java
===================================================================
---
modules/test/trunk/remote/src/main/java/org/jboss/unit/remote/driver/webpage/ClickLinkCommand.java 2008-04-07
12:55:25 UTC (rev 10514)
+++
modules/test/trunk/remote/src/main/java/org/jboss/unit/remote/driver/webpage/ClickLinkCommand.java 2008-04-08
05:26:51 UTC (rev 10515)
@@ -58,12 +58,12 @@
/**
*
*/
- public void execute(RemoteDriverCommandContext webPageCommandContext)
+ public void execute(SeleniumConfiguration config, RemoteDriverCommandContext
webPageCommandContext)
{
Selenium browser = null;
try
{
- browser = new DefaultSelenium("localhost",12345, "*firefox
/home/soshah/firefox/firefox-bin", uri.toString());
+ browser = new DefaultSelenium(config.getHost(),config.getPort(),
"*"+config.getBrowser(), uri.toString());
browser.start();
browser.open(uri.toString());
Modified:
modules/test/trunk/remote/src/main/java/org/jboss/unit/remote/driver/webpage/GetPageCommand.java
===================================================================
---
modules/test/trunk/remote/src/main/java/org/jboss/unit/remote/driver/webpage/GetPageCommand.java 2008-04-07
12:55:25 UTC (rev 10514)
+++
modules/test/trunk/remote/src/main/java/org/jboss/unit/remote/driver/webpage/GetPageCommand.java 2008-04-08
05:26:51 UTC (rev 10515)
@@ -50,12 +50,12 @@
* @param webPageCommandContext
* @return
*/
- public void execute(RemoteDriverCommandContext webPageCommandContext)
+ public void execute(SeleniumConfiguration config, RemoteDriverCommandContext
webPageCommandContext)
{
Selenium browser = null;
try
{
- browser = new DefaultSelenium("localhost",12345, "*firefox
/home/soshah/firefox/firefox-bin", uri.toString());
+ browser = new DefaultSelenium(config.getHost(),config.getPort(),
"*"+config.getBrowser(), uri.toString());
browser.start();
browser.open(uri.toString());
Added:
modules/test/trunk/remote/src/main/java/org/jboss/unit/remote/driver/webpage/SeleniumConfiguration.java
===================================================================
---
modules/test/trunk/remote/src/main/java/org/jboss/unit/remote/driver/webpage/SeleniumConfiguration.java
(rev 0)
+++
modules/test/trunk/remote/src/main/java/org/jboss/unit/remote/driver/webpage/SeleniumConfiguration.java 2008-04-08
05:26:51 UTC (rev 10515)
@@ -0,0 +1,74 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated 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.unit.remote.driver.webpage;
+
+/**
+ * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
+ *
+ */
+public class SeleniumConfiguration
+{
+ private String host = null;
+ private int port = 0;
+ private String browser = null;
+
+ /**
+ *
+ * @param host
+ * @param port
+ * @param browser
+ */
+ public SeleniumConfiguration(String host, int port, String browser)
+ {
+ this.host = host;
+ this.port = port;
+ this.browser = browser;
+ }
+
+ /**
+ *
+ * @return
+ */
+ public String getBrowser()
+ {
+ return browser;
+ }
+
+ /**
+ *
+ * @return
+ */
+ public String getHost()
+ {
+ return host;
+ }
+
+ /**
+ *
+ * @return
+ */
+ public int getPort()
+ {
+ return port;
+ }
+}
Modified:
modules/test/trunk/remote/src/main/java/org/jboss/unit/remote/driver/webpage/WebPageConversation.java
===================================================================
---
modules/test/trunk/remote/src/main/java/org/jboss/unit/remote/driver/webpage/WebPageConversation.java 2008-04-07
12:55:25 UTC (rev 10514)
+++
modules/test/trunk/remote/src/main/java/org/jboss/unit/remote/driver/webpage/WebPageConversation.java 2008-04-08
05:26:51 UTC (rev 10515)
@@ -24,6 +24,7 @@
import org.jboss.portal.test.framework.server.Node;
import org.jboss.unit.driver.DriverCommand;
+import org.jboss.unit.driver.command.StartTestCommand;
import org.jboss.portal.test.framework.server.NodeId;
import org.jboss.unit.remote.driver.RemoteDriverCommandContext;
import org.jboss.unit.remote.driver.RemoteDriverResponseContext;
@@ -60,7 +61,7 @@
DriverCommand command = commandContext.getCommand();
if(command instanceof WebPageDriverCommand)
{
- ((WebPageDriverCommand)command).execute(commandContext);
+ ((WebPageDriverCommand)command).execute(this.getSeleniumConfig(commandContext),
commandContext);
//Push the data extracted from executing the command over to the Server Side
Extension of the Test
this.pushContext(commandContext);
@@ -109,4 +110,24 @@
return remoteResponseContext;
}
+
+ /**
+ *
+ * @param commandContext
+ * @return
+ */
+ private SeleniumConfiguration getSeleniumConfig(RemoteDriverCommandContext
commandContext)
+ {
+ SeleniumConfiguration config = null;
+
+ StartTestCommand startCommand =
(StartTestCommand)commandContext.getResponseContext().getCommandContext().getCommand();
+
+ String host =
(String)startCommand.getParametrization().get("selenium-server-host");
+ int port =
Integer.parseInt((String)startCommand.getParametrization().get("selenium-server-port"));
+ String browser =
(String)startCommand.getParametrization().get("browser");
+
+ config = new SeleniumConfiguration(host,port,browser);
+
+ return config;
+ }
}
Modified:
modules/test/trunk/remote/src/main/java/org/jboss/unit/remote/driver/webpage/WebPageDriverCommand.java
===================================================================
---
modules/test/trunk/remote/src/main/java/org/jboss/unit/remote/driver/webpage/WebPageDriverCommand.java 2008-04-07
12:55:25 UTC (rev 10514)
+++
modules/test/trunk/remote/src/main/java/org/jboss/unit/remote/driver/webpage/WebPageDriverCommand.java 2008-04-08
05:26:51 UTC (rev 10515)
@@ -52,7 +52,7 @@
* @param webPageCommandContext
* @return
*/
- public abstract void execute(RemoteDriverCommandContext webPageCommandContext);
+ public abstract void execute(SeleniumConfiguration config, RemoteDriverCommandContext
webPageCommandContext);
/**
*
Added:
modules/test/trunk/remote/src/main/java/org/jboss/unit/remote/web/deployment/ActualBootstrap.java
===================================================================
---
modules/test/trunk/remote/src/main/java/org/jboss/unit/remote/web/deployment/ActualBootstrap.java
(rev 0)
+++
modules/test/trunk/remote/src/main/java/org/jboss/unit/remote/web/deployment/ActualBootstrap.java 2008-04-08
05:26:51 UTC (rev 10515)
@@ -0,0 +1,55 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated 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.unit.remote.web.deployment;
+
+import org.jboss.kernel.plugins.bootstrap.basic.BasicBootstrap;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class ActualBootstrap extends BasicBootstrap
+{
+
+ /** . */
+ private final WebBootstrap callback;
+
+ // I don't know why we need to declare it since super() does not declare it
+ public ActualBootstrap(WebBootstrap callback) throws Exception
+ {
+ super();
+
+ //
+ this.callback = callback;
+ }
+
+ protected void bootstrap() throws Throwable
+ {
+ super.bootstrap();
+
+ //
+ callback.boostrap();
+ }
+
+}
+
Added:
modules/test/trunk/remote/src/main/java/org/jboss/unit/remote/web/deployment/WebBootstrap.java
===================================================================
---
modules/test/trunk/remote/src/main/java/org/jboss/unit/remote/web/deployment/WebBootstrap.java
(rev 0)
+++
modules/test/trunk/remote/src/main/java/org/jboss/unit/remote/web/deployment/WebBootstrap.java 2008-04-08
05:26:51 UTC (rev 10515)
@@ -0,0 +1,246 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated 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.unit.remote.web.deployment;
+
+import org.jboss.kernel.plugins.deployment.xml.BeanXMLDeployer;
+import org.jboss.kernel.spi.deployment.KernelDeployment;
+import org.jboss.kernel.spi.event.KernelEventListener;
+import org.jboss.kernel.spi.event.KernelEvent;
+import org.jboss.kernel.spi.registry.KernelRegistry;
+import org.jboss.kernel.spi.registry.KernelRegistryEntry;
+import org.apache.log4j.Logger;
+
+import javax.servlet.ServletContext;
+import javax.servlet.ServletContextListener;
+import javax.servlet.ServletContextEvent;
+import java.net.URL;
+import java.net.MalformedURLException;
+
+/**
+ * A kernel bootstrap with a life cycle triggered by the
<code>ServletContextListener</code> interface.
+ * All beans will be injected as servlet context attributes. The bean xml file must be
available as
+ * a servlet context resource under the path
<i>/WEB-INF/jboss-beans.xml</i>.
+ *
+ * @todo specify an alternative logger name
+ * @todo implement the specification of an alternative xml file path
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class WebBootstrap implements ServletContextListener, KernelEventListener
+{
+
+ /**
+ * The servlet context init parameter name for the bean resource location. For
instance for a web application
+ * resource it could be <i>/WEB-INF/my-beans.xml</i>, for the web
application classloader resource it could be
+ * <i>org/jboss/portal/my-beans.xml</i>. If no init parameter is declared
then the litteral value
+ * <i>/WEB-INF/jboss-beans.xml</i> is used and the lookup is done in the
servlet context resourcees.
+ */
+ public static final String BEANS_RESOURCE_LOCATION_KEY =
"jboss.portal.mc.beans_resource_location";
+
+ /**
+ * The servlet context init parameter name for the bean resource type which can be the
servlet context
+ * or the web application classloader. If no value is specified the servlet context
will be used for
+ * resource lookup. The legal values are <i>context</i> for the servlet
context and <i>classloader</i>
+ * for the web application classloader.
+ */
+ public static final String BEANS_RESOURCE_TYPE_KEY =
"jboss.portal.mc.beans_resource_type";
+
+ /** Default value for the bean resource location. */
+ public static final String DEFAULT_JBOSS_BEANS_RESOURCE_LOCATION =
"/WEB-INF/jboss-beans.xml";
+
+ /** Servlet context resource type. */
+ public static final String CONTEXT_RESOURCE_TYPE = "context";
+
+ /** Classloader resource type. */
+ public static final String CLASSLOADER_RESOURCE_TYPE = "classloader";
+
+ /** . */
+ private final static Logger log = Logger.getLogger(WebBootstrap.class);
+
+ /** . */
+ private ServletContext servletContext;
+
+ /** . */
+ private BeanXMLDeployer deployer;
+
+ /** . */
+ private KernelDeployment deployment;
+
+ /** . */
+ private boolean registered;
+
+ /** . */
+ private ActualBootstrap bootstrap;
+
+ public void contextInitialized(ServletContextEvent event)
+ {
+ servletContext = event.getServletContext();
+
+ //
+ try
+ {
+ bootstrap = new ActualBootstrap(this);
+
+ //
+ bootstrap.run();
+
+ //
+ log.info("Web kernel started");
+ }
+ catch (Exception e)
+ {
+ log.info("Web kernel boostrap failed", e);
+ }
+ }
+
+ public void contextDestroyed(ServletContextEvent event)
+ {
+ log.info("Web kernel shutdown");
+
+ //
+ if (deployment != null)
+ {
+ deployer.undeploy(deployment);
+ }
+
+ //
+ if (registered)
+ {
+ registered = false;
+ try
+ {
+ KernelRegistry registry = bootstrap.getKernel().getRegistry();
+ registry.unregisterListener(this, null, "ABC");
+ }
+ catch (Throwable throwable)
+ {
+ log.error("Cannot unregister kernel registry listener",
throwable);
+ }
+ }
+
+ //
+ servletContext = null;
+
+ //
+ log.info("Web kernel stopped");
+ }
+
+ public void onEvent(KernelEvent event, Object object)
+ {
+ Object context = event.getContext();
+ if (context instanceof String)
+ {
+ String key = (String)context;
+ String type = event.getType();
+ if ("KERNEL_REGISTRY_REGISTERED".equals(type))
+ {
+ KernelRegistryEntry entry =
bootstrap.getKernel().getRegistry().getEntry(context);
+ Object target = entry.getTarget();
+ servletContext.setAttribute(key, target);
+ }
+ else if ("KERNEL_REGISTRY_UNREGISTERED".equals(type))
+ {
+ servletContext.removeAttribute(key);
+ }
+ }
+ }
+
+ void boostrap() throws Throwable
+ {
+ //
+ bootstrap.getKernel().getRegistry().registerListener(WebBootstrap.this, null,
"ABC");
+ registered = true;
+
+ //
+ deployer = new BeanXMLDeployer(bootstrap.getKernel());
+
+ //
+ URL url = getBeansURL();
+
+ //
+ if (url != null)
+ {
+ log.debug("About to deploy beans url=" + url);
+ deployment = deployer.deploy(url);
+ }
+ else
+ {
+ log.error("No valid beans URL was determined");
+ }
+ }
+
+ protected URL getBeansURL()
+ {
+ String location = servletContext.getInitParameter(BEANS_RESOURCE_LOCATION_KEY);
+ String type = servletContext.getInitParameter(BEANS_RESOURCE_TYPE_KEY);
+
+ //
+ if (location == null)
+ {
+ location = DEFAULT_JBOSS_BEANS_RESOURCE_LOCATION;
+ type = CONTEXT_RESOURCE_TYPE;
+ }
+ else if (type == null)
+ {
+ type = CONTEXT_RESOURCE_TYPE;
+ }
+
+ //
+ if (CONTEXT_RESOURCE_TYPE.equals(type))
+ {
+ try
+ {
+ return servletContext.getResource(location);
+ }
+ catch (MalformedURLException e)
+ {
+ log.error("Cannot obtain beans definition file from servlet context with
location=" + location, e);
+
+ //
+ return null;
+ }
+ }
+ else if (CLASSLOADER_RESOURCE_TYPE.equals(type))
+ {
+ URL resource =
Thread.currentThread().getContextClassLoader().getResource(location);
+
+ //
+ if (resource == null)
+ {
+ log.error("Cannot obtain bean definition file from thread context
classloader with location=" + location);
+ }
+
+ //
+ return resource;
+ }
+ else
+ {
+ log.error("Cannot obtain bean definition file since the context type cannot
be determined type=" + type);
+
+ //
+ return null;
+ }
+ }
+}
+
Modified: modules/test/trunk/remote/src/test/build.xml
===================================================================
--- modules/test/trunk/remote/src/test/build.xml 2008-04-07 12:55:25 UTC (rev 10514)
+++ modules/test/trunk/remote/src/test/build.xml 2008-04-08 05:26:51 UTC (rev 10515)
@@ -86,15 +86,51 @@
<tests
config="${basedir}/src/test/resources/remote-jboss-unit.xml">
<property name="serverName"
value="RemoteJBoss_4_2_1"/>
<property name="archivePath" value="${target}/test"/>
- <property name="archiveId" value="test-remote.ear"/>
+ <property name="archiveId" value="test-remote.ear"/>
+ <parameter name="selenium-server-host">
+ <value>localhost</value>
+ </parameter>
+
+ <parameter name="selenium-server-port">
+ <value>12345</value>
+ </parameter>
+
+ <parameter name="browser">
+ <value>firefox</value>
+ <!-- Uncomment to test with Internet Explorer -->
+ <!--<value>iexplore</value>-->
+ </parameter>
+
<classpath>
<pathelement path="${test_classpath}"/>
</classpath>
</tests>
- </jboss-unit>
+ </jboss-unit>
</target>
+ <target name="run.test.remote" depends="package-tests">
+ <!-- turn serverside debugging on and off here -->
+ <property name="serverDebug" value="false"/>
+
+ <!-- start the jboss unit remote server side components -->
+ <condition property="debug" value="-Xdebug -Xnoagent
-Xrunjdwp:transport=dt_socket,server=y,address=8787,suspend=y" else="">
+ <istrue value="${serverDebug}"/>
+ </condition>
+ <antcall target="cargo.jboss4x.start">
+ <param name="cargo.jvmargs.value" value="${debug}"/>
+ </antcall>
+
+ <!-- run the actual jboss unit remote test suite -->
+ <antcall target="test.remote">
+ <!-- turn client side debugging on and off here -->
+ <param name="clientDebug" value="false"/>
+ </antcall>
+
+ <!-- stop the jboss unit remote server side components -->
+ <antcall target="cargo.jboss4x.stop"/>
+ </target>
+
<target name="cargo.jboss4x.start" depends="cargo.setup">
<cargo
containerId="jboss42x"
@@ -124,29 +160,7 @@
</configuration>
</cargo>
</target>
-
- <target name="run.test.remote" depends="package-tests">
- <!-- turn serverside debugging on and off here -->
- <property name="serverDebug" value="false"/>
- <!-- start the jboss unit remote server side components -->
- <condition property="debug" value="-Xdebug -Xnoagent
-Xrunjdwp:transport=dt_socket,server=y,address=8787,suspend=y" else="">
- <istrue value="${serverDebug}"/>
- </condition>
- <antcall target="cargo.jboss4x.start">
- <param name="cargo.jvmargs.value" value="${debug}"/>
- </antcall>
-
- <!-- run the actual jboss unit remote test suite -->
- <antcall target="test.remote">
- <!-- turn client side debugging on and off here -->
- <param name="clientDebug" value="false"/>
- </antcall>
-
- <!-- stop the jboss unit remote server side components -->
- <antcall target="cargo.jboss4x.stop"/>
- </target>
-
<target name="cargo.setup" depends="prepare_env">
<property name="cargo.log.dir"
value="${target}/test/cargo"/>
<mkdir dir="${cargo.log.dir}"/>
Deleted:
modules/test/trunk/remote/src/test/java/org/jboss/unit/test/remote/ActualBootstrap.java
===================================================================
---
modules/test/trunk/remote/src/test/java/org/jboss/unit/test/remote/ActualBootstrap.java 2008-04-07
12:55:25 UTC (rev 10514)
+++
modules/test/trunk/remote/src/test/java/org/jboss/unit/test/remote/ActualBootstrap.java 2008-04-08
05:26:51 UTC (rev 10515)
@@ -1,55 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated 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.unit.test.remote;
-
-import org.jboss.kernel.plugins.bootstrap.basic.BasicBootstrap;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 1.1 $
- */
-public class ActualBootstrap extends BasicBootstrap
-{
-
- /** . */
- private final WebBootstrap callback;
-
- // I don't know why we need to declare it since super() does not declare it
- public ActualBootstrap(WebBootstrap callback) throws Exception
- {
- super();
-
- //
- this.callback = callback;
- }
-
- protected void bootstrap() throws Throwable
- {
- super.bootstrap();
-
- //
- callback.boostrap();
- }
-
-}
-
Deleted:
modules/test/trunk/remote/src/test/java/org/jboss/unit/test/remote/WebBootstrap.java
===================================================================
---
modules/test/trunk/remote/src/test/java/org/jboss/unit/test/remote/WebBootstrap.java 2008-04-07
12:55:25 UTC (rev 10514)
+++
modules/test/trunk/remote/src/test/java/org/jboss/unit/test/remote/WebBootstrap.java 2008-04-08
05:26:51 UTC (rev 10515)
@@ -1,246 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated 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.unit.test.remote;
-
-import org.jboss.kernel.plugins.deployment.xml.BeanXMLDeployer;
-import org.jboss.kernel.spi.deployment.KernelDeployment;
-import org.jboss.kernel.spi.event.KernelEventListener;
-import org.jboss.kernel.spi.event.KernelEvent;
-import org.jboss.kernel.spi.registry.KernelRegistry;
-import org.jboss.kernel.spi.registry.KernelRegistryEntry;
-import org.apache.log4j.Logger;
-
-import javax.servlet.ServletContext;
-import javax.servlet.ServletContextListener;
-import javax.servlet.ServletContextEvent;
-import java.net.URL;
-import java.net.MalformedURLException;
-
-/**
- * A kernel bootstrap with a life cycle triggered by the
<code>ServletContextListener</code> interface.
- * All beans will be injected as servlet context attributes. The bean xml file must be
available as
- * a servlet context resource under the path
<i>/WEB-INF/jboss-beans.xml</i>.
- *
- * @todo specify an alternative logger name
- * @todo implement the specification of an alternative xml file path
- *
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 1.1 $
- */
-public class WebBootstrap implements ServletContextListener, KernelEventListener
-{
-
- /**
- * The servlet context init parameter name for the bean resource location. For
instance for a web application
- * resource it could be <i>/WEB-INF/my-beans.xml</i>, for the web
application classloader resource it could be
- * <i>org/jboss/portal/my-beans.xml</i>. If no init parameter is declared
then the litteral value
- * <i>/WEB-INF/jboss-beans.xml</i> is used and the lookup is done in the
servlet context resourcees.
- */
- public static final String BEANS_RESOURCE_LOCATION_KEY =
"jboss.portal.mc.beans_resource_location";
-
- /**
- * The servlet context init parameter name for the bean resource type which can be the
servlet context
- * or the web application classloader. If no value is specified the servlet context
will be used for
- * resource lookup. The legal values are <i>context</i> for the servlet
context and <i>classloader</i>
- * for the web application classloader.
- */
- public static final String BEANS_RESOURCE_TYPE_KEY =
"jboss.portal.mc.beans_resource_type";
-
- /** Default value for the bean resource location. */
- public static final String DEFAULT_JBOSS_BEANS_RESOURCE_LOCATION =
"/WEB-INF/jboss-beans.xml";
-
- /** Servlet context resource type. */
- public static final String CONTEXT_RESOURCE_TYPE = "context";
-
- /** Classloader resource type. */
- public static final String CLASSLOADER_RESOURCE_TYPE = "classloader";
-
- /** . */
- private final static Logger log = Logger.getLogger(WebBootstrap.class);
-
- /** . */
- private ServletContext servletContext;
-
- /** . */
- private BeanXMLDeployer deployer;
-
- /** . */
- private KernelDeployment deployment;
-
- /** . */
- private boolean registered;
-
- /** . */
- private ActualBootstrap bootstrap;
-
- public void contextInitialized(ServletContextEvent event)
- {
- servletContext = event.getServletContext();
-
- //
- try
- {
- bootstrap = new ActualBootstrap(this);
-
- //
- bootstrap.run();
-
- //
- log.info("Web kernel started");
- }
- catch (Exception e)
- {
- log.info("Web kernel boostrap failed", e);
- }
- }
-
- public void contextDestroyed(ServletContextEvent event)
- {
- log.info("Web kernel shutdown");
-
- //
- if (deployment != null)
- {
- deployer.undeploy(deployment);
- }
-
- //
- if (registered)
- {
- registered = false;
- try
- {
- KernelRegistry registry = bootstrap.getKernel().getRegistry();
- registry.unregisterListener(this, null, "ABC");
- }
- catch (Throwable throwable)
- {
- log.error("Cannot unregister kernel registry listener",
throwable);
- }
- }
-
- //
- servletContext = null;
-
- //
- log.info("Web kernel stopped");
- }
-
- public void onEvent(KernelEvent event, Object object)
- {
- Object context = event.getContext();
- if (context instanceof String)
- {
- String key = (String)context;
- String type = event.getType();
- if ("KERNEL_REGISTRY_REGISTERED".equals(type))
- {
- KernelRegistryEntry entry =
bootstrap.getKernel().getRegistry().getEntry(context);
- Object target = entry.getTarget();
- servletContext.setAttribute(key, target);
- }
- else if ("KERNEL_REGISTRY_UNREGISTERED".equals(type))
- {
- servletContext.removeAttribute(key);
- }
- }
- }
-
- void boostrap() throws Throwable
- {
- //
- bootstrap.getKernel().getRegistry().registerListener(WebBootstrap.this, null,
"ABC");
- registered = true;
-
- //
- deployer = new BeanXMLDeployer(bootstrap.getKernel());
-
- //
- URL url = getBeansURL();
-
- //
- if (url != null)
- {
- log.debug("About to deploy beans url=" + url);
- deployment = deployer.deploy(url);
- }
- else
- {
- log.error("No valid beans URL was determined");
- }
- }
-
- protected URL getBeansURL()
- {
- String location = servletContext.getInitParameter(BEANS_RESOURCE_LOCATION_KEY);
- String type = servletContext.getInitParameter(BEANS_RESOURCE_TYPE_KEY);
-
- //
- if (location == null)
- {
- location = DEFAULT_JBOSS_BEANS_RESOURCE_LOCATION;
- type = CONTEXT_RESOURCE_TYPE;
- }
- else if (type == null)
- {
- type = CONTEXT_RESOURCE_TYPE;
- }
-
- //
- if (CONTEXT_RESOURCE_TYPE.equals(type))
- {
- try
- {
- return servletContext.getResource(location);
- }
- catch (MalformedURLException e)
- {
- log.error("Cannot obtain beans definition file from servlet context with
location=" + location, e);
-
- //
- return null;
- }
- }
- else if (CLASSLOADER_RESOURCE_TYPE.equals(type))
- {
- URL resource =
Thread.currentThread().getContextClassLoader().getResource(location);
-
- //
- if (resource == null)
- {
- log.error("Cannot obtain bean definition file from thread context
classloader with location=" + location);
- }
-
- //
- return resource;
- }
- else
- {
- log.error("Cannot obtain bean definition file since the context type cannot
be determined type=" + type);
-
- //
- return null;
- }
- }
-}
-
Modified:
modules/test/trunk/remote/src/test/java/org/jboss/unit/test/remote/webpage/ClickLinkCommandTestCase.java
===================================================================
---
modules/test/trunk/remote/src/test/java/org/jboss/unit/test/remote/webpage/ClickLinkCommandTestCase.java 2008-04-07
12:55:25 UTC (rev 10514)
+++
modules/test/trunk/remote/src/test/java/org/jboss/unit/test/remote/webpage/ClickLinkCommandTestCase.java 2008-04-08
05:26:51 UTC (rev 10515)
@@ -30,6 +30,7 @@
import org.jboss.unit.driver.command.StartTestCommand;
import static org.jboss.unit.api.Assert.*;
import org.jboss.unit.info.TestInfo;
+import org.jboss.unit.info.impl.SimpleParameterInfo;
import org.jboss.unit.info.impl.SimpleTestCaseInfo;
import org.jboss.unit.driver.response.EndTestResponse;
import org.jboss.unit.remote.RequestContext;
@@ -103,7 +104,14 @@
*/
public void initDriver(DriverContext context) throws DriverException
{
- this.info = new SimpleTestCaseInfo(this.getClass().getName());
+ SimpleParameterInfo browserParam = new SimpleParameterInfo("browser");
+ SimpleParameterInfo hostParam = new
SimpleParameterInfo("selenium-server-host");
+ SimpleParameterInfo portParam = new
SimpleParameterInfo("selenium-server-port");
+
+ this.info = new SimpleTestCaseInfo(this.getClass().getName());
+ ((SimpleTestCaseInfo)this.info).addParameter(browserParam);
+ ((SimpleTestCaseInfo)this.info).addParameter(hostParam);
+ ((SimpleTestCaseInfo)this.info).addParameter(portParam);
}
/**
Modified:
modules/test/trunk/remote/src/test/java/org/jboss/unit/test/remote/webpage/GetPageCommandTestCase.java
===================================================================
---
modules/test/trunk/remote/src/test/java/org/jboss/unit/test/remote/webpage/GetPageCommandTestCase.java 2008-04-07
12:55:25 UTC (rev 10514)
+++
modules/test/trunk/remote/src/test/java/org/jboss/unit/test/remote/webpage/GetPageCommandTestCase.java 2008-04-08
05:26:51 UTC (rev 10515)
@@ -31,6 +31,7 @@
import static org.jboss.unit.api.Assert.*;
import org.jboss.unit.info.TestInfo;
import org.jboss.unit.info.impl.SimpleTestCaseInfo;
+import org.jboss.unit.info.impl.SimpleParameterInfo;
import org.jboss.unit.driver.response.EndTestResponse;
import org.jboss.unit.remote.RequestContext;
import org.jboss.unit.remote.ResponseContext;
@@ -90,8 +91,15 @@
*
*/
public void initDriver(DriverContext context) throws DriverException
- {
- this.info = new SimpleTestCaseInfo(this.getClass().getName());
+ {
+ SimpleParameterInfo browserParam = new SimpleParameterInfo("browser");
+ SimpleParameterInfo hostParam = new
SimpleParameterInfo("selenium-server-host");
+ SimpleParameterInfo portParam = new
SimpleParameterInfo("selenium-server-port");
+
+ this.info = new SimpleTestCaseInfo(this.getClass().getName());
+ ((SimpleTestCaseInfo)this.info).addParameter(browserParam);
+ ((SimpleTestCaseInfo)this.info).addParameter(hostParam);
+ ((SimpleTestCaseInfo)this.info).addParameter(portParam);
}
/**
Modified: modules/test/trunk/remote/src/test/resources/remote-jboss-unit.xml
===================================================================
--- modules/test/trunk/remote/src/test/resources/remote-jboss-unit.xml 2008-04-07 12:55:25
UTC (rev 10514)
+++ modules/test/trunk/remote/src/test/resources/remote-jboss-unit.xml 2008-04-08 05:26:51
UTC (rev 10515)
@@ -4,6 +4,6 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:jboss:jboss-unit:1.0 jboss-unit_1_0.xsd">
<generic>
- <class
name="org.jboss.unit.remote.driver.RemoteTestDriverClient"/>
- </generic>
+ <class name="org.jboss.unit.remote.driver.RemoteTestDriverClient"/>
+ </generic>
</jboss-unit>
\ No newline at end of file
Modified: modules/test/trunk/remote/src/test/resources/server-beans.xml
===================================================================
--- modules/test/trunk/remote/src/test/resources/server-beans.xml 2008-04-07 12:55:25 UTC
(rev 10514)
+++ modules/test/trunk/remote/src/test/resources/server-beans.xml 2008-04-08 05:26:51 UTC
(rev 10515)
@@ -59,7 +59,7 @@
</uninstall>
<!-- Configuration for the test case -->
<!-- url of the web page to be accessed/asserted -->
- <property
name="uri">http://localhost:8080/test-remote</property>
+ <property
name="uri">http://localhost:8080/test-remote/</property>
</bean>
<!-- GetPageCommandTestCase -->
@@ -71,7 +71,7 @@
<parameter><this/></parameter>
</uninstall>
<!-- Configuration for the test case -->
- <property
name="uri">http://localhost:8080/test-remote</property>
+ <property
name="uri">http://localhost:8080/test-remote/</property>
<property name="link">link1</property>
</bean>
</deployment>
\ No newline at end of file
Modified: modules/test/trunk/remote/src/test/resources/war/WEB-INF/web.xml
===================================================================
--- modules/test/trunk/remote/src/test/resources/war/WEB-INF/web.xml 2008-04-07 12:55:25
UTC (rev 10514)
+++ modules/test/trunk/remote/src/test/resources/war/WEB-INF/web.xml 2008-04-08 05:26:51
UTC (rev 10515)
@@ -35,6 +35,6 @@
<param-value>classloader</param-value>
</context-param>
<listener>
-
<listener-class>org.jboss.unit.test.remote.WebBootstrap</listener-class>
+
<listener-class>org.jboss.unit.remote.web.deployment.WebBootstrap</listener-class>
</listener>
</web-app>