CVS: Tapestry/junit/src/net/sf/tapestry/junit/mock TestReset.xml,NONE,1.1.2.1 MockTestCase.java,1.10.2.7,1.10.2.8 TestImplicitPages.xml,1.1.2.1,1.1.2.2

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-serv32677/junit/src/net/sf/tapestry/junit/mock

Modified Files:
      Tag: hship-2-3
	MockTestCase.java TestImplicitPages.xml 
Added Files:
      Tag: hship-2-3
	TestReset.xml 
Log Message:
Finish up code and tests for dynamically locating page specifications and templates.

--- NEW FILE: TestReset.xml ---
<?xml version="1.0" encoding="UTF-8"?>

<!-- $Id: TestReset.xml,v 1.1.2.1 2002/12/12 12:42:38 hship Exp $ -->


<!-- Fill in some code-coverage gaps in the page service. -->

<mock-test>
    <context name="mock"/>

  	<servlet name="app" class="net.sf.tapestry.ApplicationServlet">
  		<init-parameter
  			name="net.sf.tapestry.application-specification"
  			value="/net/sf/tapestry/junit/mock/simple/Simple.application"/>
  	</servlet>
    
	<!-- Reset works just like page service. -->
    
    <request>
    	<parameter name="service" value="reset"/>
    	<parameter name="context" value="Home"/>

	  	<assert-output name="English Language Check">
<![CDATA[
<title>JUnit Simple Home Page</title>
]]>
		</assert-output>
		
		<assert-output name="English Blurb">
The start of the JUnit test suite: JUnit Simple Application.
		</assert-output>
	</request>		
		
	<!-- Test that the page name argument is honored.  Test
	     fabrication of service URL for reset service. -->
	     
  	<request>
  		<parameter name="service" value="reset"/>
  		<parameter name="context" value="Two"/>
  		
	
		<assert-output name="Reset Link">
<![CDATA[		
<a href="/mock/app?service=reset&amp;context=Two">reset caching</a>
]]>
		</assert-output>
		  		
	</request>	
	
	<!-- Test missing page -->
	
	<request>
		<parameter name="service" value="reset"/>
		<parameter name="context" value="Qbert"/>
		
		<assert-output name="Page Title">
<![CDATA[
<title>Exception</title>
]]>
		</assert-output>
		
		<assert-output name="Error Message">
Page 'Qbert' not found in application namespace.
		</assert-output>
				
	</request>			
	
	<!-- Test wrong number of context parameters. -->
	
	<request>
		<parameter name="service" value="reset"/>
		
		<assert-output name="Page Title">
<![CDATA[
<title>Exception</title>
]]>
		</assert-output>
		
		<assert-output name="Error Message">
Service reset requires exactly one service parameter.
		</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.7
retrieving revision 1.10.2.8
diff -C2 -d -r1.10.2.7 -r1.10.2.8
*** MockTestCase.java	11 Dec 2002 14:02:24 -0000	1.10.2.7
--- MockTestCase.java	12 Dec 2002 12:42:38 -0000	1.10.2.8
***************
*** 33,36 ****
--- 33,55 ----
      }
  
+     // Note: JUnit runs tests in order they are defined here.  I typically
+     // add new tests first since they run first that way.  Perhaps at some
+     // point, I will order them differently (though since they all pass,
+     // the order isn't that important).
+     
+     // Should also look at JUnit documentation; perhaps there's a way to
+     // implicitly define tests based on the found XML files?  Possibly
+     // in a static suite() method.
+     
+     /**
+      *  Test the reset service.
+      *
+      **/
+     
+     public void testReset() throws Exception
+     {
+         attempt("TestReset.xml");
+     }
+ 
      /**
       *  Test failure for application that doesn't provide a home page.

Index: TestImplicitPages.xml
===================================================================
RCS file: /cvsroot/tapestry/Tapestry/junit/src/net/sf/tapestry/junit/mock/Attic/TestImplicitPages.xml,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -C2 -d -r1.1.2.1 -r1.1.2.2
*** TestImplicitPages.xml	11 Dec 2002 14:02:25 -0000	1.1.2.1
--- TestImplicitPages.xml	12 Dec 2002 12:42:38 -0000	1.1.2.2
***************
*** 37,46 ****
  		</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>
      	
--- 37,128 ----
  		</assert-output>		
  
! 		<assert-output name="Text from page">
  This page's specification is a sibling of the app specification.
  		</assert-output>
  				
  	</request>	
! 			
! 	<request>
! 		<parameter name="service" value="page"/>
! 		<parameter name="context" value="InPages"/>
! 		
! 		<assert-output name="Title">
! <![CDATA[
! <title>InPages Page</title>
! ]]>
! 		</assert-output>		
! 
! 		<assert-output name="Text from page">
! The specification, and properties files, are located in WEB-INF/pages.
! 		</assert-output>
! 				
! 	</request>
! 	
! 	<request>
! 		<parameter name="service" value="page"/>
! 		<parameter name="context" value="InWebInf"/>
! 		
! 		<assert-output name="Title">
! <![CDATA[
! <title>InWebInf Page</title>
! ]]>
! 		</assert-output>		
! 
! 		<assert-output name="Text from page">
! The specification, and properties files, are located in directly in WEB-INF.
! 		</assert-output>
! 				
! 	</request>	
! 	
! 	<request>
! 		<parameter name="service" value="page"/>
! 		<parameter name="context" value="InAppRoot"/>
! 		
! 		<assert-output name="Title">
! <![CDATA[
! <title>InAppRoot Page</title>
! ]]>
! 		</assert-output>		
! 
! 		<assert-output name="Text from page">
! The specification, and properties files, are located in the application root.
! 		</assert-output>
! 				
! 	</request>	
! 	
! 		
! 	<request>
! 		<parameter name="service" value="page"/>
! 		<parameter name="context" value="StaleLink"/>
! 		
! 		<assert-output name="Title">
! <![CDATA[
! <title>Application StaleLink Page</title>
! ]]>
! 		</assert-output>		
! 
! 		<assert-output name="Text from page">
! This is an application-provided version of the StaleLink page.
! 		</assert-output>
! 				
! 	</request>	
! 	
! 	<request>
! 		<parameter name="service" value="page"/>
! 		<parameter name="context" value="framework:StaleLink"/>
! 		
! 		<assert-output name="Title">
! <![CDATA[
! <title>Stale Link</title>
! ]]>
! 		</assert-output>		
! 
! 		<assert-output name="Text from page">
! <![CDATA[
! You have clicked on a <i>stale link</i>.
! ]]>
! 		</assert-output>
! 				
! 	</request>							 	 	 
  </mock-test>
      	



-------------------------------------------------------
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/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.