1 16 package org.apache.myfaces.el; 17 18 import org.apache.myfaces.MyFacesBaseTest; 19 20 import java.util.ArrayList ; 21 import java.util.HashMap ; 22 import java.util.List ; 23 import java.util.Map ; 24 25 26 31 public class ELBaseTest extends MyFacesBaseTest 32 { 33 35 protected A _a = new A(); 36 protected A _theA = new A(); 37 protected List _l = new ArrayList (); 38 protected Map _m = new HashMap (); 39 protected Object [] _a0; 40 protected Object [] _a1; 41 42 protected double[] _arrd = {0, 1, 2}; 43 protected int[] _arri = {0, 1, 2}; 44 protected Double [] _arrD = {new Double (0), new Double (1), new Double (2)}; 45 protected Integer [] _arrI = {new Integer (0), new Integer (1), new Integer (2)}; 46 47 49 public ELBaseTest(String name) 50 { 51 super(name); 52 } 53 54 56 protected void setUp() 57 throws Exception 58 { 59 super.setUp(); 60 61 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 [] {new Integer (0), new Integer (1), new Integer (2)}; 80 _a1 = new Object [] {_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 (true)); 88 89 _m.put(new Integer (0), _a0); 90 _m.put(new Long (0), _a0); 91 _m.put(new Long (1), _a1); 92 _m.put("list", _l); 93 _m.put(new Boolean (true), "TRUE"); 94 _m.put(new Boolean (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 (false)); 108 _m.put("t", new Boolean (true)); 109 } 110 } 111 | Popular Tags |