KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > pluto > portalImpl > portlet > TestConfigFactory


1 /*
2  * Copyright 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.pluto.portalImpl.portlet;
17
18 import java.io.IOException JavaDoc;
19 import java.io.InputStream JavaDoc;
20 import java.util.List JavaDoc;
21
22 import org.apache.commons.digester.Digester;
23 import org.xml.sax.SAXException JavaDoc;
24
25 /**
26  * @author <a HREF="ddewolf@apache.com">David H. DeWolf</a>
27  *
28  */

29 public class TestConfigFactory {
30
31     private Digester digester = new Digester();
32
33     public TestConfigFactory() {
34         digester = new Digester();
35         digester.addObjectCreate("testportlet-config",
36                                  java.util.ArrayList JavaDoc.class);
37
38
39         digester.addObjectCreate("testportlet-config/testsuite-config",
40                                  TestConfig.class);
41
42         digester.addBeanPropertySetter("testportlet-config/testsuite-config/name",
43                                        "name");
44
45         digester.addBeanPropertySetter("testportlet-config/testsuite-config/class",
46                                        "testClassName");
47
48         digester.addBeanPropertySetter("testportlet-config/testsuite-config/display-uri",
49                                        "displayURI");
50
51         digester.addCallMethod("testportlet-config/testsuite-config/init-param", "addInitParameter", 2);
52         digester.addCallParam("testportlet-config/testsuite-config/init-param/name", 0);
53         digester.addCallParam("testportlet-config/testsuite-config/init-param/value", 1);
54
55         digester.addCallMethod("testportlet-config/testsuite-config/action-param", "addActionParameter", 2);
56         digester.addCallParam("testportlet-config/testsuite-config/action-param/name", 0);
57         digester.addCallParam("testportlet-config/testsuite-config/action-param/value", 1);
58
59         digester.addCallMethod("testportlet-config/testsuite-config/render-param", "addRenderParameter", 2);
60         digester.addCallParam("testportlet-config/testsuite-config/render-param/name", 0);
61         digester.addCallParam("testportlet-config/testsuite-config/render-param/value", 1);
62
63         digester.addSetRoot("testportlet-config/testsuite-config",
64                             "add");
65
66     }
67
68     public List JavaDoc createTests(InputStream JavaDoc in)
69     throws SAXException JavaDoc, IOException JavaDoc {
70         return (List JavaDoc)digester.parse(in);
71     }
72 }
73
Popular Tags