Package org.apache.struts.action

Examples of org.apache.struts.action.Action


  @Test
  public void testCreationAction() throws Exception
  {
    ActionCreator actionCreator = new ActionCreatorImpl();
    Action action = actionCreator.createAction(SimpleDispatchAction.class);
    NavigableDispatchController controller = (NavigableDispatchController) action;
    assert controller.getBeanSource() != null;
    assert controller.getNavigationHolder() != null;
  }
View Full Code Here


  @Test
  public void testCreationAction() throws Exception
  {
    ActionCreator actionCreator = new ActionCreatorImpl();
    Action action = actionCreator.createAction(NavigableLookupDispatchAction.class);
    NavigableLookupDispatchController controller = (NavigableLookupDispatchController) action;
    assert controller.getBeanSource() != null;
    assert controller.getNavigationHolder() != null;
    assert controller.internalGetKeyMethodMap() != null;
  }
View Full Code Here

  @Test
  public void testCreationAction() throws Exception
  {
    ActionCreator actionCreator = new ActionCreatorImpl();
    Action action = actionCreator.createAction(NavigableFormSubmitBean.class);
    NavigableSubmitController controller = (NavigableSubmitController) action;
    assert controller.getBeanSource() != null;
    assert controller.getNavigationHolder() != null;
  }
View Full Code Here

  @Test
  public void testCreationAction() throws Exception
  {
    ActionCreator actionCreator = new ActionCreatorImpl();
    Action action = actionCreator.createAction(NavigableReadOnlyBean.class);
    NavigableController controller = (NavigableController) action;
    assert controller.getBeanSource() != null;
    assert controller.getNavigationHolder() != null;
  }
View Full Code Here

   */
  @Test
  public void testActionCreate() throws Exception
  {

    Action createAction = actionCreator.createAction(TestAction.class);

    assert createAction instanceof ControllerAction;

    ControllerAction controllerAction = (ControllerAction) createAction;
    Object newActionBean = controllerAction.getBeanSource().createBean(null);
View Full Code Here

  @Test
  public void testCreateControllerAction() throws Exception
  {

    Action createAction = actionCreator.createControllerAction(TestAction.class);

    assert createAction instanceof ControllerAction;

    ControllerAction controllerAction = (ControllerAction) createAction;
    Object newActionBean = controllerAction.getBeanSource().createBean(null);
View Full Code Here

    replay(mapping);

    ControllerRequestProcessor controllerRequestProcessor = new ControllerRequestProcessor();
    controllerRequestProcessor.setActionCreator(new ActionCreatorImpl());
    Action action1 = controllerRequestProcessor.processActionCreate(null, null, mapping);
    Action action2 = controllerRequestProcessor.processActionCreate(null, null, mapping);

    assert action1 != null;
    assert action1 instanceof ReadOnlyControllerAction;

    verify(mapping);
View Full Code Here

    replay(creator);

    ControllerRequestProcessor controllerRequestProcessor = new ControllerRequestProcessor();
    controllerRequestProcessor.setActionCreator(creator);

    Action action1 = controllerRequestProcessor.processActionCreate(null, null, mapping);
    Action action2 = controllerRequestProcessor.processActionCreate(null, null, mapping);

    verify(mapping);
    verify(creator);

    assert action1 != null;
View Full Code Here

   */
  @Test
  public void testProcessRegularAction() throws Exception
  {

    Action action = createMock(Action.class);
    ModuleConfig config = createMock(ModuleConfig.class);
    ServletContext context = createMock(ServletContext.class);
    ActionServlet servlet = createMock(ActionServlet.class);

    expect(servlet.getServletContext()).andReturn(context);
    expect(config.getPrefix()).andReturn("");
    expect(action.execute(null, null, (HttpServletRequest) null, (HttpServletResponse) null)).andReturn(null)
        .times(1);

    replay(action);
    replay(config);
    replay(context);
View Full Code Here

  @Override
  protected Action getAction(ActionContext context, String type, ActionConfig actionConfig) throws Exception
  {

    String className = type;
    Action action = null;

    ModuleConfig moduleConfig = actionConfig.getModuleConfig();
    String actionsKey = Constants.ACTIONS_KEY + moduleConfig.getPrefix();
   
    final Map applicationScope = context.getApplicationScope();
   
    Map<String, Action> actions = (Map<String, Action>) applicationScope.get(actionsKey);

    if (actions == null)
    {
      actions = new HashMap<String, Action>();
      applicationScope.put(actionsKey, actions);
    }

    boolean isNew = false;

    synchronized (actions)
    {
      action = (Action) actions.get(className);

      if (action == null)
      {
        // load the action class
        Class clazz = Class.forName(className);
       
        // delegate action creation to ActionCreator
        action = actionCreator.createAction(clazz);
        isNew = true;
      }

      if (isNew)
      {
        actions.put(className, action);
        if (action.getServlet() == null)
        {
          ServletActionContext saContext = (ServletActionContext) context;
          ActionServlet actionServlet = saContext.getActionServlet();

          action.setServlet(actionServlet);
        }
      }
    }
    return action;
  }
View Full Code Here

TOP

Related Classes of org.apache.struts.action.Action

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.