Author: julien(a)jboss.com
Date: 2007-10-11 20:33:46 -0400 (Thu, 11 Oct 2007)
New Revision: 8610
Added:
modules/test/trunk/remote/src/main/org/jboss/unit/remote/driver/TestCaseFactory.java
modules/test/trunk/remote/src/resources/jboss-unit-remote-jar/org/
modules/test/trunk/remote/src/resources/jboss-unit-remote-jar/org/jboss/
modules/test/trunk/remote/src/resources/jboss-unit-remote-jar/org/jboss/unit/
modules/test/trunk/remote/src/resources/jboss-unit-remote-jar/org/jboss/unit/remote/
modules/test/trunk/remote/src/resources/jboss-unit-remote-jar/org/jboss/unit/remote/driver/
modules/test/trunk/remote/src/resources/jboss-unit-remote-jar/org/jboss/unit/remote/driver/jboss-beans.xml
Modified:
modules/test/trunk/build/ide/intellij/idea60/modules/remote/remote.iml
modules/test/trunk/build/ide/intellij/idea60/modules/tooling/tooling.iml
modules/test/trunk/build/ide/intellij/idea60/modules/unit/unit.iml
modules/test/trunk/remote/build.xml
modules/test/trunk/remote/src/main/org/jboss/unit/remote/RequestContext.java
modules/test/trunk/remote/src/main/org/jboss/unit/remote/driver/RemoteTestDriverClient.java
modules/test/trunk/remote/src/main/org/jboss/unit/remote/driver/RemoteTestDriverServer.java
modules/test/trunk/remote/src/main/org/jboss/unit/remote/driver/TestConversation.java
modules/test/trunk/remote/src/main/org/jboss/unit/remote/driver/handler/deployer/DeployerHandler.java
modules/test/trunk/remote/src/main/org/jboss/unit/remote/driver/handler/deployer/response/DeployerResponse.java
modules/test/trunk/remote/src/main/org/jboss/unit/remote/driver/handler/http/command/HTTPDriverCommand.java
modules/test/trunk/remote/src/main/org/jboss/unit/remote/driver/handler/http/response/HTTPDriverResponse.java
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/deployment/Deployer.java
modules/test/trunk/tooling/build.xml
modules/test/trunk/tooling/src/main/org/jboss/unit/tooling/ant/TestsType.java
modules/test/trunk/unit/src/main/org/jboss/unit/Failure.java
modules/test/trunk/unit/src/main/org/jboss/unit/info/impl/SimpleTestCaseInfo.java
modules/test/trunk/unit/src/main/org/jboss/unit/info/impl/SimpleTestSuiteInfo.java
Log:
more work on remote extension + set JVM property for jboss logging to use JUL logging +
started to implement JPDA option
Modified: modules/test/trunk/build/ide/intellij/idea60/modules/remote/remote.iml
===================================================================
--- modules/test/trunk/build/ide/intellij/idea60/modules/remote/remote.iml 2007-10-12
00:05:43 UTC (rev 8609)
+++ modules/test/trunk/build/ide/intellij/idea60/modules/remote/remote.iml 2007-10-12
00:33:46 UTC (rev 8610)
@@ -37,6 +37,168 @@
</library>
</orderEntry>
<orderEntry type="module" module-name="test" />
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root
url="jar://$MODULE_DIR$/../../../../../../thirdparty/jboss/microcontainer/lib/jboss-managed.jar!/"
/>
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root
url="jar://$MODULE_DIR$/../../../../../../thirdparty/jboss/microcontainer/lib/jboss-deployers-vfs-spi.jar!/"
/>
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root
url="jar://$MODULE_DIR$/../../../../../../thirdparty/jboss/microcontainer/lib/jboss-metatype.jar!/"
/>
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root
url="jar://$MODULE_DIR$/../../../../../../thirdparty/jboss/microcontainer/lib/jboss-deployers-impl.jar!/"
/>
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root
url="jar://$MODULE_DIR$/../../../../../../thirdparty/jboss/microcontainer/lib/jboss-kernel.jar!/"
/>
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root
url="jar://$MODULE_DIR$/../../../../../../thirdparty/jboss/microcontainer/lib/jboss-container-metadata-spi.jar!/"
/>
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root
url="jar://$MODULE_DIR$/../../../../../../thirdparty/jboss/microcontainer/lib/jboss-classloader.jar!/"
/>
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root
url="jar://$MODULE_DIR$/../../../../../../thirdparty/jboss/microcontainer/lib/jboss-deployers-client-spi.jar!/"
/>
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root
url="jar://$MODULE_DIR$/../../../../../../thirdparty/jboss/microcontainer/lib/jboss-container-metadata.jar!/"
/>
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root
url="jar://$MODULE_DIR$/../../../../../../thirdparty/jboss/microcontainer/lib/jboss-dependency.jar!/"
/>
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root
url="jar://$MODULE_DIR$/../../../../../../thirdparty/jboss/microcontainer/lib/jboss-container.jar!/"
/>
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root
url="jar://$MODULE_DIR$/../../../../../../thirdparty/jboss/microcontainer/lib/jboss-deployers-core.jar!/"
/>
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root
url="jar://$MODULE_DIR$/../../../../../../thirdparty/jboss/microcontainer/lib/jboss-deployers-vfs.jar!/"
/>
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root
url="jar://$MODULE_DIR$/../../../../../../thirdparty/jboss/microcontainer/lib/jboss-deployers-core-spi.jar!/"
/>
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root
url="jar://$MODULE_DIR$/../../../../../../thirdparty/jboss/microcontainer/lib/jboss-deployers-client.jar!/"
/>
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root
url="jar://$MODULE_DIR$/../../../../../../thirdparty/jboss/microcontainer/lib/jboss-aop-mc-int.jar!/"
/>
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root
url="jar://$MODULE_DIR$/../../../../../../thirdparty/jboss/microcontainer/lib/jboss-deployers-structure-spi.jar!/"
/>
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root
url="jar://$MODULE_DIR$/../../../../../../thirdparty/jboss/microcontainer/lib/jboss-deployers-spi.jar!/"
/>
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
<orderEntryProperties />
</component>
<component name="VcsManagerConfiguration">
Modified: modules/test/trunk/build/ide/intellij/idea60/modules/tooling/tooling.iml
===================================================================
--- modules/test/trunk/build/ide/intellij/idea60/modules/tooling/tooling.iml 2007-10-12
00:05:43 UTC (rev 8609)
+++ modules/test/trunk/build/ide/intellij/idea60/modules/tooling/tooling.iml 2007-10-12
00:33:46 UTC (rev 8610)
@@ -9,6 +9,24 @@
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="module" module-name="unit" />
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root
url="jar://$MODULE_DIR$/../../../../../../thirdparty/apache-ant/lib/ant.jar!/"
/>
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root
url="jar://$MODULE_DIR$/../../../../../../tools/lib/ant-junit.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
<orderEntryProperties />
</component>
<component name="VcsManagerConfiguration">
Modified: modules/test/trunk/build/ide/intellij/idea60/modules/unit/unit.iml
===================================================================
--- modules/test/trunk/build/ide/intellij/idea60/modules/unit/unit.iml 2007-10-12 00:05:43
UTC (rev 8609)
+++ modules/test/trunk/build/ide/intellij/idea60/modules/unit/unit.iml 2007-10-12 00:33:46
UTC (rev 8610)
@@ -8,6 +8,15 @@
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root
url="jar://$MODULE_DIR$/../../../../../../thirdparty/apache-log4j/lib/log4j.jar!/"
/>
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
<orderEntryProperties />
</component>
<component name="VcsManagerConfiguration">
Modified: modules/test/trunk/remote/build.xml
===================================================================
--- modules/test/trunk/remote/build.xml 2007-10-12 00:05:43 UTC (rev 8609)
+++ modules/test/trunk/remote/build.xml 2007-10-12 00:33:46 UTC (rev 8610)
@@ -86,10 +86,16 @@
&libraries;
<path id="library.classpath">
<path refid="jboss.portal/modules/common.classpath"/>
+
+ <path refid="apache.log4j.classpath"/>
+
<path refid="apache.httpclient.classpath"/>
<path refid="apache.codec.classpath"/>
<path refid="apache.logging.classpath"/>
- <path refid="apache.log4j.classpath"/>
+
+ <path refid="jboss/common.core.classpath"/>
+ <path refid="jboss/common.logging.spi.classpath"/>
+ <path refid="jboss.microcontainer.classpath"/>
</path>
<!-- Configure modules -->
Modified: modules/test/trunk/remote/src/main/org/jboss/unit/remote/RequestContext.java
===================================================================
---
modules/test/trunk/remote/src/main/org/jboss/unit/remote/RequestContext.java 2007-10-12
00:05:43 UTC (rev 8609)
+++
modules/test/trunk/remote/src/main/org/jboss/unit/remote/RequestContext.java 2007-10-12
00:33:46 UTC (rev 8610)
@@ -47,4 +47,24 @@
this.parametrization = parametrization;
this.payload = payload;
}
+
+ public boolean isRequestCount(int requestCount)
+ {
+ return this.requestCount == requestCount;
+ }
+
+ public int getRequestCount()
+ {
+ return requestCount;
+ }
+
+ public Map<String, String> getParametrization()
+ {
+ return parametrization;
+ }
+
+ public Map<String, Serializable> getPayload()
+ {
+ return payload;
+ }
}
Modified:
modules/test/trunk/remote/src/main/org/jboss/unit/remote/driver/RemoteTestDriverClient.java
===================================================================
---
modules/test/trunk/remote/src/main/org/jboss/unit/remote/driver/RemoteTestDriverClient.java 2007-10-12
00:05:43 UTC (rev 8609)
+++
modules/test/trunk/remote/src/main/org/jboss/unit/remote/driver/RemoteTestDriverClient.java 2007-10-12
00:33:46 UTC (rev 8610)
@@ -25,23 +25,40 @@
import org.jboss.unit.driver.TestDriver;
import org.jboss.unit.driver.DriverCommand;
import org.jboss.unit.driver.DriverResponse;
+import org.jboss.unit.driver.response.FailureResponse;
+import org.jboss.unit.driver.command.StartTestCommand;
import org.jboss.unit.info.TestInfo;
+import org.jboss.unit.info.TestSuiteInfo;
+import org.jboss.unit.info.impl.SimpleTestSuiteInfo;
+import org.jboss.unit.info.impl.SimpleParameterInfo;
import org.jboss.unit.TestId;
+import org.jboss.unit.Failure;
import org.jboss.portal.test.framework.server.NodeId;
import org.jboss.portal.test.framework.server.Node;
import org.jboss.portal.test.framework.server.NodeManager;
+import org.jboss.kernel.plugins.bootstrap.basic.BasicBootstrap;
+import org.jboss.kernel.plugins.deployment.xml.BeanXMLDeployer;
+import org.jboss.kernel.spi.deployment.KernelDeployment;
+import org.jboss.beans.metadata.plugins.AbstractBeanMetaData;
+import org.jboss.beans.metadata.plugins.AbstractConstructorMetaData;
+import org.jboss.beans.metadata.plugins.AbstractValueMetaData;
+import org.jboss.beans.metadata.plugins.annotations.Inject;
+import java.net.URL;
+import java.util.Map;
+import java.util.HashMap;
+
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 1.1 $
*/
-public class RemoteTestDriverClient implements TestDriver
+public class RemoteTestDriverClient extends BasicBootstrap implements TestDriver
{
// Config
- /** . */
- private NodeId initialNodeId;
+ /** Need to make initial node id configurable somehow. */
+// private String initialNodeId;
// Services
@@ -51,14 +68,27 @@
/** . */
private ProtocolHandler protocolHandler;
- public NodeId getInitialNodeId()
+ /** . */
+ private String archivePath;
+
+// public String getInitialNodeId()
+// {
+// return initialNodeId;
+// }
+//
+// public void setInitialNodeId(String initialNodeId)
+// {
+// this.initialNodeId = initialNodeId;
+// }
+
+ public String getArchivePath()
{
- return initialNodeId;
+ return archivePath;
}
- public void setInitialNodeId(NodeId initialNodeId)
+ public void setArchivePath(String archivePath)
{
- this.initialNodeId = initialNodeId;
+ this.archivePath = archivePath;
}
public NodeManager getNodeManager()
@@ -66,6 +96,7 @@
return nodeManager;
}
+ @Inject(bean="NodeManager")
public void setNodeManager(NodeManager nodeManager)
{
this.nodeManager = nodeManager;
@@ -76,6 +107,7 @@
return protocolHandler;
}
+ @Inject(bean="DeployerHandler")
public void setProtocolHandler(ProtocolHandler protocolHandler)
{
this.protocolHandler = protocolHandler;
@@ -86,28 +118,125 @@
return (RemoteTestDriver)node.lookupService(RemoteTestDriver.SERVICE_ID);
}
+ private boolean started = false;
+ private FailureResponse failed;
+ private KernelDeployment deployment;
+ private BeanXMLDeployer beanDeployer;
+
+ private void start()
+ {
+ if (!started && failed == null)
+ {
+
+ //
+ run();
+
+ // Install our self first
+ try
+ {
+ AbstractBeanMetaData bmd = new AbstractBeanMetaData("TestDriver",
getClass().getName());
+ AbstractConstructorMetaData cmd = new AbstractConstructorMetaData();
+ bmd.setConstructor(cmd);
+ TestCaseFactory factory = new TestCaseFactory(this);
+ AbstractValueMetaData vmd = new AbstractValueMetaData(factory);
+ cmd.setFactory(vmd);
+ cmd.setFactoryMethod("getTestCase");
+ getKernel().getController().install(bmd);
+ }
+ catch (Throwable throwable)
+ {
+ throwable.printStackTrace();
+ failed = new FailureResponse(Failure.createErrorFailure("Could not
startup kernel", throwable));
+ return;
+ }
+
+ // Now deploy beans
+ try
+ {
+ URL url =
getClass().getResource("/org/jboss/unit/remote/driver/jboss-beans.xml");
+ beanDeployer = new BeanXMLDeployer(getKernel());
+ deployment = beanDeployer.deploy(url);
+ beanDeployer.validate();
+ }
+ catch (Throwable throwable)
+ {
+ throwable.printStackTrace();
+ failed = new FailureResponse(Failure.createErrorFailure("Could not
deploy beans", throwable));
+ return;
+ }
+
+ //
+ started = true;
+ }
+ }
+
public TestInfo getInfo()
{
- Node node = nodeManager.getNode(initialNodeId);
+ start();
+
+ // Always retrieve meta data from the default node
+ Node node = nodeManager.getNode(NodeId.DEFAULT);
+
+ //
TestDriver server = getServer(node);
- return server.getInfo();
+
+ //
+ SimpleTestSuiteInfo testInfo = new
SimpleTestSuiteInfo((TestSuiteInfo)server.getInfo());
+
+ System.out.println("testInfo = " + testInfo);
+
+ //
+ Map<String, SimpleParameterInfo> parameters = new HashMap<String,
SimpleParameterInfo>(testInfo.getParameters());
+
+ //
+ parameters.put("archivePath", new
SimpleParameterInfo("archivePath"));
+
+ //
+ testInfo.setParameters(parameters);
+
+ //
+ return testInfo;
}
public DriverResponse invoke(TestId testId, DriverCommand command)
{
- try
+ start();
+
+ //
+ if (command instanceof StartTestCommand)
{
- Node node = nodeManager.getNode(initialNodeId);
+ StartTestCommand start = (StartTestCommand)command;
+ archivePath = start.getParametrization().get("archivePath");
- // Create conversation
- TestConversation conversation = createConversation(testId, node);
+ try
+ {
+ Node node = nodeManager.getNode(NodeId.DEFAULT);
- //
- return conversation.handleCommand(command);
+ // Create conversation
+ TestConversation conversation = createConversation(testId, node);
+
+ //
+ return conversation.handleCommand(command);
+ }
+ catch (Exception e)
+ {
+ return new FailureResponse(Failure.createErrorFailure(e));
+ }
+ finally
+ {
+ try
+ {
+ beanDeployer.undeploy(deployment);
+ }
+ catch (Throwable ignore)
+ {
+ ignore.printStackTrace();
+ }
+ }
}
- catch (Exception e)
+ else
{
- throw new Error(e);
+ return new FailureResponse(Failure.createErrorFailure("Command " +
command + " not accepted"));
}
}
Modified:
modules/test/trunk/remote/src/main/org/jboss/unit/remote/driver/RemoteTestDriverServer.java
===================================================================
---
modules/test/trunk/remote/src/main/org/jboss/unit/remote/driver/RemoteTestDriverServer.java 2007-10-12
00:05:43 UTC (rev 8609)
+++
modules/test/trunk/remote/src/main/org/jboss/unit/remote/driver/RemoteTestDriverServer.java 2007-10-12
00:33:46 UTC (rev 8610)
@@ -47,22 +47,28 @@
private SimpleTestSuiteInfo info = new SimpleTestSuiteInfo("Main");
/** . */
- private Map<String, TestDriver> drivers = new HashMap<String,
TestDriver>();
+ private Map<String, RemoteTestDriver> drivers = new HashMap<String,
RemoteTestDriver>();
- /** . */
- private RequestContext requestContext;
+ public void pushContext(TestId testId, RequestContext requestContext)
+ {
+ String name = testId.getName(0);
- /** . */
- private ResponseContext responseContext;
+ //
+ RemoteTestDriver driver = drivers.get(name);
- public void pushContext(TestId testId, RequestContext testContext)
- {
- this.requestContext = testContext;
+ //
+ driver.pushContext(testId.range(1), requestContext);
}
public ResponseContext popContext(TestId testId)
{
- return responseContext;
+ String name = testId.getName(0);
+
+ //
+ RemoteTestDriver driver = drivers.get(name);
+
+ //
+ return driver.popContext(testId.range(1));
}
public TestInfo getInfo()
@@ -96,7 +102,7 @@
return driver.invoke(driverId, command);
}
- public void addDriver(TestDriver driver)
+ public void mount(RemoteTestDriver driver)
{
synchronized(RemoteTestDriverServer.class)
{
@@ -108,7 +114,7 @@
}
}
- public synchronized void removeDriver(TestDriver driver)
+ public synchronized void unmount(RemoteTestDriver driver)
{
synchronized(RemoteTestDriverServer.class)
{
@@ -120,11 +126,6 @@
}
}
-
-
-
-
-
// /** . */
// private String initialPath = "/test";
//
Added:
modules/test/trunk/remote/src/main/org/jboss/unit/remote/driver/TestCaseFactory.java
===================================================================
--- modules/test/trunk/remote/src/main/org/jboss/unit/remote/driver/TestCaseFactory.java
(rev 0)
+++
modules/test/trunk/remote/src/main/org/jboss/unit/remote/driver/TestCaseFactory.java 2007-10-12
00:33:46 UTC (rev 8610)
@@ -0,0 +1,44 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.unit.remote.driver;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class TestCaseFactory
+{
+
+ /** . */
+ private final Object testCase;
+
+ public TestCaseFactory(Object testCase)
+ {
+ this.testCase = testCase;
+ }
+
+ public Object getTestCase()
+ {
+ return testCase;
+ }
+}
Modified:
modules/test/trunk/remote/src/main/org/jboss/unit/remote/driver/TestConversation.java
===================================================================
---
modules/test/trunk/remote/src/main/org/jboss/unit/remote/driver/TestConversation.java 2007-10-12
00:05:43 UTC (rev 8609)
+++
modules/test/trunk/remote/src/main/org/jboss/unit/remote/driver/TestConversation.java 2007-10-12
00:33:46 UTC (rev 8610)
@@ -24,6 +24,7 @@
import org.jboss.unit.driver.DriverResponse;
import org.jboss.unit.driver.DriverCommand;
+import org.jboss.unit.driver.command.StartTestCommand;
import org.jboss.unit.driver.response.EndTestResponse;
import org.jboss.unit.remote.RequestContext;
import org.jboss.unit.remote.ResponseContext;
@@ -87,26 +88,23 @@
*/
public final DriverResponse handleCommand(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);
-// }
+ RemoteDriverResponseContext respCtx;
+ if (command instanceof StartTestCommand)
+ {
+ StartTestCommand start = (StartTestCommand)command;
+ parametrization = start.getParametrization();
+ pushContext(commandContext);
+ DriverResponse response = getDriver().getServer(node).invoke(testId, command);
+ respCtx = commandContext.createResponseContext(response);
+ }
+ else
+ {
+ respCtx = protocolHandler.handleCommand(this, commandContext);
+ }
- RemoteDriverResponseContext respCtx = protocolHandler.handleCommand(this,
commandContext);
-
//
DriverResponse response = respCtx.getResponse();
Modified:
modules/test/trunk/remote/src/main/org/jboss/unit/remote/driver/handler/deployer/DeployerHandler.java
===================================================================
---
modules/test/trunk/remote/src/main/org/jboss/unit/remote/driver/handler/deployer/DeployerHandler.java 2007-10-12
00:05:43 UTC (rev 8609)
+++
modules/test/trunk/remote/src/main/org/jboss/unit/remote/driver/handler/deployer/DeployerHandler.java 2007-10-12
00:33:46 UTC (rev 8610)
@@ -119,7 +119,7 @@
return new RemoteDriverCommandContext(responseContext.getCommandContext());
}
- return null; //To change body of implemented methods use File | Settings | File
Templates.
+ return null;
}
public RemoteDriverResponseContext handleCommand(TestConversation conversation,
RemoteDriverCommandContext commandContext) throws Exception
Modified:
modules/test/trunk/remote/src/main/org/jboss/unit/remote/driver/handler/deployer/response/DeployerResponse.java
===================================================================
---
modules/test/trunk/remote/src/main/org/jboss/unit/remote/driver/handler/deployer/response/DeployerResponse.java 2007-10-12
00:05:43 UTC (rev 8609)
+++
modules/test/trunk/remote/src/main/org/jboss/unit/remote/driver/handler/deployer/response/DeployerResponse.java 2007-10-12
00:33:46 UTC (rev 8610)
@@ -24,10 +24,12 @@
import org.jboss.unit.driver.DriverResponse;
+import java.io.Serializable;
+
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 1.1 $
*/
-public class DeployerResponse extends DriverResponse
+public class DeployerResponse extends DriverResponse implements Serializable
{
}
Modified:
modules/test/trunk/remote/src/main/org/jboss/unit/remote/driver/handler/http/command/HTTPDriverCommand.java
===================================================================
---
modules/test/trunk/remote/src/main/org/jboss/unit/remote/driver/handler/http/command/HTTPDriverCommand.java 2007-10-12
00:05:43 UTC (rev 8609)
+++
modules/test/trunk/remote/src/main/org/jboss/unit/remote/driver/handler/http/command/HTTPDriverCommand.java 2007-10-12
00:33:46 UTC (rev 8610)
@@ -24,10 +24,12 @@
import org.jboss.unit.driver.DriverCommand;
+import java.io.Serializable;
+
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 1.1 $
*/
-public class HTTPDriverCommand extends DriverCommand
+public class HTTPDriverCommand extends DriverCommand implements Serializable
{
}
Modified:
modules/test/trunk/remote/src/main/org/jboss/unit/remote/driver/handler/http/response/HTTPDriverResponse.java
===================================================================
---
modules/test/trunk/remote/src/main/org/jboss/unit/remote/driver/handler/http/response/HTTPDriverResponse.java 2007-10-12
00:05:43 UTC (rev 8609)
+++
modules/test/trunk/remote/src/main/org/jboss/unit/remote/driver/handler/http/response/HTTPDriverResponse.java 2007-10-12
00:33:46 UTC (rev 8610)
@@ -24,10 +24,12 @@
import org.jboss.unit.driver.DriverResponse;
+import java.io.Serializable;
+
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 1.1 $
*/
-public abstract class HTTPDriverResponse extends DriverResponse
+public abstract class HTTPDriverResponse extends DriverResponse implements Serializable
{
}
Added:
modules/test/trunk/remote/src/resources/jboss-unit-remote-jar/org/jboss/unit/remote/driver/jboss-beans.xml
===================================================================
---
modules/test/trunk/remote/src/resources/jboss-unit-remote-jar/org/jboss/unit/remote/driver/jboss-beans.xml
(rev 0)
+++
modules/test/trunk/remote/src/resources/jboss-unit-remote-jar/org/jboss/unit/remote/driver/jboss-beans.xml 2007-10-12
00:33:46 UTC (rev 8610)
@@ -0,0 +1,68 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ 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. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+<deployment
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="urn:jboss:bean-deployer:2.0
bean-deployer_2_0.xsd"
+ xmlns="urn:jboss:bean-deployer:2.0">
+
+ <bean name="NodeFactory"
class="org.jboss.portal.test.framework.impl.generic.server.GenericNodeFactory">
+ <constructor>
+ <parameter>servers.xml</parameter>
+ <parameter>RemoteTomcat_6_0</parameter>
+ </constructor>
+ </bean>
+
+ <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="NodeManager"
class="org.jboss.portal.test.framework.server.NodeManager">
+ <constructor>
+ <parameter>
+ <list>
+ <inject bean="Node0"/>
+<!--
+ <inject bean="Node1"/>
+ <inject bean="Node2"/>
+-->
+ </list>
+ </parameter>
+ </constructor>
+ </bean>
+
+ <bean name="Deployer"
class="org.jboss.portal.test.framework.deployment.Deployer">
+ </bean>
+
+ <bean name="HTTPHandler"
class="org.jboss.unit.remote.driver.handler.http.HTTPHandler">
+ </bean>
+
+ <bean name="DeployerHandler"
class="org.jboss.unit.remote.driver.handler.deployer.DeployerHandler">
+ <property name="nextHandler"><inject
bean="HTTPHandler"/></property>
+ <property name="archivePath"><inject bean="TestDriver"
property="archivePath" state="Instantiated"/></property>
+ <property name="deployer"><inject
bean="Deployer"/></property>
+ </bean>
+
+</deployment>
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-10-12
00:05:43 UTC (rev 8609)
+++
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/deployment/Deployer.java 2007-10-12
00:33:46 UTC (rev 8610)
@@ -25,11 +25,9 @@
import org.jboss.portal.test.framework.server.Node;
-import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.HashMap;
-import java.util.Iterator;
import java.util.Map;
import java.io.File;
@@ -43,7 +41,7 @@
{
/** . */
- private Map deployments;
+ private Map<URL,Deployment> deployments;
public void create()
{
@@ -52,14 +50,13 @@
public void start()
{
// Should check that the deployer agent is here
- deployments = new HashMap();
+ deployments = new HashMap<URL,Deployment>();
}
public void stop()
{
- for (Iterator i = new ArrayList(deployments.keySet()).iterator(); i.hasNext();)
+ for (URL url : new ArrayList<URL>(deployments.keySet()))
{
- URL url = (URL)i.next();
undeploy(url);
}
@@ -110,12 +107,12 @@
public void deploy(String url, Node[] nodes) throws Exception
{
- this.deploy(getArchiveURL(url), nodes);
+ this.deploy(new URL(url), nodes);
}
public void undeploy(URL url)
{
- Deployment deployment = (Deployment)deployments.remove(url);
+ Deployment deployment = deployments.remove(url);
if (deployment != null)
{
deployment.undeploy();
@@ -134,57 +131,6 @@
public void undeploy(String url) throws Exception
{
- this.undeploy(getArchiveURL(url));
+ this.undeploy(new URL(url));
}
-
- /**
- * Try to discover the URL for the deployment archive based on the archive name and
"standard" archive locations
- * (relative to the where the test is executed):
- * <p/>
- * <ul> <li>.</li> <li>output/libs/</li>
<li>test/outputs/libs/</li> <li>output/lib/</li>
<li>test/output/lib/</li>
- * <li>../output/lib/</li> <li>../test/output/lib/</li>
</ul>
- *
- * @param archive the name of the archive to deploy
- * @return a URL pointing to the archive to be deployed
- * @throws IllegalArgumentException if no archive with the given name can be found to
be deployed
- */
- private URL getArchiveURL(String archive)
- {
- URL url = null;
- try
- {
- url = new URL(archive);
- }
- catch (MalformedURLException ignore)
- {
-// // archive parameter was not a URL, try to build one from "standard"
locations, by considering it as a file name
-// String locs[] = {archive, "output/libs/" + archive,
"test/outputs/libs/" + archive, "output/lib/" + archive,
-// "test/output/lib/" + archive, "../output/lib/" +
archive, "../test/output/lib/" + archive,
-// "../output/lib/tests/" + archive};
-//
-// for (int i = 0; i < locs.length && url == null; i++)
-// {
-// File file = new File(locs[i]);
-// if (file.exists())
-// {
-// try
-// {
-// url = file.toURL();
-// }
-// catch (MalformedURLException e)
-// {
-// // shouldn't happen
-// }
-// }
-// }
- }
-
- // if we still don't have a URL at this point, we won't find one: declare
failure!
- if (url == null)
- {
- throw new IllegalArgumentException("Cannot obtain URL for: " +
archive);
- }
-
- return url;
- }
}
Modified: modules/test/trunk/tooling/build.xml
===================================================================
--- modules/test/trunk/tooling/build.xml 2007-10-12 00:05:43 UTC (rev 8609)
+++ modules/test/trunk/tooling/build.xml 2007-10-12 00:33:46 UTC (rev 8610)
@@ -85,7 +85,7 @@
<!-- Configure thirdparty libraries -->
&libraries;
<path id="library.classpath">
- <path location="${apache.ant.lib}/ant-junit.jar"/>
+ <path location="../tools/lib/ant-junit.jar"/>
<path location="${apache.ant.lib}/ant.jar"/>
<path location="${project.root}/unit/"/>
</path>
Modified: modules/test/trunk/tooling/src/main/org/jboss/unit/tooling/ant/TestsType.java
===================================================================
---
modules/test/trunk/tooling/src/main/org/jboss/unit/tooling/ant/TestsType.java 2007-10-12
00:05:43 UTC (rev 8609)
+++
modules/test/trunk/tooling/src/main/org/jboss/unit/tooling/ant/TestsType.java 2007-10-12
00:33:46 UTC (rev 8610)
@@ -26,20 +26,15 @@
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.Project;
import org.apache.tools.ant.types.Path;
-import org.apache.tools.ant.types.FileSet;
+import org.apache.tools.ant.types.Environment;
import org.apache.tools.ant.taskdefs.Java;
-import org.apache.tools.ant.taskdefs.optional.junit.XMLResultAggregator;
-import org.apache.tools.ant.taskdefs.optional.junit.AggregateTransformer;
import org.jboss.unit.tooling.filter.IncludeTestFilter;
import org.jboss.unit.tooling.filter.ExcludeTestFilter;
import org.jboss.unit.tooling.Main;
-import org.jboss.unit.tooling.MainBuilder;
-import org.jboss.unit.report.impl.junit.JUnitTestReport;
import java.util.List;
import java.util.LinkedList;
import java.util.Set;
-import java.io.File;
/**
* @author <a href="mailto:boleslaw dot dawidowicz at redhat anotherdot
com">Boleslaw Dawidowicz</a>
@@ -63,7 +58,9 @@
private String suiteName;
+ private boolean jpda;
+
public TestsType()
{
}
@@ -79,8 +76,6 @@
addArguments(javaTask);
-
-
javaTask.setClassname("org.jboss.unit.tooling.Main");
try
@@ -111,7 +106,22 @@
javaTask = (Java)getProject().createTask("java");
+ // Set jboss logging to use JUL
+ Environment.Variable pluginProperty = new Environment.Variable();
+ pluginProperty.setKey("org.jboss.logging.Logger.pluginClass");
+ pluginProperty.setValue("org.jboss.logging.jdk.JDK14LoggerPlugin");
+ javaTask.addSysproperty(pluginProperty);
+ // Beginning of jpda option implementation, need to improve it
+ if (jpda)
+ {
+ Environment.Variable javaDotCompilerProperty = new Environment.Variable();
+ javaDotCompilerProperty.setKey("java.compiler");
+ javaDotCompilerProperty.setValue("NONE");
+ javaTask.addSysproperty(javaDotCompilerProperty);
+ javaTask.setJvmargs("-Xdebug -Xnoagent
-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000");
+ }
+
// Apply task classpath
if (getClasspath() != null)
{
@@ -347,4 +357,14 @@
{
this.suiteName = suiteName;
}
+
+ public boolean isJpda()
+ {
+ return jpda;
+ }
+
+ public void setJpda(boolean jpda)
+ {
+ this.jpda = jpda;
+ }
}
Modified: modules/test/trunk/unit/src/main/org/jboss/unit/Failure.java
===================================================================
--- modules/test/trunk/unit/src/main/org/jboss/unit/Failure.java 2007-10-12 00:05:43 UTC
(rev 8609)
+++ modules/test/trunk/unit/src/main/org/jboss/unit/Failure.java 2007-10-12 00:33:46 UTC
(rev 8610)
@@ -76,9 +76,9 @@
return type;
}
- public static Failure createErrorFailure(String messge)
+ public static Failure createErrorFailure(String message)
{
- return new Failure(messge, FailureType.ERROR);
+ return new Failure(message, FailureType.ERROR);
}
public static Failure createErrorFailure(String message, Throwable throwable)
@@ -95,4 +95,9 @@
{
return new Failure(throwable, FailureType.ASSERTION);
}
+
+ public static Failure createAssertionFailure(String message)
+ {
+ return new Failure(message, FailureType.ASSERTION);
+ }
}
Modified:
modules/test/trunk/unit/src/main/org/jboss/unit/info/impl/SimpleTestCaseInfo.java
===================================================================
---
modules/test/trunk/unit/src/main/org/jboss/unit/info/impl/SimpleTestCaseInfo.java 2007-10-12
00:05:43 UTC (rev 8609)
+++
modules/test/trunk/unit/src/main/org/jboss/unit/info/impl/SimpleTestCaseInfo.java 2007-10-12
00:33:46 UTC (rev 8610)
@@ -39,4 +39,9 @@
{
super(that);
}
+
+ public String toString()
+ {
+ return getName();
+ }
}
Modified:
modules/test/trunk/unit/src/main/org/jboss/unit/info/impl/SimpleTestSuiteInfo.java
===================================================================
---
modules/test/trunk/unit/src/main/org/jboss/unit/info/impl/SimpleTestSuiteInfo.java 2007-10-12
00:05:43 UTC (rev 8609)
+++
modules/test/trunk/unit/src/main/org/jboss/unit/info/impl/SimpleTestSuiteInfo.java 2007-10-12
00:33:46 UTC (rev 8610)
@@ -31,6 +31,7 @@
import java.util.HashMap;
import java.util.Set;
import java.util.Collections;
+import java.util.Iterator;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
@@ -142,4 +143,21 @@
return new SimpleTestCaseInfo(testCase);
}
}
+
+ public String toString()
+ {
+ StringBuilder builder = new StringBuilder(getName());
+ builder.append('[');
+ for (Iterator i = tests.values().iterator();i.hasNext();)
+ {
+ TestInfo test = (TestInfo)i.next();
+ builder.append(test);
+ if (i.hasNext())
+ {
+ builder.append(',');
+ }
+ }
+ builder.append(']');
+ return builder.toString();
+ }
}