You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by pa...@apache.org on 2002/08/16 20:51:20 UTC
cvs commit: jakarta-tomcat-catalina/catalina/src/test/org/apache/naming/resources BaseDirContextTestCase.java
patrickl 2002/08/16 11:51:20
Modified: catalina build.xml
catalina/src/test/org/apache/naming/resources
BaseDirContextTestCase.java
Log:
This patch fixes the JUnit tests in Catalina to run against the ROOT webapp. Now 'ant test' succeeds.
Submitted by: Steve Downey (steve.downey@netfolio.com)
Revision Changes Path
1.18 +1 -1 jakarta-tomcat-catalina/catalina/build.xml
Index: build.xml
===================================================================
RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/build.xml,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- build.xml 15 Aug 2002 13:56:31 -0000 1.17
+++ build.xml 16 Aug 2002 18:51:20 -0000 1.18
@@ -15,7 +15,7 @@
<property name="catalina.dist" value="${catalina.home}/dist"/>
<property name="test.failonerror" value="true"/>
<property name="test.runner" value="junit.textui.TestRunner"/>
- <property name="test.webapp" value="../webapps/build/examples"/>
+ <property name="test.webapp" value="../webapps/build/ROOT"/>
<property name="test.webapp.war" value="${java.io.tmpdir}/webapp.war"/>
<!-- Source dependencies -->
1.2 +41 -42 jakarta-tomcat-catalina/catalina/src/test/org/apache/naming/resources/BaseDirContextTestCase.java
Index: BaseDirContextTestCase.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/test/org/apache/naming/resources/BaseDirContextTestCase.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- BaseDirContextTestCase.java 18 Jul 2002 16:47:31 -0000 1.1
+++ BaseDirContextTestCase.java 16 Aug 2002 18:51:20 -0000 1.2
@@ -139,8 +139,7 @@
* directory context.
*/
protected static final String topLevelNames[] =
- { "images", "jsp", "servlets", "META-INF", "WEB-INF" };
-
+ { "index.jsp", "jakarta-banner.gif", "tomcat.gif", "tomcat-power.gif", "META-INF", "WEB-INF" };
/**
* The set of names that should be present in the WEB-INF
@@ -247,7 +246,7 @@
// Look up the WEB-INF entry
Object webInfEntry = context.lookup("WEB-INF");
assertNotNull("Found WEB-INF entry", webInfEntry);
- assert("WEB-INF entry is a DirContext",
+ assertTrue("WEB-INF entry is a DirContext",
webInfEntry instanceof DirContext);
DirContext webInfContext = (DirContext) webInfEntry;
@@ -303,7 +302,7 @@
// Look up the WEB-INF entry
Object webInfEntry = context.lookup("WEB-INF");
assertNotNull("Found WEB-INF entry", webInfEntry);
- assert("WEB-INF entry is a DirContext",
+ assertTrue("WEB-INF entry is a DirContext",
webInfEntry instanceof DirContext);
DirContext webInfContext = (DirContext) webInfEntry;
@@ -353,20 +352,20 @@
while (ne.hasMore()) {
Object next = ne.next();
- assert("list() returns NameClassPair instances",
+ assertTrue("list() returns NameClassPair instances",
next instanceof NameClassPair);
NameClassPair ncp = (NameClassPair) next;
- assert("Name '" + ncp.getName() + "' is expected",
+ assertTrue("Name '" + ncp.getName() + "' is expected",
isListed(ncp.getName(), list));
if (isDirContext(ncp.getName())) {
- assert("Class '" + ncp.getClassName() + "' is '" +
+ assertTrue("Class '" + ncp.getClassName() + "' is '" +
contextClassName + "'",
contextClassName.equals(ncp.getClassName()));
}
- assert("Relative is 'true'", ncp.isRelative());
+ assertTrue("Relative is 'true'", ncp.isRelative());
}
@@ -391,30 +390,30 @@
while (ne.hasMore()) {
Object next = ne.next();
- assert("listBindings() returns Binding instances",
+ assertTrue("listBindings() returns Binding instances",
next instanceof Binding);
Binding b = (Binding) next;
- assert("Name '" + b.getName() + "' is expected",
+ assertTrue("Name '" + b.getName() + "' is expected",
isListed(b.getName(), list));
if (isDirContext(b.getName())) {
- assert("Class '" + b.getClassName() + "' is '" +
+ assertTrue("Class '" + b.getClassName() + "' is '" +
contextClassName + "'",
contextClassName.equals(b.getClassName()));
}
- assert("Relative is 'true'", b.isRelative());
+ assertTrue("Relative is 'true'", b.isRelative());
Object object = b.getObject();
assertNotNull("Name '" + b.getName() + "' has a non-null object",
object);
- if (b.getName().equals("web.xml")) {
- assert("Entry '" + b.getName() + "' is a Resource",
- object instanceof Resource);
- } else {
- assert("Entry '" + b.getName() + "' is a DirContext",
- object instanceof DirContext);
+ if(isDirContext(b.getName())) {
+ assertTrue("Entry '" + b.getName() + "' is a DirContext",
+ object instanceof DirContext);
+ } else {
+ assertTrue("Entry '" + b.getName() + "' is a Resource",
+ object instanceof Resource);
}
}
@@ -445,35 +444,35 @@
while (ne.hasMore()) {
Object next = ne.next();
- assert("getAll() returns Attribute instances",
+ assertTrue("getAll() returns Attribute instances",
next instanceof Attribute);
Attribute attr = (Attribute) next;
String name = attr.getID();
int index = getIndex(name, webInfAttrs);
- assert("WEB-INF attribute '" + name + "' is expected",
+ assertTrue("WEB-INF attribute '" + name + "' is expected",
index >= 0);
Object value = attr.get();
assertNotNull("get() returned non-null", value);
if (name.equals("creationdate")) {
- assert("Creation date is a date",
+ assertTrue("Creation date is a date",
value instanceof Date);
- assert("Creation date equals " + creationDate,
+ assertTrue("Creation date equals " + creationDate,
creationDate.equals((Date) value));
} else if (name.equals("displayname")) {
- assert("Display name is a string",
+ assertTrue("Display name is a string",
value instanceof String);
- assert("Display name equals " + displayName,
+ assertTrue("Display name equals " + displayName,
displayName.equals((String) value));
} else if (name.equals("getcontentlength")) {
- assert("Content length is a long",
+ assertTrue("Content length is a long",
value instanceof Long);
- assert("Content length equals " + contentLength,
+ assertTrue("Content length equals " + contentLength,
contentLength == ((Long) value).longValue());
} else if (name.equals("getlastmodified")) {
- assert("Last modified date is a date",
+ assertTrue("Last modified date is a date",
value instanceof Date);
- assert("Last modified date is " + lastModifiedDate,
+ assertTrue("Last modified date is " + lastModifiedDate,
lastModifiedDate.equals((Date) value));
}
@@ -505,35 +504,35 @@
while (ne.hasMore()) {
Object next = ne.next();
- assert("getAll() returns Attribute instances",
+ assertTrue("getAll() returns Attribute instances",
next instanceof Attribute);
Attribute attr = (Attribute) next;
String name = attr.getID();
int index = getIndex(name, webXmlAttrs);
- assert("WEB-INF/web.xml attribute '" + name + "' is expected",
+ assertTrue("WEB-INF/web.xml attribute '" + name + "' is expected",
index >= 0);
Object value = attr.get();
assertNotNull("get() returned non-null", value);
if (name.equals("creationdate")) {
- assert("Creation date is a date",
+ assertTrue("Creation date is a date",
value instanceof Date);
- assert("Creation date equals " + creationDate,
+ assertTrue("Creation date equals " + creationDate,
creationDate.equals((Date) value));
} else if (name.equals("displayname")) {
- assert("Display name is a string",
+ assertTrue("Display name is a string",
value instanceof String);
- assert("Display name equals " + displayName,
+ assertTrue("Display name equals " + displayName,
displayName.equals((String) value));
} else if (name.equals("getcontentlength")) {
- assert("Content length is a long",
+ assertTrue("Content length is a long",
value instanceof Long);
- assert("Content length equals " + contentLength,
+ assertTrue("Content length equals " + contentLength,
contentLength == ((Long) value).longValue());
} else if (name.equals("getlastmodified")) {
- assert("Last modified date is a date",
+ assertTrue("Last modified date is a date",
value instanceof Date);
- assert("Last modified date is " + lastModifiedDate,
+ assertTrue("Last modified date is " + lastModifiedDate,
lastModifiedDate.equals((Date) value));
}
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>