CVS: Tapestry/junit/src/net/sf/tapestry/junit/mock TestImplicitPages.xml,NONE,1.1.2.1 MockTestCase.java,1.10.2.6,1.10.2.7 MockContext.java,1.3.2.1,1.3.2.2 TestPage.xml,1.2,1.2.2.1 MockTester.java,1.8.2.5,1.8.2.6
Howard Lewis Ship <[email protected]>
| Newsgroups | gmane.comp.java.tapestry.cvs |
|---|---|
| Message-ID | <[email protected]> |
Update of /cvsroot/tapestry/Tapestry/junit/src/net/sf/tapestry/junit/mock
In directory sc8-pr-cvs1:/tmp/cvs-serv15280/junit/src/net/sf/tapestry/junit/mock
Modified Files:
Tag: hship-2-3
MockTestCase.java MockContext.java TestPage.xml
MockTester.java
Added Files:
Tag: hship-2-3
TestImplicitPages.xml
Log Message:
Check in support for templates in the application root.
--- NEW FILE: TestImplicitPages.xml ---
<?xml version="1.0" encoding="UTF-8"?>
<!-- $Id: TestImplicitPages.xml,v 1.1.2.1 2002/12/11 14:02:25 hship Exp $ -->
<mock-test>
<context name="c2" root="context2"/>
<servlet name="app" class="net.sf.tapestry.ApplicationServlet">
<init-parameter
name="net.sf.tapestry.application-specification"
value="/net/sf/tapestry/junit/mock/c2/C2.application"/>
</servlet>
<!-- Check that the home service is the default service. -->
<request>
<assert-output name="Title">
<![CDATA[
<title>Implicit Home Page</title>
]]>
</assert-output>
<assert-output name="Text from Home Page">
No page specification.
</assert-output>
</request>
<request>
<parameter name="service" value="page"/>
<parameter name="context" value="WithApplication"/>
<assert-output name="Title">
<![CDATA[
<title>WithApplication Page</title>
]]>
</assert-output>
<assert-output name="Text from Home Page">
This page's specification is a sibling of the app specification.
</assert-output>
</request>
</mock-test>
Index: MockTestCase.java
===================================================================
RCS file: /cvsroot/tapestry/Tapestry/junit/src/net/sf/tapestry/junit/mock/MockTestCase.java,v
retrieving revision 1.10.2.6
retrieving revision 1.10.2.7
diff -C2 -d -r1.10.2.6 -r1.10.2.7
*** MockTestCase.java 8 Dec 2002 15:04:43 -0000 1.10.2.6
--- MockTestCase.java 11 Dec 2002 14:02:24 -0000 1.10.2.7
***************
*** 38,41 ****
--- 38,52 ----
**/
+ public void testImplicitPages()
+ throws Exception
+ {
+ attempt("TestImplicitPages.xml");
+ }
+
+ /**
+ * Test failure for application that doesn't provide a home page.
+ *
+ **/
+
public void testFailNoHome()
throws Exception
Index: MockContext.java
===================================================================
RCS file: /cvsroot/tapestry/Tapestry/junit/src/net/sf/tapestry/junit/mock/MockContext.java,v
retrieving revision 1.3.2.1
retrieving revision 1.3.2.2
diff -C2 -d -r1.3.2.1 -r1.3.2.2
*** MockContext.java 2 Dec 2002 22:37:38 -0000 1.3.2.1
--- MockContext.java 11 Dec 2002 14:02:24 -0000 1.3.2.2
***************
*** 27,31 ****
{
private MockSession _session;
!
private String _servletContextName = "test";
private Map _initParameters = new HashMap();
--- 27,38 ----
{
private MockSession _session;
!
! /**
! * Directory, relative to the current directory (i.e., System property user.dir)
! * that is the context root.
! *
! **/
!
! private String _rootDirectory = "context";
private String _servletContextName = "test";
private Map _initParameters = new HashMap();
***************
*** 58,65 ****
public URL getResource(String path) throws MalformedURLException
{
StringBuffer buffer = new StringBuffer();
buffer.append(System.getProperty("user.dir"));
! buffer.append("/context");
buffer.append(path);
--- 65,79 ----
public URL getResource(String path) throws MalformedURLException
{
+ if (path == null || ! path.startsWith("/"))
+ throw new MalformedURLException("Not a valid context path.");
+
StringBuffer buffer = new StringBuffer();
buffer.append(System.getProperty("user.dir"));
! buffer.append("/");
! buffer.append(_rootDirectory);
!
! // Path has a leading slash
!
buffer.append(path);
***************
*** 182,185 ****
--- 196,209 ----
{
_servletContextName = servletContextName;
+ }
+
+ public String getRootDirectory()
+ {
+ return _rootDirectory;
+ }
+
+ public void setRootDirectory(String rootDirectory)
+ {
+ _rootDirectory = rootDirectory;
}
Index: TestPage.xml
===================================================================
RCS file: /cvsroot/tapestry/Tapestry/junit/src/net/sf/tapestry/junit/mock/TestPage.xml,v
retrieving revision 1.2
retrieving revision 1.2.2.1
diff -C2 -d -r1.2 -r1.2.2.1
*** TestPage.xml 23 Oct 2002 14:29:00 -0000 1.2
--- TestPage.xml 11 Dec 2002 14:02:25 -0000 1.2.2.1
***************
*** 1,5 ****
<?xml version="1.0" encoding="UTF-8"?>
! <!-- $Id -->
--- 1,5 ----
<?xml version="1.0" encoding="UTF-8"?>
! <!-- $Id$ -->
***************
*** 22,34 ****
<assert-output name="Page Title">
! <![CDATA[
! <title>Exception</title>
! ]]>
</assert-output>
-
- <!-- Note: this doesn't seem like the correct message in this situation. -->
<assert-output>
! Page 'Qbert' not found in framework namespace.
</assert-output>
--- 22,32 ----
<assert-output name="Page Title">
! <![CDATA[
! <title>Exception</title>
! ]]>
</assert-output>
<assert-output>
! Page 'Qbert' not found in application namespace.
</assert-output>
***************
*** 39,51 ****
<assert-output name="Page Title">
! <![CDATA[
! <title>Exception</title>
! ]]>
</assert-output>
! <!-- Note: this *ALSO* doesn't seem like the correct message in this situation. -->
<assert-output>
! Service page requires exactly one service parameter.
</assert-output>
</request>
--- 37,49 ----
<assert-output name="Page Title">
! <![CDATA[
! <title>Exception</title>
! ]]>
</assert-output>
! <!-- Note: this doesn't seem like the correct message in this situation. -->
<assert-output>
! Service page requires exactly one service parameter.
</assert-output>
</request>
Index: MockTester.java
===================================================================
RCS file: /cvsroot/tapestry/Tapestry/junit/src/net/sf/tapestry/junit/mock/MockTester.java,v
retrieving revision 1.8.2.5
retrieving revision 1.8.2.6
diff -C2 -d -r1.8.2.5 -r1.8.2.6
*** MockTester.java 7 Dec 2002 13:26:15 -0000 1.8.2.5
--- MockTester.java 11 Dec 2002 14:02:25 -0000 1.8.2.6
***************
*** 186,192 ****
private void setupContext(Element parent)
{
! Element context = parent.getChild("context");
! _context = new MockContext();
if (context == null)
--- 186,192 ----
private void setupContext(Element parent)
{
! _context = new MockContext();
! Element context = parent.getChild("context");
if (context == null)
***************
*** 197,200 ****
--- 197,205 ----
if (name != null)
_context.setServletContextName(name);
+
+ String root = context.getAttributeValue("root");
+
+ if (root != null)
+ _context.setRootDirectory(root);
setInitParameters(context, _context);
-------------------------------------------------------
This sf.net email is sponsored by:
With Great Power, Comes Great Responsibility
Learn to use your power at OSDN's High Performance Computing Channel
http://hpc.devchannel.org/