| org.apache.naming.resources.BaseDirContextTestCase
All known Subclasses: org.apache.naming.resources.WARDirContextTestCase, org.apache.naming.resources.FileDirContextTestCase,
BaseDirContextTestCase | abstract public class BaseDirContextTestCase extends TestCase (Code) | | Basic unit tests for the javax.naming.directory.DirContext
implementations. This class must be subclassed for each individual
DirContext implementation.
WARNING: These tests make certain assumptions that
can generate "false negative" results if they are violated:
- The pathname of a directory (or WAR file) containing the static
resources of the
/examples web application shipped
with Tomcat is passed to our test class as a system property
named doc.base .
- The entry names that can be found in the top-level DirContext of
the static resources are enumerated in the
topLevelNames
variable.
- The entry names that can be found in the WEB-INF DirContext of
the static resources are enumerated in the
webInfNames
variable.
- The entry names in either the top-level or WEB-INF DirContext contexts
that should themselves be
DirContext implementations (i.e.
"subdirectories" in the static resources for this web application)
are enumerated in the dirContextNames variable.
author: Craig R. McClanahan version: $Revision: 1.3 $ $Date: 2004/02/27 14:58:55 $ |
Field Summary | |
protected DirContext | context A directory context implementation to be tested. | final protected static String | dirContextNames Entry names that must be DirContexts. | protected String | docBase The pathname of the document base directory for this directory context. | final protected static String | topLevelNames The set of names that should be present in the top-level
directory context. | final protected static String | webInfAttrs The set of names that should be attributes of WEB-INF. | final protected static String | webInfNames The set of names that should be present in the WEB-INF
directory context. | final protected static String | webXmlAttrs The set of names that should be attributes of WEB-INF/web.xml. |
Method Summary | |
protected void | checkList(NamingEnumeration ne, String list) Check the results of a list() call against the specified entry list. | protected void | checkListBindings(NamingEnumeration ne, String list) Check the results of a listBindings() call against the
specified entry list. | protected void | checkWebInfAttributes(Attributes attrs, Date creationDate, long contentLength, String displayName, Date lastModifiedDate) Check the attributes associated with a WEB-INF entry. | protected void | checkWebXmlAttributes(Attributes attrs, Date creationDate, long contentLength, String displayName, Date lastModifiedDate) Check the attributes associated with a WEB-INF/web.xml entry. | protected int | getIndex(String name, String list) Return the index of the specified name in the specified list, or
-1 if the name is not present. | protected boolean | isDirContext(String name) | protected boolean | isListed(String name, String list) Returns true if the specified name is found in the
specified list. | abstract public void | setUp() Set up instance variables required by this test case. | abstract public void | tearDown() Tear down instance variables required by this test case. | abstract public void | testGetAttributesWebInf() Test the attributes returned for the WEB-INF entry. | abstract public void | testGetAttributesWebXml() Test the attributes returned for the WEB-INF/web.xml
entry. | public void | testListBindingsTopLevel() We should be able to list the bindings of the top-level context itself,
and locate some entries we know are there. | public void | testListBindingsWebInfDirect() We should be able to list the bindings of the WEB-INF entry,
and locate some entries we know are there. | public void | testListBindingsWebInfIndirect() We should be able to list the bindings of the WEB-INF entry,
and locate some entries we know are there. | public void | testListTopLevel() We should be able to list the contents of the top-level context itself,
and locate some entries we know are there. | public void | testListWebInfDirect() We should be able to list the contents of the WEB-INF entry,
and locate some entries we know are there. | public void | testListWebInfIndirect() We should be able to list the contents of the WEB-INF entry,
and locate some entries we know are there. |
context | protected DirContext context(Code) | | A directory context implementation to be tested.
|
dirContextNames | final protected static String dirContextNames(Code) | | Entry names that must be DirContexts. Names not on this list are
assumed to be Resources.
|
docBase | protected String docBase(Code) | | The pathname of the document base directory for this directory context.
|
topLevelNames | final protected static String topLevelNames(Code) | | The set of names that should be present in the top-level
directory context.
|
webInfAttrs | final protected static String webInfAttrs(Code) | | The set of names that should be attributes of WEB-INF.
|
webInfNames | final protected static String webInfNames(Code) | | The set of names that should be present in the WEB-INF
directory context.
|
webXmlAttrs | final protected static String webXmlAttrs(Code) | | The set of names that should be attributes of WEB-INF/web.xml.
|
BaseDirContextTestCase | public BaseDirContextTestCase(String name)(Code) | | Construct a new instance of this test case.
Parameters: name - Name of the test case |
checkList | protected void checkList(NamingEnumeration ne, String list) throws NamingException(Code) | | Check the results of a list() call against the specified entry list.
enum The naming enumeration we are checking Parameters: list - The list of entry names we are expecting exception: NamingException - if a naming exception occurs |
checkListBindings | protected void checkListBindings(NamingEnumeration ne, String list) throws NamingException(Code) | | Check the results of a listBindings() call against the
specified entry list.
enum The naming enumeration we are checking Parameters: list - The list of entry names we are expecting exception: NamingException - if a naming exception occurs |
checkWebInfAttributes | protected void checkWebInfAttributes(Attributes attrs, Date creationDate, long contentLength, String displayName, Date lastModifiedDate) throws NamingException(Code) | | Check the attributes associated with a WEB-INF entry.
Parameters: attrs - The attributes for this entry Parameters: creationDate - The creation date for this entry Parameters: contentLength - The content length for this entry Parameters: displayName - The display name for this entry Parameters: lastModifiedDate - The last modified date for this entry |
checkWebXmlAttributes | protected void checkWebXmlAttributes(Attributes attrs, Date creationDate, long contentLength, String displayName, Date lastModifiedDate) throws NamingException(Code) | | Check the attributes associated with a WEB-INF/web.xml entry.
Parameters: attrs - The attributes for this entry Parameters: creationDate - The creation date for this entry Parameters: contentLength - The content length for this entry Parameters: displayName - The display name for this entry Parameters: lastModifiedDate - The last modified date for this entry |
getIndex | protected int getIndex(String name, String list)(Code) | | Return the index of the specified name in the specified list, or
-1 if the name is not present.
Parameters: name - Name to be looked up Parameters: list - List of names to be checked |
isDirContext | protected boolean isDirContext(String name)(Code) | | Is an entry of the specified name supposed to be a DirContext?
Parameters: name - Name to be checked |
isListed | protected boolean isListed(String name, String list)(Code) | | Returns true if the specified name is found in the
specified list.
Parameters: name - Name to be looked up Parameters: list - List to be looked up into |
setUp | abstract public void setUp()(Code) | | Set up instance variables required by this test case. This method
MUST be implemented by a subclass.
|
tearDown | abstract public void tearDown()(Code) | | Tear down instance variables required by this test case. This method
MUST be implemented by a subclass.
|
testGetAttributesWebInf | abstract public void testGetAttributesWebInf()(Code) | | Test the attributes returned for the WEB-INF entry.
|
testGetAttributesWebXml | abstract public void testGetAttributesWebXml()(Code) | | Test the attributes returned for the WEB-INF/web.xml
entry.
|
testListBindingsTopLevel | public void testListBindingsTopLevel()(Code) | | We should be able to list the bindings of the top-level context itself,
and locate some entries we know are there.
|
testListBindingsWebInfDirect | public void testListBindingsWebInfDirect()(Code) | | We should be able to list the bindings of the WEB-INF entry,
and locate some entries we know are there.
|
testListBindingsWebInfIndirect | public void testListBindingsWebInfIndirect()(Code) | | We should be able to list the bindings of the WEB-INF entry,
and locate some entries we know are there.
|
testListTopLevel | public void testListTopLevel()(Code) | | We should be able to list the contents of the top-level context itself,
and locate some entries we know are there.
|
testListWebInfDirect | public void testListWebInfDirect()(Code) | | We should be able to list the contents of the WEB-INF entry,
and locate some entries we know are there.
|
testListWebInfIndirect | public void testListWebInfIndirect()(Code) | | We should be able to list the contents of the WEB-INF entry,
and locate some entries we know are there.
|
|
|