/**
  * Tests creating empty action flow configuration.
  *
  * @throws Exception when something goes wrong.
  */
 @Test
 public void testNoFlow() throws Exception {
   ActionProxy proxy = getActionProxy("/noFlow/noFlow");
   Assert.assertNotNull(proxy);
   proxy.getInvocation().getInvocationContext().setSession(new HashMap<String, Object>());
   proxy.execute();
 }
  public void testRangeValidation() {
    HashMap<String, String> params = new HashMap<String, String>();
    params.put("longFoo", "200");

    HashMap<String, Object> extraContext = new HashMap<String, Object>();
    extraContext.put(ActionContext.PARAMETERS, params);

    try {
      ActionProxy proxy =
          actionProxyFactory.createActionProxy(
              "", MockConfigurationProvider.VALIDATION_ACTION_NAME, extraContext);
      proxy.execute();
      assertTrue(((ValidationAware) proxy.getAction()).hasFieldErrors());

      Map errors = ((ValidationAware) proxy.getAction()).getFieldErrors();
      List errorMessages = (List) errors.get("longFoo");
      assertEquals(1, errorMessages.size());

      String errorMessage = (String) errorMessages.get(0);
      assertNotNull(errorMessage);
    } catch (Exception e) {
      e.printStackTrace();
      fail();
    }
  }
Ejemplo n.º 3
0
  public void testNoTokenInSession() throws Exception {
    assertEquals(oldContext, ActionContext.getContext());

    ActionProxy proxy = buildProxy(getActionName());
    setToken(request);
    ActionContext.getContext().getSession().clear();
    assertEquals(TokenInterceptor.INVALID_TOKEN_CODE, proxy.execute());
  }
Ejemplo n.º 4
0
  public void testCAllExecute2Times() throws Exception {
    setToken(request);
    ActionProxy proxy = buildProxy(getActionName());
    assertEquals(Action.SUCCESS, proxy.execute());

    ActionProxy proxy2 = buildProxy(getActionName());
    // must not call setToken
    // double post will result in a invalid.token return code
    assertEquals(TokenInterceptor.INVALID_TOKEN_CODE, proxy2.execute());
  }
Ejemplo n.º 5
0
  @Test
  public void testDestroy() throws Exception {
    initServletMockObjects();
    request.setParameter("id", "101");

    ActionProxy proxy = getActionProxy("/user/destroy");
    proxy.getAction();
    String result = proxy.execute();
    assertEquals(Action.SUCCESS, result);
  }
  public void testIncludeParameterInResult() throws Exception {

    ResultConfig resultConfig =
        new ResultConfig.Builder("", "")
            .addParam("actionName", "someActionName")
            .addParam("namespace", "someNamespace")
            .addParam("encode", "true")
            .addParam("parse", "true")
            .addParam("location", "someLocation")
            .addParam("prependServletContext", "true")
            .addParam("method", "someMethod")
            .addParam("param1", "value 1")
            .addParam("param2", "value 2")
            .addParam("param3", "value 3")
            .addParam("anchor", "fragment")
            .build();

    ActionContext context = ActionContext.getContext();
    MockHttpServletRequest req = new MockHttpServletRequest();
    MockHttpServletResponse res = new MockHttpServletResponse();
    context.put(ServletActionContext.HTTP_REQUEST, req);
    context.put(ServletActionContext.HTTP_RESPONSE, res);

    Map<String, ResultConfig> results = new HashMap<String, ResultConfig>();
    results.put("myResult", resultConfig);

    ActionConfig actionConfig =
        new ActionConfig.Builder("", "", "").addResultConfigs(results).build();

    ServletActionRedirectResult result = new ServletActionRedirectResult();
    result.setActionName("myAction");
    result.setNamespace("/myNamespace");
    result.setParse(false);
    result.setEncode(false);
    result.setPrependServletContext(false);
    result.setAnchor("fragment");
    result.setUrlHelper(new DefaultUrlHelper());

    IMocksControl control = createControl();
    ActionProxy mockActionProxy = control.createMock(ActionProxy.class);
    ActionInvocation mockInvocation = control.createMock(ActionInvocation.class);
    expect(mockInvocation.getProxy()).andReturn(mockActionProxy);
    expect(mockInvocation.getResultCode()).andReturn("myResult");
    expect(mockActionProxy.getConfig()).andReturn(actionConfig);
    expect(mockInvocation.getInvocationContext()).andReturn(context);

    control.replay();
    result.setActionMapper(container.getInstance(ActionMapper.class));
    result.execute(mockInvocation);
    assertEquals(
        "/myNamespace/myAction.action?param1=value+1&param2=value+2&param3=value+3#fragment",
        res.getRedirectedUrl());

    control.verify();
  }
  public void testCAllExecute2Times() throws Exception {
    setToken(request);
    ActionProxy proxy = buildProxy(getActionName());
    assertEquals(Action.SUCCESS, proxy.execute());

    ActionProxy proxy2 = buildProxy(getActionName());
    // must not call setToken
    // double post will just return success and render the same view as the first execute
    // see TokenInterceptor where a 2nd call will return invalid.token code instead
    assertEquals(Action.SUCCESS, proxy2.execute());
  }
Ejemplo n.º 8
0
  @Test
  public void testCreate() throws Exception {
    initServletMockObjects();
    request.setParameter("user.firstName", "first_name");
    request.setParameter("user.lastName", "last_name");

    ActionProxy proxy = getActionProxy("/user/create");
    proxy.getAction();
    String result = proxy.execute();
    assertEquals(Action.SUCCESS, result);
  }
  /**
   * Test adding SmartPoints to Groups.
   *
   * @throws Exception the exception
   */
  public void testImportEcoMode() throws Exception {
    SessionAuthenticationTestUtil.setAuthenticationTest();
    SessionAuthenticationTestUtil.setMockSession();

    request.setSession(SessionAuthenticationTestUtil.setSessionTest());

    /**
     * *********************************
     *
     * <p>TESTING FAILURE
     *
     * <p>*********************************
     */
    logger.debug("TESTING FAILURE");

    ActionProxy proxy = getActionProxy("/systemsettings/ajax.importEcoMode.action");

    EcoModeAjaxAction action = (EcoModeAjaxAction) proxy.getAction();

    action.setServletRequest(request);

    EcoModeBCFMockImpl bcf = (EcoModeBCFMockImpl) action.getEcoModeBCF();
    bcf.setMode(BaseMockImpl.MODE_FAILURE);

    /** Asserts * */
    String actionResponse = proxy.execute();
    assertEquals(MESSAGE_STRUTS_OUTCOME, EXCEPTION, actionResponse);

    /**
     * *********************************
     *
     * <p>TESTING SUCCESS
     *
     * <p>*********************************
     */
    logger.debug("TESTING SUCCESS");

    proxy = getActionProxy("/systemsettings/ajax.importEcoMode.action");
    action = (EcoModeAjaxAction) proxy.getAction();
    SessionAuthenticationTestUtil.setMockSession();
    action.setServletRequest(request);

    action.setUploadEcoModeFile(new File("arquivo.csv"));
    action.setUploadTag("1,2,3,4");
    // Create REQUEST mock ---- END

    bcf = (EcoModeBCFMockImpl) action.getEcoModeBCF();
    bcf.setMode(BaseMockImpl.MODE_SUCCESS);

    /** Asserts * */
    actionResponse = proxy.execute();
    assertEquals(MESSAGE_STRUTS_OUTCOME, EXCEPTION, actionResponse);
  }
Ejemplo n.º 10
0
  @Test
  public void testNewn() throws Exception {
    initServletMockObjects();

    ActionProxy proxy = getActionProxy("/user/new");
    UserAction userAction = (UserAction) proxy.getAction();
    String result = proxy.execute();
    assertEquals(Action.SUCCESS, result);

    User user = userAction.getUser();
    assertNotNull(user);
  }
  public void testAnnotatedMethodSuccess3() throws Exception {
    HashMap<String, Object> params = new HashMap<String, Object>();

    // make it not fail
    params.put("param1", "key1");

    HashMap<String, Object> extraContext = new HashMap<String, Object>();
    extraContext.put(ActionContext.PARAMETERS, params);

    ActionProxy proxy = actionProxyFactory.createActionProxy("", "annotatedMethod", extraContext);
    proxy.execute();
    assertFalse(((ValidationAware) proxy.getAction()).hasActionErrors());
  }
Ejemplo n.º 12
0
  @Test
  public void testList() throws Exception {
    initServletMockObjects();
    request.setParameter("search.firstName", "first_name_page");
    request.setParameter("search.lastName", "last_name_page");

    ActionProxy proxy = getActionProxy("/user/list");
    UserAction userAction = (UserAction) proxy.getAction();
    String result = proxy.execute();
    assertEquals(Action.SUCCESS, result);

    List<UserView> listLogin = userAction.getListLogin();
    assertEquals(3, listLogin.size());
  }
  public void testNotAnnotatedMethodSuccess2() throws Exception {
    HashMap<String, Object> params = new HashMap<String, Object>();

    HashMap<String, Object> extraContext = new HashMap<String, Object>();
    extraContext.put(ActionContext.PARAMETERS, params);

    ActionProxy proxy =
        actionProxyFactory.createActionProxy("", "notAnnotatedMethod", extraContext);
    proxy.execute();
    assertFalse(((ValidationAware) proxy.getAction()).hasActionErrors());

    Collection errors = ((ValidationAware) proxy.getAction()).getActionErrors();
    assertEquals(0, errors.size());
  }
  public void testAnnotatedMethodFailure() throws Exception {
    HashMap<String, Object> params = new HashMap<String, Object>();

    HashMap<String, Object> extraContext = new HashMap<String, Object>();
    extraContext.put(ActionContext.PARAMETERS, params);

    ActionProxy proxy = actionProxyFactory.createActionProxy("", "annotatedMethod", extraContext);
    proxy.execute();
    assertTrue(((ValidationAware) proxy.getAction()).hasActionErrors());
    Collection errors = ((ValidationAware) proxy.getAction()).getActionErrors();
    assertEquals(1, errors.size());

    assertEquals("Need param1 or param2.", errors.iterator().next());
  }
  public void testExecute() throws Exception {

    request.setParameter("emplid", "3");

    ActionProxy proxy = getActionProxy("personDelete");

    PersonDeleter action = (PersonDeleter) proxy.getAction();

    assertNotNull(action);

    String result = proxy.execute();

    assertEquals(
        "Result of calling execute method is not success but it should be.", "success", result);
  }
Ejemplo n.º 16
0
  @Test
  public void testEdit() throws Exception {
    initServletMockObjects();
    request.setParameter("id", "102");

    ActionProxy proxy = getActionProxy("/user/edit");
    UserAction userAction = (UserAction) proxy.getAction();
    String result = proxy.execute();
    assertEquals(Action.SUCCESS, result);

    User user = userAction.getUser();
    assertNotNull(user);
    assertEquals("first_name_102", user.getFirstName());
    assertEquals("last_name_102", user.getLastName());
  }
  public void testInput() throws Exception {

    request.setParameter("emplid", "2");

    ActionProxy proxy = getActionProxy("inputPersonUpdate");

    PersonUpdater action = (PersonUpdater) proxy.getAction();

    assertNotNull(action);

    String result = proxy.execute();

    assertEquals("Result of calling input method is not input but it should be.", "input", result);

    Person person = action.getPerson();

    assertEquals("Person's last name is not Cole but should be.", "Cole", person.getLastName());
  }
  @Override
  protected void setUp() throws Exception {
    super.setUp();
    annotationActionValidatorManager =
        (AnnotationActionValidatorManager) container.getInstance(ActionValidatorManager.class);

    ActionConfig config = new ActionConfig.Builder("packageName", "name", "").build();
    ActionInvocation invocation = EasyMock.createNiceMock(ActionInvocation.class);
    ActionProxy proxy = EasyMock.createNiceMock(ActionProxy.class);

    EasyMock.expect(invocation.getProxy()).andReturn(proxy).anyTimes();
    EasyMock.expect(invocation.getAction()).andReturn(null).anyTimes();
    EasyMock.expect(invocation.invoke()).andReturn(Action.SUCCESS).anyTimes();
    EasyMock.expect(proxy.getMethod()).andReturn("execute").anyTimes();
    EasyMock.expect(proxy.getConfig()).andReturn(config).anyTimes();

    EasyMock.replay(invocation);
    EasyMock.replay(proxy);

    ActionContext.getContext().setActionInvocation(invocation);
  }
  public void testExecute() throws Exception {

    request.setParameter("person.emplid", "2");
    request.setParameter("person.firstName", "Kate");
    request.setParameter("person.lastName", "Cole");

    ActionProxy proxy = getActionProxy("executePersonUpdate");

    PersonUpdater action = (PersonUpdater) proxy.getAction();

    assertNotNull(action);

    String result = proxy.execute();

    assertEquals(
        "Result of calling execute method is not success but it should be.", "success", result);

    Person person = action.getPerson();

    assertEquals("Person's first name is not Kate but should be.", "Kate", person.getFirstName());
  }
Ejemplo n.º 20
0
  @Test
  public void testExecute() throws Exception {

    ActionMapping mapping = getActionMapping("/system/user-list");
    assertNotNull(mapping);
    assertEquals("/system", mapping.getNamespace());
    assertEquals("user-list", mapping.getName());

    log.info("Answer value is " + mapping.getName());

    ActionProxy proxy = getActionProxy("/system/user-list");

    UserListAction action = (UserListAction) proxy.getAction();

    assertNotNull(action);

    String result = proxy.execute();

    assertEquals(
        "Result of calling execute method is not success but it should be.", "success", result);
  }
  /**
   * Tests creating action flow override configuration.
   *
   * @throws Exception when something goes wrong.
   */
  @Test
  public void testCorrectFlowOverride() throws Exception {
    ActionProxy proxy = getActionProxy("/correctFlowOverride/correctFlowOverride");
    Assert.assertNotNull(proxy);
    proxy.getInvocation().getInvocationContext().setSession(new HashMap<String, Object>());
    proxy.execute();

    ActionConfig overriddenViewConf =
        configuration
            .getRuntimeConfiguration()
            .getActionConfig("/correctFlowOverride", "savePhone-2ViewOverride");

    Assert.assertNotNull(overriddenViewConf);
    Assert.assertEquals("phone", overriddenViewConf.getMethodName());
    Assert.assertEquals(
        "anotherPhone",
        overriddenViewConf
            .getResults()
            .get(Action.SUCCESS)
            .getParams()
            .get(ServletDispatcherResult.DEFAULT_PARAM));

    ActionConfig actionConfig =
        configuration
            .getRuntimeConfiguration()
            .getActionConfig("/correctFlowOverride", "saveName-1ViewOverride");

    Assert.assertNotNull(actionConfig);
    Assert.assertEquals("executeOverride", actionConfig.getMethodName());
    Assert.assertEquals(
        "name",
        actionConfig
            .getResults()
            .get(Action.SUCCESS)
            .getParams()
            .get(ServletDispatcherResult.DEFAULT_PARAM));
  }
Ejemplo n.º 22
0
 public void testNoTokenInParams() throws Exception {
   ActionProxy proxy = buildProxy(getActionName());
   assertEquals(TokenInterceptor.INVALID_TOKEN_CODE, proxy.execute());
 }
Ejemplo n.º 23
0
  @Test
  public void testCURD() throws Exception {
    initServletMockObjects();
    ActionProxy proxy = getActionProxy("/referance/new");
    ReferanceAction referanceAction = (ReferanceAction) proxy.getAction();
    String result = proxy.execute();
    assertEquals(Action.SUCCESS, result);

    initServletMockObjects();
    request.setParameter("referanceBean.name", "name");
    request.setParameter("referanceBean.code", "code");
    request.setParameter("referanceBean.textEN", "textEN");
    request.setParameter("referanceBean.textCN", "textCN");
    request.setParameter("referanceBean.category", "category");

    proxy = getActionProxy("/referance/create");
    referanceAction = (ReferanceAction) proxy.getAction();
    result = proxy.execute();
    assertEquals(Action.SUCCESS, result);

    initServletMockObjects();
    proxy = getActionProxy("/referance/list");
    referanceAction = (ReferanceAction) proxy.getAction();
    result = proxy.execute();
    assertEquals(Action.SUCCESS, result);
    List<ReferanceView> listReferance = referanceAction.getListReferance();
    assertEquals(2, listReferance.size());
    Page page = referanceAction.getPage();
    assertEquals(1, page.getPage());

    Long idEN = listReferance.get(0).getId();
    Long idCN = listReferance.get(1).getId();

    initServletMockObjects();
    request.setParameter("id", Long.toString(idEN));
    proxy = getActionProxy("/referance/edit");
    referanceAction = (ReferanceAction) proxy.getAction();
    result = proxy.execute();
    assertEquals(Action.SUCCESS, result);
    Referance referance = referanceAction.getReferance();
    assertEquals("name", referance.getName());
    assertEquals("code", referance.getCode());
    assertEquals("textEN", referance.getText());
    assertEquals("en", referance.getLang());
    assertEquals("category", referance.getCategory());

    initServletMockObjects();
    request.setParameter("referance.id", Long.toString(idEN));
    request.setParameter("referance.name", "name-updated");
    request.setParameter("referance.code", "code-updated");
    request.setParameter("referance.text", "textEN-updated");
    request.setParameter("referance.lang", "en");
    request.setParameter("referance.category", "category-updated");
    proxy = getActionProxy("/referance/update");
    referanceAction = (ReferanceAction) proxy.getAction();
    result = proxy.execute();
    assertEquals(Action.SUCCESS, result);

    initServletMockObjects();
    request.setParameter("id", Long.toString(idEN));
    proxy = getActionProxy("/referance/show");
    referanceAction = (ReferanceAction) proxy.getAction();
    result = proxy.execute();
    assertEquals(Action.SUCCESS, result);
    referance = referanceAction.getReferance();
    assertEquals("name-updated", referance.getName());
    assertEquals("code-updated", referance.getCode());
    assertEquals("textEN-updated", referance.getText());
    assertEquals("en", referance.getLang());
    assertEquals("category-updated", referance.getCategory());

    initServletMockObjects();
    request.setParameter("id", Long.toString(idEN));
    proxy = getActionProxy("/referance/destroy");
    referanceAction = (ReferanceAction) proxy.getAction();
    result = proxy.execute();
    assertEquals(Action.SUCCESS, result);

    initServletMockObjects();
    request.setParameter("id", Long.toString(idCN));
    proxy = getActionProxy("/referance/destroy");
    referanceAction = (ReferanceAction) proxy.getAction();
    result = proxy.execute();
    assertEquals(Action.SUCCESS, result);
  }
Ejemplo n.º 24
0
  /**
   * Load Action class for mapping and invoke the appropriate Action method, or go directly to the
   * Result.
   *
   * <p>This method first creates the action context from the given parameters, and then loads an
   * <tt>ActionProxy</tt> from the given action name and namespace. After that, the Action method is
   * executed and output channels through the response object. Actions not found are sent back to
   * the user via the {@link Dispatcher#sendError} method, using the 404 return code. All other
   * errors are reported by throwing a ServletException.
   *
   * @param request the HttpServletRequest object
   * @param response the HttpServletResponse object
   * @param mapping the action mapping object
   * @throws ServletException when an unknown error occurs (not a 404, but typically something that
   *     would end up as a 5xx by the servlet container)
   * @param context Our ServletContext object
   */
  public void serviceAction(
      HttpServletRequest request,
      HttpServletResponse response,
      ServletContext context,
      ActionMapping mapping)
      throws ServletException {

    Map<String, Object> extraContext = createContextMap(request, response, mapping, context);

    // If there was a previous value stack, then create a new copy and pass it in to be used by the
    // new Action
    ValueStack stack =
        (ValueStack) request.getAttribute(ServletActionContext.STRUTS_VALUESTACK_KEY);
    boolean nullStack = stack == null;
    if (nullStack) {
      ActionContext ctx = ActionContext.getContext();
      if (ctx != null) {
        stack = ctx.getValueStack();
      }
    }
    if (stack != null) {
      extraContext.put(ActionContext.VALUE_STACK, valueStackFactory.createValueStack(stack));
    }

    String timerKey = "Handling request from Dispatcher";
    try {
      UtilTimerStack.push(timerKey);
      String namespace = mapping.getNamespace();
      String name = mapping.getName();
      String method = mapping.getMethod();

      Configuration config = configurationManager.getConfiguration();
      ActionProxy proxy =
          config
              .getContainer()
              .getInstance(ActionProxyFactory.class)
              .createActionProxy(namespace, name, method, extraContext, true, false);

      request.setAttribute(
          ServletActionContext.STRUTS_VALUESTACK_KEY, proxy.getInvocation().getStack());

      // if the ActionMapping says to go straight to a result, do it!
      if (mapping.getResult() != null) {
        Result result = mapping.getResult();
        result.execute(proxy.getInvocation());
      } else {
        proxy.execute();
      }

      // If there was a previous value stack then set it back onto the request
      if (!nullStack) {
        request.setAttribute(ServletActionContext.STRUTS_VALUESTACK_KEY, stack);
      }
    } catch (ConfigurationException e) {
      // WW-2874 Only log error if in devMode
      if (devMode) {
        String reqStr = request.getRequestURI();
        if (request.getQueryString() != null) {
          reqStr = reqStr + "?" + request.getQueryString();
        }
        LOG.error("Could not find action or result\n" + reqStr, e);
      } else {
        if (LOG.isWarnEnabled()) {
          LOG.warn("Could not find action or result", e);
        }
      }
      sendError(request, response, context, HttpServletResponse.SC_NOT_FOUND, e);
    } catch (Exception e) {
      if (handleException || devMode) {
        sendError(request, response, context, HttpServletResponse.SC_INTERNAL_SERVER_ERROR, e);
      } else {
        throw new ServletException(e);
      }
    } finally {
      UtilTimerStack.pop(timerKey);
    }
  }
Ejemplo n.º 25
0
 public void testTokenInterceptorSuccess() throws Exception {
   setToken(request);
   ActionProxy proxy = buildProxy(getActionName());
   assertEquals(Action.SUCCESS, proxy.execute());
 }
  public String intercept(ActionInvocation invocation) throws Exception {
    ActionContext ac = invocation.getInvocationContext();

    HttpServletRequest request = (HttpServletRequest) ac.get(ServletActionContext.HTTP_REQUEST);

    if (!(request instanceof MultiPartRequestWrapper)) {
      if (LOG.isDebugEnabled()) {
        ActionProxy proxy = invocation.getProxy();
        LOG.debug(
            getTextMessage(
                "struts.messages.bypass.request",
                new String[] {proxy.getNamespace(), proxy.getActionName()}));
      }

      return invocation.invoke();
    }

    ValidationAware validation = null;

    Object action = invocation.getAction();

    if (action instanceof ValidationAware) {
      validation = (ValidationAware) action;
    }

    MultiPartRequestWrapper multiWrapper = (MultiPartRequestWrapper) request;

    if (multiWrapper.hasErrors()) {
      for (String error : multiWrapper.getErrors()) {
        if (validation != null) {
          validation.addActionError(error);
        }

        if (LOG.isWarnEnabled()) {
          LOG.warn(error);
        }
      }
    }

    // bind allowed Files
    Enumeration fileParameterNames = multiWrapper.getFileParameterNames();
    while (fileParameterNames != null && fileParameterNames.hasMoreElements()) {
      // get the value of this input tag
      String inputName = (String) fileParameterNames.nextElement();

      // get the content type
      String[] contentType = multiWrapper.getContentTypes(inputName);

      if (isNonEmpty(contentType)) {
        // get the name of the file from the input tag
        String[] fileName = multiWrapper.getFileNames(inputName);

        if (isNonEmpty(fileName)) {
          // get a File object for the uploaded File
          File[] files = multiWrapper.getFiles(inputName);
          if (files != null && files.length > 0) {
            List<File> acceptedFiles = new ArrayList<File>(files.length);
            List<String> acceptedContentTypes = new ArrayList<String>(files.length);
            List<String> acceptedFileNames = new ArrayList<String>(files.length);
            String contentTypeName = inputName + "ContentType";
            String fileNameName = inputName + "FileName";

            for (int index = 0; index < files.length; index++) {
              if (acceptFile(
                  action,
                  files[index],
                  fileName[index],
                  contentType[index],
                  inputName,
                  validation)) {
                acceptedFiles.add(files[index]);
                acceptedContentTypes.add(contentType[index]);
                acceptedFileNames.add(fileName[index]);
              }
            }

            if (!acceptedFiles.isEmpty()) {
              Map<String, Object> params = ac.getParameters();

              params.put(inputName, acceptedFiles.toArray(new File[acceptedFiles.size()]));
              params.put(
                  contentTypeName,
                  acceptedContentTypes.toArray(new String[acceptedContentTypes.size()]));
              params.put(
                  fileNameName, acceptedFileNames.toArray(new String[acceptedFileNames.size()]));
            }
          }
        } else {
          if (LOG.isWarnEnabled()) {
            LOG.warn(
                getTextMessage(action, "struts.messages.invalid.file", new String[] {inputName}));
          }
        }
      } else {
        if (LOG.isWarnEnabled()) {
          LOG.warn(
              getTextMessage(
                  action, "struts.messages.invalid.content.type", new String[] {inputName}));
        }
      }
    }

    // invoke action
    return invocation.invoke();
  }
 public void testNullTokenName() throws Exception {
   setToken((String) null);
   ActionProxy proxy = buildProxy(getActionName());
   proxy.execute();
 }