Example usage for org.apache.commons.validator ValidatorAction setName

List of usage examples for org.apache.commons.validator ValidatorAction setName

Introduction

In this page you can find the example usage for org.apache.commons.validator ValidatorAction setName.

Prototype

public void setName(String name) 

Source Link

Document

Sets the name of the validator action.

Usage

From source file:jp.terasoluna.fw.web.struts.form.FieldChecksExTest06.java

/**
 * testValidateArraysIndex22()//from   w  w w.ja v  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  ww . ja v a  2 s. c o  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()/*  w w  w .ja va 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()//from  w  w w.j  a  v  a2  s .com
 * <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()/*from  w w w .  j  a  v  a 2s . com*/
 * <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. j ava2s. c om
 * <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  ww. j  a v a  2  s.  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());
}

From source file:jp.terasoluna.fw.web.struts.form.FieldChecksExTest06.java

/**
 * testValidateArraysIndex19()// w  w  w .j  a va  2 s  .  co  m
 * <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"));
}

From source file:jp.terasoluna.fw.web.struts.form.FieldChecksExTest06.java

/**
 * testValidateArraysIndex26()/*  w ww  .  j a v a  2 s .com*/
 * <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]);

}

From source file:jp.terasoluna.fw.web.struts.form.FieldChecksExTest06.java

/**
 * testValidateArraysIndex29()//  ww  w .  j a  v  a 2s.c  o  m
 * <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]);

}