KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > cocoon > transformation > FilterTransformerTestCase


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
17 package org.apache.cocoon.transformation;
18
19 import junit.framework.Test;
20 import junit.framework.TestSuite;
21 import junit.textui.TestRunner;
22 import org.apache.avalon.framework.parameters.Parameters;
23 import org.apache.cocoon.SitemapComponentTestCase;
24
25 /**
26  * A simple testcase for FilterTransformer.
27  *
28  * @author <a HREF="mailto:stephan@apache.org">Stephan Michels </a>
29  * @version CVS $Id: FilterTransformerTestCase.java 55454 2004-10-24 18:02:39Z cziegeler $
30  */

31 public class FilterTransformerTestCase extends SitemapComponentTestCase {
32
33     /**
34      * Run this test suite from commandline
35      *
36      * @param args commandline arguments (ignored)
37      */

38     public static void main( String JavaDoc[] args ) {
39         TestRunner.run(suite());
40     }
41     
42     /** Create a test suite.
43      * This test suite contains all test cases of this class.
44      * @return the Test object containing all test cases.
45      */

46     public static Test suite() {
47         TestSuite suite = new TestSuite(FilterTransformerTestCase.class);
48         return suite;
49     }
50
51     /**
52      * Testcase for count=1, blocknr=1
53      */

54     public void testFilter_1_1() throws Exception JavaDoc {
55         getLogger().debug("testFilter_1_1");
56
57         Parameters parameters = new Parameters();
58         parameters.setParameter( "element-name", "leaf" );
59         parameters.setParameter( "count", "1" );
60         parameters.setParameter( "blocknr", "1" );
61
62         String JavaDoc input = "resource://org/apache/cocoon/transformation/filter-input.xml";
63         String JavaDoc result = "resource://org/apache/cocoon/transformation/filter-result-1-1.xml";
64         String JavaDoc src = null;
65         
66         assertEqual(load(result), transform("filter", src, parameters, load(input)));
67     }
68     
69     /**
70      * Testcase for count=3, blocknr=1
71      */

72     public void testFilter_3_1() throws Exception JavaDoc {
73         getLogger().debug("testFilter_3_1");
74         
75         Parameters parameters = new Parameters();
76         parameters.setParameter( "element-name", "leaf" );
77         parameters.setParameter( "count", "3" );
78         parameters.setParameter( "blocknr", "1" );
79         
80         String JavaDoc input = "resource://org/apache/cocoon/transformation/filter-input.xml";
81         String JavaDoc result = "resource://org/apache/cocoon/transformation/filter-result-3-1.xml";
82         String JavaDoc src = null;
83         
84         assertEqual(load(result), transform("filter", src, parameters, load(input)));
85     }
86
87     /**
88      * Testcase for count=1, blocknr=3
89      */

90     public void testFilter_1_3() throws Exception JavaDoc {
91         getLogger().debug("testFilter_1_3");
92         
93         Parameters parameters = new Parameters();
94         parameters.setParameter( "element-name", "leaf" );
95         parameters.setParameter( "count", "1" );
96         parameters.setParameter( "blocknr", "3" );
97         
98         String JavaDoc input = "resource://org/apache/cocoon/transformation/filter-input.xml";
99         String JavaDoc result = "resource://org/apache/cocoon/transformation/filter-result-1-3.xml";
100         String JavaDoc src = null;
101         
102         assertEqual(load(result), transform("filter", src, parameters, load(input)));
103     }
104 }
105
Popular Tags