KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > cocoon > FlowscriptReloadTestCase


1 /*
2  * Copyright 1999-2004 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16 package org.apache.cocoon;
17
18 /**
19  * Check the reloading of flowscript source files.
20  *
21  * @version $Id: $
22  */

23 public class FlowscriptReloadTestCase
24     extends HtmlUnitTestCase
25 {
26     final String JavaDoc pageurl = "/samples/flow/test/";
27     final String JavaDoc flowscriptPath = "samples/flow/test/sendpage.js";
28     final String JavaDoc paramToken = "@REPLACEME@";
29     final String JavaDoc resultXPath = "html/body//p[1]";
30
31     public void testFlowscriptReload()
32         throws Exception JavaDoc
33     {
34         // Copy the flowscript from its source directory to the destination
35
// area, and replace the parameter value with 'abc'
36

37         final String JavaDoc expected1 = "replaceme-abc";
38         copyWebappFile(flowscriptPath, paramToken, expected1);
39         loadHtmlPage(pageurl+"showString");
40         String JavaDoc result1 = evalXPath(resultXPath);
41         assertEquals("Original request", expected1, result1);
42
43         // Copy the flowscript from its source directory to the destination
44
// area, and replace the parameter value with '123'
45

46         final String JavaDoc expected2 = "replaceme-123";
47         copyWebappFile(flowscriptPath, paramToken, expected2);
48         loadHtmlPage(pageurl+"showString");
49         String JavaDoc result2 = evalXPath(resultXPath);
50         assertEquals("After flowscript was modified", expected2, result2);
51     }
52 }
53
Popular Tags