You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cactus-dev@jakarta.apache.org by vm...@apache.org on 2003/10/25 23:05:49 UTC
cvs commit: jakarta-cactus/integration/ant/src/test/org/apache/cactus/integration/ant/container TestEarParser.java
vmassol 2003/10/25 14:05:49
Modified: integration/ant/src/java/org/apache/cactus/integration/ant/container
Tag: CACTUS_15_BRANCH EarParser.java
integration/ant/src/test/org/apache/cactus/integration/ant/container
Tag: CACTUS_15_BRANCH TestEarParser.java
Log:
Reverted previous change according to Chris's comment that Cactus is a quality tool and thus should enforce best practices. <context-root> is not optional.
Revision Changes Path
No revision
No revision
1.1.2.2 +4 -4 jakarta-cactus/integration/ant/src/java/org/apache/cactus/integration/ant/container/EarParser.java
Index: EarParser.java
===================================================================
RCS file: /home/cvs/jakarta-cactus/integration/ant/src/java/org/apache/cactus/integration/ant/container/EarParser.java,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -u -r1.1.2.1 -r1.1.2.2
--- EarParser.java 25 Oct 2003 17:22:05 -0000 1.1.2.1
+++ EarParser.java 25 Oct 2003 21:05:48 -0000 1.1.2.2
@@ -163,9 +163,9 @@
if (context == null)
{
// The application.xml does not define a <context-root> element.
- // We will thus assume that the root context is the webUri
- // retrieved above minus the extension.
- context = theWebUri.substring(0, theWebUri.length() - 4);
+ // This is wrong!
+ throw new BuildException("Your application.xml must define a "
+ + "<context-root> element in the <web> module definition.");
}
// Remove leading "/" if there is one.
No revision
No revision
1.1.2.2 +13 -8 jakarta-cactus/integration/ant/src/test/org/apache/cactus/integration/ant/container/TestEarParser.java
Index: TestEarParser.java
===================================================================
RCS file: /home/cvs/jakarta-cactus/integration/ant/src/test/org/apache/cactus/integration/ant/container/TestEarParser.java,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -u -r1.1.2.1 -r1.1.2.2
--- TestEarParser.java 25 Oct 2003 17:22:06 -0000 1.1.2.1
+++ TestEarParser.java 25 Oct 2003 21:05:49 -0000 1.1.2.2
@@ -58,6 +58,7 @@
import org.apache.cactus.integration.ant.deployment.ApplicationXml;
import org.apache.cactus.integration.ant.deployment.EarArchive;
+import org.apache.tools.ant.BuildException;
import com.mockobjects.dynamic.Mock;
@@ -124,19 +125,23 @@
/**
* Verify that if the <code>application.xml</code> does not define a
- * <code>context-root</code> element, then Cactus will use the web URI
- * as the test context (minus the ".war" extension). This test context
- * is used when polling the container to see if it is started.
+ * <code>context-root</code> element, an exception is raised.
*
* @exception Exception on error
*/
- public void testParseTestContextWhenNoWebUriInApplicationXml()
+ public void testParseTestContextWhenNoWebUriInApplicationXml()
throws Exception
{
mockApplicationXml.expectAndReturn("getWebModuleContextRoot",
"test.war", null);
-
- String context = EarParser.parseTestContext(archive, "test.war");
- assertEquals("test", context);
+
+ try
+ {
+ EarParser.parseTestContext(archive, "test.war");
+ }
+ catch (BuildException expected)
+ {
+ assertTrue(true);
+ }
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: cactus-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: cactus-dev-help@jakarta.apache.org