Class AbstractInjectableActionTest<ACTION extends org.apache.struts2.action.Action>

All Implemented Interfaces:
org.springframework.beans.factory.Aware, org.springframework.context.ApplicationContextAware

public abstract class AbstractInjectableActionTest<ACTION extends org.apache.struts2.action.Action> extends AbstractInjectableStateTest
Instructions for creating a test using this base class. 1: Decide which action you're testing. 2: Find that action in struts.xml by searching for the class name. 3: Check which method you should be calling on the action. (it'll be listed in struts.xml). 4: return the name of that method in getMethodName, and return that action's class in getActionClass 5: call getActionProxy().execute() to run the action, and check the string result of that call for success or failure.

If there is no method listed in struts.xml, then just return null in getMethodName, which will call the default method. Your action or an interceptor may expect certain query parameters or POST variables. To set these look at setParameters

Since:
7.2.0
  • Field Details

    • mockitoRule

      public org.mockito.junit.MockitoRule mockitoRule
    • contentPermissionManager

      @Inject protected ContentPermissionManager contentPermissionManager
    • spacePermissionManager

      @Inject protected SpacePermissionManager spacePermissionManager
    • pageService

      @Inject protected PageService pageService
    • spaceService

      @Inject protected SpaceService spaceService
    • viewRenderer

      @Inject protected Renderer viewRenderer
    • collaborativeEditingHelper

      @Inject protected CollaborativeEditingHelper collaborativeEditingHelper
    • xsrfTokenGenerator

      @Inject protected com.atlassian.struts.xsrf.XsrfTokenGenerator xsrfTokenGenerator
    • request

      protected org.springframework.mock.web.MockHttpServletRequest request
    • space

      protected Space space
    • groupOfTestUser

      protected com.atlassian.user.Group groupOfTestUser
    • confluenceTestUser

      protected ConfluenceUser confluenceTestUser
    • person

      protected Person person
  • Constructor Details

    • AbstractInjectableActionTest

      public AbstractInjectableActionTest()
  • Method Details

    • setup

      public final void setup() throws Exception
      Throws:
      Exception
    • getMethodName

      protected abstract String getMethodName()
    • setParameters

      protected void setParameters(Map<String,?> parameters)
    • setRequestXsrfToken

      protected void setRequestXsrfToken()
    • setParameters

      protected void setParameters(AbstractPage page)
    • setParameters

      protected void setParameters(Comment comment)
    • setParameters

      protected void setParameters(Space space)
    • getRemoteUserName

      protected String getRemoteUserName()
    • prepareContext

      protected Map<String,Object> prepareContext()
    • getAction

      protected final ACTION getAction()
    • getActionProxy

      protected org.apache.struts2.ActionProxy getActionProxy()
    • becomeTestUser

      protected void becomeTestUser()
    • becomeAdmin

      protected void becomeAdmin()
    • becomeAnonymous

      protected void becomeAnonymous()
    • createUserInGroup

      protected ConfluenceUser createUserInGroup(String username, com.atlassian.user.Group group) throws com.atlassian.user.EntityException
      Throws:
      com.atlassian.user.EntityException
    • installExpiredLicense

      protected void installExpiredLicense() throws IOException
      Throws:
      IOException