vmassol 2005/01/29 07:49:19
Modified: documentation/docs/xdocs changes.xml
documentation/docs/xdocs/integration/ant task_cactus.xml
integration/ant/src/java/org/apache/cactus/integration/ant
CactusTask.java
integration/ant/src/java/org/apache/cactus/integration/ant/container
AbstractContainer.java Container.java
ContainerRunner.java ContainerWrapper.java
integration/ant/src/java/org/apache/cactus/integration/ant/container/jboss
JBoss3xContainer.java
integration/ant/src/java/org/apache/cactus/integration/ant/container/orion
AbstractOrionContainer.java
integration/ant/src/java/org/apache/cactus/integration/ant/container/weblogic
WebLogic7xContainer.java
integration/ant/src/test/org/apache/cactus/integration/ant/container
MockContainer.java
Log:
CACTUS-81: Added 3 new attributes to the nested containers of the
<code><cactus></code> task: <code>protocol</code>, <code>server</code>
and <code>port</code>. This allows running Cactus tests located in a container
that is remote from the Cactus client. Thanks to Thomas Schapitz.
Revision Changes Path
1.212 +7 -0 jakarta-cactus/documentation/docs/xdocs/changes.xml
Index: changes.xml
===================================================================
RCS file: /home/cvs/jakarta-cactus/documentation/docs/xdocs/changes.xml,v
retrieving revision 1.211
retrieving revision 1.212
diff -u -r1.211 -r1.212
--- changes.xml 28 Jan 2005 12:59:59 -0000 1.211
+++ changes.xml 29 Jan 2005 15:49:18 -0000 1.212
@@ -91,6 +91,13 @@
</devs>
<release version="1.8dev" date="in CVS">
+ <action dev="VMA" type="add" issue="CACTUS-81" due-to="Thomas
Schapitz">
+ Added 3 new attributes to the nested containers of the
+ <code><cactus></code> task: <code>protocol</code>,
+ <code>server</code> and <code>port</code>. This allows
+ running Cactus tests located in a container that is
+ remote from the Cactus client.
+ </action>
</release>
<release version="1.7" date="28 Jan 2005">
1.28 +39 -8
jakarta-cactus/documentation/docs/xdocs/integration/ant/task_cactus.xml
Index: task_cactus.xml
===================================================================
RCS file:
/home/cvs/jakarta-cactus/documentation/docs/xdocs/integration/ant/task_cactus.xml,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -r1.27 -r1.28
--- task_cactus.xml 10 Dec 2004 13:26:34 -0000 1.27
+++ task_cactus.xml 29 Jan 2005 15:49:18 -0000 1.28
@@ -248,14 +248,45 @@
as appropriate.
</p>
- <note>
- The <cactus> task assumes that the container that it starts
will
- accept requests from localhost. If you have specified a custom
- container configuration, make sure you have configured your
- container to listen to localhost. Otherwise, the <cactus> task
- will fail to notice your container is running as it checks for that
- on localhost.
- </note>
+ <section title="Common Parameters">
+
+ <p>
+ Here is a list of parameters that are common to all containers.
+ </p>
+
+ <table>
+ <tr>
+ <th>Name</th>
+ <th>Description</th>
+ <th>Required</th>
+ </tr>
+ <tr>
+ <td>protocol</td>
+ <td>
+ Protocol to use for communication, one of http or https. Note
that
+ https will only work, if a.) JSSE is installed b.) the proper
+ certificates are installed.
+ </td>
+ <td>No, default is http</td>
+ </tr>
+ <tr>
+ <td>server</td>
+ <td>
+ Host name or ip of the machine running the server. Note, that
+ the built in deployment support will not work for remote hosts.
+ </td>
+ <td>No, default is localhost</td>
+ </tr>
+ <tr>
+ <td>port</td>
+ <td>
+ The TCP port that the container should listen to
+ </td>
+ <td>No, default is 8080</td>
+ </tr>
+ </table>
+
+ </section>
<anchor id="generic"/>
<section title="generic">
1.34 +8 -11
jakarta-cactus/integration/ant/src/java/org/apache/cactus/integration/ant/CactusTask.java
Index: CactusTask.java
===================================================================
RCS file:
/home/cvs/jakarta-cactus/integration/ant/src/java/org/apache/cactus/integration/ant/CactusTask.java,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -r1.33 -r1.34
--- CactusTask.java 2 Jul 2004 07:03:49 -0000 1.33
+++ CactusTask.java 29 Jan 2005 15:49:18 -0000 1.34
@@ -1,7 +1,7 @@
/*
* ========================================================================
*
- * Copyright 2003-2004 The Apache Software Foundation.
+ * Copyright 2003-2005 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -197,15 +197,13 @@
{
containers[i].init();
log("--------------------------------------------------"
- + "---------------",
- Project.MSG_INFO);
- log("Running tests against " + containers[i].getName(),
+ + "---------------", Project.MSG_INFO);
+ log("Running tests against " + containers[i].getName()
+ + " @ " + containers[i].getBaseURL(),
Project.MSG_INFO);
log("--------------------------------------------------"
- + "---------------",
- Project.MSG_INFO);
- contextUrl.setValue(
- "http://localhost:" + containers[i].getPort() + "/"
+ + "---------------", Project.MSG_INFO);
+ contextUrl.setValue(containers[i].getBaseURL() + "/"
+ thisDeployable.getTestContext());
executeInContainer(containers[i], thisDeployable);
}
@@ -432,8 +430,7 @@
runner.setLog(new AntLog(this));
try
{
- URL url =
- new URL("http", "localhost", theContainer.getPort(), "/"
+ URL url = new URL(theContainer.getBaseURL() + "/"
+ theFile.getTestContext()
+ theFile.getServletRedirectorMapping()
+ "?Cactus_Service=RUN_TEST");
1.19 +57 -2
jakarta-cactus/integration/ant/src/java/org/apache/cactus/integration/ant/container/AbstractContainer.java
Index: AbstractContainer.java
===================================================================
RCS file:
/home/cvs/jakarta-cactus/integration/ant/src/java/org/apache/cactus/integration/ant/container/AbstractContainer.java,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -r1.18 -r1.19
--- AbstractContainer.java 31 May 2004 20:05:22 -0000 1.18
+++ AbstractContainer.java 29 Jan 2005 15:49:18 -0000 1.19
@@ -1,7 +1,7 @@
/*
* ========================================================================
*
- * Copyright 2003-2004 The Apache Software Foundation.
+ * Copyright 2003-2005 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -110,6 +110,16 @@
* start the containers.
*/
private Path containerClasspath;
+
+ /**
+ * The server (name or ip) the container is living on
+ */
+ private String server = "localhost";
+
+ /**
+ * The protocol the container is using
+ */
+ private String protocol = "http";
// Public Methods
----------------------------------------------------------
@@ -191,6 +201,26 @@
this.unlessCondition = theUnlessCondition;
}
+ /**
+ * Sets the server (name or ip) to which the container is living.
+ *
+ * @param theServer The server to set
+ */
+ public final void setServer(String theServer)
+ {
+ this.server = theServer;
+ }
+
+ /**
+ * Sets the protocol the container should use
+ *
+ * @param theProtocol The protocol to set
+ */
+ public final void setProtocol(String theProtocol)
+ {
+ this.protocol = theProtocol;
+ }
+
// Container Implementation
------------------------------------------------
/**
@@ -312,6 +342,31 @@
{
return this.containerClasspath;
}
+
+ /**
+ * @see Container#getServer()
+ */
+ public final String getServer()
+ {
+ return this.server;
+ }
+
+ /**
+ * @see Container#getProtocol()
+ */
+ public final String getProtocol()
+ {
+ return this.protocol;
+ }
+
+ /**
+ * @see Container#getBaseURL()
+ */
+ public final String getBaseURL()
+ {
+ return this.getProtocol() + "://" + this.getServer() + ":"
+ + this.getPort();
+ }
// Protected Methods
-------------------------------------------------------
1.14 +22 -4
jakarta-cactus/integration/ant/src/java/org/apache/cactus/integration/ant/container/Container.java
Index: Container.java
===================================================================
RCS file:
/home/cvs/jakarta-cactus/integration/ant/src/java/org/apache/cactus/integration/ant/container/Container.java,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- Container.java 31 May 2004 20:05:22 -0000 1.13
+++ Container.java 29 Jan 2005 15:49:18 -0000 1.14
@@ -1,7 +1,7 @@
/*
* ========================================================================
*
- * Copyright 2003-2004 The Apache Software Foundation.
+ * Copyright 2003-2005 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -36,8 +36,6 @@
*/
public interface Container
{
- // Public Methods
----------------------------------------------------------
-
/**
* Returns a displayable name of the container for logging purposes.
*
@@ -161,4 +159,24 @@
* shutting down the container.
*/
void shutDown();
+
+ /**
+ * Returns the server (name or IP) to where the container is living.
+ *
+ * @return The server
+ */
+ String getServer();
+
+ /**
+ * Returns the protocol, that should be used for communication to the
+ * container.
+ *
+ * @return The protocol
+ */
+ String getProtocol();
+
+ /**
+ * @return the base URL of the container, including protocol, name and
port
+ */
+ String getBaseURL();
}
1.10 +6 -5
jakarta-cactus/integration/ant/src/java/org/apache/cactus/integration/ant/container/ContainerRunner.java
Index: ContainerRunner.java
===================================================================
RCS file:
/home/cvs/jakarta-cactus/integration/ant/src/java/org/apache/cactus/integration/ant/container/ContainerRunner.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- ContainerRunner.java 31 May 2004 20:05:22 -0000 1.9
+++ ContainerRunner.java 29 Jan 2005 15:49:18 -0000 1.10
@@ -1,7 +1,7 @@
/*
* ========================================================================
*
- * Copyright 2003-2004 The Apache Software Foundation.
+ * Copyright 2003-2005 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -265,16 +265,17 @@
}
/**
- * Sets the HTTP URL that will be continuously pinged to check if the
+ * Sets the HTTP/HTTPS URL that will be continuously pinged to check if
the
* container is running.
*
* @param theTestURL The URL to set
*/
public void setURL(URL theTestURL)
{
- if (!theTestURL.getProtocol().equals("http"))
+ if (!(theTestURL.getProtocol().equalsIgnoreCase("http")
+ || theTestURL.getProtocol().equalsIgnoreCase("https")))
{
- throw new IllegalArgumentException("Not a HTTP URL");
+ throw new IllegalArgumentException("Not a HTTP or HTTPS URL");
}
this.testURL = theTestURL;
}
1.15 +26 -1
jakarta-cactus/integration/ant/src/java/org/apache/cactus/integration/ant/container/ContainerWrapper.java
Index: ContainerWrapper.java
===================================================================
RCS file:
/home/cvs/jakarta-cactus/integration/ant/src/java/org/apache/cactus/integration/ant/container/ContainerWrapper.java,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- ContainerWrapper.java 31 May 2004 20:05:22 -0000 1.14
+++ ContainerWrapper.java 29 Jan 2005 15:49:18 -0000 1.15
@@ -198,4 +198,29 @@
{
return this.container.getContainerClasspath();
}
+
+ /**
+ * @see Container#getServer()
+ */
+ public String getServer()
+ {
+ return this.container.getServer();
+ }
+
+ /**
+ * @see Container#getProtocol()
+ */
+ public String getProtocol()
+ {
+ return this.container.getProtocol();
+ }
+
+ /**
+ * @see Container#getBaseURL()
+ */
+ public String getBaseURL()
+ {
+ return this.container.getBaseURL();
+ }
+
}
1.19 +3 -3
jakarta-cactus/integration/ant/src/java/org/apache/cactus/integration/ant/container/jboss/JBoss3xContainer.java
Index: JBoss3xContainer.java
===================================================================
RCS file:
/home/cvs/jakarta-cactus/integration/ant/src/java/org/apache/cactus/integration/ant/container/jboss/JBoss3xContainer.java,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -r1.18 -r1.19
--- JBoss3xContainer.java 20 Jun 2004 14:04:12 -0000 1.18
+++ JBoss3xContainer.java 29 Jan 2005 15:49:18 -0000 1.19
@@ -314,13 +314,13 @@
if (this.version.startsWith("3.2"))
{
- java.createArg().setValue("--server=localhost:"
+ java.createArg().setValue("--server=" + this.getServer() + ":"
+ this.getJndiPort());
java.createArg().setValue("--shutdown");
}
else
{
- java.createArg().setValue("localhost");
+ java.createArg().setValue(this.getServer());
java.createArg().setValue(String.valueOf(getPort()));
}
java.execute();
1.12 +2 -2
jakarta-cactus/integration/ant/src/java/org/apache/cactus/integration/ant/container/orion/AbstractOrionContainer.java
Index: AbstractOrionContainer.java
===================================================================
RCS file:
/home/cvs/jakarta-cactus/integration/ant/src/java/org/apache/cactus/integration/ant/container/orion/AbstractOrionContainer.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- AbstractOrionContainer.java 31 May 2004 20:05:26 -0000 1.11
+++ AbstractOrionContainer.java 29 Jan 2005 15:49:18 -0000 1.12
@@ -124,7 +124,7 @@
fileSet.createInclude().setName("*.jar");
classpath.addFileset(fileSet);
java.setClassname("com.evermind.client.orion.OrionConsoleAdmin");
- java.createArg().setValue("ormi://localhost:23791/");
+ java.createArg().setValue("ormi://" + this.getServer() + ":23791/");
java.createArg().setValue("admin");
java.createArg().setValue("password");
java.createArg().setValue("-shutdown");
1.17 +2 -2
jakarta-cactus/integration/ant/src/java/org/apache/cactus/integration/ant/container/weblogic/WebLogic7xContainer.java
Index: WebLogic7xContainer.java
===================================================================
RCS file:
/home/cvs/jakarta-cactus/integration/ant/src/java/org/apache/cactus/integration/ant/container/weblogic/WebLogic7xContainer.java,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- WebLogic7xContainer.java 31 May 2004 20:05:25 -0000 1.16
+++ WebLogic7xContainer.java 29 Jan 2005 15:49:18 -0000 1.17
@@ -235,7 +235,7 @@
java.setClassname("weblogic.Admin");
java.createArg().setValue("-url");
- java.createArg().setValue("t3://localhost:" + getPort());
+ java.createArg().setValue("t3://" + this.getServer() + ":" +
getPort());
java.createArg().setValue("-username");
java.createArg().setValue("weblogic");
java.createArg().setValue("-password");
1.15 +25 -1
jakarta-cactus/integration/ant/src/test/org/apache/cactus/integration/ant/container/MockContainer.java
Index: MockContainer.java
===================================================================
RCS file:
/home/cvs/jakarta-cactus/integration/ant/src/test/org/apache/cactus/integration/ant/container/MockContainer.java,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- MockContainer.java 31 May 2004 20:05:23 -0000 1.14
+++ MockContainer.java 29 Jan 2005 15:49:18 -0000 1.15
@@ -195,6 +195,30 @@
}
}
+ /**
+ * @see Container#getServer()
+ */
+ public String getServer()
+ {
+ return null;
+ }
+
+ /**
+ * @see Container#getProtocol()
+ */
+ public String getProtocol()
+ {
+ return null;
+ }
+
+ /**
+ * @see Container#getBaseURL()
+ */
+ public String getBaseURL()
+ {
+ return null;
+ }
+
// Public Methods
----------------------------------------------------------
/**
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]