KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > myfaces > el > ELBaseTest


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.myfaces.el;
17
18 import org.apache.myfaces.MyFacesBaseTest;
19
20 import java.util.ArrayList JavaDoc;
21 import java.util.HashMap JavaDoc;
22 import java.util.List JavaDoc;
23 import java.util.Map JavaDoc;
24
25
26 /**
27  * @author Manfred Geiler (latest modification by $Author: matze $)
28  * @author Anton Koinov
29  * @version $Revision: 1.6 $ $Date: 2004/10/13 11:50:59 $
30  */

31 public class ELBaseTest extends MyFacesBaseTest
32 {
33     //~ Instance fields ----------------------------------------------------------------------------
34

35     protected A _a = new A();
36     protected A _theA = new A();
37     protected List JavaDoc _l = new ArrayList JavaDoc();
38     protected Map JavaDoc _m = new HashMap JavaDoc();
39     protected Object JavaDoc[] _a0;
40     protected Object JavaDoc[] _a1;
41     
42     protected double[] _arrd = {0, 1, 2};
43     protected int[] _arri = {0, 1, 2};
44     protected Double JavaDoc[] _arrD = {new Double JavaDoc(0), new Double JavaDoc(1), new Double JavaDoc(2)};
45     protected Integer JavaDoc[] _arrI = {new Integer JavaDoc(0), new Integer JavaDoc(1), new Integer JavaDoc(2)};
46
47     //~ Constructors -------------------------------------------------------------------------------
48

49     public ELBaseTest(String JavaDoc name)
50     {
51         super(name);
52     }
53
54     //~ Methods ------------------------------------------------------------------------------------
55

56     protected void setUp()
57     throws Exception JavaDoc
58     {
59         super.setUp();
60
61         /*
62         _httpServletRequest.setAttribute("theA", _theA);
63         _httpServletRequest.setAttribute("a", _a);
64         */

65         _application.setVariableResolver(
66             new VariableResolverImpl()
67             {
68                 {
69                     _implicitObjects.put("theA", _theA);
70                     _implicitObjects.put("a", _a);
71                     _implicitObjects.put("testmap", _m);
72                     _implicitObjects.put("arrd", _arrd);
73                     _implicitObjects.put("arri", _arri);
74                     _implicitObjects.put("arrD", _arrD);
75                     _implicitObjects.put("arrI", _arrI);
76                 }
77             });
78
79         _a0 = new Object JavaDoc[] {new Integer JavaDoc(0), new Integer JavaDoc(1), new Integer JavaDoc(2)};
80         _a1 = new Object JavaDoc[] {_a0, null};
81
82         _l.add(0, _a0);
83         _l.add(1, _a1);
84         _l.add(2, "hello");
85         _l.add(3, new D("testClass"));
86         _l.add(4, _m);
87         _l.add(5, new Boolean JavaDoc(true));
88
89         _m.put(new Integer JavaDoc(0), _a0);
90         _m.put(new Long JavaDoc(0), _a0);
91         _m.put(new Long JavaDoc(1), _a1);
92         _m.put("list", _l);
93         _m.put(new Boolean JavaDoc(true), "TRUE");
94         _m.put(new Boolean JavaDoc(false), "FALSE");
95         _m.put("true_", "TRUE_");
96         _m.put("false_", "FALSE_");
97         _m.put("o", new D("OBJECT"));
98         _m.put("o0", new D(_a0));
99         _m.put("o1", new D(_a1));
100         _m.put("map", _m);
101         _m.put("David's", _m);
102         _m.put("my]bracket[", _m);
103         _m.put("my\\]bracket[", _m);
104         _m.put("my\\\\]bracket[", _m);
105         _m.put("\\]true[", "_TRUE_");
106         _m.put("\\]false[", "_FALSE_");
107         _m.put("f", new Boolean JavaDoc(false));
108         _m.put("t", new Boolean JavaDoc(true));
109     }
110 }
111
Popular Tags