Java tutorial
/* * Copyright (c) 2007 NTT DATA Corporation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package jp.terasoluna.fw.web.struts.form; import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; import javax.servlet.http.HttpServletRequest; import jp.terasoluna.fw.web.struts.action.ActionMappingEx; import jp.terasoluna.utlib.DynaActionFormCreator; import jp.terasoluna.utlib.LogUTUtil; import jp.terasoluna.utlib.MockHttpServletRequest; import jp.terasoluna.utlib.MockHttpSession; import jp.terasoluna.utlib.PropertyTestCase; import jp.terasoluna.utlib.UTUtil; import org.apache.commons.validator.Arg; import org.apache.commons.validator.Field; import org.apache.commons.validator.Msg; import org.apache.commons.validator.Validator; import org.apache.commons.validator.ValidatorAction; import org.apache.commons.validator.ValidatorResources; import org.apache.commons.validator.Var; import org.apache.struts.Globals; import org.apache.struts.action.ActionMessage; import org.apache.struts.action.ActionMessages; /** * {@link jp.terasoluna.fw.web.struts.form.FieldChecksEx} * NXubN{bNXeXg?B * * <p> * <h4>?yNXTv?z</h4> * Validator?[NX?B * <p> * * @see jp.terasoluna.fw.web.struts.form.FieldChecksEx */ public class FieldChecksExTest06 extends PropertyTestCase { /** * NXeXggpDynaValidatorActionFormEx?t@C?B */ private static final String CONFIG_FILE_NAME = FieldChecksExTest06.class.getResource("FieldChecksExTest.xml") .getPath(); /** * DynaValidatorActionFormEx??digester?[t@C?B */ private final static String RULES_FILE_NAME = FieldChecksExTest06.class .getResource("FieldChecksExTest-rules.xml").getPath(); /** * DynaValidatorActionFormEx??NX?B */ private static final DynaActionFormCreator creator = new DynaActionFormCreator(RULES_FILE_NAME); /** * eXggpDynaValidatorActionFormExCX^X?B */ private DynaValidatorActionFormEx formEx = null; /** * ???^Xg?B */ public Class[] validClassList = { Object.class, ValidatorAction.class, Field.class, ActionMessages.class, Validator.class, HttpServletRequest.class }; /** * ????B */ public String validClassStr = "java.lang.Object," + "org.apache.commons.validator.ValidatorAction," + "org.apache.commons.validator.Field," + "org.apache.struts.action.ActionMessages," + "org.apache.commons.validator.Validator," + "javax.servlet.http.HttpServletRequest"; /** * eXggpANVtH?[?B */ FieldChecksEx_ValidatorActionFormExStub01 form = null; /** * eXgP?[X?s * GUI AvP?[VN?B * * @param args java R}h?p??[^ */ public static void main(String[] args) { junit.swingui.TestRunner.run(FieldChecksExTest06.class); } /** * ????s?B * * @throws Exception ?\bh?O * @see jp.terasoluna.utlib.spring.PropertyTestCase#setUpData() */ @Override protected void setUpData() throws Exception { LogUTUtil.flush(); deleteProperty("validation.hankaku.kana.list"); deleteProperty("validation.zenkaku.kana.list"); form = new FieldChecksEx_ValidatorActionFormExStub01(); } /** * ?I???s?B * * @throws Exception ?\bh?O * @see jp.terasoluna.utlib.spring.PropertyTestCase#cleanUpData() */ @Override protected void cleanUpData() throws Exception { } /** * RXgN^?B * * @param name eXgP?[XO?B */ public FieldChecksExTest06(String name) { super(name); } /** * testValidateArraysIndex01() * <br><br> * * (?n) * <br> * _?FC,F * <br><br> * l?F(?) bean:*<br> * (?) va:*<br> * (?) field:var:indexedListProperty=null<br> * (?) errors:not null<br> * (vf)<br> * (?) validator:not null<br> * (?) request:not null<br> * (?) session:not null<br> * (?) ActionForm:not null<br> * * <br> * l?F(l) boolean:true<br> * (?) errors:not null<br> * (vf)<br> * * <br> * fieldindexedListPropertynull?AtruemF?B * <br> * * @throws Exception ?\bh?O */ // public void testValidateArraysIndex01() throws Exception { // //eXgf?[^? // // ++++ beanIuWFNg ++++ // String bean = null; // // ++++ ??IuWFNg // ValidatorAction va = new ValidatorAction(); // // ++++ ?tB?[h? // Field field = new Field(); // field.setIndexedListProperty(null); // // G?[? // ActionMessages errors = new ActionMessages(); // // [HTTPNGXg // HttpServletRequest request = new MockHttpServletRequest(); // // // 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()); // } /** * testValidateArraysIndex02() * <br><br> * * (?n) * <br> * _?FC,F * <br><br> * l?F(?) bean:*<br> * (?) va:*<br> * (?) field:var:indexedListProperty=""<br> * (?) errors:not null<br> * (vf)<br> * (?) validator:not null<br> * (?) request:not null<br> * (?) session:not null<br> * (?) ActionForm:not null<br> * * <br> * l?F(l) boolean:true<br> * (?) errors:not null<br> * (vf)<br> * * <br> * fieldindexedListProperty?A * truemF?B * <br> * * @throws Exception ?\bh?O */ // public void testValidateArraysIndex02() throws Exception { // //eXgf?[^? // // ++++ beanIuWFNg ++++ // String bean = null; // // // ++++ ??IuWFNg // ValidatorAction va = new ValidatorAction(); // // // ++++ ?tB?[h? // Field field = new Field(); // field.setIndexedListProperty(""); // // // G?[? // ActionMessages errors = new ActionMessages(); // // [HTTPNGXg // HttpServletRequest request = new MockHttpServletRequest(); // // // 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()); // } /** * testValidateArraysIndex03() * <br><br> * * (?n) * <br> * _?FF * <br><br> * l?F(?) bean:*<br> * (?) va:methodParams?FXg<br> * name?Fnot null<br> * (?) field:not null<br> * (?) errors:not null<br> * (vf)<br> * (?) validator:not null<br> * (?) request:not null<br> * (?) session:not null<br> * (?) ActionForm:not null<br> * * <br> * l?F(l) boolean:true<br> * (?) ?O:?Ox?FG?[<br> * Class pattern length is zero.<br> * (?) errors:not null<br> * (vf)<br> * * <br> * vamethodParamsXg???AtruemF?B<br> * ?getParamClasseXg * <br> * * @throws Exception ?\bh?O */ public void testValidateArraysIndex03() throws Exception { //eXgf?[^? // ++++ beanIuWFNg ++++ String bean = null; // ++++ ??IuWFNg ValidatorAction va = new ValidatorAction(); va.setMethodParams(""); // ++++ ?tB?[h? Field field = new Field(); // G?[? ActionMessages errors = new ActionMessages(); // [HTTPNGXg HttpServletRequest request = new MockHttpServletRequest(); // 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()); // G?[?O`FbN assertTrue(LogUTUtil.checkError("Class pattern length is zero.")); } /** * testValidateArraysIndex04() * <br><br> * * (?n) * <br> * _?FF * <br><br> * l?F(?) bean:*<br> * (?) va:methodParams?FtestClass<br> * ?NX<br> * (?) field:not null<br> * (?) errors:not null<br> * (vf)<br> * (?) validator:not null<br> * (?) request:not null<br> * (?) session:not null<br> * (?) ActionForm:not null<br> * * <br> * l?F(l) boolean:true<br> * (?) ?O:?Ox?FG?[<br> * ONX?FClassNotFoundException<br> * ?Ox?FG?[<br> * ?bZ?[W?F<br> * "Can not get class pattern."<br> * (?) errors:not null<br> * (vf)<br> * * <br> * vamethodParams?NX???A * truemF?B<br> * ?getParamClasseXg * <br> * * @throws Exception ?\bh?O */ public void testValidateArraysIndex04() throws Exception { //eXgf?[^? // ++++ beanIuWFNg ++++ String bean = null; // ++++ ??IuWFNg ValidatorAction va = new ValidatorAction(); va.setMethodParams("testClass"); // ++++ ?tB?[h? Field field = new Field(); // G?[? ActionMessages errors = new ActionMessages(); // [HTTPNGXg HttpServletRequest request = new MockHttpServletRequest(); // 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()); // G?[?O`FbN assertTrue(LogUTUtil.checkError("", new ClassNotFoundException())); assertTrue(LogUTUtil.checkError("Can not get class pattern.")); } /** * testValidateArraysIndex05() * <br><br> * * (?n) * <br> * _?FC,F * <br><br> * l?F(?) bean:*<br> * (?) va:methodParams?F6S??<br> * name?Fnull<br> * (?) field:not null<br> * (?) errors:not null<br> * (vf)<br> * (?) validator:not null<br> * (?) request:not null<br> * (?) session:not null<br> * (?) ActionForm:not null<br> * * <br> * l?F(l) boolean:true<br> * (?) ?O:?Ox?FG?[<br> * ?bZ?[W?F<br> * "Can not get validateMethod."<br> * (?) errors:not null<br> * (vf)<br> * * <br> * vanamenull?AtruemF?B * <br> * * @throws Exception ?\bh?O */ public void testValidateArraysIndex05() throws Exception { //eXgf?[^? // ++++ beanIuWFNg ++++ String bean = null; // ++++ ??IuWFNg ValidatorAction va = new ValidatorAction(); va.setMethodParams(this.validClassStr); va.setName(null); // ++++ ?tB?[h? Field field = new Field(); // G?[? ActionMessages errors = new ActionMessages(); // [HTTPNGXg HttpServletRequest request = new MockHttpServletRequest(); // 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()); // G?[?O`FbN assertTrue(LogUTUtil.checkError("Can not get validateMethod.")); } /** * testValidateArraysIndex06() * <br><br> * * (?n) * <br> * _?FC,F * <br><br> * l?F(?) bean:*<br> * (?) va:methodParams?F6S??<br> * name?F""<br> * (?) field:not null<br> * (?) errors:not null<br> * (vf)<br> * (?) validator:not null<br> * (?) request:not null<br> * (?) session:not null<br> * (?) ActionForm:not null<br> * * <br> * l?F(l) boolean:true<br> * (?) ?O:?Ox?FG?[<br> * ?bZ?[W?F<br> * "Can not get validateMethod."<br> * (?) errors:not null<br> * (vf)<br> * * <br> * vaname?AtruemF?B * <br> * * @throws Exception ?\bh?O */ public void testValidateArraysIndex06() throws Exception { //eXgf?[^? // ++++ beanIuWFNg ++++ String bean = null; // ++++ ??IuWFNg ValidatorAction va = new ValidatorAction(); va.setMethodParams(this.validClassStr); va.setName(""); // ++++ ?tB?[h? Field field = new Field(); // G?[? ActionMessages errors = new ActionMessages(); // [HTTPNGXg HttpServletRequest request = new MockHttpServletRequest(); // 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()); // G?[?O`FbN assertTrue(LogUTUtil.checkError("Can not get validateMethod.")); } /** * testValidateArraysIndex07() * <br><br> * * (?n) * <br> * _?FC,F * <br><br> * l?F(?) bean:*<br> * (?) va:methodParams?F6S??<br> * name?F"testArray"<br> * (?) field:not null<br> * (?) errors:not null<br> * (vf)<br> * (?) validator:not null<br> * (?) request:not null<br> * (?) session:not null<br> * (?) ActionForm:not null<br> * * <br> * l?F(l) boolean:true<br> * (?) ?O:?Ox?FG?[<br> * ONX?F<br> * NoSuchMethodException<br> * ?Ox?FG?[<br> * ?bZ?[W?F<br> * "Can not get validateMethod."<br> * (?) errors:not null<br> * (vf)<br> * * <br> * vaname?\bhFieldChecksEx?A * ValidWhen????AtruemF?B * <br> * * @throws Exception ?\bh?O */ public void testValidateArraysIndex07() throws Exception { //eXgf?[^? // ++++ beanIuWFNg ++++ String bean = null; // ++++ ??IuWFNg ValidatorAction va = new ValidatorAction(); va.setMethodParams(this.validClassStr); va.setName("testArray"); // ++++ ?tB?[h? Field field = new Field(); // G?[? ActionMessages errors = new ActionMessages(); // [HTTPNGXg HttpServletRequest request = new MockHttpServletRequest(); // 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()); // G?[?O`FbN assertTrue(LogUTUtil.checkError("", new NoSuchMethodException())); assertTrue(LogUTUtil.checkError("Can not get validateMethod.")); } /** * testValidateArraysIndex08() * <br><br> * * (?n) * <br> * _?FF * <br><br> * l?F(?) bean:*<br> * (?) va:methodParams?F"java.lang.String"<br> * name?F"stringLengthArray"<br> * (?) field:not null<br> * (?) errors:not null<br> * (vf)<br> * (?) validator:not null<br> * (?) request:not null<br> * (?) session:not null<br> * (?) ActionForm:not null<br> * * <br> * l?F(l) boolean:true<br> * (?) ?O:?Ox?FG?[<br> * ONX?F<br> * NoSuchMethodException<br> * ?Ox?FG?[<br> * ?bZ?[W?F<br> * "Can not get validateMethod."<br> * (?) errors:not null<br> * (vf)<br> * * <br> * va?`FbN?\bh??A * methodParamsw?v???A * truemF?B * <br> * * @throws Exception ?\bh?O */ public void testValidateArraysIndex08() throws Exception { //eXgf?[^? // ++++ beanIuWFNg ++++ String bean = null; // ++++ ??IuWFNg ValidatorAction va = new ValidatorAction(); va.setMethodParams("java.lang.String"); va.setName("stringLengthArray"); // ++++ ?tB?[h? Field field = new Field(); // G?[? ActionMessages errors = new ActionMessages(); // [HTTPNGXg HttpServletRequest request = new MockHttpServletRequest(); // 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()); // G?[?O`FbN assertTrue(LogUTUtil.checkError("", new NoSuchMethodException())); assertTrue(LogUTUtil.checkError("Can not get validateMethod.")); } /** * testValidateArraysIndex09() * <br><br> * * (?n) * <br> * _?FF * <br><br> * l?F(?) bean:*<br> * (?) va:methodParams?F6??<br> * name?F"stringLengthArray"<br> * (?) field:not null<br> * (?) errors:not null<br> * (vf)<br> * (?) validator:not null<br> * (?) request:not null<br> * (?) session:not null<br> * (?) ActionForm:not null<br> * * <br> * l?F(l) boolean:true<br> * (?) ?O:?Ox?FG?[<br> * ONX?F<br> * NoSuchMethodException<br> * ?Ox?FG?[<br> * ?bZ?[W?F<br> * "Can not get validateMethod."<br> * (?) errors:not null<br> * (vf)<br> * * <br> * va?`FbN?\bh??A * methodParamsw?v???A * truemF?B * <br> * * @throws Exception ?\bh?O */ public void testValidateArraysIndex09() throws Exception { //eXgf?[^? // ++++ beanIuWFNg ++++ String bean = null; // ++++ ??IuWFNg ValidatorAction va = new ValidatorAction(); String argStr = "javax.servlet.http.HttpServletRequest," + "org.apache.commons.validator.ValidatorAction," + "org.apache.commons.validator.Field," + "org.apache.struts.action.ActionMessages," + "org.apache.commons.validator.Validator," + "java.lang.Object"; va.setMethodParams(argStr); va.setName("stringLengthArray"); // ++++ ?tB?[h? Field field = new Field(); // G?[? ActionMessages errors = new ActionMessages(); // [HTTPNGXg HttpServletRequest request = new MockHttpServletRequest(); // 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()); // G?[?O`FbN assertTrue(LogUTUtil.checkError("", new NoSuchMethodException())); assertTrue(LogUTUtil.checkError("Can not get validateMethod.")); } /** * testValidateArraysIndex10() * <br><br> * * (?n) * <br> * _?FC,F * <br><br> * l?F(?) bean:*<br> * (?) va:methodParams?F6S??<br> * name?F"stringLengthArray"<br> * (?) field:not null<br> * (?) errors:not null<br> * (vf)<br> * (?) validator:not null<br> * (?) request:ActionMapping?Fnull<br> * (?) session:not null<br> * (?) ActionForm:not null<br> * * <br> * l?F(l) boolean:true<br> * (?) ?O:?Ox?FG?[<br> * ?bZ?[W?F<br> * "Can not get ActionForm."<br> * (?) errors:not null<br> * (vf)<br> * * <br> * NGXgActionMapping???A * truemF?B * <br> * * @throws Exception ?\bh?O */ public void testValidateArraysIndex10() 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(); // G?[? ActionMessages errors = new ActionMessages(); // [HTTPNGXg HttpServletRequest request = new MockHttpServletRequest(); // 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()); // G?[?O`FbN assertTrue(LogUTUtil.checkError("Can not get ActionForm.")); } /** * testValidateArraysIndex11() * <br><br> * * (??n) * <br> * _?FF * <br><br> * l?F(?) bean:*<br> * (?) va:methodParams?F6S??<br> * name?F"stringLengthArray"<br> * (?) field:not null<br> * (?) errors:not null<br> * (vf)<br> * (?) validator:not null<br> * (?) request:ANVtH?[?F"logon"<br> * (?) session:L?[?F"logon"l<br> * ActionFormIuWFNgO<br> * (?) ActionForm:null<br> * * <br> * l?F(l) boolean:true<br> * (?) ?O:?Ox?FG?[<br> * ?bZ?[W?F<br> * "Can not get ActionForm."<br> * (?) errors:not null<br> * (vf)<br> * * <br> * ZbVANVtH?[ActionFormNX???A * truemF?B * <br> * * @throws Exception ?\bh?O */ public void testValidateArraysIndex11() 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(); // 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(); session.setAttribute("logon", "hoge"); 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()); // G?[?O`FbN assertTrue(LogUTUtil.checkError("Can not get ActionForm.")); } /** * testValidateArraysIndex12() * <br><br> * * (?n) * <br> * _?FF * <br><br> * l?F(?) bean:*<br> * (?) va:methodParams?F6S??<br> * name?F"stringLengthArray"<br> * (?) field:not null<br> * (?) errors:not null<br> * (vf)<br> * (?) validator:not null<br> * (?) request:ANVtH?[?F"logon"<br> * L?[?F"logon"l<br> * ActionFormIuWFNgO<br> * (?) session:L?[?F"logon"l?<br> * (?) ActionForm:null<br> * * <br> * l?F(l) boolean:true<br> * (?) ?O:?Ox?FG?[<br> * ?bZ?[W?F<br> * "Can not get ActionForm."<br> * (?) errors:not null<br> * (vf)<br> * * <br> * NGXgANVtH?[ActionFormNX???A * truemF?B * <br> * * @throws Exception ?\bh?O */ public void testValidateArraysIndex12() 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(); // 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); request.setAttribute("logon", "hoge"); // 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()); // G?[?O`FbN assertTrue(LogUTUtil.checkError("Can not get ActionForm.")); } /** * testValidateArraysIndex13() * <br><br> * * (?n) * <br> * _?FF * <br><br> * l?F(?) bean:*<br> * (?) va:methodParams?F6S??<br> * name?F"stringLengthArray"<br> * (?) field:not null<br> * (?) errors:not null<br> * (vf)<br> * (?) validator:not null<br> * (?) request:ANVtH?[?F"logon"<br> * L?[?F"logon"l?<br> * (?) session:L?[?F"logon"l?<br> * (?) ActionForm:not null<br> * * <br> * l?F(l) boolean:true<br> * (?) ?O:?Ox?FG?[<br> * ?bZ?[W?F<br> * "Can not get ActionForm."<br> * (?) errors:not null<br> * (vf)<br> * * <br> * ANVtH?[???AtruemF?B * <br> * * @throws Exception ?\bh?O */ public void testValidateArraysIndex13() 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(); // 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); // 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()); // G?[?O`FbN assertTrue(LogUTUtil.checkError("Can not get ActionForm.")); } /** * testValidateArraysIndex14() * <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()); } /** * testValidateArraysIndex15() * <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()); } /** * testValidateArraysIndex16() * <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()); } /** * testValidateArraysIndex17() * <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()); } /** * testValidateArraysIndex18() * <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()); } /** * testValidateArraysIndex19() * <br><br> * * (??n) * <br> * _?FF * <br><br> * l?F(?) bean:*<br> * (?) va:methodParams?F6S??<br> * name?F"requiredArray"<br> * (?) field:property="stringArray"<br> * (?) errors:not null<br> * ActionMessage(<br> * "testMessage")<br> * (?) validator:not null<br> * (?) request:ANVtH?[?F"logon"<br> * (?) session:L?[?F"logon"l<br> * ActionFormIuWFNg<br> * (?) ActionForm:String[] stringArray = {<br> * null<br> * }<br> * * <br> * l?F(l) boolean:false<br> * (?) errors:ActionMessage(<br> * "testMessage")<br> * ActionMessage(<br> * "message")<br> * * <br> * ??v?peBvf1?z^?A?G?[????A * G?[?bZ?[W?AfalsepmF?B * <br> * * @throws Exception ?\bh?O */ public void testValidateArraysIndex19() throws Exception { //eXgf?[^? // ++++ beanIuWFNg ++++ String bean = null; // ++++ ??IuWFNg ValidatorAction va = new ValidatorAction(); va.setMethodParams(this.validClassStr); va.setName("requiredArray"); // ++++ ?tB?[h? Field field = new Field(); field.setProperty("stringArray"); Msg msg = new Msg(); msg.setKey("message"); msg.setName("requiredArray"); msg.setResource(false); field.addMsg(msg); // G?[? ActionMessages errors = new ActionMessages(); ActionMessage error = new ActionMessage("testMessage"); errors.add(Globals.ERROR_KEY, error); // [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 assertFalse(result); // G?[??B assertEquals(2, errors.size()); Iterator it = errors.get(); List<String> nameList = new ArrayList<String>(); while (it.hasNext()) { ActionMessage message = (ActionMessage) it.next(); nameList.add(message.getKey()); } assertTrue(nameList.contains("testMessage")); assertTrue(nameList.contains("message")); } /** * testValidateArraysIndex20() * <br><br> * * (??n) * <br> * _?FF * <br><br> * l?F(?) bean:*<br> * (?) va:methodParams?F6S??<br> * name?F"requiredArray"<br> * (?) field:property="stringArray"<br> * arg:position="0",key="##INDEX",resource="false"<br> * arg:position="1",key="##INDEX",resource="false"<br> * arg:position="3",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:???FString[1]<br> * ??F<br> * [0]:null(false)<br> * * <br> * l?F(l) boolean:false<br> * (?) errors:ActionMessage("message"<br> * args{<br> * "1", "1", "1"<br> * })<br> * * <br> * argvf##INDEX???A??`FbN?s * mF?B * <br> * * @throws Exception ?\bh?O */ public void testValidateArraysIndex20() throws Exception { //eXgf?[^? // ++++ beanIuWFNg ++++ String bean = null; // ++++ ??IuWFNg ValidatorAction va = new ValidatorAction(); va.setMethodParams(this.validClassStr); va.setName("requiredArray"); // ++++ ?tB?[h? Field field = new Field(); field.setProperty("stringArray"); Arg arg0 = new Arg(); arg0.setKey("##INDEX"); arg0.setPosition(0); arg0.setResource(false); field.addArg(arg0); Arg arg1 = new Arg(); arg1.setKey("##INDEX"); arg1.setPosition(1); arg1.setResource(false); field.addArg(arg1); Arg arg2 = new Arg(); arg2.setKey("##INDEX"); arg2.setPosition(3); arg2.setResource(false); field.addArg(arg2); Msg msg = new Msg(); msg.setKey("message"); msg.setName("requiredArray"); field.addMsg(msg); // 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); FieldChecksEx_MessageResourcesImpl01 messageResources = new FieldChecksEx_MessageResourcesImpl01(null, null); messageResources.message = "{0},{1},{2},{3}"; request.setAttribute(Globals.MESSAGES_KEY, messageResources); // 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 assertFalse(result); // G?[?1??B assertEquals(1, errors.size()); Iterator it = errors.get(); ActionMessage message = (ActionMessage) it.next(); assertEquals("message", message.getKey()); Object values[] = message.getValues(); assertEquals("1", values[0]); assertEquals("1", values[1]); assertNull(values[2]); assertEquals("1", values[3]); } /** * testValidateArraysIndex21() * <br><br> * * (??n) * <br> * _?FF * <br><br> * l?F(?) bean:*<br> * (?) va:methodParams?F6S??<br> * name?F"numberArray"<br> * (?) field:property="stringArray"<br> * var:integerLength="2"<br> * var:scale="1"<br> * var:isAccordedScale="true"<br> * arg:position="0",key="${var:integerLength}",<br> * resource="false"<br> * arg:position="1",key="${var:scale}",<br> * resource="false"<br> * arg:position="2",key="${var:isAccordedInteger}",<br> * resource="false"<br> * arg:position="3",key="##INDEX",<br> * resource="false"<br> * msg:key="numberArray",name="numberArray"<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:???FString[5]<br> * ??F<br> * [0]:10.1(true)<br> * [1]:1.11(false)<br> * [2]:100.1(false)<br> * [3]:100(false)<br> * [4]:10.0(true)<br> * * <br> * l?F(l) boolean:false<br> * (?) errors:ActionMessage(<br> * "numberArray",<br> * arg{"2","1","true","2"})<br> * ActionMessage(<br> * "numberArray",<br> * arg{"2","1","true","3"})<br> * ActionMessage(<br> * "numberArray",<br> * arg{"2","1","true","4"})<br> * * <br> * ??v?peB?vfz?A?G?[????A * u##INDEXlG?[?CfbNXu * mF?B * <br> * * @throws Exception ?\bh?O */ @SuppressWarnings("deprecation") public void testValidateArraysIndex21() 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("stringArray"); Var var = new Var(); var.setName("integerLength"); var.setValue("2"); field.addVar(var); var = new Var(); var.setName("scale"); var.setValue("1"); field.addVar(var); var = new Var(); var.setName("isAccordedScale"); var.setValue("true"); field.addVar(var); Arg arg0 = new Arg(); arg0.setKey("${var:integerLength}"); arg0.setPosition(0); arg0.setResource(false); field.addArg(arg0); Arg arg1 = new Arg(); arg1.setKey("${var:scale}"); arg1.setPosition(1); arg1.setResource(false); field.addArg(arg1); Arg arg2 = new Arg(); arg2.setKey("${var:isAccordedScale}"); arg2.setPosition(2); arg2.setResource(false); field.addArg(arg2); Arg arg3 = new Arg(); arg3.setKey("##INDEX"); arg3.setPosition(3); arg3.setResource(false); field.addArg(arg3); Msg msg = new Msg(); msg.setKey("numberArray"); msg.setName("numberArray"); field.addMsg(msg); UTUtil.invokePrivate(field, "process", Map.class, Map.class, new HashMap(), new HashMap()); // 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 = { "10.1", "1.11", "100.1", "100", "10.0" }; form.setStringArray(testArray); session.setAttribute("logon", form); request.setSession(session); FieldChecksEx_MessageResourcesImpl01 messageResources = new FieldChecksEx_MessageResourcesImpl01(null, null); messageResources.message = "{0},{1},{2},{3}"; request.setAttribute(Globals.MESSAGES_KEY, messageResources); // 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 assertFalse(result); // G?[?1??B assertEquals(3, errors.size()); Iterator it = errors.get(); int counter = 2; while (it.hasNext()) { ActionMessage message = (ActionMessage) it.next(); assertEquals("numberArray", message.getKey()); assertEquals("2", message.getValues()[0]); assertEquals("1", message.getValues()[1]); assertEquals("true", message.getValues()[2]); assertEquals(String.valueOf(counter++), message.getValues()[3]); } } /** * testValidateArraysIndex22() * <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()); } /** * testValidateArraysIndex23() * <br><br> * * (??n) * <br> * _?FF * <br><br> * l?F(?) bean:*<br> * (?) va:methodParams?Fnull<br> * (?) field:*<br> * (?) errors:not null<br> * (vf)<br> * (?) validator:not null<br> * (?) request:not null<br> * (?) session:not null<br> * (?) ActionForm:not null<br> * * <br> * l?F(l) boolean:true<br> * (?) ?O:?Ox?FG?[<br> * Can not get class pattern.<br> * (?) errors:not null<br> * (vf)<br> * * <br> * vamethodParamsnull???AtruemF?B<br> * ?getParamClasseXg * <br> * * @throws Exception ?\bh?O */ public void testValidateArraysIndex23() throws Exception { //eXgf?[^? // ++++ beanIuWFNg ++++ String bean = null; // ++++ ??IuWFNg ValidatorAction va = new ValidatorAction(); UTUtil.setPrivateField(va, "methodParams", null); // ++++ ?tB?[h? Field field = new Field(); // G?[? ActionMessages errors = new ActionMessages(); // [HTTPNGXg HttpServletRequest request = new MockHttpServletRequest(); // 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()); // G?[?O`FbN assertTrue(LogUTUtil.checkError("Can not get class pattern.")); } /** * testValidateArraysIndex24() * <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()); } /** * testValidateArraysIndex25() * <br><br> * * (??n) * <br> * _?FF * <br><br> * l?F(?) bean:*<br> * (?) va:methodParams?F6S??<br> * name?F"minLengthArray"<br> * (?) field:property="row.values"<br> * var:minlength="3"<br> * arg:position="0",key="##INDEX",<br> * resource="false"<br> * arg:position="1",key="${var:minlength}",<br> * resource="false"<br> * msg:key="minLengthArray",name="minLengthArray"<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:JavaBean row<br> * + String[] values = {<br> * "a", "bbbb","cc"<br> * }<br> * (?) ?bZ?[W\?[X:message={0},{1}<br> * * <br> * l?F(l) boolean:false<br> * (?) errors:ActionMessage(<br> * "minLengthArray",<br> * arg{"2","3"})<br> * * <br> * ??lANVtH?[lXgv?peB???A????smF?B * <br> * * @throws Exception ?\bh?O */ @SuppressWarnings("deprecation") public void testValidateArraysIndex25() throws Exception { //eXgf?[^? // ++++ beanIuWFNg ++++ String bean = null; // ++++ ??IuWFNg ValidatorAction va = new ValidatorAction(); va.setMethodParams(this.validClassStr); va.setName("minLengthArray"); // ++++ ?tB?[h? Field field = new Field(); field.setProperty("row.values"); Var var = new Var(); var.setName("minlength"); var.setValue("3"); field.addVar(var); Arg arg0 = new Arg(); arg0.setPosition(0); arg0.setKey("##INDEX"); arg0.setResource(false); //arg0.setName("minLengthArray"); field.addArg(arg0); Arg arg1 = new Arg(); arg1.setPosition(1); arg1.setKey("${var:minlength}"); arg1.setResource(false); //arg1.setName("minLength"); field.addArg(arg1); Msg msg = new Msg(); msg.setKey("minLengthArray"); msg.setName("minLengthArray"); field.addMsg(msg); UTUtil.invokePrivate(field, "process", Map.class, Map.class, new HashMap(), new HashMap()); // 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(); FieldChecksEx_JavaBeanStub01 row = new FieldChecksEx_JavaBeanStub01(); String[] values = { "a", "bbbb", "cc" }; row.values = values; form.setRow(row); session.setAttribute("logon", form); request.setSession(session); FieldChecksEx_MessageResourcesImpl01 messageResources = new FieldChecksEx_MessageResourcesImpl01(null, null); messageResources.message = "{0},{1}"; request.setAttribute(Globals.MESSAGES_KEY, messageResources); // 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(2, errors.size()); Iterator it = errors.get(); ActionMessage message = (ActionMessage) it.next(); assertEquals("minLengthArray", message.getKey()); assertEquals("1", message.getValues()[0]); assertEquals("3", message.getValues()[1]); message = (ActionMessage) it.next(); assertEquals("minLengthArray", message.getKey()); assertEquals("3", message.getValues()[0]); assertEquals("3", message.getValues()[1]); } /** * testValidateArraysIndex26() * <br><br> * * (??n) * <br> * _?FF * <br><br> * l?F(?) bean:*<br> * (?) va:methodParams?F6S??<br> * name?F"alphaNumericStringArray"<br> * (?) field:property="rows.value"<br> * arg:position="0",key="##INDEX",<br> * resource="false"<br> * msg:key="alphaNumericStringArray",name="alphaNumericStringArray"<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:<br> * JavaBean[] rows<br> * +rows[0]<br> * + String value = ""<br> * +rows[1]<br> * + String value = "test"<br> * +rows[2]<br> * + String value = ""<br> * (?) ?bZ?[W\?[X:message={0}<br> * * <br> * l?F(l) boolean:false<br> * (?) errors:ActionMessage(<br> * "alphaNumericStringArray",<br> * arg{"2"})<br> * * <br> * ??lANVtH?[lXgv?peB???A????smF?B * <br> * * @throws Exception ?\bh?O */ @SuppressWarnings("deprecation") public void testValidateArraysIndex26() throws Exception { //eXgf?[^? // ++++ beanIuWFNg ++++ String bean = null; // ++++ ??IuWFNg ValidatorAction va = new ValidatorAction(); va.setMethodParams(this.validClassStr); va.setName("alphaNumericStringArray"); // ++++ ?tB?[h? Field field = new Field(); field.setProperty("rows.value"); Var var = new Var(); field.addVar(var); Arg arg0 = new Arg(); arg0.setPosition(0); arg0.setKey("##INDEX"); arg0.setResource(false); field.addArg(arg0); Msg msg = new Msg(); msg.setKey("alphaNumericStringArray"); msg.setName("alphaNumericStringArray"); field.addMsg(msg); UTUtil.invokePrivate(field, "process", Map.class, Map.class, new HashMap(), new HashMap()); // 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(); FieldChecksEx_JavaBeanStub01[] rows = { new FieldChecksEx_JavaBeanStub01(), new FieldChecksEx_JavaBeanStub01(), new FieldChecksEx_JavaBeanStub01() }; rows[0].value = ""; rows[1].value = "test"; rows[2].value = ""; form.rows = rows; session.setAttribute("logon", form); request.setSession(session); FieldChecksEx_MessageResourcesImpl01 messageResources = new FieldChecksEx_MessageResourcesImpl01(null, null); messageResources.message = "{0}"; request.setAttribute(Globals.MESSAGES_KEY, messageResources); // 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?[?2??B assertEquals(2, errors.size()); Iterator it = errors.get(); ActionMessage message = (ActionMessage) it.next(); assertEquals("alphaNumericStringArray", message.getKey()); assertEquals("1", message.getValues()[0]); message = (ActionMessage) it.next(); assertEquals("alphaNumericStringArray", message.getKey()); assertEquals("3", message.getValues()[0]); } /** * testValidateArraysIndex27() * <br><br> * * (??n) * <br> * _?FF * <br><br> * l?F(?) bean:*<br> * (?) va:methodParams?F6S??<br> * name?F"requiredArray"<br> * (?) field:property="rowList.map(key)"<br> * arg:position="0",key="##INDEX",<br> * resource="false"<br> * msg:key="requiredArray",name="requiredArray"<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<JavaBean> rowList<br> * + rowList[0]<br> * + Map map = { key = null }<br> * + rowList[1]<br> * + Map map = { key = null }<br> * + rowList[2]<br> * + Map map = { key = null }<br> * (?) ?bZ?[W\?[X:message={0}<br> * * <br> * l?F(l) boolean:false<br> * (?) errors:ActionMessage(<br> * "minLengthArray",<br> * arg{"1"})<br> * ActionMessage(<br> * "minLengthArray",<br> * arg{"2"})<br> * ActionMessage(<br> * "minLengthArray",<br> * arg{"3"})<br> * * <br> * ??lANVtH?[lXgv?peB???A????smF?B * <br> * * @throws Exception ?\bh?O */ @SuppressWarnings({ "deprecation", "unchecked" }) public void testValidateArraysIndex27() throws Exception { //eXgf?[^? // ++++ beanIuWFNg ++++ String bean = null; // ++++ ??IuWFNg ValidatorAction va = new ValidatorAction(); va.setMethodParams(this.validClassStr); va.setName("requiredArray"); // ++++ ?tB?[h? Field field = new Field(); field.setProperty("rowList.map(key)"); Var var = new Var(); field.addVar(var); Arg arg0 = new Arg(); arg0.setPosition(0); arg0.setKey("##INDEX"); arg0.setResource(false); field.addArg(arg0); Msg msg = new Msg(); msg.setKey("requiredArray"); msg.setName("requiredArray"); field.addMsg(msg); UTUtil.invokePrivate(field, "process", Map.class, Map.class, new HashMap(), new HashMap()); // 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(); List rowList = new ArrayList(); FieldChecksEx_JavaBeanStub01 row = new FieldChecksEx_JavaBeanStub01(); Map map = new HashMap(); map.put("key", null); row.map = map; rowList.add(row); row = new FieldChecksEx_JavaBeanStub01(); map = new HashMap(); map.put("key", null); row.map = map; rowList.add(row); row = new FieldChecksEx_JavaBeanStub01(); map = new HashMap(); map.put("key", null); row.map = map; rowList.add(row); form.rowList = rowList; session.setAttribute("logon", form); request.setSession(session); FieldChecksEx_MessageResourcesImpl01 messageResources = new FieldChecksEx_MessageResourcesImpl01(null, null); messageResources.message = "{0}"; request.setAttribute(Globals.MESSAGES_KEY, messageResources); // 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?[?2??B assertEquals(3, errors.size()); Iterator it = errors.get(); ActionMessage message = (ActionMessage) it.next(); assertEquals("requiredArray", message.getKey()); assertEquals("1", message.getValues()[0]); message = (ActionMessage) it.next(); assertEquals("requiredArray", message.getKey()); assertEquals("2", message.getValues()[0]); message = (ActionMessage) it.next(); assertEquals("requiredArray", message.getKey()); assertEquals("3", message.getValues()[0]); } /** * testValidateArraysIndex28() * <br><br> * * (??n) * <br> * _?FF * <br><br> * l?F(?) bean:*<br> * (?) va:methodParams?F6S??<br> * name?F"minLengthArray"<br> * (?) field:property="row.values"<br> * var:minlength="3"<br> * arg:position="0",key="##INDEX",<br> * resource="false"<br> * arg:position="1",key="${var:minlength}",<br> * resource="false"<br> * msg:key="minLengthArray",name="minLengthArray"<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:DynaValidatorActionFormExCX^X<br> * JavaBean row<br> * + String[] values = {<br> * "a", "bbbb","cc"<br> * }<br> * (?) ?bZ?[W\?[X:message={0},{1}<br> * * <br> * l?F(l) boolean:false<br> * (?) errors:ActionMessage(<br> * "minLengthArray",<br> * arg{"2","3"})<br> * * <br> * ??lANVtH?[lXgv?peB???A????smF?B * <br> * * @throws Exception ?\bh?O */ @SuppressWarnings("deprecation") public void testValidateArraysIndex28() throws Exception { //eXgf?[^? // ++++ beanIuWFNg ++++ this.formEx = (DynaValidatorActionFormEx) creator.create(CONFIG_FILE_NAME); String bean = null; // ++++ ??IuWFNg ValidatorAction va = new ValidatorAction(); va.setMethodParams(this.validClassStr); va.setName("minLengthArray"); // ++++ ?tB?[h? Field field = new Field(); field.setProperty("row.values"); Var var = new Var(); var.setName("minlength"); var.setValue("3"); field.addVar(var); Arg arg0 = new Arg(); arg0.setPosition(0); arg0.setKey("##INDEX"); arg0.setResource(false); //arg0.setName("minLengthArray"); field.addArg(arg0); Arg arg1 = new Arg(); arg1.setPosition(1); arg1.setKey("${var:minlength}"); arg1.setResource(false); //arg1.setName("minLength"); field.addArg(arg1); Msg msg = new Msg(); msg.setKey("minLengthArray"); msg.setName("minLengthArray"); field.addMsg(msg); UTUtil.invokePrivate(field, "process", Map.class, Map.class, new HashMap(), new HashMap()); // 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(); FieldChecksEx_JavaBeanStub01 row = new FieldChecksEx_JavaBeanStub01(); String[] values = { "a", "bbbb", "cc" }; row.values = values; formEx.set("row", row); session.setAttribute("logon", formEx); request.setSession(session); FieldChecksEx_MessageResourcesImpl01 messageResources = new FieldChecksEx_MessageResourcesImpl01(null, null); messageResources.message = "{0},{1}"; request.setAttribute(Globals.MESSAGES_KEY, messageResources); // 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?[?2??B assertEquals(2, errors.size()); Iterator it = errors.get(); ActionMessage message = (ActionMessage) it.next(); assertEquals("minLengthArray", message.getKey()); assertEquals("1", message.getValues()[0]); assertEquals("3", message.getValues()[1]); message = (ActionMessage) it.next(); assertEquals("minLengthArray", message.getKey()); assertEquals("3", message.getValues()[0]); assertEquals("3", message.getValues()[1]); } /** * testValidateArraysIndex29() * <br><br> * * (??n) * <br> * _?FF * <br><br> * l?F(?) bean:*<br> * (?) va:methodParams?F6S??<br> * name?F"alphaNumericStringArray"<br> * (?) field:property="rows.value"<br> * arg:position="0",key="##INDEX",<br> * resource="false"<br> * msg:key="alphaNumericStringArray",name="alphaNumericStringArray"<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:DynaValidatorActionFormExCX^X<br> * JavaBean[] rows<br> * +rows[0]<br> * + String value = ""<br> * +rows[1]<br> * + String value = "test"<br> * +rows[2]<br> * + String value = ""<br> * (?) ?bZ?[W\?[X:message={0}<br> * * <br> * l?F(l) boolean:false<br> * (?) errors:ActionMessage(<br> * "alphaNumericStringArray",<br> * arg{"2"})<br> * * <br> * ??lANVtH?[lXgv?peB???A????smF?B * <br> * * @throws Exception ?\bh?O */ @SuppressWarnings("deprecation") public void testValidateArraysIndex29() throws Exception { //eXgf?[^? this.formEx = (DynaValidatorActionFormEx) creator.create(CONFIG_FILE_NAME); // ++++ beanIuWFNg ++++ String bean = null; // ++++ ??IuWFNg ValidatorAction va = new ValidatorAction(); va.setMethodParams(this.validClassStr); va.setName("alphaNumericStringArray"); // ++++ ?tB?[h? Field field = new Field(); field.setProperty("rows.value"); Var var = new Var(); field.addVar(var); Arg arg0 = new Arg(); arg0.setPosition(0); arg0.setKey("##INDEX"); arg0.setResource(false); field.addArg(arg0); Msg msg = new Msg(); msg.setKey("alphaNumericStringArray"); msg.setName("alphaNumericStringArray"); field.addMsg(msg); UTUtil.invokePrivate(field, "process", Map.class, Map.class, new HashMap(), new HashMap()); // 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(); FieldChecksEx_JavaBeanStub01[] rows = { new FieldChecksEx_JavaBeanStub01(), new FieldChecksEx_JavaBeanStub01(), new FieldChecksEx_JavaBeanStub01() }; rows[0].value = ""; rows[1].value = "test"; rows[2].value = ""; formEx.set("rows", rows); session.setAttribute("logon", formEx); request.setSession(session); FieldChecksEx_MessageResourcesImpl01 messageResources = new FieldChecksEx_MessageResourcesImpl01(null, null); messageResources.message = "{0}"; request.setAttribute(Globals.MESSAGES_KEY, messageResources); // 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?[?2??B assertEquals(2, errors.size()); Iterator it = errors.get(); ActionMessage message = (ActionMessage) it.next(); assertEquals("alphaNumericStringArray", message.getKey()); assertEquals("1", message.getValues()[0]); message = (ActionMessage) it.next(); assertEquals("alphaNumericStringArray", message.getKey()); assertEquals("3", message.getValues()[0]); } /** * testValidateArraysIndex30() * <br><br> * * (??n) * <br> * _?FF * <br><br> * l?F(?) bean:*<br> * (?) va:methodParams?F6S??<br> * name?F"requiredArray"<br> * (?) field:property="rowList.map(key)"<br> * arg:position="0",key="##INDEX",<br> * resource="false"<br> * msg:key="requiredArray",name="requiredArray"<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:DynaValidatorActionFormExCX^X<br> * ArrayList<JavaBean> rowList<br> * + rowList[0]<br> * + Map map = { key = null }<br> * + rowList[1]<br> * + Map map = { key = null }<br> * + rowList[2]<br> * + Map map = { key = null }<br> * (?) ?bZ?[W\?[X:message={0}<br> * * <br> * l?F(l) boolean:false<br> * (?) errors:ActionMessage(<br> * "minLengthArray",<br> * arg{"1"})<br> * ActionMessage(<br> * "minLengthArray",<br> * arg{"2"})<br> * ActionMessage(<br> * "minLengthArray",<br> * arg{"2"})<br> * * <br> * ??lANVtH?[lXgv?peB???A????smF?B * <br> * * @throws Exception ?\bh?O */ @SuppressWarnings({ "deprecation", "unchecked" }) public void testValidateArraysIndex30() throws Exception { //eXgf?[^? this.formEx = (DynaValidatorActionFormEx) creator.create(CONFIG_FILE_NAME); // ++++ beanIuWFNg ++++ String bean = null; // ++++ ??IuWFNg ValidatorAction va = new ValidatorAction(); va.setMethodParams(this.validClassStr); va.setName("requiredArray"); // ++++ ?tB?[h? Field field = new Field(); field.setProperty("rowList.map(key)"); Var var = new Var(); field.addVar(var); Arg arg0 = new Arg(); arg0.setPosition(0); arg0.setKey("##INDEX"); arg0.setResource(false); field.addArg(arg0); Msg msg = new Msg(); msg.setKey("requiredArray"); msg.setName("requiredArray"); field.addMsg(msg); UTUtil.invokePrivate(field, "process", Map.class, Map.class, new HashMap(), new HashMap()); // 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(); List rowList = new ArrayList(); FieldChecksEx_JavaBeanStub01 row = new FieldChecksEx_JavaBeanStub01(); Map map = new HashMap(); map.put("key", null); row.map = map; rowList.add(row); row = new FieldChecksEx_JavaBeanStub01(); map = new HashMap(); map.put("key", null); row.map = map; rowList.add(row); row = new FieldChecksEx_JavaBeanStub01(); map = new HashMap(); map.put("key", null); row.map = map; rowList.add(row); formEx.set("rowList", rowList); session.setAttribute("logon", formEx); request.setSession(session); FieldChecksEx_MessageResourcesImpl01 messageResources = new FieldChecksEx_MessageResourcesImpl01(null, null); messageResources.message = "{0}"; request.setAttribute(Globals.MESSAGES_KEY, messageResources); // 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?[?2??B assertEquals(3, errors.size()); Iterator it = errors.get(); ActionMessage message = (ActionMessage) it.next(); assertEquals("requiredArray", message.getKey()); assertEquals("1", message.getValues()[0]); message = (ActionMessage) it.next(); assertEquals("requiredArray", message.getKey()); assertEquals("2", message.getValues()[0]); message = (ActionMessage) it.next(); assertEquals("requiredArray", message.getKey()); assertEquals("3", message.getValues()[0]); } /** * testValidateArraysIndex31() * <br><br> * * (??n) * <br> * _?FF * <br><br> * l?F(?) bean:*<br> * (?) va:methodParams?F6S??<br> * name?F"requiredArray"<br> * (?) field:property="/"<br> * arg:position="0",key="##INDEX",<br> * resource="false"<br> * msg:key="requiredArray",name="requiredArray"<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:DynaValidatorActionFormExCX^X<br> * ArrayList<JavaBean> rowList<br> * + rowList[0]<br> * + Map map = { key = null }<br> * + rowList[1]<br> * + Map map = { key = null }<br> * + rowList[2]<br> * + Map map = { key = null }<br> * (?) ?bZ?[W\?[X:message={0}<br> * * <br> * l?F(l) boolean:true<br> * (?) ?O:?Ox?FG?[ * O?FIllegalArgumentException * "Invalid character has found within property name. '/' Cannot use [ / \" ' ]" * * <br> * s?v?peBw???AG?[?O?o?AtruemF?B * <br> * * @throws Exception ?\bh?O */ @SuppressWarnings({ "deprecation", "unchecked" }) public void testValidateArraysIndex31() throws Exception { //eXgf?[^? this.formEx = (DynaValidatorActionFormEx) creator.create(CONFIG_FILE_NAME); // ++++ beanIuWFNg ++++ String bean = null; // ++++ ??IuWFNg ValidatorAction va = new ValidatorAction(); va.setMethodParams(this.validClassStr); va.setName("requiredArray"); // ++++ ?tB?[h? Field field = new Field(); field.setProperty("/"); Var var = new Var(); field.addVar(var); Arg arg0 = new Arg(); arg0.setPosition(0); arg0.setKey("##INDEX"); arg0.setResource(false); field.addArg(arg0); Msg msg = new Msg(); msg.setKey("requiredArray"); msg.setName("requiredArray"); field.addMsg(msg); UTUtil.invokePrivate(field, "process", Map.class, Map.class, new HashMap(), new HashMap()); // 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(); List rowList = new ArrayList(); FieldChecksEx_JavaBeanStub01 row = new FieldChecksEx_JavaBeanStub01(); Map map = new HashMap(); map.put("key", null); row.map = map; rowList.add(row); row = new FieldChecksEx_JavaBeanStub01(); map = new HashMap(); map.put("key", null); row.map = map; rowList.add(row); row = new FieldChecksEx_JavaBeanStub01(); map = new HashMap(); map.put("key", null); row.map = map; rowList.add(row); formEx.set("rowList", rowList); session.setAttribute("logon", formEx); request.setSession(session); FieldChecksEx_MessageResourcesImpl01 messageResources = new FieldChecksEx_MessageResourcesImpl01(null, null); messageResources.message = "{0}"; request.setAttribute(Globals.MESSAGES_KEY, messageResources); // 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?[?O assertTrue(LogUTUtil.checkError("", new IllegalArgumentException( "Invalid character has found " + "within property name. '/' Cannot use [ / \" ' ]"))); } /** * testGetHankakuKanaList01() * <br><br> * * (??n) * <br> * _?FF * <br><br> * l?F(?) hankakuKanaList: * <br> * (?) v?peBt@C:validation.hankaku.kana.list<br> * ??B<br> * * <br> * l?F(l) String: * <br> * * <br> * NX?hankakuKanaListlmF?B * <br> * * @throws Exception ?\bh?O */ public void testGetHankakuKanaList01() throws Exception { assertEquals("" + "", FieldChecksEx.getHankakuKanaList()); } /** * testGetZenkakuKanaList01() * <br><br> * * (??n) * <br> * _?FF * <br><br> * l?F(?) zenkakuKanaList:ACEGI@BDFHJLNPR * KMOQSTVXZ\UWY[]^`ceg * _adfhijklmnqtwzorux{ * psvy|}~?? * ??b?[<br> * (?) v?peBt@C:validation.zenkaku.kana.list<br> * ??B<br> * * <br> * l?F(l) String:ACEGI@BDFHJLNPRKMOQS * TVXZ\UWY[]^`ceg_adfh * ijklmnqtwzorux{psvy| * }~???? * b?[<br> * * <br> * NX?zenkakuKanaListlmF?B * <br> * * @throws Exception ?\bh?O */ public void testGetZenkakuKanaList01() throws Exception { assertEquals("ACEGI@BDFHJLNPRKMOQS" + "TVXZ\UWY[]^`ceg_adfhijklm" + "nqtwzorux{psvy|}~?" + "???b?[", FieldChecksEx.getZenkakuKanaList()); } }