1 7 package com.inversoft.verge.mvc.view.jsp.actionflow.test; 8 9 10 import javax.servlet.ServletException ; 11 import javax.servlet.jsp.tagext.TagData ; 12 import javax.servlet.jsp.tagext.VariableInfo ; 13 14 import com.inversoft.junit.JspTestCase; 15 import com.inversoft.verge.config.VergeConfigConstants; 16 import com.inversoft.verge.config.servlet.ConfigServlet; 17 import com.inversoft.verge.mvc.view.jsp.actionflow.ATei; 18 19 20 29 public class ATeiTest extends JspTestCase { 30 31 36 public ATeiTest(String name) { 37 super(name); 38 setLocal(true); 39 } 40 41 42 45 public void testWithForm() { 46 if (isLocal()) { 47 getContext().setInitParameter(VergeConfigConstants.CONTEXT_PARAM, 48 "src/com/inversoft/verge/mvc/view/jsp/actionflow/test/test-config.xml"); 49 } 50 51 ConfigServlet cs = new ConfigServlet(); 52 try { 53 cs.init(createConfig("ConfigServlet")); 54 } catch (ServletException se) { 55 fail(se.toString()); 56 } 57 58 ATei tei = new ATei(); 59 Object [][] params = {{"form", "testForm"}, {"namespace", "testNS"}}; 60 TagData data = new TagData (params); 61 assertTrue(tei.isValid(data)); 62 63 VariableInfo [] infos = tei.getVariableInfo(data); 64 assertEquals(1, infos.length); 65 assertEquals("User", infos[0].getVarName()); 66 assertEquals(VariableInfo.NESTED, infos[0].getScope()); 67 } 68 69 72 public void testWithoutForm() { 73 if (isLocal()) { 74 getContext().setInitParameter(VergeConfigConstants.CONTEXT_PARAM, 75 "src/com/inversoft/verge/mvc/view/jsp/actionflow/test/test-config.xml"); 76 } 77 78 ConfigServlet cs = new ConfigServlet(); 79 try { 80 cs.init(createConfig("ConfigServlet")); 81 } catch (ServletException se) { 82 fail(se.toString()); 83 } 84 85 ATei tei = new ATei(); 86 Object [][] params = {{"namespace", "testNS"}}; 87 TagData data = new TagData (params); 88 assertTrue(tei.isValid(data)); 89 90 VariableInfo [] infos = tei.getVariableInfo(data); 91 assertNull(infos); 92 } 93 } | Popular Tags |