vmassol 2004/06/20 07:04:12
Modified: integration/maven plugin.properties plugin.jelly
documentation/docs/xdocs/integration/ant task_cactus.xml
integration/ant/src/java/org/apache/cactus/integration/ant/container/jboss
JBoss3xContainer.java
integration/maven/xdocs changes.xml properties.xml
documentation/docs/xdocs changes.xml
Log:
<action dev="VMA" type="add" issue="CACTUS-119">
The <code><jboss3x></code> container element now supports
running JBoss in a temporary directory, specified by the
<code>tmpdir</code> attribute. In addition, by using the
<code>configDir</code> attribute, you can now specify a
directory where you have stored a custom JBoss server configuration
(identified by the <code>config</code> attribute).
This configuration will be copied to the tmp directory and used
to configure JBoss.
</action>
Revision Changes Path
1.18 +8 -0 jakarta-cactus/integration/maven/plugin.properties
Index: plugin.properties
===================================================================
RCS file: /home/cvs/jakarta-cactus/integration/maven/plugin.properties,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- plugin.properties 8 Jun 2004 07:13:17 -0000 1.17
+++ plugin.properties 20 Jun 2004 14:04:11 -0000 1.18
@@ -105,6 +105,14 @@
# Name of the JBoss server configuration to use.
cactus.jboss3x.config.name = default
+# Default tmp directory where the JBoss server configuration for Cactus
+# will be created.
+cactus.jboss3x.tmp.dir = ${cactus.home.jboss3x}/server/cactus
+
+# (optional) Location of a custom user-specified server configuration which
+# will be copied to cactus.jboss3x.tmp.dir if specified.
+# Ex: cactus.jboss3x.config.dir = target/jboss-cactus
+
# Name of the JNDI port on which JBoss is started. This is only used
# to shutdown JBoss.
cactus.jboss3x.jndiport = 1099
1.28 +17 -13 jakarta-cactus/integration/maven/plugin.jelly
Index: plugin.jelly
===================================================================
RCS file: /home/cvs/jakarta-cactus/integration/maven/plugin.jelly,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -r1.27 -r1.28
--- plugin.jelly 8 Jun 2004 07:13:17 -0000 1.27
+++ plugin.jelly 20 Jun 2004 14:04:11 -0000 1.28
@@ -361,9 +361,10 @@
dir="${cactus.home.jboss3x}"
output="${cactus.reports.dir}/jboss3x.out"
todir="${cactus.reports.dir}/jboss3x"
- config="${cactus.jboss3x.config.name}">
- <j:if test="${context.getVariable('cactus.tmp.dir') != null}">
- <ant:setProperty name="tmpdir" value="${cactus.tmp.dir}"/>
+ config="${cactus.jboss3x.config.name}"
+ tmpdir="${cactus.jboss3x.tmp.dir}">
+ <j:if test="${context.getVariable('cactus.jboss3x.config.dir') != null}">
+ <ant:setProperty name="configdir" value="${cactus.jboss3x.config.dir}"/>
</j:if>
<j:if test="${context.getVariable('cactus.jboss3x.jndiport') != null}">
<ant:setProperty name="jndiport" value="${cactus.jboss3x.jndiport}"/>
@@ -594,9 +595,10 @@
dir="${cactus.home.jboss3x}"
output="${cactus.reports.dir}/jboss3x.out"
todir="${cactus.reports.dir}/jboss3x"
- config="${cactus.jboss3x.config.name}">
- <j:if test="${context.getVariable('cactus.tmp.dir') != null}">
- <ant:setProperty name="tmpdir" value="${cactus.tmp.dir}"/>
+ config="${cactus.jboss3x.config.name}"
+ tmpdir="${cactus.jboss3x.tmp.dir}">
+ <j:if test="${context.getVariable('cactus.jboss3x.config.dir') != null}">
+ <ant:setProperty name="configdir" value="${cactus.jboss3x.config.dir}"/>
</j:if>
<j:if test="${context.getVariable('cactus.jboss3x.jndiport') != null}">
<ant:setProperty name="jndiport" value="${cactus.jboss3x.jndiport}"/>
@@ -764,9 +766,10 @@
dir="${cactus.home.jboss3x}"
output="${cactus.reports.dir}/jboss3x.out"
todir="${cactus.reports.dir}/jboss3x"
- config="${cactus.jboss3x.config.name}">
- <j:if test="${context.getVariable('cactus.tmp.dir') != null}">
- <ant:setProperty name="tmpdir" value="${cactus.tmp.dir}"/>
+ config="${cactus.jboss3x.config.name}"
+ tmpdir="${cactus.jboss3x.tmp.dir}">
+ <j:if test="${context.getVariable('cactus.jboss3x.config.dir') != null}">
+ <ant:setProperty name="configdir" value="${cactus.jboss3x.config.dir}"/>
</j:if>
<j:if test="${context.getVariable('cactus.jboss3x.jndiport') != null}">
<ant:setProperty name="jndiport" value="${cactus.jboss3x.jndiport}"/>
@@ -994,10 +997,11 @@
dir="${cactus.home.jboss3x}"
output="${cactus.reports.dir}/jboss3x.out"
todir="${cactus.reports.dir}/jboss3x"
- config="${cactus.jboss3x.config.name}">
- <j:if test="${context.getVariable('cactus.tmp.dir') != null}">
- <ant:setProperty name="tmpdir" value="${cactus.tmp.dir}"/>
- </j:if>
+ config="${cactus.jboss3x.config.name}"
+ tmpdir="${cactus.jboss3x.tmp.dir}">
+ <j:if test="${context.getVariable('cactus.jboss3x.config.dir') != null}">
+ <ant:setProperty name="configdir" value="${cactus.jboss3x.config.dir}"/>
+ </j:if>
<j:if test="${context.getVariable('cactus.jboss3x.jndiport') != null}">
<ant:setProperty name="jndiport" value="${cactus.jboss3x.jndiport}"/>
</j:if>
1.25 +14 -1
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.24
retrieving revision 1.25
diff -u -r1.24 -r1.25
--- task_cactus.xml 28 May 2004 20:54:20 -0000 1.24
+++ task_cactus.xml 20 Jun 2004 14:04:11 -0000 1.25
@@ -398,7 +398,9 @@
<tr>
<td>config</td>
<td>
- The name of the JBoss server configuration to use
+ The name of the JBoss server configuration to use. The
+ files in this server configuration will be copied to the
+ tmp directory used to start the container.
</td>
<td>No, the default is <em>default</em></td>
</tr>
@@ -422,6 +424,17 @@
JNDI port.
</td>
<td>No, default is 1099</td>
+ </tr>
+ <tr>
+ <td>tmpdir</td>
+ <td>
+ The directory to which the container will be installed for the
+ tests.
+ </td>
+ <td>
+ No (by default the <code>[JBOSS_HOME]/server/cactus</code>
+ temporary directory is used)
+ </td>
</tr>
<tr>
<td>output</td>
1.18 +90 -13
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.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- JBoss3xContainer.java 19 Jun 2004 14:31:12 -0000 1.17
+++ JBoss3xContainer.java 20 Jun 2004 14:04:12 -0000 1.18
@@ -33,7 +33,9 @@
import org.apache.cactus.integration.ant.container.AbstractJavaContainer;
import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.taskdefs.Copy;
import org.apache.tools.ant.taskdefs.Java;
+import org.apache.tools.ant.types.FileSet;
import org.apache.tools.ant.types.Path;
import org.apache.tools.ant.util.FileUtils;
import org.w3c.dom.Document;
@@ -63,6 +65,12 @@
private String config = "default";
/**
+ * The location of a directory where to find the JBoss server
+ * configurations.
+ */
+ private File configDir;
+
+ /**
* The port to which the container should be bound.
*/
private int port = 8080;
@@ -82,6 +90,11 @@
* The context root of the tested application.
*/
private String testContextRoot;
+
+ /**
+ * The temporary directory from which the container will be started.
+ */
+ private File tmpDir;
// Public Methods ----------------------------------------------------------
@@ -108,6 +121,16 @@
}
/**
+ * Sets the location of the server configuration directory.
+ *
+ * @param theConfigDir The configuration directory
+ */
+ public final void setConfigDir(File theConfigDir)
+ {
+ this.configDir = theConfigDir;
+ }
+
+ /**
* Sets the port that will be used to poll the server to verify if
* it is started. This is needed for the use case where the user
* has defined his own JBoss configuration by using the
@@ -135,6 +158,16 @@
{
this.jndiPort = theJndiPort;
}
+
+ /**
+ * Sets the temporary directory from which the container is run.
+ *
+ * @param theTmpDir The temporary directory to set
+ */
+ public final void setTmpDir(File theTmpDir)
+ {
+ this.tmpDir = theTmpDir;
+ }
// Container Implementation ------------------------------------------------
@@ -171,7 +204,16 @@
{
return this.jndiPort;
}
-
+
+ /**
+ * @return The temporary directory from which the container will be
+ * started.
+ */
+ protected final File getTmpDir()
+ {
+ return this.tmpDir;
+ }
+
/**
* @see AbstractJavaContainer#init()
*/
@@ -207,10 +249,24 @@
{
try
{
- prepare("cactus/jboss3x");
+ // TODO: It seems JBoss 3.2.x does not support server
+ // configurations located in directories with spaces in their name.
+ // Thus we define the default tmp dir to default to where default
+ // JBoss server configurations are located. This should be removed
+ // once we find out how to make JBoss work when using the default
+ // tmp dir of System.getProperty("java.io.tmpdir")
+ if (getTmpDir() == null)
+ {
+ setTmpDir(new File(this.dir, "server/cactus"));
+ }
+
+ File customServerDir = setupTempDirectory(getTmpDir(),
+ "cactus/jboss3x");
+ cleanTempDirectory(customServerDir);
+
+ prepare("cactus/jboss3x", customServerDir);
File binDir = new File(this.dir, "bin");
- File configDir = new File(this.dir, "server");
Java java = createJavaForStartUp();
java.setDir(binDir);
@@ -219,11 +275,10 @@
createSysProperty("program.name",
new File(binDir, "run.bat")));
java.addSysproperty(
- createSysProperty("jboss.server.home.dir",
- new File(configDir, this.config)));
+ createSysProperty("jboss.server.home.dir", customServerDir));
java.addSysproperty(
createSysProperty("jboss.server.home.url",
- new File(configDir, this.config).toURL().toString()));
+ customServerDir.toURL().toString()));
Path classpath = java.createClasspath();
classpath.createPathElement().setLocation(
@@ -302,19 +357,41 @@
*
* @param theDirName The name of the temporary container installation
* directory
+ * @param theCustomServerDir the directory where the JBoss server
+ * configuration is to be deployed
* @throws IOException If an I/O error occurs
*/
- private void prepare(String theDirName) throws IOException
+ private void prepare(String theDirName, File theCustomServerDir)
+ throws IOException
{
FileUtils fileUtils = FileUtils.newFileUtils();
- // TODO: Find out how to create a valid default server configuration.
- // Copying the server directory does not seem to be enough
+ // If the configDir property has not been set, let's default it to
+ // the default JBoss server configuration directory.
+ File computedConfigDir;
+ if (this.configDir == null)
+ {
+ computedConfigDir = new File(this.dir, "server");
+ }
+ else
+ {
+ computedConfigDir = this.configDir;
+ }
+
+ // Copy the default JBoss server config directory into our custom
+ // server directory.
+ Copy copy = new Copy();
+ copy.setTaskName("cactus");
+ copy.setProject(getProject());
+ copy.setTodir(theCustomServerDir);
+ FileSet srcFiles = new FileSet();
+ srcFiles.setDir(new File(computedConfigDir, this.config));
+ copy.addFileset(srcFiles);
+ copy.execute();
- // deploy the web-app by copying the WAR file into the webapps
+ // Deploy the web-app by copying the WAR file into the webapps
// directory
- File configDir = new File(this.dir, "server");
- File deployDir = new File(configDir, this.config + "/deploy");
+ File deployDir = new File(theCustomServerDir, "/deploy");
fileUtils.copyFile(getDeployableFile().getFile(),
new File(deployDir, getDeployableFile().getFile().getName()),
null, true);
1.38 +13 -0 jakarta-cactus/integration/maven/xdocs/changes.xml
Index: changes.xml
===================================================================
RCS file: /home/cvs/jakarta-cactus/integration/maven/xdocs/changes.xml,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -r1.37 -r1.38
--- changes.xml 8 Jun 2004 07:13:17 -0000 1.37
+++ changes.xml 20 Jun 2004 14:04:12 -0000 1.38
@@ -8,6 +8,19 @@
<body>
<release version="1.7dev" date="in CVS">
+ <action dev="vmassol" type="add" issue="CACTUS-119">
+ Added new <code>cactus.jboss3x.config.dir</code> property which allows
+ users to specify the location of a custom JBoss server configuration
+ to use. This configuration, if specified, will be copied by the
+ <cactus> task to <code>cactus.jboss3x.tmp.dir</code>.
+ </action>
+ <action dev="vmassol" type="add" issue="CACTUS-119">
+ Added new <code>cactus.jboss3x.tmp.dir</code> property which
+ points to where the JBoss server configuration for Cactus will be
+ created. It defaults to
+ <code>${cactus.home.jboss3x}/server/cactus</code>.
+ </action>
+ </action>
<action dev="vmassol" type="add">
Added new <code>cactus.sysproperties</code> property to the
Maven plugin for Cactus to allow passing system properties to
1.22 +22 -0 jakarta-cactus/integration/maven/xdocs/properties.xml
Index: properties.xml
===================================================================
RCS file: /home/cvs/jakarta-cactus/integration/maven/xdocs/properties.xml,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -r1.21 -r1.22
--- properties.xml 8 Jun 2004 07:13:17 -0000 1.21
+++ properties.xml 20 Jun 2004 14:04:12 -0000 1.22
@@ -293,6 +293,28 @@
</td>
</tr>
<tr>
+ <td>cactus.jboss3x.tmp.dir</td>
+ <td>Yes</td>
+ <td>
+ <p>
+ Default tmp directory where the JBoss server configuration for
+ Cactus will be created.
+ Default value is <code>${cactus.home.jboss3x}/server/cactus</code>.
+ </p>
+ </td>
+ </tr>
+ <tr>
+ <td>cactus.jboss3x.config.dir</td>
+ <td>Yes</td>
+ <td>
+ <p>
+ Location of a custom user-specified server configuration which
+ will be copied to <code>cactus.jboss3x.tmp.dir</code> if
+ specified. By default this property is not set.
+ </p>
+ </td>
+ </tr>
+ <tr>
<td>cactus.jboss3x.jndiport</td>
<td>Yes</td>
<td>
1.200 +10 -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.199
retrieving revision 1.200
diff -u -r1.199 -r1.200
--- changes.xml 19 Jun 2004 15:10:52 -0000 1.199
+++ changes.xml 20 Jun 2004 14:04:12 -0000 1.200
@@ -90,6 +90,16 @@
</devs>
<release version="1.7dev" date="in CVS">
+ <action dev="VMA" type="add" issue="CACTUS-119">
+ The <code><jboss3x></code> container element now supports
+ running JBoss in a temporary directory, specified by the
+ <code>tmpdir</code> attribute. In addition, by using the
+ <code>configDir</code> attribute, you can now specify a
+ directory where you have stored a custom JBoss server configuration
+ (identified by the <code>config</code> attribute).
+ This configuration will be copied to the tmp directory and used
+ to configure JBoss.
+ </action>
<action dev="VMA" type="fix" issue="CACTUS-123" due-to="Maxwell
Grender-Jones">
Cactus was failing with a <code>NullPointerException</code> if the
response was not returning any output stream (which happens if
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]