Author: julien(a)jboss.com
Date: 2007-09-10 19:03:20 -0400 (Mon, 10 Sep 2007)
New Revision: 8207
Added:
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/driver/http/HTTPTestDriverHandler.java
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/driver/remote/RemoteDriverCommandContext.java
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/driver/remote/RemoteDriverResponseContext.java
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/driver/remote/RemoteTestDriverProtocolHandler.java
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/driver/web/WebTestDriverHandler.java
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/impl/generic/config/
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/impl/generic/config/AuthenticationConfig.java
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/impl/generic/config/DeployerConfig.java
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/impl/generic/config/HTTPTestRunnerConfig.java
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/impl/generic/config/NodeConfig.java
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/impl/generic/config/RemoteDeployerConfig.java
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/impl/generic/config/ServerConfig.java
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/impl/generic/config/ServiceConfig.java
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/impl/generic/server/GenericLocalServiceLookup.java
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/impl/generic/server/GenericNode.java
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/impl/generic/server/GenericNodeFactory.java
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/impl/generic/server/GenericRemoteServiceLookup.java
Removed:
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/driver/http/HTTPTestContext.java
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/driver/http/HTTPTestDriver.java
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/driver/http/HTTPTestDriverClient.java
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/driver/http/HTTPTestDriverServer.java
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/driver/http/command/HTTPDriverCommandContext.java
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/driver/http/command/SendResponseCommand.java
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/driver/http/response/HTTPDriverResponseContext.java
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/driver/http/response/SendResponseResponse.java
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/driver/remote/command/RemoteDriverCommandContext.java
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/driver/remote/response/RemoteDriverResponseContext.java
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/driver/web/WebTestDriverClient.java
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/driver/web/command/WebDriverCommandContext.java
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/driver/web/response/WebDriverResponseContext.java
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/impl/generic/server/DirectServiceLookup.java
Modified:
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/deployment/Deployer.java
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/driver/http/HTTPTestConversation.java
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/driver/remote/RemoteTestDriverClient.java
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/driver/remote/RemoteTestDriverServer.java
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/driver/remote/TestContext.java
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/driver/remote/TestConversation.java
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/driver/web/WebTestConversation.java
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/driver/web/command/WebDriverCommand.java
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/impl/generic/agent/GenericTestAgent.java
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/impl/generic/server/GenericServiceLookup.java
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/junit/JUnitAdapter.java
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/mc/TestRuntimeContext.java
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/server/Node.java
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/server/NodeManager.java
modules/test/trunk/test/src/resources/generic/portal-test-jar/org/jboss/portal/test/framework/container/http-runner-beans.xml
modules/test/trunk/test/src/resources/jboss/portal-test-jar/org/jboss/portal/test/framework/container/http-runner-beans.xml
Log:
update test framework to allow the mix of different test drivers in one test case /
improved the test request count implementation
Modified:
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/deployment/Deployer.java
===================================================================
---
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/deployment/Deployer.java 2007-09-10
12:13:33 UTC (rev 8206)
+++
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/deployment/Deployer.java 2007-09-10
23:03:20 UTC (rev 8207)
@@ -31,6 +31,7 @@
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
+import java.io.File;
/**
* Client side view of deployment.
@@ -70,6 +71,26 @@
{
}
+ public void deploy(String parentName, String childName, Node node) throws Exception
+ {
+ deploy(parentName, childName, new Node[]{node});
+ }
+
+ public void deploy(File parent, String childName, Node node) throws Exception
+ {
+ deploy(parent, childName, new Node[]{node});
+ }
+
+ public void deploy(String parentName, String childName, Node[] nodes) throws
Exception
+ {
+ deploy(new File(parentName), childName, nodes);
+ }
+
+ public void deploy(File parent, String childName, Node[] nodes) throws Exception
+ {
+ deploy(new File(parent, childName).toURL(), nodes);
+ }
+
public void deploy(String url, Node node) throws Exception
{
deploy(url, new Node[]{node});
@@ -87,6 +108,11 @@
deployments.put(url, deployment);
}
+ public void deploy(String url, Node[] nodes) throws Exception
+ {
+ this.deploy(getArchiveURL(url), nodes);
+ }
+
public void undeploy(URL url)
{
Deployment deployment = (Deployment)deployments.remove(url);
@@ -96,11 +122,16 @@
}
}
- public void deploy(String url, Node[] nodes) throws Exception
+ public void undeploy(String parentName, String childName) throws Exception
{
- this.deploy(getArchiveURL(url), nodes);
+ undeploy(new File(parentName), childName);
}
+ public void undeploy(File parent, String childName) throws Exception
+ {
+ undeploy(new File(parent, childName).toURL());
+ }
+
public void undeploy(String url) throws Exception
{
this.undeploy(getArchiveURL(url));
Deleted:
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/driver/http/HTTPTestContext.java
===================================================================
---
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/driver/http/HTTPTestContext.java 2007-09-10
12:13:33 UTC (rev 8206)
+++
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/driver/http/HTTPTestContext.java 2007-09-10
23:03:20 UTC (rev 8207)
@@ -1,116 +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.test.framework.driver.http;
-
-import org.jboss.portal.test.framework.driver.remote.TestContext;
-import org.jboss.portal.test.framework.driver.DriverResponse;
-import org.jboss.portal.test.framework.TestParametrization;
-
-/**
- * The test context seen from the server side.
- * @todo make a client side context and a server side context, basically (server side
context == client side context + services)
- *
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 5498 $
- */
-public class HTTPTestContext extends TestContext
-{
-
- /**
- * Return the current test case context.
- *
- * @return the current test context
- * @throws IllegalStateException if there is no current context
- */
- public static HTTPTestContext getCurrentContext() throws IllegalStateException
- {
- throw new UnsupportedOperationException("Don't use this API");
- }
-
- /**
- * Return the current test case context or null if none exist.
- *
- * @return the current test context
- */
- public static HTTPTestContext peekCurrentContext()
- {
- throw new UnsupportedOperationException("Don't use this API");
- }
-
- /**
- * Set the current context.
- *
- * @param newContext the test case context
- */
- public static void setCurrentContext(HTTPTestContext newContext)
- {
- throw new UnsupportedOperationException("Don't use this API");
- }
-
- public static boolean isCurrentRequestCount(int count) throws IllegalStateException
- {
- return getCurrentContext().requestCount == count;
- }
-
- public static int getCurrentRequestCount() throws IllegalStateException
- {
- return getCurrentContext().requestCount;
- }
-
- public static DriverResponse getCurrentResponse() throws IllegalStateException
- {
- HTTPTestContext ctx = getCurrentContext();
- if (ctx != null)
- {
- return ctx.response;
- }
- else
- {
- return null;
- }
- }
-
- public static void setCurrentResponse(DriverResponse currentResponse) throws
IllegalStateException
- {
- HTTPTestContext ctx = getCurrentContext();
- ctx.setResponse(currentResponse);
- }
-
- /** . */
- String initialPath;
-
- public HTTPTestContext(TestContext that)
- {
- super(that);
- }
-
- public HTTPTestContext(int requestCount, String archivePath, TestParametrization
parametrization)
- {
- super(requestCount, archivePath, parametrization);
- }
-
- public String getInitialPath()
- {
- return initialPath;
- }
-}
Modified:
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/driver/http/HTTPTestConversation.java
===================================================================
---
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/driver/http/HTTPTestConversation.java 2007-09-10
12:13:33 UTC (rev 8206)
+++
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/driver/http/HTTPTestConversation.java 2007-09-10
23:03:20 UTC (rev 8207)
@@ -27,8 +27,8 @@
import org.apache.commons.httpclient.UsernamePasswordCredentials;
import org.apache.commons.httpclient.HttpMethod;
import org.apache.commons.httpclient.Header;
-import org.apache.commons.httpclient.HeaderElement;
import org.apache.commons.httpclient.NameValuePair;
+import org.apache.commons.httpclient.HeaderElement;
import org.apache.commons.httpclient.methods.PostMethod;
import org.apache.commons.httpclient.methods.ByteArrayRequestEntity;
import org.apache.commons.httpclient.methods.GetMethod;
@@ -36,28 +36,17 @@
import org.apache.commons.httpclient.params.HttpMethodParams;
import org.apache.log4j.Logger;
import org.jboss.portal.test.framework.server.Node;
-import org.jboss.portal.test.framework.driver.http.command.HTTPDriverCommandContext;
-import org.jboss.portal.test.framework.driver.http.command.HTTPDriverCommand;
import org.jboss.portal.test.framework.driver.http.command.DoGetCommand;
import org.jboss.portal.test.framework.driver.http.command.DoPostCommand;
-import org.jboss.portal.test.framework.driver.http.command.SendResponseCommand;
import org.jboss.portal.test.framework.driver.http.command.DoMethodCommand;
-import org.jboss.portal.test.framework.driver.http.response.HTTPDriverResponseContext;
-import org.jboss.portal.test.framework.driver.http.response.HTTPDriverResponse;
-import org.jboss.portal.test.framework.driver.http.response.InvokeGetResponse;
-import org.jboss.portal.test.framework.driver.http.response.InvokePostResponse;
-import org.jboss.portal.test.framework.driver.http.response.InvokeMethodResponse;
import org.jboss.portal.test.framework.driver.remote.TestConversation;
import org.jboss.portal.test.framework.driver.remote.TestContext;
-import org.jboss.portal.test.framework.driver.remote.RemoteTestDriver;
-import
org.jboss.portal.test.framework.driver.remote.response.RemoteDriverResponseContext;
-import org.jboss.portal.test.framework.driver.remote.command.RemoteDriverCommandContext;
+import org.jboss.portal.test.framework.driver.remote.RemoteDriverResponseContext;
+import org.jboss.portal.test.framework.driver.remote.RemoteDriverCommandContext;
import org.jboss.portal.test.framework.driver.DriverResponse;
import org.jboss.portal.test.framework.driver.DriverCommand;
import org.jboss.portal.test.framework.driver.response.ErrorResponse;
import org.jboss.portal.test.framework.driver.response.FailureResponse;
-import org.jboss.portal.test.framework.driver.command.StartTestCommand;
-import org.jboss.portal.test.framework.TestParametrization;
import org.jboss.portal.common.http.HttpRequest;
import org.jboss.portal.common.http.HttpHeaders;
import org.jboss.portal.common.http.HttpHeader;
@@ -70,67 +59,38 @@
import java.net.URISyntaxException;
import java.net.MalformedURLException;
-import junit.framework.AssertionFailedError;
-
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 1.1 $
*/
-public class HTTPTestConversation extends TestConversation
+public class HTTPTestConversation
{
/** . */
private final Logger log = Logger.getLogger(getClass());
/** . */
- private final HTTPTestDriverClient driver;
+ private final HttpClient client;
- /** The node to invoke. */
- private Node node;
-
- /** The request count for that session. */
- private int requestCount;
-
/** . */
- private HttpClient client;
+ private final TestConversation conversation;
- /** The test parametrization. */
- private TestParametrization parametrization;
-
- public HTTPTestConversation(HTTPTestDriverClient driver, String testId, Node node)
+ public HTTPTestConversation(TestConversation conversation)
{
- super(driver, testId);
+ HttpClient client = new HttpClient(new SimpleHttpConnectionManager());
+ client.getParams().setParameter(HttpMethodParams.RETRY_HANDLER, null);
+ client.getState().setCredentials(AuthScope.ANY, new
UsernamePasswordCredentials("test", "test"));
//
- this.driver = driver;
- this.node = node;
-
- //
- this.client = new HttpClient(new SimpleHttpConnectionManager());
- this.client.getParams().setParameter(HttpMethodParams.RETRY_HANDLER, null);
- this.client.getState().setCredentials(AuthScope.ANY, new
UsernamePasswordCredentials("test", "test"));
+ this.conversation = conversation;
+ this.client = client;
}
- protected RemoteDriverCommandContext createContext(DriverCommand command)
+ public RemoteDriverResponseContext invoke(RemoteDriverCommandContext commandContext)
throws Exception
{
- return new HTTPDriverCommandContext(command);
- }
-
- protected DriverCommand createCommand(RemoteDriverResponseContext responseContext)
throws Exception
- {
- if (responseContext.getResponse() instanceof HTTPDriverResponse)
- {
- return createHTTPCommand((HTTPDriverResponseContext)responseContext);
- }
- else
- {
- return null;
- }
- }
-
- protected RemoteDriverResponseContext invoke(RemoteDriverCommandContext
commandContext) throws Exception
- {
DriverCommand command = commandContext.getCommand();
+
+ //
if (command instanceof DoMethodCommand)
{
DoMethodCommand method = (DoMethodCommand)command;
@@ -173,8 +133,8 @@
NameValuePair[] nvps = (NameValuePair[])tmp.toArray(new
NameValuePair[tmp.size()]);
post.setRequestBody(nvps);
}
- executeHTTPMethod(post);
- return decodeHTTPResponse(post);
+ executeHTTPMethod(commandContext, post);
+ return decodeHTTPResponse(commandContext, post);
}
finally
{
@@ -199,8 +159,8 @@
get.addRequestHeader(_header);
}
get.setFollowRedirects(false);
- executeHTTPMethod(get);
- return decodeHTTPResponse(get);
+ executeHTTPMethod(commandContext, get);
+ return decodeHTTPResponse(commandContext, get);
}
finally
{
@@ -211,25 +171,9 @@
}
}
}
- else if (command instanceof StartTestCommand)
- {
- requestCount = -1;
- parametrization = ((StartTestCommand)command).getParametrization();
- pushContext();
- DriverResponse response = driver.getServer(node).invoke(testId, command);
- requestCount = 0;
- return new HTTPDriverResponseContext(response);
- }
- else if (command instanceof SendResponseCommand)
- {
- pushContext();
- DriverResponse response = driver.getServer(node).invoke(testId, command);
- requestCount++;
- return new HTTPDriverResponseContext(response);
- }
else
{
- return new HTTPDriverResponseContext(new ErrorResponse("Unexpected
response"));
+ return commandContext.createResponseContext(new ErrorResponse("Unexpected
response"));
}
}
@@ -237,137 +181,127 @@
{
if (!uri.isAbsolute())
{
- int port = driver.getPort(node);
+ Node node = conversation.getNode();
+ int port = conversation.getDriver().getPort(node);
uri = new URI("http://localhost:" + port).resolve(uri);
}
return uri.toURL();
}
- /**
- * Create an http command from an http response.
- * @param responseContext
- */
- protected HTTPDriverCommand createHTTPCommand(HTTPDriverResponseContext
responseContext) throws Exception
+ private RemoteDriverResponseContext decodeHTTPResponse(RemoteDriverCommandContext
commandContext, HttpMethod httpMethod) throws Exception
{
-
- DriverResponse resp = responseContext.getResponse();
- if (resp instanceof InvokeMethodResponse)
- {
- if (resp instanceof InvokeGetResponse)
- {
- InvokeGetResponse igr = (InvokeGetResponse)resp;
- URI uri = igr.getURI();
- return new DoGetCommand(igr.getURI(), igr.getHeaders());
- }
- else
- {
- InvokePostResponse ipr = (InvokePostResponse)resp;
- HttpRequest.Body dpcb = ipr.getBody();
- return new DoPostCommand(ipr.getURI(), ipr.getContentType(), dpcb);
- }
- }
- else
- {
- HttpMethod method = responseContext.getHttpMethod();
- byte[] body = method.getResponseBody();
- HttpHeaders _headers = new HttpHeaders();
- Header[] headers = method.getResponseHeaders();
- for (int i = 0;i < headers.length;i++)
- {
- Header header = headers[i];
- HttpHeader _header = _headers.addHeader(header.getName());
- HeaderElement[] elts = header.getElements();
- if (elts != null)
- {
- for (int j = 0;j < elts.length;j++)
- {
- HeaderElement elt = elts[j];
- HttpHeader.Element _elt = _header.addElement(elt.getName(),
elt.getValue());
- NameValuePair[] params = elt.getParameters();
- if (params != null)
- {
- for (int k = 0;k < params.length;k++)
- {
- NameValuePair param = params[k];
- _elt.addParam(param.getName(), param.getValue());
- }
- }
- }
- }
- }
- return new SendResponseCommand(_headers, body);
- }
- }
-
- private HTTPDriverResponseContext decodeHTTPResponse(HttpMethod httpMethod) throws
Exception
- {
- TestContext ctx = popContext();
+ TestContext ctx = conversation.popContext();
DriverResponse response = ctx.getResponse();
int status = httpMethod.getStatusCode();
switch (status)
{
case 200:
+ // HTTP response is ok
if (response == null)
{
- throw new AssertionFailedError("No result for test " + testId +
" in the response");
+ response = new FailureResponse("No result for test " +
conversation.getTestId() + " in the response");
}
- else
- {
- log.info("# Received '200' code");
- requestCount++;
- return new HTTPDriverResponseContext(httpMethod, response);
- }
- // Send redirect
+
+ //
+ log.info("# Received '200' code");
+ break;
case 302:
- // If any result has been setup during the action it overrides the 302 code
- if (response != null)
+ // Send redirect
+ if (response == null)
{
- log.info("# Received Result object which overrides the 302");
- requestCount++;
- return new HTTPDriverResponseContext(httpMethod, response);
- }
+ // Satisfy the 302 code
+ Header locationHeader =
httpMethod.getResponseHeader("location");
+ if (locationHeader != null)
+ {
+ String redirectLocation = locationHeader.getValue();
+ log.info("# Received '302' code --> " +
redirectLocation);
+ DoGetCommand cmd = new DoGetCommand(new URI(redirectLocation));
- // Otherwise satisfy the 302 code
- Header locationHeader = httpMethod.getResponseHeader("location");
- if (locationHeader != null)
- {
- String redirectLocation = locationHeader.getValue();
- log.info("# Received '302' code --> " +
redirectLocation);
- DoGetCommand cmd = new DoGetCommand(new URI(redirectLocation));
+ // We should somehow stuff the response in the next payload
+ // but it's not yet proven it's usefull
- // For now we don't add any contextual payload as
- // 302 is some kind of implicit redirect response
- return (HTTPDriverResponseContext)invoke(new
HTTPDriverCommandContext(cmd));
+ // For now we don't add any contextual payload as
+ // 302 is some kind of implicit redirect response
+ return invoke(new
RemoteDriverCommandContext(commandContext.getResponseContext(), cmd));
+ }
+ else
+ {
+ // The response is invalid
+ response = new FailureResponse("302 Code with corrupted
data");
+ }
}
else
{
- // The response is invalid
- return new HTTPDriverResponseContext(httpMethod, new
FailureResponse("302 Code with corrupted data"));
+ // If any result has been setup during the action it overrides the 302
code
+ log.info("# Received Result object which overrides the 302");
}
+ break;
case 500:
log.info("# Received '500' code");
- return new HTTPDriverResponseContext(httpMethod, new
FailureResponse("Received '500' code at " + httpMethod.getURI()));
+ response = new FailureResponse("Received '500' code at " +
httpMethod.getURI());
+ break;
case 404:
log.info("# Received '404' code");
- return new HTTPDriverResponseContext(httpMethod, new
FailureResponse("Received '404' code at " + httpMethod.getURI()));
+ response = new FailureResponse("Received '404' code at " +
httpMethod.getURI());
+ break;
default:
- return new HTTPDriverResponseContext(httpMethod, new
ErrorResponse("Unexpected http code " + status + " at " +
httpMethod.getURI()));
+ response = new ErrorResponse("Unexpected http code " + status +
" at " + httpMethod.getURI());
+ break;
}
+
+ //
+ RemoteDriverResponseContext responseCtx =
commandContext.createResponseContext(response);
+
+ //
+ byte[] body = httpMethod.getResponseBody();
+ responseCtx.setPayload("http.response.body", body);
+
+ //
+ HttpHeaders _headers = new HttpHeaders();
+ Header[] headers = httpMethod.getResponseHeaders();
+ for (int i = 0;i < headers.length;i++)
+ {
+ Header header = headers[i];
+ HttpHeader _header = _headers.addHeader(header.getName());
+ HeaderElement[] elts = header.getElements();
+ if (elts != null)
+ {
+ for (int j = 0;j < elts.length;j++)
+ {
+ HeaderElement elt = elts[j];
+ HttpHeader.Element _elt = _header.addElement(elt.getName(),
elt.getValue());
+ NameValuePair[] params = elt.getParameters();
+ if (params != null)
+ {
+ for (int k = 0;k < params.length;k++)
+ {
+ NameValuePair param = params[k];
+ _elt.addParam(param.getName(), param.getValue());
+ }
+ }
+ }
+ }
+ }
+ responseCtx.setPayload("http.response.headers", _headers);
+
+ //
+ return responseCtx;
}
- private int executeHTTPMethod(HttpMethod method) throws Exception
+ private int executeHTTPMethod(RemoteDriverCommandContext commandContext, HttpMethod
method) throws Exception
{
int port = method.getURI().getPort();
// Update to the next node
- node = driver.getNode(port);
+ Node node = conversation.getDriver().getNode(port);
if (node == null)
{
throw new IllegalArgumentException("Wrong port " +
method.getURI().getPort() + " in URI " + method.getURI());
}
+ conversation.setNode(node);
// Push context to the node
- pushContext();
+ conversation.pushContext(commandContext);
//
log.info("# Invoking test case over http " + method.getURI());
@@ -377,21 +311,7 @@
// otherwise the content will be lost
method.getResponseBody();
-
+ //
return status;
}
-
- private void pushContext()
- {
- HTTPTestContext ctx = new HTTPTestContext(requestCount, driver.getArchivePath(),
parametrization);
- log.info("# Updating test case context of : " + node + " : " +
ctx);
- RemoteTestDriver agent = driver.getServer(node);
- agent.pushContext(testId, ctx);
- }
-
- private TestContext popContext()
- {
- RemoteTestDriver agent = driver.getServer(node);
- return agent.popContext(testId);
- }
}
Deleted:
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/driver/http/HTTPTestDriver.java
===================================================================
---
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/driver/http/HTTPTestDriver.java 2007-09-10
12:13:33 UTC (rev 8206)
+++
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/driver/http/HTTPTestDriver.java 2007-09-10
23:03:20 UTC (rev 8207)
@@ -1,33 +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.test.framework.driver.http;
-
-import org.jboss.portal.test.framework.driver.remote.RemoteTestDriver;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 1.1 $
- */
-public interface HTTPTestDriver extends RemoteTestDriver
-{
-}
Deleted:
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/driver/http/HTTPTestDriverClient.java
===================================================================
---
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/driver/http/HTTPTestDriverClient.java 2007-09-10
12:13:33 UTC (rev 8206)
+++
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/driver/http/HTTPTestDriverClient.java 2007-09-10
23:03:20 UTC (rev 8207)
@@ -1,39 +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.test.framework.driver.http;
-
-import org.jboss.portal.test.framework.driver.remote.RemoteTestDriverClient;
-import org.jboss.portal.test.framework.driver.remote.TestConversation;
-import org.jboss.portal.test.framework.server.Node;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 1.1 $
- */
-public class HTTPTestDriverClient extends RemoteTestDriverClient
-{
- protected TestConversation createConversation(String testId, Node node)
- {
- return new HTTPTestConversation(this, testId, node);
- }
-}
Added:
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/driver/http/HTTPTestDriverHandler.java
===================================================================
---
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/driver/http/HTTPTestDriverHandler.java
(rev 0)
+++
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/driver/http/HTTPTestDriverHandler.java 2007-09-10
23:03:20 UTC (rev 8207)
@@ -0,0 +1,84 @@
+/******************************************************************************
+ * 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.test.framework.driver.remote.RemoteTestDriverProtocolHandler;
+import org.jboss.portal.test.framework.driver.remote.TestConversation;
+import org.jboss.portal.test.framework.driver.remote.RemoteDriverCommandContext;
+import org.jboss.portal.test.framework.driver.remote.RemoteDriverResponseContext;
+import org.jboss.portal.test.framework.driver.DriverCommand;
+import org.jboss.portal.test.framework.driver.http.response.HTTPDriverResponse;
+import org.jboss.portal.test.framework.driver.http.response.InvokeMethodResponse;
+import org.jboss.portal.test.framework.driver.http.response.InvokeGetResponse;
+import org.jboss.portal.test.framework.driver.http.response.InvokePostResponse;
+import org.jboss.portal.test.framework.driver.http.command.DoGetCommand;
+import org.jboss.portal.test.framework.driver.http.command.DoPostCommand;
+import org.jboss.portal.common.http.HttpRequest;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class HTTPTestDriverHandler implements RemoteTestDriverProtocolHandler
+{
+
+ public DriverCommand createCommand(RemoteDriverResponseContext responseContext)
+ {
+ if (responseContext.getResponse() instanceof HTTPDriverResponse)
+ {
+ HTTPDriverResponse resp = (HTTPDriverResponse)responseContext.getResponse();
+ if (resp instanceof InvokeMethodResponse)
+ {
+ if (resp instanceof InvokeGetResponse)
+ {
+ InvokeGetResponse igr = (InvokeGetResponse)resp;
+ return new DoGetCommand(igr.getURI(), igr.getHeaders());
+ }
+ else
+ {
+ InvokePostResponse ipr = (InvokePostResponse)resp;
+ HttpRequest.Body dpcb = ipr.getBody();
+ return new DoPostCommand(ipr.getURI(), ipr.getContentType(), dpcb);
+ }
+ }
+ }
+
+ //
+ return null;
+ }
+
+ public RemoteDriverResponseContext invoke(TestConversation conversation,
RemoteDriverCommandContext commandContext) throws Exception
+ {
+ HTTPTestConversation httpConversation =
(HTTPTestConversation)conversation.getAttribute("http.conversation");
+
+ //
+ if (httpConversation == null)
+ {
+ httpConversation = new HTTPTestConversation(conversation);
+ conversation.setAttribute("http.conversation", httpConversation);
+ }
+
+ //
+ return httpConversation.invoke(commandContext);
+ }
+}
Deleted:
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/driver/http/HTTPTestDriverServer.java
===================================================================
---
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/driver/http/HTTPTestDriverServer.java 2007-09-10
12:13:33 UTC (rev 8206)
+++
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/driver/http/HTTPTestDriverServer.java 2007-09-10
23:03:20 UTC (rev 8207)
@@ -1,62 +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.test.framework.driver.http;
-
-import org.jboss.portal.test.framework.driver.remote.RemoteTestDriverServer;
-import org.jboss.portal.test.framework.driver.remote.TestContext;
-
-/**
- * Extends the remote test driver server to add the notion of initial path that can be
used by
- * the tested system.
- *
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 1.1 $
- */
-public class HTTPTestDriverServer extends RemoteTestDriverServer
-{
-
- /** . */
- private String initialPath = "/test";
-
- public String getInitialPath()
- {
- return initialPath;
- }
-
- public void setInitialPath(String initialPath)
- {
- this.initialPath = initialPath;
- }
-
- public void pushContext(String testId, TestContext testContext)
- {
- if (testContext instanceof HTTPTestContext)
- {
- HTTPTestContext httpTestContext = (HTTPTestContext)testContext;
- httpTestContext.initialPath = initialPath;
- }
-
- //
- super.pushContext(testId, testContext);
- }
-}
Deleted:
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/driver/http/command/HTTPDriverCommandContext.java
===================================================================
---
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/driver/http/command/HTTPDriverCommandContext.java 2007-09-10
12:13:33 UTC (rev 8206)
+++
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/driver/http/command/HTTPDriverCommandContext.java 2007-09-10
23:03:20 UTC (rev 8207)
@@ -1,46 +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.test.framework.driver.http.command;
-
-import org.jboss.portal.test.framework.driver.DriverCommand;
-import org.jboss.portal.test.framework.driver.remote.command.RemoteDriverCommandContext;
-import
org.jboss.portal.test.framework.driver.remote.response.RemoteDriverResponseContext;
-
-/**
- * The context of the command invoked by the client.
- *
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 1.1 $
- */
-public class HTTPDriverCommandContext extends RemoteDriverCommandContext
-{
- public HTTPDriverCommandContext(RemoteDriverResponseContext responseContext,
DriverCommand command)
- {
- super(responseContext, command);
- }
-
- public HTTPDriverCommandContext(DriverCommand command)
- {
- super(command);
- }
-}
Deleted:
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/driver/http/command/SendResponseCommand.java
===================================================================
---
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/driver/http/command/SendResponseCommand.java 2007-09-10
12:13:33 UTC (rev 8206)
+++
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/driver/http/command/SendResponseCommand.java 2007-09-10
23:03:20 UTC (rev 8207)
@@ -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.portal.test.framework.driver.http.command;
-
-import org.jboss.portal.common.http.HttpHeaders;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 1.1 $
- */
-public class SendResponseCommand extends HTTPDriverCommand
-{
-
- /** . */
- private HttpHeaders headers;
-
- /** . */
- private byte[] bytes;
-
- public SendResponseCommand(HttpHeaders headers, byte[] bytes)
- {
- this.headers = headers;
- this.bytes = bytes;
- }
-
- public HttpHeaders getHeaders()
- {
- return headers;
- }
-
- public byte[] getBytes()
- {
- return bytes;
- }
-}
Deleted:
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/driver/http/response/HTTPDriverResponseContext.java
===================================================================
---
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/driver/http/response/HTTPDriverResponseContext.java 2007-09-10
12:13:33 UTC (rev 8206)
+++
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/driver/http/response/HTTPDriverResponseContext.java 2007-09-10
23:03:20 UTC (rev 8207)
@@ -1,58 +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.test.framework.driver.http.response;
-
-import org.apache.commons.httpclient.HttpMethod;
-import org.jboss.portal.test.framework.driver.DriverResponse;
-import
org.jboss.portal.test.framework.driver.remote.response.RemoteDriverResponseContext;
-
-/**
- * The context of the response received by the client.
- *
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 1.1 $
- */
-public class HTTPDriverResponseContext extends RemoteDriverResponseContext
-{
-
- /** The http method if not null. */
- private HttpMethod httpMethod;
-
- public HTTPDriverResponseContext(HttpMethod httpMethod, DriverResponse response)
- {
- super(response);
-
- //
- this.httpMethod = httpMethod;
- }
-
- public HTTPDriverResponseContext(DriverResponse response)
- {
- this(null, response);
- }
-
- public HttpMethod getHttpMethod()
- {
- return httpMethod;
- }
-}
Deleted:
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/driver/http/response/SendResponseResponse.java
===================================================================
---
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/driver/http/response/SendResponseResponse.java 2007-09-10
12:13:33 UTC (rev 8206)
+++
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/driver/http/response/SendResponseResponse.java 2007-09-10
23:03:20 UTC (rev 8207)
@@ -1,35 +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.test.framework.driver.http.response;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 1.1 $
- */
-public class SendResponseResponse extends HTTPDriverResponse
-{
- public String toString()
- {
- return "SendResponse[]";
- }
-}
Copied:
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/driver/remote/RemoteDriverCommandContext.java
(from rev 8097,
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/driver/remote/command/RemoteDriverCommandContext.java)
===================================================================
---
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/driver/remote/RemoteDriverCommandContext.java
(rev 0)
+++
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/driver/remote/RemoteDriverCommandContext.java 2007-09-10
23:03:20 UTC (rev 8207)
@@ -0,0 +1,112 @@
+/******************************************************************************
+ * 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.remote;
+
+import org.jboss.portal.test.framework.driver.DriverCommand;
+import org.jboss.portal.test.framework.driver.DriverResponse;
+
+import java.util.Map;
+import java.util.HashMap;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class RemoteDriverCommandContext
+{
+
+ /** The previous response if not null. */
+ private RemoteDriverResponseContext responseContext;
+
+ /** . */
+ private final int requestCount;
+
+ /** The command to invoke. */
+ private DriverCommand command;
+
+ /** . */
+ private final Map payload;
+
+ public RemoteDriverCommandContext(RemoteDriverResponseContext responseContext,
DriverCommand command)
+ {
+ this.responseContext = responseContext;
+ this.requestCount = responseContext.getCommandContext().requestCount + 1;
+ this.command = command;
+ this.payload = new HashMap(responseContext.getPayload());
+ }
+
+ public RemoteDriverCommandContext(DriverCommand command)
+ {
+ this.responseContext = null;
+ this.requestCount = -1;
+ this.command = command;
+ this.payload = new HashMap();
+ }
+
+ public RemoteDriverCommandContext(RemoteDriverCommandContext commandContext,
DriverCommand command)
+ {
+ Map payload = commandContext.responseContext != null ? new
HashMap(commandContext.responseContext.getPayload()) : new HashMap();
+
+ //
+ this.responseContext = commandContext.responseContext;
+ this.requestCount = commandContext.requestCount + 1;
+ this.command = command;
+ this.payload = payload;
+ }
+
+ public RemoteDriverCommandContext(RemoteDriverCommandContext commandContext)
+ {
+ Map payload = commandContext.responseContext != null ? new
HashMap(commandContext.responseContext.getPayload()) : new HashMap();
+
+ //
+ this.responseContext = commandContext.responseContext;
+ this.requestCount = commandContext.requestCount + 1;
+ this.command = commandContext.command;
+ this.payload = payload;
+ }
+
+ public Map getPayload()
+ {
+ return payload;
+ }
+
+ public int getRequestCount()
+ {
+ return requestCount;
+ }
+
+ public RemoteDriverResponseContext createResponseContext(DriverResponse response)
+ {
+ return new RemoteDriverResponseContext(this, response);
+ }
+
+ public RemoteDriverResponseContext getResponseContext()
+ {
+ return responseContext;
+ }
+
+ public DriverCommand getCommand()
+ {
+ return command;
+ }
+}
Copied:
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/driver/remote/RemoteDriverResponseContext.java
(from rev 8097,
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/driver/remote/response/RemoteDriverResponseContext.java)
===================================================================
---
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/driver/remote/RemoteDriverResponseContext.java
(rev 0)
+++
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/driver/remote/RemoteDriverResponseContext.java 2007-09-10
23:03:20 UTC (rev 8207)
@@ -0,0 +1,97 @@
+/******************************************************************************
+ * 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.remote;
+
+import org.jboss.portal.test.framework.driver.DriverResponse;
+
+import java.util.Map;
+import java.util.HashMap;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class RemoteDriverResponseContext
+{
+
+ /** . */
+ private final RemoteDriverCommandContext commandContext;
+
+ /** . */
+ private final DriverResponse response;
+
+ /** . */
+ private final Map payload;
+
+ RemoteDriverResponseContext(RemoteDriverCommandContext commandContext, DriverResponse
response)
+ {
+ this.commandContext = commandContext;
+ this.response = response;
+ this.payload = new HashMap();
+ }
+
+ public RemoteDriverCommandContext getCommandContext()
+ {
+ return commandContext;
+ }
+
+ public Map getPayload()
+ {
+ return payload;
+ }
+
+ public Object getPayload(String name)
+ {
+ if (name == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ return payload.get(name);
+ }
+
+ public void setPayload(String name, Object value)
+ {
+ if (name == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ if (value == null)
+ {
+ payload.remove(name);
+ }
+ else
+ {
+ payload.put(name, value);
+ }
+ }
+
+ public void removePayload(String name)
+ {
+ setPayload(name, null);
+ }
+
+ public DriverResponse getResponse()
+ {
+ return response;
+ }
+}
Modified:
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/driver/remote/RemoteTestDriverClient.java
===================================================================
---
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/driver/remote/RemoteTestDriverClient.java 2007-09-10
12:13:33 UTC (rev 8206)
+++
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/driver/remote/RemoteTestDriverClient.java 2007-09-10
23:03:20 UTC (rev 8207)
@@ -30,12 +30,13 @@
import org.jboss.portal.test.framework.driver.DriverCommand;
import org.jboss.portal.test.framework.driver.TestDriverException;
import org.jboss.portal.test.framework.driver.TestDriver;
+import org.jboss.portal.test.framework.deployment.Deployer;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 1.1 $
*/
-public abstract class RemoteTestDriverClient implements TestDriver
+public class RemoteTestDriverClient implements TestDriver
{
// Config
@@ -51,6 +52,9 @@
/** . */
private NodeManager nodeManager;
+ /** . */
+ private Deployer deployer;
+
public NodeId getInitialNodeId()
{
return initialNodeId;
@@ -81,6 +85,16 @@
this.nodeManager = nodeManager;
}
+ public Deployer getDeployer()
+ {
+ return deployer;
+ }
+
+ public void setDeployer(Deployer deployer)
+ {
+ this.deployer = deployer;
+ }
+
public RemoteTestDriver getServer(Node node)
{
return (RemoteTestDriver)node.lookupService(RemoteTestDriver.SERVICE_ID);
@@ -111,7 +125,10 @@
}
}
- protected abstract TestConversation createConversation(String testId, Node node);
+ protected TestConversation createConversation(String testId, Node node)
+ {
+ return new TestConversation(this, testId, node);
+ }
public Node getNode(int port)
{
Added:
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/driver/remote/RemoteTestDriverProtocolHandler.java
===================================================================
---
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/driver/remote/RemoteTestDriverProtocolHandler.java
(rev 0)
+++
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/driver/remote/RemoteTestDriverProtocolHandler.java 2007-09-10
23:03:20 UTC (rev 8207)
@@ -0,0 +1,39 @@
+/******************************************************************************
+ * 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.remote;
+
+import org.jboss.portal.test.framework.driver.remote.RemoteDriverCommandContext;
+import org.jboss.portal.test.framework.driver.remote.RemoteDriverResponseContext;
+import org.jboss.portal.test.framework.driver.DriverCommand;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public interface RemoteTestDriverProtocolHandler
+{
+
+ DriverCommand createCommand(RemoteDriverResponseContext responseContext);
+
+ RemoteDriverResponseContext invoke(TestConversation conversation,
RemoteDriverCommandContext commandContext) throws Exception;
+}
Modified:
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/driver/remote/RemoteTestDriverServer.java
===================================================================
---
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/driver/remote/RemoteTestDriverServer.java 2007-09-10
12:13:33 UTC (rev 8206)
+++
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/driver/remote/RemoteTestDriverServer.java 2007-09-10
23:03:20 UTC (rev 8207)
@@ -34,16 +34,12 @@
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 5636 $
*/
-public class RemoteTestDriverServer extends AbstractTestDriverServer implements
TestDriverContainer
+public class RemoteTestDriverServer extends AbstractTestDriverServer implements
RemoteTestDriver, TestDriverContainer
{
/** . */
private static final RemoteTestSuite suite = new RemoteTestSuite("Main");
- public RemoteTestDriverServer()
- {
- }
-
public void pushContext(String testId, TestContext testContext)
{
testContext.testAgent = getAgent();
@@ -57,7 +53,7 @@
return suite.popContext(testId);
}
- public void addDriver(TestDriver driver)
+ public void addDriver(TestDriver driver)
{
synchronized(RemoteTestDriverServer.class)
{
@@ -87,4 +83,30 @@
{
return suite.getInfo();
}
+
+// /** . */
+// private String initialPath = "/test";
+//
+// public String getInitialPath()
+// {
+// return initialPath;
+// }
+//
+// public void setInitialPath(String initialPath)
+// {
+// this.initialPath = initialPath;
+// }
+//
+// public void pushContext(String testId, TestContext testContext)
+// {
+// if (testContext instanceof HTTPTestContext)
+// {
+// HTTPTestContext httpTestContext = (HTTPTestContext)testContext;
+// httpTestContext.initialPath = initialPath;
+// }
+//
+// //
+// super.pushContext(testId, testContext);
+// }
+
}
Modified:
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/driver/remote/TestContext.java
===================================================================
---
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/driver/remote/TestContext.java 2007-09-10
12:13:33 UTC (rev 8206)
+++
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/driver/remote/TestContext.java 2007-09-10
23:03:20 UTC (rev 8207)
@@ -31,6 +31,7 @@
import java.io.File;
import java.net.MalformedURLException;
import java.net.URL;
+import java.util.Map;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
@@ -51,6 +52,9 @@
/** The test parametrization. */
protected TestParametrization parametrization;
+ /** . */
+ private Map attributes;
+
/**
* The test agent, normally only valid in the server side for now.
* It is transient so it is not marshalled when the context is popped on the client
by
@@ -69,17 +73,20 @@
this.response = that.response;
this.parametrization = that.parametrization;
this.testAgent = that.testAgent;
+ this.attributes =that.attributes;
}
/**
* Normally used on the client side.
*/
- public TestContext(int requestCount, String archivePath, TestParametrization
parametrization)
+ public TestContext(int requestCount, String archivePath, TestParametrization
parametrization, Map attributes)
{
this.requestCount = requestCount;
this.archivePath = archivePath;
+ this.response = null;
this.parametrization = parametrization;
this.testAgent = null;
+ this.attributes = attributes;
}
public TestParametrization getParametrization()
@@ -114,6 +121,36 @@
return requestCount == count;
}
+ public Object getAttribute(String name)
+ {
+ if (name == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ return attributes.get(name);
+ }
+
+ public void setAttribute(String name, Object value)
+ {
+ if (name == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ if (value == null)
+ {
+ attributes.remove(name);
+ }
+ else
+ {
+ attributes.put(name, value);
+ }
+ }
+
+ public void removeAttribute(String name)
+ {
+ setAttribute(name, null);
+ }
+
/**
* Return the response.
*
Modified:
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/driver/remote/TestConversation.java
===================================================================
---
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/driver/remote/TestConversation.java 2007-09-10
12:13:33 UTC (rev 8206)
+++
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/driver/remote/TestConversation.java 2007-09-10
23:03:20 UTC (rev 8207)
@@ -24,36 +24,84 @@
import org.jboss.portal.test.framework.driver.DriverResponse;
import org.jboss.portal.test.framework.driver.DriverCommand;
-import org.jboss.portal.test.framework.driver.remote.command.RemoteDriverCommandContext;
-import
org.jboss.portal.test.framework.driver.remote.response.RemoteDriverResponseContext;
+import org.jboss.portal.test.framework.driver.http.command.HTTPDriverCommand;
+import org.jboss.portal.test.framework.driver.http.HTTPTestDriverHandler;
+import org.jboss.portal.test.framework.driver.http.response.HTTPDriverResponse;
+import org.jboss.portal.test.framework.driver.command.StartTestCommand;
+import org.jboss.portal.test.framework.driver.remote.response.DeployResponse;
+import org.jboss.portal.test.framework.driver.remote.response.UndeployResponse;
+import org.jboss.portal.test.framework.server.Node;
+import org.jboss.portal.test.framework.TestParametrization;
+import org.jboss.portal.test.framework.deployment.Deployer;
+import org.apache.log4j.Logger;
+import java.util.Map;
+import java.util.HashMap;
+
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 1.1 $
*/
-public abstract class TestConversation
+public final class TestConversation
{
+ /** . */
+ private final Logger log = Logger.getLogger(getClass());
+
/** The test name. */
- protected final String testId;
+ private final String testId;
/** . */
- protected final RemoteTestDriverClient driver;
+ private final RemoteTestDriverClient driver;
- protected TestConversation(RemoteTestDriverClient driver, String testId)
+ /** . */
+ private final Map attributes;
+
+ /** The node to invoke. */
+ private Node node;
+
+ /** The test parametrization. */
+ private TestParametrization parametrization;
+
+ public TestConversation(RemoteTestDriverClient driver, String testId, Node node)
{
this.driver = driver;
this.testId = testId;
+ this.node = node;
+ this.attributes = new HashMap();
}
- public final DriverResponse handleCommand(DriverCommand command) throws Exception
+ DriverResponse handleCommand(DriverCommand command) throws Exception
{
- RemoteDriverCommandContext commandContext = createContext(command);
+ RemoteDriverCommandContext commandContext = new
RemoteDriverCommandContext(command);
//
return handleCommand(commandContext);
}
+ private RemoteDriverResponseContext invokeCommand(RemoteDriverCommandContext
commandContext) throws Exception
+ {
+ DriverCommand command = commandContext.getCommand();
+
+ //
+ if (command instanceof StartTestCommand)
+ {
+ StartTestCommand start = (StartTestCommand)command;
+ parametrization = start.getParametrization();
+ pushContext(commandContext);
+ DriverResponse response = getDriver().getServer(node).invoke(testId, command);
+ return commandContext.createResponseContext(response);
+ }
+ else if (command instanceof HTTPDriverCommand)
+ {
+ return new HTTPTestDriverHandler().invoke(this, commandContext);
+ }
+ else
+ {
+ throw new IllegalArgumentException("Not yet handled " + command);
+ }
+ }
+
/**
* Trigger an interaction with the server here.
*
@@ -63,26 +111,122 @@
*/
public final DriverResponse handleCommand(RemoteDriverCommandContext commandContext)
throws Exception
{
- RemoteDriverResponseContext respCtx = invoke(commandContext);
+ RemoteDriverResponseContext respCtx = invokeCommand(commandContext);
//
- DriverCommand command = createCommand(respCtx);
+ DriverResponse response = respCtx.getResponse();
//
- if (command != null)
+ if (response instanceof HTTPDriverResponse)
{
- return handleCommand(command);
+ DriverCommand cmd = new HTTPTestDriverHandler().createCommand(respCtx);
+ return handleCommand(new RemoteDriverCommandContext(respCtx, cmd));
}
+ else if (response instanceof DeployResponse)
+ {
+ DeployResponse deploy = (DeployResponse)response;
+
+ //
+ Deployer deployer = driver.getDeployer();
+ deployer.deploy(driver.getArchivePath(), deploy.getId(), node);
+
+ //
+ return handleCommand(new
RemoteDriverCommandContext(respCtx.getCommandContext()));
+ }
+ else if (response instanceof UndeployResponse)
+ {
+ UndeployResponse undeploy = (UndeployResponse)response;
+
+ //
+ Deployer deployer = driver.getDeployer();
+ deployer.undeploy(driver.getArchivePath(), undeploy.getId());
+
+ //
+ return handleCommand(new
RemoteDriverCommandContext(respCtx.getCommandContext()));
+ }
else
{
return respCtx.getResponse();
}
}
- protected abstract RemoteDriverCommandContext createContext(DriverCommand command);
+ public Object getAttribute(String name)
+ {
+ if (name == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ return attributes.get(name);
+ }
- protected abstract RemoteDriverResponseContext invoke(RemoteDriverCommandContext
commandContext) throws Exception;
+ public void setAttribute(String name, Object value)
+ {
+ if (name == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ if (value == null)
+ {
+ attributes.remove(name);
+ }
+ else
+ {
+ attributes.put(name, value);
+ }
+ }
- protected abstract DriverCommand createCommand(RemoteDriverResponseContext
responseContext) throws Exception;
+ public void removeAttribute(String name)
+ {
+ setAttribute(name, null);
+ }
+ public RemoteTestDriverClient getDriver()
+ {
+ return driver;
+ }
+
+ public String getTestId()
+ {
+ return testId;
+ }
+
+ public Node getNode()
+ {
+ return node;
+ }
+
+ public void setNode(Node node)
+ {
+ this.node = node;
+ }
+
+ public TestParametrization getParametrization()
+ {
+ return parametrization;
+ }
+
+ public void setParametrization(TestParametrization parametrization)
+ {
+ this.parametrization = parametrization;
+ }
+
+ public void pushContext(RemoteDriverCommandContext commandContext)
+ {
+ TestContext ctx = new TestContext(
+ commandContext.getRequestCount(),
+ driver.getArchivePath(),
+ parametrization,
+ commandContext.getPayload());
+
+ //
+ log.info("# Updating test case context of : " + node + " : " +
ctx);
+ RemoteTestDriver agent = driver.getServer(node);
+ agent.pushContext(testId, ctx);
+ }
+
+ public TestContext popContext()
+ {
+ RemoteTestDriver agent = driver.getServer(node);
+ return agent.popContext(testId);
+ }
}
Deleted:
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/driver/remote/command/RemoteDriverCommandContext.java
===================================================================
---
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/driver/remote/command/RemoteDriverCommandContext.java 2007-09-10
12:13:33 UTC (rev 8206)
+++
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/driver/remote/command/RemoteDriverCommandContext.java 2007-09-10
23:03:20 UTC (rev 8207)
@@ -1,61 +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.test.framework.driver.remote.command;
-
-import org.jboss.portal.test.framework.driver.DriverCommand;
-import
org.jboss.portal.test.framework.driver.remote.response.RemoteDriverResponseContext;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 1.1 $
- */
-public class RemoteDriverCommandContext
-{
-
- /** The previous response if not null. */
- private RemoteDriverResponseContext responseContext;
-
- /** The command to invoke. */
- private DriverCommand command;
-
- public RemoteDriverCommandContext(RemoteDriverResponseContext responseContext,
DriverCommand command)
- {
- this.responseContext = responseContext;
- this.command = command;
- }
-
- public RemoteDriverCommandContext(DriverCommand command)
- {
- this.command = command;
- }
-
- public RemoteDriverResponseContext getResponseContext()
- {
- return responseContext;
- }
-
- public DriverCommand getCommand()
- {
- return command;
- }
-}
Deleted:
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/driver/remote/response/RemoteDriverResponseContext.java
===================================================================
---
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/driver/remote/response/RemoteDriverResponseContext.java 2007-09-10
12:13:33 UTC (rev 8206)
+++
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/driver/remote/response/RemoteDriverResponseContext.java 2007-09-10
23:03:20 UTC (rev 8207)
@@ -1,46 +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.test.framework.driver.remote.response;
-
-import org.jboss.portal.test.framework.driver.DriverResponse;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 1.1 $
- */
-public class RemoteDriverResponseContext
-{
-
- /** . */
- private DriverResponse response;
-
- public RemoteDriverResponseContext(DriverResponse response)
- {
- this.response = response;
- }
-
- public DriverResponse getResponse()
- {
- return response;
- }
-}
Modified:
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/driver/web/WebTestConversation.java
===================================================================
---
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/driver/web/WebTestConversation.java 2007-09-10
12:13:33 UTC (rev 8206)
+++
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/driver/web/WebTestConversation.java 2007-09-10
23:03:20 UTC (rev 8207)
@@ -24,162 +24,83 @@
import org.jboss.portal.test.framework.driver.remote.TestConversation;
import org.jboss.portal.test.framework.driver.remote.TestContext;
-import org.jboss.portal.test.framework.driver.remote.RemoteTestDriver;
-import
org.jboss.portal.test.framework.driver.remote.response.RemoteDriverResponseContext;
-import org.jboss.portal.test.framework.driver.remote.command.RemoteDriverCommandContext;
-import org.jboss.portal.test.framework.driver.web.response.PerformClickResponse;
-import org.jboss.portal.test.framework.driver.web.response.WebDriverResponseContext;
-import org.jboss.portal.test.framework.driver.web.response.GetPageResponse;
-import org.jboss.portal.test.framework.driver.web.response.DnDResponse;
+import org.jboss.portal.test.framework.driver.remote.RemoteDriverResponseContext;
+import org.jboss.portal.test.framework.driver.remote.RemoteDriverCommandContext;
import org.jboss.portal.test.framework.driver.web.command.PerformClickCommand;
-import org.jboss.portal.test.framework.driver.web.command.WebDriverCommandContext;
import org.jboss.portal.test.framework.driver.web.command.GetPageCommand;
import org.jboss.portal.test.framework.driver.web.command.DnDCommand;
-import org.jboss.portal.test.framework.server.Node;
import org.jboss.portal.test.framework.driver.DriverCommand;
import org.jboss.portal.test.framework.driver.DriverResponse;
-import org.jboss.portal.test.framework.driver.response.EndTestResponse;
-import org.jboss.portal.test.framework.driver.command.StartTestCommand;
import org.apache.log4j.Logger;
import com.thoughtworks.selenium.Selenium;
+import com.thoughtworks.selenium.DefaultSelenium;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 1.1 $
*/
-public class WebTestConversation extends TestConversation
+public class WebTestConversation
{
/** . */
private final Logger log = Logger.getLogger(getClass());
/** . */
- private final WebTestDriverClient driver;
+ private final Selenium selenium;
- /** The node to invoke. */
- private Node node;
+ /** . */
+ private final TestConversation conversation;
- /** The request count for that session. */
- private int requestCount;
-
- public WebTestConversation(WebTestDriverClient driver, String testId, Node node)
+ public WebTestConversation(TestConversation conversation)
{
- super(driver, testId);
+ // We open localhost:8080 provided by tomcat as we need to open something for
selenium
+ Selenium selenium = new DefaultSelenium("localhost", 12345,
"*firefox", "http://localhost:8080");
+ selenium.start();
//
- this.node = node;
- this.driver = driver;
+ this.conversation = conversation;
+ this.selenium = selenium;
}
- protected RemoteDriverCommandContext createContext(DriverCommand command)
- {
- return new WebDriverCommandContext(command);
- }
-
protected RemoteDriverResponseContext invoke(RemoteDriverCommandContext
commandContext) throws Exception
{
DriverCommand command = commandContext.getCommand();
-
- //
- if (command instanceof StartTestCommand)
+ if (command instanceof PerformClickCommand)
{
- log.info("# Starting test : " + node + " : " + testId);
- requestCount = -1;
- pushContext();
- DriverResponse response = driver.getServer(node).invoke(testId, command);
- return new WebDriverResponseContext(response);
- }
- else
- {
- if (command instanceof PerformClickCommand)
- {
- PerformClickCommand performClick = (PerformClickCommand)command;
- String id = performClick.getId();
- log.info("# Clicking element : " + node + " : " + id);
- requestCount++;
- pushContext();
- Selenium selenium = driver.getSelenium();
- selenium.click(id);
- Thread.sleep(5000);
+ PerformClickCommand performClick = (PerformClickCommand)command;
+ String id = performClick.getId();
+ log.info("# Clicking element : " + conversation.getNode() + " :
" + id);
+ conversation.pushContext(commandContext);
+ selenium.click(id);
+ Thread.sleep(5000);
// selenium.waitForPageToLoad("50000");
- }
- else if (command instanceof GetPageCommand)
- {
- GetPageCommand getPage = (GetPageCommand)command;
- String uri = getPage.getURI();
- log.info("# Getting page : " + node + " : " + uri);
- requestCount++;
- pushContext();
- Selenium selenium = driver.getSelenium();
- selenium.open(uri);
- selenium.waitForPageToLoad("5000");
- }
- else if (command instanceof DnDCommand)
- {
- DnDCommand dnd = (DnDCommand)command;
- String fromId = dnd.getFromId();
- int deltaX = dnd.getDeltaX();
- int deltaY = dnd.getDeltaY();
- String move = (deltaX > 0 ? ("+" + deltaX) :
Integer.toString(deltaX)) + "," + (deltaY > 0 ? ("+" + deltaY) :
Integer.toString(deltaY));
- log.info("# DnD : " + node + " : " + fromId + "
-> (" + move + ")");
- requestCount++;
- pushContext();
- Selenium selenium = driver.getSelenium();
- selenium.dragAndDrop(fromId, move);
- Thread.sleep(5000);
-// selenium.waitForPageToLoad("50000");
- }
-
- //
- TestContext ctx = popContext();
- DriverResponse response = ctx.getResponse();
- return new WebDriverResponseContext(response);
}
- }
-
- protected DriverCommand createCommand(RemoteDriverResponseContext responseContext)
throws Exception
- {
- DriverResponse response = responseContext.getResponse();
-
- //
- if (response instanceof PerformClickResponse)
+ else if (command instanceof GetPageCommand)
{
- PerformClickResponse performClick = (PerformClickResponse)response;
- return new PerformClickCommand(performClick.getId());
+ GetPageCommand getPage = (GetPageCommand)command;
+ String uri = getPage.getURI();
+ log.info("# Getting page : " + conversation.getNode() + " :
" + uri);
+ conversation.pushContext(commandContext);
+ selenium.open(uri);
+ selenium.waitForPageToLoad("5000");
}
- else if (response instanceof GetPageResponse)
+ else if (command instanceof DnDCommand)
{
- GetPageResponse getPage = (GetPageResponse)response;
- return new GetPageCommand(getPage.getURI());
+ DnDCommand dnd = (DnDCommand)command;
+ String fromId = dnd.getFromId();
+ int deltaX = dnd.getDeltaX();
+ int deltaY = dnd.getDeltaY();
+ String move = (deltaX > 0 ? ("+" + deltaX) :
Integer.toString(deltaX)) + "," + (deltaY > 0 ? ("+" + deltaY) :
Integer.toString(deltaY));
+ log.info("# DnD : " + conversation.getNode() + " : " +
fromId + " -> (" + move + ")");
+ conversation.pushContext(commandContext);
+ selenium.dragAndDrop(fromId, move);
+ Thread.sleep(5000);
+// selenium.waitForPageToLoad("50000");
}
- else if (response instanceof DnDResponse)
- {
- DnDResponse dnd = (DnDResponse)response;
- return new DnDCommand(dnd.getFromId(), dnd.getDeltaX(), dnd.getDeltaY());
- }
- else
- {
- if (response instanceof EndTestResponse)
- {
- log.info("# Ending test : " + testId);
- }
- //
- return null;
- }
+ //
+ TestContext ctx = conversation.popContext();
+ DriverResponse response = ctx.getResponse();
+ return commandContext.createResponseContext(response);
}
-
- private void pushContext()
- {
- TestContext ctx = new TestContext(requestCount, driver.getArchivePath(), null);
- log.info("# Updating test case context of : " + node + " : " +
ctx);
- RemoteTestDriver agent = driver.getServer(node);
- agent.pushContext(testId, ctx);
- }
-
- private TestContext popContext()
- {
- RemoteTestDriver agent = driver.getServer(node);
- return agent.popContext(testId);
- }
}
Deleted:
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/driver/web/WebTestDriverClient.java
===================================================================
---
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/driver/web/WebTestDriverClient.java 2007-09-10
12:13:33 UTC (rev 8206)
+++
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/driver/web/WebTestDriverClient.java 2007-09-10
23:03:20 UTC (rev 8207)
@@ -1,58 +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.test.framework.driver.web;
-
-import org.jboss.portal.test.framework.driver.remote.RemoteTestDriverClient;
-import org.jboss.portal.test.framework.driver.remote.TestConversation;
-import org.jboss.portal.test.framework.server.Node;
-import com.thoughtworks.selenium.Selenium;
-import com.thoughtworks.selenium.DefaultSelenium;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 1.1 $
- */
-public class WebTestDriverClient extends RemoteTestDriverClient
-{
-
- /** . */
- private Selenium selenium;
-
- protected TestConversation createConversation(String testId, Node node)
- {
- return new WebTestConversation(this, testId, node);
- }
-
- public Selenium getSelenium()
- {
- if (selenium == null)
- {
- // We open localhost:8080 provided by tomcat as we need to open something for
selenium
- selenium = new DefaultSelenium("localhost", 12345,
"*firefox", "http://localhost:8080");
- selenium.start();
- }
-
- //
- return selenium;
- }
-}
Added:
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/driver/web/WebTestDriverHandler.java
===================================================================
---
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/driver/web/WebTestDriverHandler.java
(rev 0)
+++
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/driver/web/WebTestDriverHandler.java 2007-09-10
23:03:20 UTC (rev 8207)
@@ -0,0 +1,89 @@
+/******************************************************************************
+ * 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.web;
+
+import org.jboss.portal.test.framework.driver.remote.RemoteTestDriverProtocolHandler;
+import org.jboss.portal.test.framework.driver.remote.TestConversation;
+import org.jboss.portal.test.framework.driver.remote.RemoteDriverCommandContext;
+import org.jboss.portal.test.framework.driver.remote.RemoteDriverResponseContext;
+import org.jboss.portal.test.framework.driver.DriverCommand;
+import org.jboss.portal.test.framework.driver.DriverResponse;
+import org.jboss.portal.test.framework.driver.web.response.WebDriverResponse;
+import org.jboss.portal.test.framework.driver.web.response.PerformClickResponse;
+import org.jboss.portal.test.framework.driver.web.response.GetPageResponse;
+import org.jboss.portal.test.framework.driver.web.response.DnDResponse;
+import org.jboss.portal.test.framework.driver.web.command.PerformClickCommand;
+import org.jboss.portal.test.framework.driver.web.command.GetPageCommand;
+import org.jboss.portal.test.framework.driver.web.command.DnDCommand;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class WebTestDriverHandler implements RemoteTestDriverProtocolHandler
+{
+
+ public DriverCommand createCommand(RemoteDriverResponseContext responseContext)
+ {
+ if (responseContext.getResponse() instanceof WebDriverResponse)
+ {
+ DriverResponse resp = responseContext.getResponse();
+
+ //
+ if (resp instanceof PerformClickResponse)
+ {
+ PerformClickResponse performClick = (PerformClickResponse)resp;
+ return new PerformClickCommand(performClick.getId());
+ }
+ else if (resp instanceof GetPageResponse)
+ {
+ GetPageResponse getPage = (GetPageResponse)resp;
+ return new GetPageCommand(getPage.getURI());
+ }
+ else if (resp instanceof DnDResponse)
+ {
+ DnDResponse dnd = (DnDResponse)resp;
+ return new DnDCommand(dnd.getFromId(), dnd.getDeltaX(), dnd.getDeltaY());
+ }
+ }
+
+ //
+ return null;
+ }
+
+
+ public RemoteDriverResponseContext invoke(TestConversation conversation,
RemoteDriverCommandContext commandContext) throws Exception
+ {
+ WebTestConversation webConversation =
(WebTestConversation)conversation.getAttribute("web.conversation");
+
+ //
+ if (webConversation == null)
+ {
+ webConversation = new WebTestConversation(conversation);
+ conversation.setAttribute("web.conversation", webConversation);
+ }
+
+ //
+ return webConversation.invoke(commandContext);
+ }
+}
Modified:
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/driver/web/command/WebDriverCommand.java
===================================================================
---
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/driver/web/command/WebDriverCommand.java 2007-09-10
12:13:33 UTC (rev 8206)
+++
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/driver/web/command/WebDriverCommand.java 2007-09-10
23:03:20 UTC (rev 8207)
@@ -28,6 +28,6 @@
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 1.1 $
*/
-public class WebDriverCommand extends DriverCommand
+public abstract class WebDriverCommand extends DriverCommand
{
}
Deleted:
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/driver/web/command/WebDriverCommandContext.java
===================================================================
---
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/driver/web/command/WebDriverCommandContext.java 2007-09-10
12:13:33 UTC (rev 8206)
+++
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/driver/web/command/WebDriverCommandContext.java 2007-09-10
23:03:20 UTC (rev 8207)
@@ -1,44 +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.test.framework.driver.web.command;
-
-import org.jboss.portal.test.framework.driver.remote.command.RemoteDriverCommandContext;
-import
org.jboss.portal.test.framework.driver.remote.response.RemoteDriverResponseContext;
-import org.jboss.portal.test.framework.driver.DriverCommand;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 1.1 $
- */
-public class WebDriverCommandContext extends RemoteDriverCommandContext
-{
- public WebDriverCommandContext(RemoteDriverResponseContext responseContext,
DriverCommand command)
- {
- super(responseContext, command);
- }
-
- public WebDriverCommandContext(DriverCommand command)
- {
- super(command);
- }
-}
Deleted:
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/driver/web/response/WebDriverResponseContext.java
===================================================================
---
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/driver/web/response/WebDriverResponseContext.java 2007-09-10
12:13:33 UTC (rev 8206)
+++
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/driver/web/response/WebDriverResponseContext.java 2007-09-10
23:03:20 UTC (rev 8207)
@@ -1,38 +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.test.framework.driver.web.response;
-
-import
org.jboss.portal.test.framework.driver.remote.response.RemoteDriverResponseContext;
-import org.jboss.portal.test.framework.driver.DriverResponse;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 1.1 $
- */
-public class WebDriverResponseContext extends RemoteDriverResponseContext
-{
- public WebDriverResponseContext(DriverResponse response)
- {
- super(response);
- }
-}
Modified:
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/impl/generic/agent/GenericTestAgent.java
===================================================================
---
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/impl/generic/agent/GenericTestAgent.java 2007-09-10
12:13:33 UTC (rev 8206)
+++
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/impl/generic/agent/GenericTestAgent.java 2007-09-10
23:03:20 UTC (rev 8207)
@@ -23,23 +23,16 @@
package org.jboss.portal.test.framework.impl.generic.agent;
import org.jboss.portal.test.framework.agent.TestAgent;
+import org.jboss.portal.test.framework.impl.generic.config.AuthenticationConfig;
+import org.jboss.portal.test.framework.impl.generic.config.DeployerConfig;
+import org.jboss.portal.test.framework.impl.generic.server.GenericServiceLookup;
+import org.jboss.portal.test.framework.server.ServiceLookupFailedException;
import org.codehaus.cargo.container.deployer.Deployer;
-import org.codehaus.cargo.container.deployer.DeployerType;
import org.codehaus.cargo.container.deployable.Deployable;
import org.codehaus.cargo.container.deployable.WAR;
import org.codehaus.cargo.container.configuration.Configuration;
-import org.codehaus.cargo.container.configuration.ConfigurationType;
-import org.codehaus.cargo.container.property.GeneralPropertySet;
-import org.codehaus.cargo.container.property.ServletPropertySet;
import org.codehaus.cargo.container.property.RemotePropertySet;
-import org.codehaus.cargo.container.ContainerType;
import org.codehaus.cargo.container.Container;
-import org.codehaus.cargo.generic.configuration.ConfigurationFactory;
-import org.codehaus.cargo.generic.configuration.DefaultConfigurationFactory;
-import org.codehaus.cargo.generic.ContainerFactory;
-import org.codehaus.cargo.generic.DefaultContainerFactory;
-import org.codehaus.cargo.generic.deployer.DeployerFactory;
-import org.codehaus.cargo.generic.deployer.DefaultDeployerFactory;
import java.net.URL;
import java.net.URISyntaxException;
@@ -49,44 +42,76 @@
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 1.1 $
*/
-public class GenericTestAgent implements TestAgent
+public class GenericTestAgent extends GenericServiceLookup implements TestAgent
{
/** . */
private Deployer cargoDeployer;
+ /** . */
+ private DeployerConfig deployerConfig;
+
+ /** . */
+ private AuthenticationConfig authenticationConfig;
+
+ public DeployerConfig getDeployerConfig()
+ {
+ return deployerConfig;
+ }
+
+ public void setDeployerConfig(DeployerConfig deployerConfig)
+ {
+ this.deployerConfig = deployerConfig;
+ }
+
+ public AuthenticationConfig getAuthenticationConfig()
+ {
+ return authenticationConfig;
+ }
+
+ public void setAuthenticationConfig(AuthenticationConfig authenticationConfig)
+ {
+ this.authenticationConfig = authenticationConfig;
+ }
+
public void start()
{
+ Configuration cfg = deployerConfig.createConfiguration();
+ //
+ if (authenticationConfig != null)
+ {
+ cfg.setProperty(RemotePropertySet.USERNAME,
authenticationConfig.getUsername());
+ cfg.setProperty(RemotePropertySet.PASSWORD,
authenticationConfig.getPassword());
+ }
+
+ //
+ Container container = deployerConfig.createContainer(cfg);
+ cargoDeployer = deployerConfig.createDeployer(container);
+ }
+
+
// String name = "jboss4x";
// String protocol = "http";
// String host = "localhost";
// String port = "8080";
+// private ServerConfig createConfig()
+// {
+// AuthenticationConfig authentication = new AuthenticationConfig();
+// authentication.setUsername("admin");
+// authentication.setPassword("admin");
+//
+// RemoteDeployerConfig cargo = new RemoteDeployerConfig();
+// cargo.setName("tomcat5x");
+// cargo.setHost("localhost");
+// cargo.setPort("8080");
+//
+// ServerConfig ccfg = new ServerConfig("TomcatRemote");
+// ccfg.setAuthentication(authentication);
+// ccfg.setDeployer(cargo);
+// return ccfg;
+// }
- ContainerType containerType = ContainerType.REMOTE;
- DeployerType deployerType = DeployerType.REMOTE;
- String name = "tomcat5x";
- String protocol = "http";
- String host = "localhost";
- String port = "8080";
- String username = "admin";
- String password = "admin";
-
- ConfigurationFactory cfgFactory = new DefaultConfigurationFactory();
- Configuration cfg = cfgFactory.createConfiguration(name,
ConfigurationType.RUNTIME);
- cfg.setProperty(GeneralPropertySet.PROTOCOL, protocol);
- cfg.setProperty(GeneralPropertySet.HOSTNAME, host);
- cfg.setProperty(ServletPropertySet.PORT, port);
- cfg.setProperty(RemotePropertySet.USERNAME, username);
- cfg.setProperty(RemotePropertySet.PASSWORD, password);
-
- ContainerFactory containerFactory = new DefaultContainerFactory();
- Container container = containerFactory.createContainer(name, containerType, cfg);
-
- DeployerFactory deployerFactory = new DefaultDeployerFactory();
- cargoDeployer = deployerFactory.createDeployer(container, deployerType);
- }
-
public void deploy(URL url) throws Exception
{
Deployable deployable = createDeployable(url);
@@ -114,4 +139,9 @@
}
throw new IllegalArgumentException("Illegal URL " + url);
}
+
+ public Object lookupService() throws ServiceLookupFailedException
+ {
+ return this;
+ }
}
Added:
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/impl/generic/config/AuthenticationConfig.java
===================================================================
---
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/impl/generic/config/AuthenticationConfig.java
(rev 0)
+++
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/impl/generic/config/AuthenticationConfig.java 2007-09-10
23:03:20 UTC (rev 8207)
@@ -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.test.framework.impl.generic.config;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class AuthenticationConfig
+{
+
+ /** . */
+ private String username;
+
+ /** . */
+ private String password;
+
+ public String getUsername()
+ {
+ return username;
+ }
+
+ public void setUsername(String username)
+ {
+ this.username = username;
+ }
+
+ public String getPassword()
+ {
+ return password;
+ }
+
+ public void setPassword(String password)
+ {
+ this.password = password;
+ }
+}
Added:
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/impl/generic/config/DeployerConfig.java
===================================================================
---
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/impl/generic/config/DeployerConfig.java
(rev 0)
+++
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/impl/generic/config/DeployerConfig.java 2007-09-10
23:03:20 UTC (rev 8207)
@@ -0,0 +1,45 @@
+/******************************************************************************
+ * 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.impl.generic.config;
+
+import org.codehaus.cargo.container.ContainerType;
+import org.codehaus.cargo.container.Container;
+import org.codehaus.cargo.container.configuration.ConfigurationType;
+import org.codehaus.cargo.container.configuration.Configuration;
+import org.codehaus.cargo.container.deployer.DeployerType;
+import org.codehaus.cargo.container.deployer.Deployer;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public abstract class DeployerConfig
+{
+
+ public abstract Configuration createConfiguration();
+
+ public abstract Container createContainer(Configuration cfg);
+
+ public abstract Deployer createDeployer(Container container);
+
+}
Added:
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/impl/generic/config/HTTPTestRunnerConfig.java
===================================================================
---
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/impl/generic/config/HTTPTestRunnerConfig.java
(rev 0)
+++
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/impl/generic/config/HTTPTestRunnerConfig.java 2007-09-10
23:03:20 UTC (rev 8207)
@@ -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.test.framework.impl.generic.config;
+
+import org.jboss.portal.test.framework.TestParametrization;
+import org.jboss.portal.test.framework.TestParameterValue;
+import org.jboss.portal.test.framework.junit.JUnitAdapter;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class HTTPTestRunnerConfig
+{
+
+ /**
+ * Returns the server name from the test parametrization. If no value is found then
it
+ * returns the litteral string <i>RemoteTomcat-6.0</i>.
+ *
+ * @return the server name
+ */
+ public String getServerName()
+ {
+ TestParametrization parametrization = JUnitAdapter.getParametrization();
+ TestParameterValue archive =
parametrization.getParameterValue("serverName");
+
+ //
+ if (archive != null)
+ {
+ return (String)archive.get();
+ }
+ else
+ {
+ return "RemoteTomcat-6.0";
+ }
+ }
+}
Added:
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/impl/generic/config/NodeConfig.java
===================================================================
---
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/impl/generic/config/NodeConfig.java
(rev 0)
+++
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/impl/generic/config/NodeConfig.java 2007-09-10
23:03:20 UTC (rev 8207)
@@ -0,0 +1,89 @@
+/******************************************************************************
+ * 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.impl.generic.config;
+
+import java.util.Map;
+import java.util.HashMap;
+import java.util.Iterator;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class NodeConfig
+{
+
+ /** . */
+ private final String id;
+
+ /** . */
+ private AuthenticationConfig authentication;
+
+ /** . */
+ private DeployerConfig deployer;
+
+ /** . */
+ private Map services;
+
+ public NodeConfig(String id)
+ {
+ this.id = id;
+ this.services = new HashMap();
+ }
+
+ public String getId()
+ {
+ return id;
+ }
+
+ public void addService(ServiceConfig service)
+ {
+ services.put(service.getName(), service);
+ }
+
+ public Map getServices()
+ {
+ return services;
+ }
+
+ public AuthenticationConfig getAuthentication()
+ {
+ return authentication;
+ }
+
+ public void setAuthentication(AuthenticationConfig authentication)
+ {
+ this.authentication = authentication;
+ }
+
+ public DeployerConfig getDeployer()
+ {
+ return deployer;
+ }
+
+ public void setDeployer(DeployerConfig deployer)
+ {
+ this.deployer = deployer;
+ }
+
+}
Added:
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/impl/generic/config/RemoteDeployerConfig.java
===================================================================
---
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/impl/generic/config/RemoteDeployerConfig.java
(rev 0)
+++
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/impl/generic/config/RemoteDeployerConfig.java 2007-09-10
23:03:20 UTC (rev 8207)
@@ -0,0 +1,122 @@
+/******************************************************************************
+ * 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.impl.generic.config;
+
+import org.codehaus.cargo.container.ContainerType;
+import org.codehaus.cargo.container.Container;
+import org.codehaus.cargo.container.property.GeneralPropertySet;
+import org.codehaus.cargo.container.property.ServletPropertySet;
+import org.codehaus.cargo.container.configuration.ConfigurationType;
+import org.codehaus.cargo.container.configuration.Configuration;
+import org.codehaus.cargo.container.deployer.DeployerType;
+import org.codehaus.cargo.container.deployer.Deployer;
+import org.codehaus.cargo.generic.configuration.ConfigurationFactory;
+import org.codehaus.cargo.generic.configuration.DefaultConfigurationFactory;
+import org.codehaus.cargo.generic.ContainerFactory;
+import org.codehaus.cargo.generic.DefaultContainerFactory;
+import org.codehaus.cargo.generic.deployer.DeployerFactory;
+import org.codehaus.cargo.generic.deployer.DefaultDeployerFactory;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class RemoteDeployerConfig extends DeployerConfig
+{
+
+ /** . */
+ private String name;
+
+ /** . */
+ private String host;
+
+ /** . */
+ private String port;
+
+ public Configuration createConfiguration()
+ {
+ ConfigurationFactory cfgFactory = new DefaultConfigurationFactory();
+ Configuration cfg = cfgFactory.createConfiguration(name,
ConfigurationType.RUNTIME);
+ cfg.setProperty(GeneralPropertySet.PROTOCOL, "http");
+ cfg.setProperty(GeneralPropertySet.HOSTNAME, host);
+ cfg.setProperty(ServletPropertySet.PORT, port);
+ return cfg;
+ }
+
+ public Container createContainer(Configuration cfg)
+ {
+ ContainerFactory containerFactory = new DefaultContainerFactory();
+ return containerFactory.createContainer(name, ContainerType.REMOTE, cfg);
+ }
+
+ public Deployer createDeployer(Container container)
+ {
+ DeployerFactory deployerFactory = new DefaultDeployerFactory();
+ return deployerFactory.createDeployer(container, DeployerType.REMOTE);
+ }
+
+ public ContainerType getContainerType()
+ {
+ return ContainerType.REMOTE;
+ }
+
+ public DeployerType getDeployerType()
+ {
+ return DeployerType.REMOTE;
+ }
+
+ public ConfigurationType getConfigurationType()
+ {
+ return ConfigurationType.RUNTIME;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public void setName(String name)
+ {
+ this.name = name;
+ }
+
+ public String getHost()
+ {
+ return host;
+ }
+
+ public void setHost(String host)
+ {
+ this.host = host;
+ }
+
+ public String getPort()
+ {
+ return port;
+ }
+
+ public void setPort(String port)
+ {
+ this.port = port;
+ }
+}
Added:
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/impl/generic/config/ServerConfig.java
===================================================================
---
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/impl/generic/config/ServerConfig.java
(rev 0)
+++
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/impl/generic/config/ServerConfig.java 2007-09-10
23:03:20 UTC (rev 8207)
@@ -0,0 +1,174 @@
+/******************************************************************************
+ * 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.impl.generic.config;
+
+import org.w3c.dom.Element;
+import org.w3c.dom.Document;
+import org.jboss.portal.common.xml.XMLTools;
+import org.jboss.portal.common.io.IOTools;
+
+import java.net.URL;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+import java.io.InputStream;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class ServerConfig
+{
+
+ /** . */
+ private final String name;
+
+ /** . */
+ private final Map nodes;
+
+ public ServerConfig(String serverName)
+ {
+ if (serverName == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ this.name = serverName;
+ this.nodes = new HashMap();
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public void addNode(NodeConfig node)
+ {
+ nodes.put(node.getId(), node);
+ }
+
+ public Map getNodes()
+ {
+ return nodes;
+ }
+
+ public static Map createConfigs(URL url) throws Exception
+ {
+ Map configs = new LinkedHashMap();
+ InputStream in = null;
+ try
+ {
+ in = IOTools.safeBufferedWrapper(url.openStream());
+ Document doc =
XMLTools.getDocumentBuilderFactory().newDocumentBuilder().parse(in);
+ for (Iterator i = XMLTools.getChildrenIterator(doc.getDocumentElement(),
"server"); i.hasNext();)
+ {
+ Element serverElt = (Element)i.next();
+ ServerConfig serverCfg = createConfig(serverElt);
+ configs.put(serverCfg.getName(), serverCfg);
+ }
+ return configs;
+ }
+ finally
+ {
+ IOTools.safeClose(in);
+ }
+ }
+
+ public static ServerConfig createConfig(Element serverElt)
+ {
+ Element serverNameElt = XMLTools.getUniqueChild(serverElt, "server-name",
true);
+
+ //
+ ServerConfig serverCfg = new ServerConfig(XMLTools.asString(serverNameElt));
+
+ //
+ List nodeElts = XMLTools.getChildren(serverElt, "node");
+ for (Iterator i = nodeElts.iterator(); i.hasNext();)
+ {
+ Element nodeElt = (Element)i.next();
+
+ //
+ Element nodeIdElt = XMLTools.getUniqueChild(nodeElt, "node-id",
true);
+ List serviceElts = XMLTools.getChildren(nodeElt, "service");
+ Element deployerElt = XMLTools.getUniqueChild(nodeElt, "deployer",
true);
+
+ //
+ NodeConfig node = new NodeConfig(XMLTools.asString(nodeIdElt));
+
+ //
+ for (Iterator j = serviceElts.iterator();j.hasNext();)
+ {
+ Element serviceElt = (Element)j.next();
+
+ //
+ Element serviceNameElt = XMLTools.getUniqueChild(serviceElt,
"service-name", true);
+ Element interfaceElt = XMLTools.getUniqueChild(serviceElt,
"interface", true);
+ Element uriElt = XMLTools.getUniqueChild(serviceElt, "uri", true);
+
+ //
+ ServiceConfig service = new
ServiceConfig(XMLTools.asString(serviceNameElt));
+ service.setInterfaceClass(XMLTools.asString(interfaceElt));
+ service.setURI(XMLTools.asString(uriElt));
+
+ //
+ node.addService(service);
+ }
+
+ //
+ Element remoteElt = XMLTools.getUniqueChild(deployerElt, "remote",
true);
+ Element authenticationElt = XMLTools.getUniqueChild(deployerElt,
"authentication", false);
+
+ //
+ Element remoteNameElt = XMLTools.getUniqueChild(remoteElt, "name",
true);
+ Element remoteHostElt = XMLTools.getUniqueChild(remoteElt, "host",
true);
+ Element remotePortElt = XMLTools.getUniqueChild(remoteElt, "port",
true);
+
+ //
+ RemoteDeployerConfig cargoCfg = new RemoteDeployerConfig();
+ cargoCfg.setName(XMLTools.asString(remoteNameElt));
+ cargoCfg.setHost(XMLTools.asString(remoteHostElt));
+ cargoCfg.setPort(XMLTools.asString(remotePortElt));
+ node.setDeployer(cargoCfg);
+
+ //
+ if (authenticationElt != null)
+ {
+ Element authenticationUsernameElt =
XMLTools.getUniqueChild(authenticationElt, "username", true);
+ Element authenticationPasswordElt =
XMLTools.getUniqueChild(authenticationElt, "password", true);
+
+ //
+ AuthenticationConfig authenticationCfg = new AuthenticationConfig();
+ authenticationCfg.setUsername(XMLTools.asString(authenticationUsernameElt));
+ authenticationCfg.setPassword(XMLTools.asString(authenticationPasswordElt));
+ node.setAuthentication(authenticationCfg);
+ }
+
+ //
+ serverCfg.addNode(node);
+ }
+
+ //
+ return serverCfg;
+ }
+}
Added:
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/impl/generic/config/ServiceConfig.java
===================================================================
---
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/impl/generic/config/ServiceConfig.java
(rev 0)
+++
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/impl/generic/config/ServiceConfig.java 2007-09-10
23:03:20 UTC (rev 8207)
@@ -0,0 +1,70 @@
+/******************************************************************************
+ * 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.impl.generic.config;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class ServiceConfig
+{
+
+ /** . */
+ private final String name;
+
+ /** . */
+ private String interfaceClass;
+
+ /** . */
+ private String uri;
+
+ public ServiceConfig(String name)
+ {
+ this.name = name;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public String getInterfaceClass()
+ {
+ return interfaceClass;
+ }
+
+ public void setInterfaceClass(String interfaceClass)
+ {
+ this.interfaceClass = interfaceClass;
+ }
+
+ public String getURI()
+ {
+ return uri;
+ }
+
+ public void setURI(String uri)
+ {
+ this.uri = uri;
+ }
+}
Deleted:
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/impl/generic/server/DirectServiceLookup.java
===================================================================
---
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/impl/generic/server/DirectServiceLookup.java 2007-09-10
12:13:33 UTC (rev 8206)
+++
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/impl/generic/server/DirectServiceLookup.java 2007-09-10
23:03:20 UTC (rev 8207)
@@ -1,51 +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.test.framework.impl.generic.server;
-
-import org.jboss.portal.test.framework.server.ServiceLookup;
-import org.jboss.portal.test.framework.server.ServiceLookupFailedException;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 1.1 $
- */
-public class DirectServiceLookup implements ServiceLookup
-{
-
- /** . */
- private Object service;
-
- public DirectServiceLookup(Object service)
- {
- this.service = service;
- }
-
- public Object lookupService() throws ServiceLookupFailedException
- {
- if (service == null)
- {
- throw new ServiceLookupFailedException();
- }
- return service;
- }
-}
Copied:
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/impl/generic/server/GenericLocalServiceLookup.java
(from rev 8097,
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/impl/generic/server/DirectServiceLookup.java)
===================================================================
---
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/impl/generic/server/GenericLocalServiceLookup.java
(rev 0)
+++
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/impl/generic/server/GenericLocalServiceLookup.java 2007-09-10
23:03:20 UTC (rev 8207)
@@ -0,0 +1,51 @@
+/******************************************************************************
+ * 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.impl.generic.server;
+
+import org.jboss.portal.test.framework.server.ServiceLookup;
+import org.jboss.portal.test.framework.server.ServiceLookupFailedException;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class GenericLocalServiceLookup extends GenericServiceLookup
+{
+
+ /** . */
+ private Object service;
+
+ public GenericLocalServiceLookup(Object service)
+ {
+ this.service = service;
+ }
+
+ public Object lookupService() throws ServiceLookupFailedException
+ {
+ if (service == null)
+ {
+ throw new ServiceLookupFailedException();
+ }
+ return service;
+ }
+}
Added:
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/impl/generic/server/GenericNode.java
===================================================================
---
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/impl/generic/server/GenericNode.java
(rev 0)
+++
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/impl/generic/server/GenericNode.java 2007-09-10
23:03:20 UTC (rev 8207)
@@ -0,0 +1,59 @@
+/******************************************************************************
+ * 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.impl.generic.server;
+
+import org.jboss.portal.test.framework.server.Node;
+
+import java.util.Map;
+import java.util.Iterator;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class GenericNode extends Node
+{
+
+ public GenericNode(String id, Map serviceLookups)
+ {
+ super(id, serviceLookups);
+ }
+
+ public void start()
+ {
+ for (Iterator i = serviceLookups.values().iterator();i.hasNext();)
+ {
+ GenericServiceLookup service = (GenericServiceLookup)i.next();
+ service.start();
+ }
+ }
+
+ public void stop()
+ {
+ for (Iterator i = serviceLookups.values().iterator();i.hasNext();)
+ {
+ GenericServiceLookup service = (GenericServiceLookup)i.next();
+ service.stop();
+ }
+ }
+}
Added:
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/impl/generic/server/GenericNodeFactory.java
===================================================================
---
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/impl/generic/server/GenericNodeFactory.java
(rev 0)
+++
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/impl/generic/server/GenericNodeFactory.java 2007-09-10
23:03:20 UTC (rev 8207)
@@ -0,0 +1,131 @@
+/******************************************************************************
+ * 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.impl.generic.server;
+
+import org.jboss.portal.test.framework.server.Node;
+import org.jboss.portal.test.framework.server.NodeId;
+import org.jboss.portal.test.framework.impl.generic.config.ServerConfig;
+import org.jboss.portal.test.framework.impl.generic.config.NodeConfig;
+import org.jboss.portal.test.framework.impl.generic.config.ServiceConfig;
+import org.jboss.portal.test.framework.impl.generic.agent.GenericTestAgent;
+import org.jboss.portal.test.framework.agent.TestAgent;
+
+import java.net.URL;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.Iterator;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class GenericNodeFactory
+{
+
+ /** . */
+ private final URL serverConfigURL;
+
+ /** . */
+ private String serverName;
+
+ /** . */
+ private final Map nodes;
+
+ public GenericNodeFactory(String serverConfigLocation, String serverName)
+ {
+ if (serverConfigLocation == null)
+ {
+ throw new IllegalArgumentException("No null servers.xml location
accepted");
+ }
+ if (serverName == null)
+ {
+ throw new IllegalArgumentException("No null server name accepted");
+ }
+
+ //
+ URL serverConfigURL =
Thread.currentThread().getContextClassLoader().getResource(serverConfigLocation);
+ if (serverConfigURL == null)
+ {
+ throw new IllegalArgumentException("No invalid servers.xml location="
+ serverConfigLocation + " accepted");
+ }
+
+ //
+ this.serverName = serverName;
+ this.serverConfigURL = serverConfigURL;
+ this.nodes = new HashMap();
+ }
+
+ public String getServerName()
+ {
+ return serverName;
+ }
+
+ public URL getServerConfigURL()
+ {
+ return serverConfigURL;
+ }
+
+ public void start() throws Exception
+ {
+ Map cfgs = ServerConfig.createConfigs(serverConfigURL);
+
+ // Get the appropriate config
+ ServerConfig serverCfg = (ServerConfig)cfgs.get(serverName);
+
+ //
+ if (serverCfg == null)
+ {
+ throw new IllegalStateException("Cannot start the node factory because the
config for the server " + serverName + " has not been found");
+ }
+
+ //
+ for (Iterator i = serverCfg.getNodes().values().iterator();i.hasNext();)
+ {
+ NodeConfig nodeCfg = (NodeConfig)i.next();
+
+ //
+ Map serviceLookupMap = new HashMap();
+ for (Iterator j = nodeCfg.getServices().values().iterator();j.hasNext();)
+ {
+ ServiceConfig serviceCfg = (ServiceConfig)j.next();
+ GenericServiceLookup serviceLookup = new
GenericRemoteServiceLookup(serviceCfg.getURI(), serviceCfg.getInterfaceClass());
+ serviceLookupMap.put(serviceCfg.getName(), serviceLookup);
+ }
+
+ //
+ GenericTestAgent testAgent = new GenericTestAgent();
+ testAgent.setAuthenticationConfig(nodeCfg.getAuthentication());
+ testAgent.setDeployerConfig(nodeCfg.getDeployer());
+ serviceLookupMap.put(TestAgent.SERVICE_ID, testAgent);
+
+ //
+ GenericNode node = new GenericNode(nodeCfg.getId(), serviceLookupMap);
+ nodes.put(node.getId(), node);
+ }
+ }
+
+ public Node getNode(String nodeId)
+ {
+ return (Node)nodes.get(new NodeId(nodeId));
+ }
+}
Added:
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/impl/generic/server/GenericRemoteServiceLookup.java
===================================================================
---
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/impl/generic/server/GenericRemoteServiceLookup.java
(rev 0)
+++
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/impl/generic/server/GenericRemoteServiceLookup.java 2007-09-10
23:03:20 UTC (rev 8207)
@@ -0,0 +1,63 @@
+/******************************************************************************
+ * 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.impl.generic.server;
+
+import org.jboss.portal.test.framework.server.ServiceLookupFailedException;
+import org.jboss.remoting.transporter.TransporterClient;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class GenericRemoteServiceLookup extends GenericServiceLookup
+{
+
+ /** . */
+ private final String locatorURI;
+
+ /** . */
+ private final String serviceInterface;
+
+ public GenericRemoteServiceLookup(String locatorURI, String serviceInterface)
+ {
+ this.locatorURI = locatorURI;
+ this.serviceInterface = serviceInterface;
+ }
+
+ public Object lookupService() throws ServiceLookupFailedException
+ {
+ try
+ {
+ Class proxyInterface =
Thread.currentThread().getContextClassLoader().loadClass(serviceInterface);
+ return TransporterClient.createTransporterClient(locatorURI, proxyInterface);
+ }
+ catch (ClassNotFoundException e)
+ {
+ throw new ServiceLookupFailedException(e);
+ }
+ catch (Exception e)
+ {
+ throw new ServiceLookupFailedException(e);
+ }
+ }
+}
Modified:
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/impl/generic/server/GenericServiceLookup.java
===================================================================
---
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/impl/generic/server/GenericServiceLookup.java 2007-09-10
12:13:33 UTC (rev 8206)
+++
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/impl/generic/server/GenericServiceLookup.java 2007-09-10
23:03:20 UTC (rev 8207)
@@ -30,35 +30,14 @@
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 1.1 $
*/
-public class GenericServiceLookup implements ServiceLookup
+public abstract class GenericServiceLookup implements ServiceLookup
{
- /** . */
- private final String locatorURI;
-
- /** . */
- private final String serviceInterface;
-
- public GenericServiceLookup(String locatorURI, String serviceInterface)
+ public void start()
{
- this.locatorURI = locatorURI;
- this.serviceInterface = serviceInterface;
}
- public Object lookupService() throws ServiceLookupFailedException
+ public void stop()
{
- try
- {
- Class proxyInterface =
Thread.currentThread().getContextClassLoader().loadClass(serviceInterface);
- return TransporterClient.createTransporterClient(locatorURI, proxyInterface);
- }
- catch (ClassNotFoundException e)
- {
- throw new ServiceLookupFailedException(e);
- }
- catch (Exception e)
- {
- throw new ServiceLookupFailedException(e);
- }
}
}
Modified:
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/junit/JUnitAdapter.java
===================================================================
---
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/junit/JUnitAdapter.java 2007-09-10
12:13:33 UTC (rev 8206)
+++
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/junit/JUnitAdapter.java 2007-09-10
23:03:20 UTC (rev 8207)
@@ -44,7 +44,7 @@
import java.util.Map;
/**
- * An runner that adapts the <code>junit.framework.Test</code> interface to
the <code>TestDriver</code> protocol.
+ * A runner that adapts the <code>junit.framework.Test</code> interface to
the <code>TestDriver</code> protocol.
*
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 7228 $
Modified:
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/mc/TestRuntimeContext.java
===================================================================
---
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/mc/TestRuntimeContext.java 2007-09-10
12:13:33 UTC (rev 8206)
+++
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/mc/TestRuntimeContext.java 2007-09-10
23:03:20 UTC (rev 8207)
@@ -64,14 +64,10 @@
/** The beans that will be defined by a factory in the container. */
private Map beans;
- /**
- *
- */
+ /** . */
private boolean started;
- /**
- *
- */
+ /** . */
private KernelDeployment deployment;
/**
@@ -86,13 +82,16 @@
{
throw new IllegalArgumentException("No beans descriptor provided");
}
- this.log = Logger.getLogger(getClass());
- this.beansURL =
Thread.currentThread().getContextClassLoader().getResource(beansDD);
- this.beans = new HashMap();
+ URL beansURL =
Thread.currentThread().getContextClassLoader().getResource(beansDD);
if (beansURL == null)
{
throw new IllegalArgumentException("Bean url is not valid " +
beansDD);
}
+
+ //
+ this.log = Logger.getLogger(getClass());
+ this.beansURL = beansURL;
+ this.beans = new HashMap();
}
public void addBean(String id, Object bean) throws IllegalStateException,
IllegalArgumentException
Modified:
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/server/Node.java
===================================================================
---
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/server/Node.java 2007-09-10
12:13:33 UTC (rev 8206)
+++
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/server/Node.java 2007-09-10
23:03:20 UTC (rev 8207)
@@ -33,10 +33,10 @@
{
/** . */
- private final NodeId id;
+ protected final NodeId id;
/** . */
- final Map serviceLookups;
+ protected final Map serviceLookups;
public Node(String id, Map serviceLookups)
{
Modified:
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/server/NodeManager.java
===================================================================
---
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/server/NodeManager.java 2007-09-10
12:13:33 UTC (rev 8206)
+++
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/server/NodeManager.java 2007-09-10
23:03:20 UTC (rev 8207)
@@ -56,10 +56,18 @@
public Node[] getNodes(NodeId[] nodeIds)
{
+ if (nodeIds == null)
+ {
+ throw new IllegalArgumentException("No null node ids accepted");
+ }
Node[] nodes = new Node[nodeIds.length];
for (int i = 0;i < nodeIds.length;i++)
{
NodeId nodeId = nodeIds[i];
+ if (nodeId == null)
+ {
+ throw new IllegalArgumentException("No null node id accepted");
+ }
nodes[i] = getNode(nodeId);
}
return nodes;
@@ -67,6 +75,10 @@
public Node getNode(NodeId nodeId)
{
+ if (nodeId == null)
+ {
+ throw new IllegalArgumentException("No null node id accepted");
+ }
return (Node)nodeMap.get(nodeId);
}
}
Modified:
modules/test/trunk/test/src/resources/generic/portal-test-jar/org/jboss/portal/test/framework/container/http-runner-beans.xml
===================================================================
---
modules/test/trunk/test/src/resources/generic/portal-test-jar/org/jboss/portal/test/framework/container/http-runner-beans.xml 2007-09-10
12:13:33 UTC (rev 8206)
+++
modules/test/trunk/test/src/resources/generic/portal-test-jar/org/jboss/portal/test/framework/container/http-runner-beans.xml 2007-09-10
23:03:20 UTC (rev 8207)
@@ -1,5 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
-
<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~ JBoss, a division of Red Hat ~
~ Copyright 2006, Red Hat Middleware, LLC, and individual ~
@@ -22,136 +21,30 @@
~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA ~
~ 02110-1301 USA, or see the FSF site:
http://www.fsf.org. ~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
-
<deployment
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:jboss:bean-deployer bean-deployer_1_0.xsd"
xmlns="urn:jboss:bean-deployer">
- <bean name="TestAgent0"
class="org.jboss.portal.test.framework.impl.generic.agent.GenericTestAgent">
+ <bean name="Config"
class="org.jboss.portal.test.framework.impl.generic.config.HTTPTestRunnerConfig">
</bean>
- <bean name="TestAgentLookup0"
class="org.jboss.portal.test.framework.impl.generic.server.DirectServiceLookup">
- <constructor>
- <parameter><inject bean="TestAgent0"/></parameter>
- </constructor>
- </bean>
- <bean name="TestDriverServerLookup0"
class="org.jboss.portal.test.framework.impl.generic.server.GenericServiceLookup">
- <constructor>
- <parameter>socket://localhost:5400</parameter>
-
<parameter>org.jboss.portal.test.framework.driver.http.HTTPTestDriver</parameter>
- </constructor>
- </bean>
- <!--
- <bean name="TestDriverServerLookup0"
class="org.jboss.portal.test.framework.impl.jboss.server.JBossServiceLookup">
- <constructor>
- <parameter><inject bean="MBeanServerFactory0"
property="server"/></parameter>
-
<parameter><value>portal.test:service=TestDriverServer</value></parameter>
-
<parameter><value>org.jboss.portal.test.framework.driver.http.HTTPTestDriver</value></parameter>
- </constructor>
- </bean>
-
- <bean name="TestAgentLookup0"
class="org.jboss.portal.test.framework.impl.jboss.server.JBossServiceLookup">
- <constructor>
- <parameter><inject bean="MBeanServerFactory0"
property="server"/></parameter>
-
<parameter><value>portal.test:service=Agent</value></parameter>
-
<parameter><value>org.jboss.portal.test.framework.agent.TestAgent</value></parameter>
- </constructor>
- </bean>
-
- <bean name="TestDriverServerLookup1"
class="org.jboss.portal.test.framework.impl.jboss.server.JBossServiceLookup">
- <constructor>
- <parameter><inject bean="MBeanServerFactory0"
property="server"/></parameter>
-
<parameter><value>portal.test:service=TestDriverServer</value></parameter>
-
<parameter><value>org.jboss.portal.test.framework.driver.http.HTTPTestDriver</value></parameter>
- </constructor>
- </bean>
-
- <bean name="TestAgentLookup1"
class="org.jboss.portal.test.framework.impl.jboss.server.JBossServiceLookup">
- <constructor>
- <parameter><inject bean="MBeanServerFactory0"
property="server"/></parameter>
-
<parameter><value>portal.test:service=Agent</value></parameter>
-
<parameter><value>org.jboss.portal.test.framework.agent.TestAgent</value></parameter>
- </constructor>
- </bean>
-
- <bean name="TestDriverServerLookup2"
class="org.jboss.portal.test.framework.impl.jboss.server.JBossServiceLookup">
- <constructor>
- <parameter><inject bean="MBeanServerFactory0"
property="server"/></parameter>
-
<parameter><value>portal.test:service=TestDriverServer</value></parameter>
-
<parameter><value>org.jboss.portal.test.framework.driver.http.HTTPTestDriver</value></parameter>
- </constructor>
- </bean>
-
- <bean name="TestAgentLookup2"
class="org.jboss.portal.test.framework.impl.jboss.server.JBossServiceLookup">
- <constructor>
- <parameter><inject bean="MBeanServerFactory0"
property="server"/></parameter>
-
<parameter><value>portal.test:service=Agent</value></parameter>
-
<parameter><value>org.jboss.portal.test.framework.agent.TestAgent</value></parameter>
- </constructor>
- </bean>
- -->
-
- <bean name="Node0"
class="org.jboss.portal.test.framework.server.Node">
+ <bean name="NodeFactory"
class="org.jboss.portal.test.framework.impl.generic.server.GenericNodeFactory">
<constructor>
- <parameter><value>default</value></parameter>
- <parameter>
- <map keyClass="java.lang.String"
valueClass="org.jboss.portal.test.framework.impl.generic.server.DirectServiceLookup">
- <entry>
- <key>TestDriverServer</key>
- <value><inject
bean="TestDriverServerLookup0"/></value>
- </entry>
- <entry>
- <key>TestAgent</key>
- <value><inject
bean="TestAgentLookup0"/></value>
- </entry>
- </map>
- </parameter>
+ <parameter>servers.xml</parameter>
+ <parameter><inject bean="Config"
property="serverName"/></parameter>
</constructor>
</bean>
-<!--
- <bean name="Node1"
class="org.jboss.portal.test.framework.server.Node">
- <constructor>
- <parameter><value>ports-01</value></parameter>
- <parameter>
- <map keyClass="java.lang.String"
valueClass="org.jboss.portal.test.framework.impl.jboss.server.JBossServiceLookup">
- <entry>
- <key>TestDriverServer</key>
- <value><inject
bean="TestDriverServerLookup1"/></value>
- </entry>
- <entry>
- <key>TestAgent</key>
- <value><inject
bean="TestAgentLookup1"/></value>
- </entry>
- </map>
- </parameter>
+ <bean name="Node0"
class="org.jboss.portal.test.framework.impl.generic.server.GenericNode">
+ <constructor factoryMethod="getNode">
+ <factory bean="NodeFactory" />
+ <parameter>default</parameter>
</constructor>
</bean>
- <bean name="Node2"
class="org.jboss.portal.test.framework.server.Node">
- <constructor>
- <parameter><value>ports-02</value></parameter>
- <parameter>
- <map keyClass="java.lang.String"
valueClass="org.jboss.portal.test.framework.impl.jboss.server.JBossServiceLookup">
- <entry>
- <key>TestDriverServer</key>
- <value><inject
bean="TestDriverServerLookup2"/></value>
- </entry>
- <entry>
- <key>TestAgent</key>
- <value><inject
bean="TestAgentLookup2"/></value>
- </entry>
- </map>
- </parameter>
- </constructor>
+ <bean name="TestDriverClient"
class="org.jboss.portal.test.framework.driver.remote.RemoteTestDriverClient">
</bean>
--->
- <bean name="TestDriverClient"
class="org.jboss.portal.test.framework.driver.http.HTTPTestDriverClient">
- <constructor>
- </constructor>
- </bean>
-
<bean name="NodeManager"
class="org.jboss.portal.test.framework.server.NodeManager">
<constructor>
<parameter>
Modified:
modules/test/trunk/test/src/resources/jboss/portal-test-jar/org/jboss/portal/test/framework/container/http-runner-beans.xml
===================================================================
---
modules/test/trunk/test/src/resources/jboss/portal-test-jar/org/jboss/portal/test/framework/container/http-runner-beans.xml 2007-09-10
12:13:33 UTC (rev 8206)
+++
modules/test/trunk/test/src/resources/jboss/portal-test-jar/org/jboss/portal/test/framework/container/http-runner-beans.xml 2007-09-10
23:03:20 UTC (rev 8207)
@@ -50,7 +50,7 @@
<constructor>
<parameter><inject bean="MBeanServerFactory0"
property="server"/></parameter>
<parameter><value>portal.test:service=TestDriverServer</value></parameter>
-
<parameter><value>org.jboss.portal.test.framework.driver.http.HTTPTestDriver</value></parameter>
+
<parameter><value>org.jboss.portal.test.framework.driver.remote.RemoteTestDriver</value></parameter>
</constructor>
</bean>
@@ -85,7 +85,7 @@
<constructor>
<parameter><inject bean="MBeanServerFactory0"
property="server"/></parameter>
<parameter><value>portal.test:service=TestDriverServer</value></parameter>
-
<parameter><value>org.jboss.portal.test.framework.driver.http.HTTPTestDriver</value></parameter>
+
<parameter><value>org.jboss.portal.test.framework.driver.remote.RemoteTestDriver</value></parameter>
</constructor>
</bean>
@@ -120,7 +120,7 @@
<constructor>
<parameter><inject bean="MBeanServerFactory0"
property="server"/></parameter>
<parameter><value>portal.test:service=TestDriverServer</value></parameter>
-
<parameter><value>org.jboss.portal.test.framework.driver.http.HTTPTestDriver</value></parameter>
+
<parameter><value>org.jboss.portal.test.framework.driver.remote.RemoteTestDriver</value></parameter>
</constructor>
</bean>
@@ -186,9 +186,7 @@
</constructor>
</bean>
- <bean name="TestDriverClient"
class="org.jboss.portal.test.framework.driver.http.HTTPTestDriverClient">
- <constructor>
- </constructor>
+ <bean name="TestDriverClient"
class="org.jboss.portal.test.framework.driver.remote.RemoteTestDriverClient">
</bean>
<bean name="NodeManager"
class="org.jboss.portal.test.framework.server.NodeManager">