Author: julien(a)jboss.com
Date: 2007-04-17 15:27:20 -0400 (Tue, 17 Apr 2007)
New Revision: 6989
Added:
trunk/common/src/main/org/jboss/portal/common/test/driver/TestDriverContainer.java
trunk/test/src/main/org/jboss/portal/test/framework/driver/http/HTTPTestSuite.java
Removed:
trunk/common/src/main/org/jboss/portal/common/test/driver/TestDriverRegistry.java
Modified:
trunk/common/src/main/org/jboss/portal/common/test/driver/TestSuite.java
trunk/portlet/src/main/org/jboss/portal/test/framework/portlet/PortletTestDriver.java
trunk/portlet/src/main/org/jboss/portal/test/framework/portlet/PortletTestSuite.java
trunk/portlet/src/main/org/jboss/portal/test/framework/portlet/TestDriverRegistryAccess.java
trunk/portlet/src/main/org/jboss/portal/test/portlet/info/AbstractInfoTest.java
trunk/server/src/main/org/jboss/portal/test/server/TestRequestController.java
trunk/server/src/resources/test/test-charset-sar/META-INF/jboss-service.xml
trunk/server/src/resources/test/test-parameters-sar/META-INF/jboss-service.xml
trunk/server/src/resources/test/test-response-sar/META-INF/jboss-service.xml
trunk/server/src/resources/test/test-servlet-sar/META-INF/jboss-service.xml
trunk/test/src/main/org/jboss/portal/test/framework/driver/http/HttpTestCase.java
trunk/test/src/main/org/jboss/portal/test/framework/driver/http/HttpTestDriver.java
trunk/test/src/main/org/jboss/portal/test/framework/driver/http/HttpTestDriverServer.java
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/WSRPBaseTest.java
Log:
fix portlet and server test framework
Copied: trunk/common/src/main/org/jboss/portal/common/test/driver/TestDriverContainer.java
(from rev 6975,
trunk/common/src/main/org/jboss/portal/common/test/driver/TestDriverRegistry.java)
===================================================================
--- trunk/common/src/main/org/jboss/portal/common/test/driver/TestDriverContainer.java
(rev 0)
+++
trunk/common/src/main/org/jboss/portal/common/test/driver/TestDriverContainer.java 2007-04-17
19:27:20 UTC (rev 6989)
@@ -0,0 +1,57 @@
+/******************************************************************************
+ * 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.portal.common.test.driver;
+
+/**
+ * Provides an interface for a test driver container.
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public interface TestDriverContainer extends TestDriver
+{
+ /**
+ * Add a driver.
+ *
+ * @param driver
+ * @throws IllegalArgumentException if the driver is null or already registered
+ */
+ void addDriver(TestDriver driver) throws IllegalArgumentException;
+
+ /**
+ * Remove a driver.
+ *
+ * @param driver
+ * @throws IllegalArgumentException if the driver is null or does not exist
+ */
+ void removeDriver(TestDriver driver) throws IllegalArgumentException;
+
+ /**
+ * Return a driver that is able to understand the specified id.
+ *
+ * @param testId
+ * @return
+ * @throws IllegalArgumentException
+ */
+ TestDriver getDriver(String testId) throws IllegalArgumentException;
+}
Deleted:
trunk/common/src/main/org/jboss/portal/common/test/driver/TestDriverRegistry.java
===================================================================
---
trunk/common/src/main/org/jboss/portal/common/test/driver/TestDriverRegistry.java 2007-04-17
14:59:52 UTC (rev 6988)
+++
trunk/common/src/main/org/jboss/portal/common/test/driver/TestDriverRegistry.java 2007-04-17
19:27:20 UTC (rev 6989)
@@ -1,57 +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.portal.common.test.driver;
-
-/**
- * Provides an interface for a test driver registry.
- *
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 1.1 $
- */
-public interface TestDriverRegistry
-{
- /**
- * Register a driver.
- *
- * @param driver
- * @throws IllegalArgumentException if the driver is null or already registered
- */
- void register(TestDriver driver) throws IllegalArgumentException;
-
- /**
- * Unregister a driver.
- *
- * @param driver
- * @throws IllegalArgumentException if the driver is null or does not exist
- */
- void unregister(TestDriver driver) throws IllegalArgumentException;
-
- /**
- * Return a driver that is able to understand the specified id.
- *
- * @param itemId
- * @return
- * @throws IllegalArgumentException
- */
- TestDriver getDriver(String itemId) throws IllegalArgumentException;
-}
Modified: trunk/common/src/main/org/jboss/portal/common/test/driver/TestSuite.java
===================================================================
--- trunk/common/src/main/org/jboss/portal/common/test/driver/TestSuite.java 2007-04-17
14:59:52 UTC (rev 6988)
+++ trunk/common/src/main/org/jboss/portal/common/test/driver/TestSuite.java 2007-04-17
19:27:20 UTC (rev 6989)
@@ -29,10 +29,12 @@
import java.util.LinkedHashMap;
/**
+ * A test suite is a test driver container that expose itself as a test driver.
+ *
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 1.1 $
*/
-public class TestSuite implements TestDriver
+public class TestSuite implements TestDriverContainer
{
/** . */
@@ -47,9 +49,9 @@
info = new TestContainerInfo(id);
}
- public TestDriver getDriver(String itemId)
+ public TestDriver getDriver(String testId)
{
- TestItemInfo itemInfo = info.findItem(itemId);
+ TestItemInfo itemInfo = info.findItem(testId);
if (itemInfo == null)
{
return null;
Modified:
trunk/portlet/src/main/org/jboss/portal/test/framework/portlet/PortletTestDriver.java
===================================================================
---
trunk/portlet/src/main/org/jboss/portal/test/framework/portlet/PortletTestDriver.java 2007-04-17
14:59:52 UTC (rev 6988)
+++
trunk/portlet/src/main/org/jboss/portal/test/framework/portlet/PortletTestDriver.java 2007-04-17
19:27:20 UTC (rev 6989)
@@ -121,9 +121,9 @@
return new InvokeGetResponse("/test/" + info.getName());
}
- public void pushContext(String testId, HttpTestContext ctx)
+ public void pushContext(String testId, HttpTestContext testContext)
{
- context = new PortletTestContext(ctx);
+ context = new PortletTestContext(testContext);
}
public HttpTestContext popContext(String testId)
Modified:
trunk/portlet/src/main/org/jboss/portal/test/framework/portlet/PortletTestSuite.java
===================================================================
---
trunk/portlet/src/main/org/jboss/portal/test/framework/portlet/PortletTestSuite.java 2007-04-17
14:59:52 UTC (rev 6988)
+++
trunk/portlet/src/main/org/jboss/portal/test/framework/portlet/PortletTestSuite.java 2007-04-17
19:27:20 UTC (rev 6989)
@@ -93,13 +93,13 @@
//
sce.getServletContext().setAttribute("SequenceRegistry", driver);
- TestDriverRegistryAccess.getInstance().getTestDriverRegistry().register(driver);
+ TestDriverRegistryAccess.getInstance().getTestDriverRegistry().addDriver(driver);
}
public void contextDestroyed(ServletContextEvent sce)
{
sce.getServletContext().removeAttribute("SequenceRegistry");
- TestDriverRegistryAccess.getInstance().getTestDriverRegistry().unregister(driver);
+
TestDriverRegistryAccess.getInstance().getTestDriverRegistry().removeDriver(driver);
}
/**
Modified:
trunk/portlet/src/main/org/jboss/portal/test/framework/portlet/TestDriverRegistryAccess.java
===================================================================
---
trunk/portlet/src/main/org/jboss/portal/test/framework/portlet/TestDriverRegistryAccess.java 2007-04-17
14:59:52 UTC (rev 6988)
+++
trunk/portlet/src/main/org/jboss/portal/test/framework/portlet/TestDriverRegistryAccess.java 2007-04-17
19:27:20 UTC (rev 6989)
@@ -22,7 +22,7 @@
******************************************************************************/
package org.jboss.portal.test.framework.portlet;
-import org.jboss.portal.common.test.driver.TestDriverRegistry;
+import org.jboss.portal.common.test.driver.TestDriverContainer;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
@@ -32,19 +32,19 @@
{
/** . */
- private static TestDriverRegistry testDriverRegistry;
+ private static TestDriverContainer testDriverContainer;
/** . */
private static TestDriverRegistryAccess instance;
- public TestDriverRegistry getTestDriverRegistry()
+ public TestDriverContainer getTestDriverRegistry()
{
- return testDriverRegistry;
+ return testDriverContainer;
}
- public void setTestDriverRegistry(TestDriverRegistry testDriverRegistry)
+ public void setTestDriverRegistry(TestDriverContainer testDriverContainer)
{
- this.testDriverRegistry = testDriverRegistry;
+ this.testDriverContainer = testDriverContainer;
}
public void start() throws Exception
Modified: trunk/portlet/src/main/org/jboss/portal/test/portlet/info/AbstractInfoTest.java
===================================================================
---
trunk/portlet/src/main/org/jboss/portal/test/portlet/info/AbstractInfoTest.java 2007-04-17
14:59:52 UTC (rev 6988)
+++
trunk/portlet/src/main/org/jboss/portal/test/portlet/info/AbstractInfoTest.java 2007-04-17
19:27:20 UTC (rev 6989)
@@ -22,13 +22,12 @@
******************************************************************************/
package org.jboss.portal.test.portlet.info;
-import org.jboss.portal.test.framework.driver.http.HttpTestCase;
import org.jboss.portal.portlet.container.PortletApplicationRegistry;
import org.jboss.portal.common.test.driver.TestDriver;
import org.jboss.portal.common.test.driver.DriverResponse;
import org.jboss.portal.common.test.driver.DriverCommand;
import org.jboss.portal.common.test.driver.TestDriverException;
-import org.jboss.portal.common.test.driver.TestDriverRegistry;
+import org.jboss.portal.common.test.driver.TestDriverContainer;
import org.jboss.portal.common.test.driver.response.ErrorResponse;
import org.jboss.portal.common.test.driver.response.EndTestResponse;
import org.jboss.portal.common.test.driver.command.StartTestCommand;
@@ -52,7 +51,7 @@
protected PortletApplicationRegistry registry;
/** The controller. */
- protected TestDriverRegistry testDriverRegistry;
+ protected TestDriverContainer testDriverContainer;
public AbstractInfoTest(String testCaseId)
{
@@ -76,24 +75,24 @@
this.registry = registry;
}
- public TestDriverRegistry getTestDriverRegistry()
+ public TestDriverContainer getTestDriverRegistry()
{
- return testDriverRegistry;
+ return testDriverContainer;
}
- public void setTestDriverRegistry(TestDriverRegistry testDriverRegistry)
+ public void setTestDriverRegistry(TestDriverContainer testDriverContainer)
{
- this.testDriverRegistry = testDriverRegistry;
+ this.testDriverContainer = testDriverContainer;
}
public void create()
{
- testDriverRegistry.register(this);
+ testDriverContainer.addDriver(this);
}
public void destroy()
{
- testDriverRegistry.unregister(this);
+ testDriverContainer.removeDriver(this);
}
public TestItemInfo getInfo()
Modified: trunk/server/src/main/org/jboss/portal/test/server/TestRequestController.java
===================================================================
---
trunk/server/src/main/org/jboss/portal/test/server/TestRequestController.java 2007-04-17
14:59:52 UTC (rev 6988)
+++
trunk/server/src/main/org/jboss/portal/test/server/TestRequestController.java 2007-04-17
19:27:20 UTC (rev 6989)
@@ -28,7 +28,6 @@
import org.jboss.portal.common.test.driver.DriverResponse;
import org.jboss.portal.common.test.driver.DriverCommand;
import org.jboss.portal.common.test.driver.TestDriverException;
-import org.jboss.portal.common.test.driver.TestDriverRegistry;
import org.jboss.portal.common.test.driver.command.StartTestCommand;
import org.jboss.portal.test.framework.driver.http.HttpTestDriverServer;
import org.jboss.portal.test.framework.server.driver.AbstractTest;
@@ -41,59 +40,17 @@
{
/** . */
- private TestDriverRegistry testDriverRegistry;
-
- /** . */
private String currentTestId;
- public TestDriverRegistry getTestDriverRegistry()
+ public TestRequestController()
{
- return testDriverRegistry;
}
- public void setTestDriverRegistry(TestDriverRegistry testDriverRegistry)
- {
- this.testDriverRegistry = testDriverRegistry;
- }
-
- protected void createService()
- {
- testDriverRegistry.register(this);
- }
-
- protected void destroyService()
- {
- testDriverRegistry.unregister(this);
- }
-
-
- public void create() throws Exception
- {
- super.create();
- }
-
-
- public void start() throws Exception
- {
- super.start();
- }
-
-
- public void stop()
- {
- super.stop();
- }
-
- public void destroy()
- {
- super.destroy();
- }
-
public DriverResponse invoke(String testId, DriverCommand cmd) throws
TestDriverException
{
DriverResponse response = super.invoke(testId, cmd);
- //
+ // Save the current id for http invocations later, see handle method
if (cmd instanceof StartTestCommand)
{
currentTestId = testId;
@@ -105,6 +62,8 @@
public void handle(ServerInvocation invocation) throws ServerException
{
AbstractTest test = (AbstractTest)getDriver(currentTestId);
+
+ //
test.execute(invocation);
}
}
Modified: trunk/server/src/resources/test/test-charset-sar/META-INF/jboss-service.xml
===================================================================
--- trunk/server/src/resources/test/test-charset-sar/META-INF/jboss-service.xml 2007-04-17
14:59:52 UTC (rev 6988)
+++ trunk/server/src/resources/test/test-charset-sar/META-INF/jboss-service.xml 2007-04-17
19:27:20 UTC (rev 6989)
@@ -25,20 +25,10 @@
<!-- -->
<mbean
- code="org.jboss.portal.test.framework.driver.http.HttpTestDriverServer"
- name="portal.test:service=HttpTestDriverServer"
- xmbean-dd=""
- xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
- <xmbean/>
- <depends
- optional-attribute-name="Agent"
- proxy-type="attribute">portal.test:service=Agent</depends>
- </mbean>
- <mbean
code="org.jboss.invocation.jrmp.server.JRMPProxyFactory"
name="portal.test:service=Invoker,name=HttpTestDriverServer">
<depends
optional-attribute-name="InvokerName">jboss:service=invoker,type=jrmp</depends>
- <depends
optional-attribute-name="TargetName">portal.test:service=HttpTestDriverServer</depends>
+ <depends
optional-attribute-name="TargetName">portal:controller=Request</depends>
<attribute name="JndiName">HttpTestDriverServer</attribute>
<attribute
name="ExportedInterfaces">org.jboss.portal.test.framework.driver.http.HttpTestDriver</attribute>
</mbean>
@@ -53,7 +43,6 @@
<attribute name="ConfigLocation">conf/config.xml</attribute>
</mbean>
-
<!-- Runtime context for running portlet container -->
<mbean
code="org.jboss.portal.web.jboss.JBossWebContext"
@@ -92,7 +81,9 @@
xmbean-dd=""
xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
<xmbean/>
- <depends optional-attribute-name="TestDriverRegistry"
proxy-type="attribute">portal.test:service=HttpTestDriverServer</depends>
+ <depends
+ optional-attribute-name="Agent"
+ proxy-type="attribute">portal.test:service=Agent</depends>
</mbean>
<!-- The controller factory -->
Modified: trunk/server/src/resources/test/test-parameters-sar/META-INF/jboss-service.xml
===================================================================
---
trunk/server/src/resources/test/test-parameters-sar/META-INF/jboss-service.xml 2007-04-17
14:59:52 UTC (rev 6988)
+++
trunk/server/src/resources/test/test-parameters-sar/META-INF/jboss-service.xml 2007-04-17
19:27:20 UTC (rev 6989)
@@ -25,20 +25,10 @@
<!-- -->
<mbean
- code="org.jboss.portal.test.framework.driver.http.HttpTestDriverServer"
- name="portal.test:service=HttpTestDriverServer"
- xmbean-dd=""
- xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
- <xmbean/>
- <depends
- optional-attribute-name="Agent"
- proxy-type="attribute">portal.test:service=Agent</depends>
- </mbean>
- <mbean
code="org.jboss.invocation.jrmp.server.JRMPProxyFactory"
name="portal.test:service=Invoker,name=HttpTestDriverServer">
<depends
optional-attribute-name="InvokerName">jboss:service=invoker,type=jrmp</depends>
- <depends
optional-attribute-name="TargetName">portal.test:service=HttpTestDriverServer</depends>
+ <depends
optional-attribute-name="TargetName">portal:controller=Request</depends>
<attribute name="JndiName">HttpTestDriverServer</attribute>
<attribute
name="ExportedInterfaces">org.jboss.portal.test.framework.driver.http.HttpTestDriver</attribute>
</mbean>
@@ -91,7 +81,9 @@
xmbean-dd=""
xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
<xmbean/>
- <depends optional-attribute-name="TestDriverRegistry"
proxy-type="attribute">portal.test:service=HttpTestDriverServer</depends>
+ <depends
+ optional-attribute-name="Agent"
+ proxy-type="attribute">portal.test:service=Agent</depends>
</mbean>
<!-- The controller factory -->
Modified: trunk/server/src/resources/test/test-response-sar/META-INF/jboss-service.xml
===================================================================
---
trunk/server/src/resources/test/test-response-sar/META-INF/jboss-service.xml 2007-04-17
14:59:52 UTC (rev 6988)
+++
trunk/server/src/resources/test/test-response-sar/META-INF/jboss-service.xml 2007-04-17
19:27:20 UTC (rev 6989)
@@ -25,20 +25,10 @@
<!-- -->
<mbean
- code="org.jboss.portal.test.framework.driver.http.HttpTestDriverServer"
- name="portal.test:service=HttpTestDriverServer"
- xmbean-dd=""
- xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
- <xmbean/>
- <depends
- optional-attribute-name="Agent"
- proxy-type="attribute">portal.test:service=Agent</depends>
- </mbean>
- <mbean
code="org.jboss.invocation.jrmp.server.JRMPProxyFactory"
name="portal.test:service=Invoker,name=HttpTestDriverServer">
<depends
optional-attribute-name="InvokerName">jboss:service=invoker,type=jrmp</depends>
- <depends
optional-attribute-name="TargetName">portal.test:service=HttpTestDriverServer</depends>
+ <depends
optional-attribute-name="TargetName">portal:controller=Request</depends>
<attribute name="JndiName">HttpTestDriverServer</attribute>
<attribute
name="ExportedInterfaces">org.jboss.portal.test.framework.driver.http.HttpTestDriver</attribute>
</mbean>
@@ -91,7 +81,9 @@
xmbean-dd=""
xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
<xmbean/>
- <depends optional-attribute-name="TestDriverRegistry"
proxy-type="attribute">portal.test:service=HttpTestDriverServer</depends>
+ <depends
+ optional-attribute-name="Agent"
+ proxy-type="attribute">portal.test:service=Agent</depends>
</mbean>
<!-- The controller factory -->
Modified: trunk/server/src/resources/test/test-servlet-sar/META-INF/jboss-service.xml
===================================================================
--- trunk/server/src/resources/test/test-servlet-sar/META-INF/jboss-service.xml 2007-04-17
14:59:52 UTC (rev 6988)
+++ trunk/server/src/resources/test/test-servlet-sar/META-INF/jboss-service.xml 2007-04-17
19:27:20 UTC (rev 6989)
@@ -25,20 +25,10 @@
<!-- -->
<mbean
- code="org.jboss.portal.test.framework.driver.http.HttpTestDriverServer"
- name="portal.test:service=HttpTestDriverServer"
- xmbean-dd=""
- xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
- <xmbean/>
- <depends
- optional-attribute-name="Agent"
- proxy-type="attribute">portal.test:service=Agent</depends>
- </mbean>
- <mbean
code="org.jboss.invocation.jrmp.server.JRMPProxyFactory"
name="portal.test:service=Invoker,name=HttpTestDriverServer">
<depends
optional-attribute-name="InvokerName">jboss:service=invoker,type=jrmp</depends>
- <depends
optional-attribute-name="TargetName">portal.test:service=HttpTestDriverServer</depends>
+ <depends
optional-attribute-name="TargetName">portal:controller=Request</depends>
<attribute name="JndiName">HttpTestDriverServer</attribute>
<attribute
name="ExportedInterfaces">org.jboss.portal.test.framework.driver.http.HttpTestDriver</attribute>
</mbean>
@@ -91,7 +81,9 @@
xmbean-dd=""
xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
<xmbean/>
- <depends optional-attribute-name="TestDriverRegistry"
proxy-type="attribute">portal.test:service=HttpTestDriverServer</depends>
+ <depends
+ optional-attribute-name="Agent"
+ proxy-type="attribute">portal.test:service=Agent</depends>
</mbean>
<!-- The controller factory -->
Added: trunk/test/src/main/org/jboss/portal/test/framework/driver/http/HTTPTestSuite.java
===================================================================
--- trunk/test/src/main/org/jboss/portal/test/framework/driver/http/HTTPTestSuite.java
(rev 0)
+++
trunk/test/src/main/org/jboss/portal/test/framework/driver/http/HTTPTestSuite.java 2007-04-17
19:27:20 UTC (rev 6989)
@@ -0,0 +1,75 @@
+/******************************************************************************
+ * 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.portal.test.framework.driver.http;
+
+import org.jboss.portal.common.test.driver.TestSuite;
+import org.jboss.portal.common.test.info.TestItemInfo;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class HTTPTestSuite extends TestSuite implements HttpTestDriver
+{
+
+ public HTTPTestSuite(String id)
+ {
+ super(id);
+ }
+
+ public void pushContext(String testId, HttpTestContext testContext)
+ {
+ TestItemInfo item = info.findItem(testId);
+
+ // Get a driver
+ HttpTestDriver httpDriver = (HttpTestDriver)getDriver(testId);
+
+ // Get new relative id
+ String newTestId = item.getId(httpDriver.getInfo());
+
+ //
+ HttpTestContext ctx2 = new HttpTestContext(newTestId,
testContext.getRequestCount(), testContext.getArchivePath(),
testContext.getParametrization());
+
+ //
+ httpDriver.pushContext(newTestId, ctx2);
+ }
+
+ public HttpTestContext popContext(String testId)
+ {
+ TestItemInfo item = info.findItem(testId);
+
+ // Get a driver
+ HttpTestDriver httpDriver = (HttpTestDriver)getDriver(testId);
+
+ // Get new relative id
+ String newTestId = item.getId(httpDriver.getInfo());
+
+ //
+ HttpTestContext context = httpDriver.popContext(newTestId);
+ context = new HttpTestContext(context);
+ context.setTestAgent(null);
+
+ //
+ return context;
+ }
+}
Modified:
trunk/test/src/main/org/jboss/portal/test/framework/driver/http/HttpTestCase.java
===================================================================
---
trunk/test/src/main/org/jboss/portal/test/framework/driver/http/HttpTestCase.java 2007-04-17
14:59:52 UTC (rev 6988)
+++
trunk/test/src/main/org/jboss/portal/test/framework/driver/http/HttpTestCase.java 2007-04-17
19:27:20 UTC (rev 6989)
@@ -22,7 +22,7 @@
******************************************************************************/
package org.jboss.portal.test.framework.driver.http;
-import org.jboss.portal.common.test.driver.TestDriverRegistry;
+import org.jboss.portal.common.test.driver.TestDriverContainer;
import org.jboss.portal.common.test.driver.DriverResponse;
import org.jboss.portal.common.test.driver.DriverCommand;
import org.jboss.portal.common.test.driver.TestDriverException;
@@ -54,7 +54,7 @@
protected HttpTestContext context;
/** The driver registry, in the future we should remove that and use some kind of
external wiring mechanism. */
- protected TestDriverRegistry testDriverRegistry;
+ protected TestDriverContainer testDriverContainer;
public HttpTestCase(String testCaseId, String path)
{
@@ -78,14 +78,14 @@
return testInfo;
}
- public TestDriverRegistry getTestDriverRegistry()
+ public TestDriverContainer getTestDriverRegistry()
{
- return testDriverRegistry;
+ return testDriverContainer;
}
- public void setTestDriverRegistry(TestDriverRegistry testDriverRegistry)
+ public void setTestDriverRegistry(TestDriverContainer testDriverContainer)
{
- this.testDriverRegistry = testDriverRegistry;
+ this.testDriverContainer = testDriverContainer;
}
public String getTestCaseId()
@@ -100,17 +100,17 @@
public void create()
{
- testDriverRegistry.register(this);
+ testDriverContainer.addDriver(this);
}
public void destroy()
{
- testDriverRegistry.unregister(this);
+ testDriverContainer.removeDriver(this);
}
- public void pushContext(String testId, HttpTestContext ctx)
+ public void pushContext(String testId, HttpTestContext testContext)
{
- this.context = ctx;
+ this.context = testContext;
}
public HttpTestContext popContext(String testId)
Modified:
trunk/test/src/main/org/jboss/portal/test/framework/driver/http/HttpTestDriver.java
===================================================================
---
trunk/test/src/main/org/jboss/portal/test/framework/driver/http/HttpTestDriver.java 2007-04-17
14:59:52 UTC (rev 6988)
+++
trunk/test/src/main/org/jboss/portal/test/framework/driver/http/HttpTestDriver.java 2007-04-17
19:27:20 UTC (rev 6989)
@@ -37,7 +37,7 @@
/**
* A client side push of an http test context for a specific test.
*/
- void pushContext(String testId, HttpTestContext ctx);
+ void pushContext(String testId, HttpTestContext testContext);
/**
* A client pop of an http test context for a specific test.
Modified:
trunk/test/src/main/org/jboss/portal/test/framework/driver/http/HttpTestDriverServer.java
===================================================================
---
trunk/test/src/main/org/jboss/portal/test/framework/driver/http/HttpTestDriverServer.java 2007-04-17
14:59:52 UTC (rev 6988)
+++
trunk/test/src/main/org/jboss/portal/test/framework/driver/http/HttpTestDriverServer.java 2007-04-17
19:27:20 UTC (rev 6989)
@@ -26,8 +26,7 @@
import org.jboss.portal.common.test.driver.TestDriverException;
import org.jboss.portal.common.test.driver.TestDriver;
import org.jboss.portal.common.test.driver.DriverCommand;
-import org.jboss.portal.common.test.driver.TestDriverRegistry;
-import org.jboss.portal.common.test.driver.TestSuite;
+import org.jboss.portal.common.test.driver.TestDriverContainer;
import org.jboss.portal.common.test.info.TestItemInfo;
import org.jboss.portal.test.framework.driver.AbstractTestDriverServer;
@@ -35,56 +34,48 @@
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 5636 $
*/
-public class HttpTestDriverServer extends AbstractTestDriverServer implements
HttpTestDriver, TestDriverRegistry
+public class HttpTestDriverServer extends AbstractTestDriverServer implements
HttpTestDriver, TestDriverContainer
{
/** . */
- protected final TestSuite suite;
+ protected final HTTPTestSuite suite;
public HttpTestDriverServer()
{
- suite = new TestSuite("Main");
+ suite = new HTTPTestSuite("Main");
}
- public void pushContext(String testId, HttpTestContext ctx)
+ public void pushContext(String testId, HttpTestContext testContext)
{
- TestDriver driver = getDriver(testId);
- if (driver instanceof HttpTestDriver)
- {
- HttpTestDriver httpDriver = (HttpTestDriver)driver;
- TestItemInfo item = driver.getInfo();
- String newId = item.getId(httpDriver.getInfo());
- HttpTestContext ctx2 = new HttpTestContext(newId, ctx.getRequestCount(),
ctx.getArchivePath(), ctx.getParametrization());
- ctx2.setTestAgent(getAgent());
- httpDriver.pushContext(newId, ctx2);
- }
+ testContext.setTestAgent(getAgent());
+
+ //
+ suite.pushContext(testId, testContext);
}
public HttpTestContext popContext(String testId)
{
- TestDriver driver = getDriver(testId);
- HttpTestDriver httpDriver = (HttpTestDriver)driver;
- TestItemInfo item = httpDriver.getInfo();
- String newId = item.getId(httpDriver.getInfo());
- HttpTestContext context = httpDriver.popContext(newId);
+ HttpTestContext context = suite.popContext(testId);
+
+ //
context = new HttpTestContext(context);
context.setTestAgent(null);
return context;
}
- public synchronized void register(TestDriver driver)
+ public synchronized void addDriver(TestDriver driver)
{
suite.addDriver(driver);
}
- public synchronized void unregister(TestDriver driver)
+ public synchronized void removeDriver(TestDriver driver)
{
suite.removeDriver(driver);
}
- public TestDriver getDriver(String itemId)
+ public TestDriver getDriver(String testId)
{
- return suite.getDriver(itemId);
+ return suite.getDriver(testId);
}
public DriverResponse invoke(String testId, DriverCommand cmd) throws
TestDriverException
Modified: trunk/wsrp/src/main/org/jboss/portal/test/wsrp/WSRPBaseTest.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/test/wsrp/WSRPBaseTest.java 2007-04-17 14:59:52
UTC (rev 6988)
+++ trunk/wsrp/src/main/org/jboss/portal/test/wsrp/WSRPBaseTest.java 2007-04-17 19:27:20
UTC (rev 6989)
@@ -33,7 +33,7 @@
import org.jboss.portal.common.test.driver.DriverCommand;
import org.jboss.portal.common.test.driver.DriverResponse;
import org.jboss.portal.common.test.driver.TestDriverException;
-import org.jboss.portal.common.test.driver.TestDriverRegistry;
+import org.jboss.portal.common.test.driver.TestDriverContainer;
import org.jboss.portal.common.test.info.TestItemInfo;
import org.jboss.portal.common.test.junit.POJOJUnitTest;
import org.jboss.portal.jems.as.system.AbstractJBossService;
@@ -57,7 +57,7 @@
private POJOJUnitTest test;
/** . */
- private TestDriverRegistry testDriverRegistry;
+ private TestDriverContainer testDriverContainer;
/** . */
private HttpTestContext context;
@@ -77,25 +77,25 @@
}
- public TestDriverRegistry getTestDriverRegistry()
+ public TestDriverContainer getTestDriverRegistry()
{
- return testDriverRegistry;
+ return testDriverContainer;
}
- public void setTestDriverRegistry(TestDriverRegistry testDriverRegistry)
+ public void setTestDriverRegistry(TestDriverContainer testDriverContainer)
{
- this.testDriverRegistry = testDriverRegistry;
+ this.testDriverContainer = testDriverContainer;
}
protected void startService() throws Exception
{
test = new POJOJUnitTest(this);
- testDriverRegistry.register(this);
+ testDriverContainer.addDriver(this);
}
protected void stopService() throws Exception
{
- testDriverRegistry.unregister(this);
+ testDriverContainer.removeDriver(this);
}
/** Make it accessible from outter packages. */
@@ -128,9 +128,9 @@
return test.invoke(testId, command);
}
- public void pushContext(String testId, HttpTestContext ctx)
+ public void pushContext(String testId, HttpTestContext testContext)
{
- this.context = ctx;
+ this.context = testContext;
}
public HttpTestContext popContext(String testId)