Class PhotonAppWebTestRule

java.lang.Object
org.junit.rules.ExternalResource
com.helger.web.scope.mock.WebScopeTestRule
com.helger.photon.app.mock.PhotonAppWebTestRule
All Implemented Interfaces:
org.junit.rules.TestRule

public class PhotonAppWebTestRule extends com.helger.web.scope.mock.WebScopeTestRule
Web scope aware test rule, with a defined storage root directory
Author:
Philip Helger
  • Field Summary

    Fields inherited from class com.helger.web.scope.mock.WebScopeTestRule

    MOCK_CONTEXT_PATH
  • Constructor Summary

    Constructors
    Constructor
    Description
    Ctor using the default storage path from ScopeTestRule
    Ctor with an arbitrary path
    PhotonAppWebTestRule(File aDataPath, String sServletContextPath)
    Ctor with an arbitrary path
  • Method Summary

    Modifier and Type
    Method
    Description
    void
     
    void
     
    final File
     
    final String
     
    setDeleteAllData(boolean bDeleteAllData)
    Delete the directories with data and servlet context path before each iteration?

    Methods inherited from class com.helger.web.scope.mock.WebScopeTestRule

    createMockRequest, createMockServletContext, getContextPath, getRequest, getServletContext, getServletContextInitParameters, getServletPool, getSession, initListener, setContextPath, setServletContextInitParameters, toString

    Methods inherited from class org.junit.rules.ExternalResource

    apply

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • PhotonAppWebTestRule

      public PhotonAppWebTestRule()
      Ctor using the default storage path from ScopeTestRule
    • PhotonAppWebTestRule

      public PhotonAppWebTestRule(@Nonnull File aPath)
      Ctor with an arbitrary path
      Parameters:
      aPath - The data AND servlet context path to be used. May not be null.
      Since:
      8.0.1
    • PhotonAppWebTestRule

      public PhotonAppWebTestRule(@Nonnull File aDataPath, @Nonnull @Nonempty String sServletContextPath)
      Ctor with an arbitrary path
      Parameters:
      aDataPath - The data path to be used. May not be null.
      sServletContextPath - The servlet context path to be used. May not be null.
  • Method Details

    • getDataPath

      @Nonnull public final File getDataPath()
      Returns:
      The used data path. Never null.
    • getServletContextPath

      @Nonnull @Nonempty public final String getServletContextPath()
      Returns:
      The used servlet context path. Never null.
    • setDeleteAllData

      @Nonnull public final PhotonAppWebTestRule setDeleteAllData(boolean bDeleteAllData)
      Delete the directories with data and servlet context path before each iteration?
      Parameters:
      bDeleteAllData - true to delete them in before(), false if not.
      Returns:
      this for chaining
    • before

      public void before()
      Overrides:
      before in class com.helger.web.scope.mock.WebScopeTestRule
    • after

      public void after()
      Overrides:
      after in class com.helger.web.scope.mock.WebScopeTestRule