List of usage examples for org.apache.commons.validator Field setProperty
public void setProperty(String property)
From source file:jp.terasoluna.fw.web.struts.form.FieldChecksExTest09.java
/** * testValidateDateRange30()//from w w w . ja v a 2 s . com * <br><br> * * (??n) * <br> * _?FF * <br><br> * l?F(?) bean:Map:<br> * ["field1"=<br> * ?@"2005/01/02"]<br> * (?) va:not null<br> * (?) field:not null<br> * var:datePattern=null<br> * var:datePatternStrict="yyyy/MM/dd"<br> * var:startDate="2005/01/01"<br> * var:endDate="2005/01/03"<br> * Msg("message","message")<br> * property="field1"<br> * (?) errors:not null<br> * (vf)<br> * (?) validator:not null<br> * (?) request:not null<br> * Locale=JAPANESE<br> * * <br> * l?F(l) boolean:true<br> * (?) errors:not null<br> * (vf)<br> * * <br> * ?beanString^???AfieldOv?peB`FbN?smF?B * <br> * * @throws Exception ?\bh?O */ public void testValidateDateRange30() throws Exception { //eXgf?[^? // ++++ beanIuWFNg ++++ Map<String, String> bean = new HashMap<String, String>(); bean.put("field1", "2005/01/02"); // ++++ ??IuWFNg ValidatorAction va = new ValidatorAction(); va.setName("message"); // ++++ ?tB?[h? Field field = new Field(); field.setProperty("field1"); Var var = new Var(); var.setName("datePattern"); var.setValue(null); field.addVar(var); var = new Var(); var.setName("datePatternStrict"); var.setValue("yyyy/MM/dd"); field.addVar(var); var = new Var(); var.setName("startDate"); var.setValue("2005/01/01"); field.addVar(var); var = new Var(); var.setName("endDate"); var.setValue("2005/01/03"); field.addVar(var); // ?bZ?[W? Msg msg = new Msg(); msg.setKey("message"); msg.setName("message"); msg.setResource(false); field.addMsg(msg); // G?[? ActionMessages errors = new ActionMessages(); // [HTTPNGXg MockHttpServletRequest request = new MockHttpServletRequest(); request.setLocale(Locale.JAPANESE); // ValidatorResourcesCX^X ValidatorResources validatorResources = new ValidatorResources(); // ValidatorCX^X Validator validator = new Validator(validatorResources); // eXg?s boolean result = FieldChecksEx.validateDateRange(bean, va, field, errors, validator, request); // eXgmF // truep?B assertTrue(result); // G?[??B assertTrue(errors.isEmpty()); }
From source file:jp.terasoluna.fw.web.struts.form.FieldChecksExTest09.java
/** * testValidateDateRange32()/*from ww w.j av a 2 s .c om*/ * <br><br> * * (??n) * <br> * _?FF * <br><br> * l?F(?) bean:Map:<br> * ["field1"=<br> * ?@"2005/01/05"]<br> * (?) va:not null<br> * (?) field:not null<br> * var:datePattern=null<br> * var:datePatternStrict="yyyy/MM/dd"<br> * var:startDate="2005/01/01"<br> * var:endDate="2005/01/03"<br> * Msg("message","message")<br> * property="field2"<br> * (?) errors:not null<br> * (vf)<br> * (?) validator:not null<br> * (?) request:not null<br> * Locale=JAPANESE<br> * * <br> * l?F(l) boolean:true<br> * (?) errors:not null<br> * (vf)<br> * * <br> * ?beanString^?AfieldOv?peB????AtruemF?B * <br> * * @throws Exception ?\bh?O */ public void testValidateDateRange32() throws Exception { //eXgf?[^? // ++++ beanIuWFNg ++++ Map<String, String> bean = new HashMap<String, String>(); bean.put("field1", "2005/01/05"); // ++++ ??IuWFNg ValidatorAction va = new ValidatorAction(); va.setName("message"); // ++++ ?tB?[h? Field field = new Field(); field.setProperty("field2"); Var var = new Var(); var.setName("datePattern"); var.setValue(null); field.addVar(var); var = new Var(); var.setName("datePatternStrict"); var.setValue("yyyy/MM/dd"); field.addVar(var); var = new Var(); var.setName("startDate"); var.setValue("2005/01/01"); field.addVar(var); var = new Var(); var.setName("endDate"); var.setValue("2005/01/03"); field.addVar(var); // ?bZ?[W? Msg msg = new Msg(); msg.setKey("message"); msg.setName("message"); msg.setResource(false); field.addMsg(msg); // G?[? ActionMessages errors = new ActionMessages(); // [HTTPNGXg MockHttpServletRequest request = new MockHttpServletRequest(); request.setLocale(Locale.JAPANESE); // ValidatorResourcesCX^X ValidatorResources validatorResources = new ValidatorResources(); // ValidatorCX^X Validator validator = new Validator(validatorResources); // eXg?s boolean result = FieldChecksEx.validateDateRange(bean, va, field, errors, validator, request); // eXgmF // truep?B assertTrue(result); // G?[??B assertTrue(errors.isEmpty()); }
From source file:jp.terasoluna.fw.web.struts.form.FieldChecksExTest09.java
/** * testValidateDateRange31()/*from www .j a v a2 s .c om*/ * <br><br> * * (??n) * <br> * _?FF * <br><br> * l?F(?) bean:Map:<br> * ["field1"=<br> * ?@"2005/01/04"]<br> * (?) va:not null<br> * (?) field:not null<br> * var:datePattern=null<br> * var:datePatternStrict="yyyy/MM/dd"<br> * var:startDate="2005/01/01"<br> * var:endDate="2005/01/03"<br> * Msg("message","message")<br> * property="field1"<br> * (?) errors:not null<br> * (vf)<br> * (?) validator:not null<br> * (?) request:not null<br> * Locale=JAPANESE<br> * * <br> * l?F(l) boolean:false<br> * (?) errors:ActionMessage("message")<br> * * <br> * ?beanString^???AfieldOv?peB`FbN?smF?B * <br> * * @throws Exception ?\bh?O */ public void testValidateDateRange31() throws Exception { //eXgf?[^? // ++++ beanIuWFNg ++++ Map<String, String> bean = new HashMap<String, String>(); bean.put("field1", "2005/01/04"); // ++++ ??IuWFNg ValidatorAction va = new ValidatorAction(); va.setName("message"); // ++++ ?tB?[h? Field field = new Field(); field.setProperty("field1"); Var var = new Var(); var.setName("datePattern"); var.setValue(null); field.addVar(var); var = new Var(); var.setName("datePatternStrict"); var.setValue("yyyy/MM/dd"); field.addVar(var); var = new Var(); var.setName("startDate"); var.setValue("2005/01/01"); field.addVar(var); var = new Var(); var.setName("endDate"); var.setValue("2005/01/03"); field.addVar(var); // ?bZ?[W? Msg msg = new Msg(); msg.setKey("message"); msg.setName("message"); msg.setResource(false); field.addMsg(msg); // G?[? ActionMessages errors = new ActionMessages(); // [HTTPNGXg MockHttpServletRequest request = new MockHttpServletRequest(); request.setLocale(Locale.JAPANESE); // ValidatorResourcesCX^X ValidatorResources validatorResources = new ValidatorResources(); // ValidatorCX^X Validator validator = new Validator(validatorResources); // eXg?s boolean result = FieldChecksEx.validateDateRange(bean, va, field, errors, validator, request); // eXgmF // truep?B assertFalse(result); // G?[???B assertEquals(1, errors.size()); Iterator it = errors.get(); ActionMessage message = (ActionMessage) it.next(); assertEquals("message", message.getKey()); }
From source file:jp.terasoluna.fw.web.struts.form.FieldChecksExTest06.java
/** * testValidateArraysIndex22()/*w w w . j av a 2s.c o m*/ * <br><br> * * (??n) * <br> * _?FF * <br><br> * l?F(?) bean:*<br> * (?) va:methodParams?F6S??<br> * name?F"stringLengthArray"<br> * (?) field:property?F"codeArray"<br> * (?) errors:not null<br> * (vf)<br> * (?) validator:not null<br> * (?) request:ANVtH?["logon"<br> * (?) session:L?[?F"logon"l<br> * ActionFormIuWFNg<br> * (?) ActionForm:ArrayList codeArray=null<br> * * <br> * l?F(l) boolean:true<br> * (?) errors:not null<br> * (vf)<br> * * <br> * ??v?peBlnull???AtruemF?B * <br> * * @throws Exception ?\bh?O */ public void testValidateArraysIndex22() throws Exception { //eXgf?[^? // ++++ beanIuWFNg ++++ String bean = null; // ++++ ??IuWFNg ValidatorAction va = new ValidatorAction(); va.setMethodParams(this.validClassStr); va.setName("stringLengthArray"); // ++++ ?tB?[h? Field field = new Field(); field.setProperty("codeArray"); // G?[? ActionMessages errors = new ActionMessages(); // [HTTPNGXg FieldChecksEx_HttpServletRequestImpl01 request = new FieldChecksEx_HttpServletRequestImpl01(); ActionMappingEx mapping = new ActionMappingEx(); mapping.setName("logon"); request.setAttribute(Globals.MAPPING_KEY, mapping); MockHttpSession session = new MockHttpSession(); form.setCodeArray(null); session.setAttribute("logon", form); request.setSession(session); // ValidatorResourcesCX^X ValidatorResources validatorResources = new ValidatorResources(); // ValidatorCX^X Validator validator = new Validator(validatorResources); // eXg?s boolean result = FieldChecksEx.validateArraysIndex(bean, va, field, errors, validator, request); // eXgmF // truep?B assertTrue(result); // G?[??B assertTrue(errors.isEmpty()); }
From source file:jp.terasoluna.fw.web.struts.form.FieldChecksExTest06.java
/** * testValidateArraysIndex24()//from w w w . ja v a 2 s. co m * <br><br> * * (??n) * <br> * _?FF * <br><br> * l?F(?) bean:*<br> * (?) va:6S??<br> * name?F"numberArray"<br> * (?) field:property?FnoIndexedListProperty<br> * (?) errors:not null<br> * (vf)<br> * (?) validator:not null<br> * (?) request:not null<br> * (?) session:not null<br> * (?) ActionForm:noIndexedListPropertytB?[h<br> * ?<br> * * <br> * l?F(l) boolean:true<br> * (?) errors:not null<br> * (vf)<br> * * <br> * ??tB?[h????AtruemF?B * <br> * * @throws Exception ?\bh?O */ public void testValidateArraysIndex24() throws Exception { //eXgf?[^? // ++++ beanIuWFNg ++++ String bean = null; // ++++ ??IuWFNg ValidatorAction va = new ValidatorAction(); va.setMethodParams(this.validClassStr); va.setName("numberArray"); // ++++ ?tB?[h? Field field = new Field(); field.setProperty("noIndexedListProperty"); // G?[? ActionMessages errors = new ActionMessages(); // [HTTPNGXg FieldChecksEx_HttpServletRequestImpl01 request = new FieldChecksEx_HttpServletRequestImpl01(); ActionMappingEx mapping = new ActionMappingEx(); mapping.setName("logon"); request.setAttribute(Globals.MAPPING_KEY, mapping); MockHttpSession session = new MockHttpSession(); String[] testArray = { null }; form.setStringArray(testArray); session.setAttribute("logon", form); request.setSession(session); // ValidatorResourcesCX^X ValidatorResources validatorResources = new ValidatorResources(); // ValidatorCX^X Validator validator = new Validator(validatorResources); // eXg?s boolean result = FieldChecksEx.validateArraysIndex(bean, va, field, errors, validator, request); // eXgmF // truep?B assertTrue(result); // G?[??B assertTrue(errors.isEmpty()); }
From source file:jp.terasoluna.fw.web.struts.form.FieldChecksExTest06.java
/** * testValidateArraysIndex16()/*from w ww . j a v a 2 s . c o m*/ * <br><br> * * (??n) * <br> * _?FF * <br><br> * l?F(?) bean:*<br> * (?) va:methodParams?F6S??<br> * name?F"hankakuString12345"<br> * (?) field:property="codeArray"<br> * arg:position="0",key="##INDEX",resource="false"<br> * (?) errors:not null<br> * (vf)<br> * (?) validator:not null<br> * (?) request:ANVtH?[?F"logon"<br> * (?) session:L?[?F"logon"l<br> * ActionFormIuWFNg<br> * (?) ActionForm:ArrayList codeArray = {<br> * ""<br> * }<br> * * <br> * l?F(l) boolean:true<br> * (?) errors:not null<br> * (vf)<br> * * <br> * ??[??[?iCfbNX`FbNO?j * +5?[?A??smF?B * <br> * * @throws Exception ?\bh?O */ public void testValidateArraysIndex16() throws Exception { //eXgf?[^? // ++++ beanIuWFNg ++++ String bean = null; // ++++ ??IuWFNg ValidatorAction va = new ValidatorAction(); va.setMethodParams(this.validClassStr); va.setName("hankakuString12345"); // ++++ ?tB?[h? Field field = new Field(); field.setProperty("codeArray"); Arg arg0 = new Arg(); arg0.setKey("##INDEX"); arg0.setPosition(0); arg0.setResource(false); field.addArg(arg0); // G?[? ActionMessages errors = new ActionMessages(); // [HTTPNGXg FieldChecksEx_HttpServletRequestImpl01 request = new FieldChecksEx_HttpServletRequestImpl01(); ActionMappingEx mapping = new ActionMappingEx(); mapping.setName("logon"); request.setAttribute(Globals.MAPPING_KEY, mapping); MockHttpSession session = new MockHttpSession(); ArrayList<String> testList = new ArrayList<String>(); testList.add(""); form.setCodeArray(testList); session.setAttribute("logon", form); request.setSession(session); // ValidatorResourcesCX^X ValidatorResources validatorResources = new ValidatorResources(); // ValidatorCX^X Validator validator = new Validator(validatorResources); // eXg?s boolean result = FieldChecksEx.validateArraysIndex(bean, va, field, errors, validator, request); // eXgmF // truep?B assertTrue(result); // G?[??B assertTrue(errors.isEmpty()); }
From source file:jp.terasoluna.fw.web.struts.form.FieldChecksExTest06.java
/** * testValidateArraysIndex17()// w ww.ja va 2 s .c o m * <br><br> * * (??n) * <br> * _?FF * <br><br> * l?F(?) bean:*<br> * (?) va:methodParams?F6S??<br> * name?F"hankakuStringArray"<br> * (?) field:property="codeArray"<br> * arg:position="0",key="##INDEX",resource="false"<br> * (?) errors:not null<br> * (vf)<br> * (?) validator:not null<br> * (?) request:ANVtH?[?F"logon"<br> * (?) session:L?[?F"logon"l<br> * ActionFormIuWFNg<br> * (?) ActionForm:Arraylist codeArray = {<br> * "abc",<br> * ":",<br> * "123",<br> * "*!"",<br> * ""<br> * }<br> * * <br> * l?F(l) boolean:true<br> * (?) errors:not null<br> * (vf)<br> * * <br> * ??v?peB?vfList?G?[vf * ????AtruepmF?B * <br> * * @throws Exception ?\bh?O */ public void testValidateArraysIndex17() throws Exception { //eXgf?[^? // ++++ beanIuWFNg ++++ String bean = null; // ++++ ??IuWFNg ValidatorAction va = new ValidatorAction(); va.setMethodParams(this.validClassStr); va.setName("hankakuStringArray"); // ++++ ?tB?[h? Field field = new Field(); field.setProperty("codeArray"); Arg arg0 = new Arg(); arg0.setKey("##INDEX"); arg0.setPosition(0); arg0.setResource(false); field.addArg(arg0); // G?[? ActionMessages errors = new ActionMessages(); // [HTTPNGXg FieldChecksEx_HttpServletRequestImpl01 request = new FieldChecksEx_HttpServletRequestImpl01(); ActionMappingEx mapping = new ActionMappingEx(); mapping.setName("logon"); request.setAttribute(Globals.MAPPING_KEY, mapping); MockHttpSession session = new MockHttpSession(); ArrayList<String> testList = new ArrayList<String>(); testList.add("abc"); testList.add(":"); testList.add("123"); testList.add("*!\""); testList.add(""); form.setCodeArray(testList); session.setAttribute("logon", form); request.setSession(session); // ValidatorResourcesCX^X ValidatorResources validatorResources = new ValidatorResources(); // ValidatorCX^X Validator validator = new Validator(validatorResources); // eXg?s boolean result = FieldChecksEx.validateArraysIndex(bean, va, field, errors, validator, request); // eXgmF // truep?B assertTrue(result); // G?[??B assertTrue(errors.isEmpty()); }
From source file:jp.terasoluna.fw.web.struts.form.FieldChecksExTest06.java
/** * testValidateArraysIndex14()//www. j a v a 2 s.c o m * <br><br> * * (??n) * <br> * _?FF * <br><br> * l?F(?) bean:*<br> * (?) va:methodParams?F6S??<br> * name?F"stringLengthArray"<br> * msg:key="message",name="stringLengthArray",resource="false"<br> * (?) field:property=testArray<br> * (?) errors:not null<br> * (vf)<br> * (?) validator:not null<br> * (?) request:ANVtH?[?F"logon"<br> * (?) session:L?[?F"logon"l<br> * ActionFormIuWFNg<br> * (?) ActionForm:String testArray="String"<br> * * <br> * l?F(l) boolean:false<br> * (?) errors:ActionMessage("testMessage")<br> * * <br> * ??v?peBz?ACollection^???A * truemF?B * <br> * * @throws Exception ?\bh?O */ public void testValidateArraysIndex14() throws Exception { //eXgf?[^? // ++++ beanIuWFNg ++++ String bean = null; // ++++ ??IuWFNg ValidatorAction va = new ValidatorAction(); va.setMethodParams(this.validClassStr); va.setName("stringLengthArray"); // ++++ ?tB?[h? Field field = new Field(); field.setProperty("testArray"); Msg msg = new Msg(); msg.setKey("message"); msg.setName("stringLengthArray"); msg.setResource(false); field.addMsg(msg); Var var = new Var(); var.setName("stringLength"); var.setValue("3"); field.addVar(var); // G?[? ActionMessages errors = new ActionMessages(); // [HTTPNGXg FieldChecksEx_HttpServletRequestImpl01 request = new FieldChecksEx_HttpServletRequestImpl01(); ActionMappingEx mapping = new ActionMappingEx(); mapping.setName("logon"); request.setAttribute(Globals.MAPPING_KEY, mapping); MockHttpSession session = new MockHttpSession(); form.setTestArray("String"); session.setAttribute("logon", form); request.setSession(session); // ValidatorResourcesCX^X ValidatorResources validatorResources = new ValidatorResources(); // ValidatorCX^X Validator validator = new Validator(validatorResources); // eXg?s boolean result = FieldChecksEx.validateArraysIndex(bean, va, field, errors, validator, request); // eXgmF // falsep?B assertFalse(result); // G?[?1??B assertEquals(1, errors.size()); Iterator it = errors.get(); ActionMessage message = (ActionMessage) it.next(); assertEquals("message", message.getKey()); }
From source file:jp.terasoluna.fw.web.struts.form.FieldChecksExTest06.java
/** * testValidateArraysIndex15()//from w w w.ja v a 2 s. com * <br><br> * * (??n) * <br> * _?FF * <br><br> * l?F(?) bean:*<br> * (?) va:methodParams?F6S??<br> * name?F"stringLengthArray"<br> * (?) field:property="codeArray"<br> * var:stringLength=3<br> * arg:position="0",key="##INDEX",resource="false"<br> * arg:position="1",key="${var:length}",resource="false"<br> * (?) errors:not null<br> * (vf)<br> * (?) validator:not null<br> * (?) request:ANVtH?[?F"logon"<br> * L?[?F"logon"l<br> * ActionFormIuWFNg<br> * (?) session:L?[?F"logon"l?<br> * (?) ActionForm:ArrayList codeArray(List)<br> * * <br> * l?F(l) boolean:true<br> * (?) errors:not null<br> * (vf)<br> * * <br> * ??v?peBList^vf???A * truemF?B * <br> * * @throws Exception ?\bh?O */ public void testValidateArraysIndex15() throws Exception { //eXgf?[^? // ++++ beanIuWFNg ++++ String bean = null; // ++++ ??IuWFNg ValidatorAction va = new ValidatorAction(); va.setMethodParams(this.validClassStr); va.setName("stringLengthArray"); // ++++ ?tB?[h? Field field = new Field(); field.setProperty("codeArray"); Var var = new Var(); var.setName("stringLength"); var.setValue("3"); field.addVar(var); Arg arg0 = new Arg(); arg0.setKey("##INDEX"); arg0.setPosition(0); arg0.setResource(false); field.addArg(arg0); Arg arg1 = new Arg(); arg1.setKey("${var:stringLength}"); arg1.setPosition(1); arg1.setResource(false); field.addArg(arg1); // G?[? ActionMessages errors = new ActionMessages(); // [HTTPNGXg FieldChecksEx_HttpServletRequestImpl01 request = new FieldChecksEx_HttpServletRequestImpl01(); ActionMappingEx mapping = new ActionMappingEx(); mapping.setName("logon"); request.setAttribute(Globals.MAPPING_KEY, mapping); form.setCodeArray(new ArrayList()); request.setAttribute("logon", form); // ValidatorResourcesCX^X ValidatorResources validatorResources = new ValidatorResources(); // ValidatorCX^X Validator validator = new Validator(validatorResources); // eXg?s boolean result = FieldChecksEx.validateArraysIndex(bean, va, field, errors, validator, request); // eXgmF // truep?B assertTrue(result); // G?[??B assertTrue(errors.isEmpty()); }
From source file:jp.terasoluna.fw.web.struts.form.FieldChecksExTest06.java
/** * testValidateArraysIndex18()// w w w . jav a 2s . co m * <br><br> * * (??n) * <br> * _?FF * <br><br> * l?F(?) bean:*<br> * (?) va:methodParams?F6S??<br> * name?F"stringLengthArray"<br> * (?) field:property="stringArray"<br> * var:stringLength="3"<br> * arg:position="0",key="##INDEX",resource="false"<br> * arg:position="1",key="${var:stringLength}",resource="false"<br> * (?) errors:not null<br> * (vf)<br> * (?) validator:not null<br> * (?) request:ANVtH?[?F"logon"<br> * (?) session:L?[?F"logon"l<br> * ActionFormIuWFNg<br> * (?) ActionForm:String[] stringArray<br> * (vf)<br> * * <br> * l?F(l) boolean:true<br> * (?) errors:not null<br> * (vf)<br> * * <br> * ??v?peBz^vf???A * truemF?B * <br> * * @throws Exception ?\bh?O */ public void testValidateArraysIndex18() throws Exception { //eXgf?[^? // ++++ beanIuWFNg ++++ String bean = null; // ++++ ??IuWFNg ValidatorAction va = new ValidatorAction(); va.setMethodParams(this.validClassStr); va.setName("stringLengthArray"); // ++++ ?tB?[h? Field field = new Field(); field.setProperty("stringArray"); Var var = new Var(); var.setName("stringLength"); var.setValue("3"); field.addVar(var); Arg arg0 = new Arg(); arg0.setKey("##INDEX"); arg0.setPosition(0); arg0.setResource(false); field.addArg(arg0); Arg arg1 = new Arg(); arg1.setKey("${var:stringLength}"); arg1.setPosition(1); arg1.setResource(false); field.addArg(arg1); // G?[? ActionMessages errors = new ActionMessages(); // [HTTPNGXg FieldChecksEx_HttpServletRequestImpl01 request = new FieldChecksEx_HttpServletRequestImpl01(); ActionMappingEx mapping = new ActionMappingEx(); mapping.setName("logon"); request.setAttribute(Globals.MAPPING_KEY, mapping); MockHttpSession session = new MockHttpSession(); form.setStringArray(new String[] {}); session.setAttribute("logon", form); request.setSession(session); // ValidatorResourcesCX^X ValidatorResources validatorResources = new ValidatorResources(); // ValidatorCX^X Validator validator = new Validator(validatorResources); // eXg?s boolean result = FieldChecksEx.validateArraysIndex(bean, va, field, errors, validator, request); // eXgmF // truep?B assertTrue(result); // G?[??B assertTrue(errors.isEmpty()); }