Class AppBasedTestingBase<R extends org.spincast.core.exchange.RequestContext<?>,W extends org.spincast.core.websocket.WebsocketContext<?>>

java.lang.Object
org.spincast.testing.core.SpincastTestBase
org.spincast.testing.core.AppBasedTestingBase<R,W>
All Implemented Interfaces:
org.spincast.testing.junitrunner.BeforeAfterClassMethodsProvider, org.spincast.testing.junitrunner.CanBeDisabled, org.spincast.testing.junitrunner.RepeatedClassAfterMethodProvider, org.spincast.testing.junitrunner.TestFailureListener

public abstract class AppBasedTestingBase<R extends org.spincast.core.exchange.RequestContext<?>,W extends org.spincast.core.websocket.WebsocketContext<?>> extends SpincastTestBase
  • Field Summary

    Fields inherited from class org.spincast.testing.core.SpincastTestBase

    logger, spincastConfig
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
     
    void
     
    protected abstract void
    Starts the application.
    protected void
    Removes all the cookies saved from a previous response.
    protected org.spincast.plugins.httpclient.builders.ConnectRequestBuilder
    Starts an Https Client builder for a CONNECT method.
    protected org.spincast.plugins.httpclient.builders.ConnectRequestBuilder
    CONNECT(String pathOrUrl, boolean isFullUrl)
    Starts an Https Client builder for a CONNECT method.
    protected org.spincast.plugins.httpclient.builders.ConnectRequestBuilder
    CONNECT(String pathOrUrl, boolean isFullUrl, boolean isHttps)
    Starts an Http(s) Client builder for a CONNECT method.
    protected final com.google.inject.Injector
    The test class must implement this method to create the Guice injector.
    protected String
    Creates an URL to the started HTTPS server.
    protected String
    createTestUrl(String path, boolean isHttps)
    Creates an URL to the started HTTP(S) server.
    protected String
    createTestUrl(String pathOrUrl, boolean isFullUrl, boolean isHttps)
    Creates an URL to the started HTTP(S) server.
    protected String
    createTestUrl(String host, String path, boolean isHttps)
     
    protected org.spincast.plugins.httpclient.builders.DeleteRequestBuilder
    DELETE(String path)
    Starts an Https Client builder for a DELETE method.
    protected org.spincast.plugins.httpclient.builders.DeleteRequestBuilder
    DELETE(String pathOrUrl, boolean isFullUrl)
    Starts an Https Client builder for a DELETE method.
    protected org.spincast.plugins.httpclient.builders.DeleteRequestBuilder
    DELETE(String pathOrUrl, boolean isFullUrl, boolean isHttps)
    Starts an Http(s) Client builder for a DELETE method.
    protected String
    Format a date so it can be used in a HTTP header.
    protected org.spincast.plugins.httpclient.builders.GetRequestBuilder
    GET(String path)
    Starts an Https Client builder for a GET method.
    protected org.spincast.plugins.httpclient.builders.GetRequestBuilder
    GET(String pathOrUrl, boolean isFullUrl)
    Starts an Https Client builder for a GET method.
    protected org.spincast.plugins.httpclient.builders.GetRequestBuilder
    GET(String pathOrUrl, boolean isFullUrl, boolean isHttps)
    Starts an Http(s) Client builder for a GET method.
    protected abstract AppTestingConfigs
    We force test classes to provide information about the required testing configurations.
    protected org.spincast.core.cookies.CookieFactory
     
    protected Set<com.google.inject.Key<?>>
    Extra exact bindings to remvoe before the plugins are applied.
    protected com.google.inject.Module
    Can be overriden with something like :
    protected List<org.spincast.core.guice.SpincastPlugin>
    The extra required plugins.
    protected final com.google.inject.Module
    If an overriding Module is to be added using the Guice tweaker.
    protected final List<org.spincast.core.guice.SpincastPlugin>
    The extra required plugins.
    protected org.spincast.plugins.httpclient.websocket.HttpClient
     
    protected org.spincast.core.cookies.Cookie
     
    protected Set<org.spincast.core.cookies.Cookie>
    The Cookies returned by the previous HttpResponse.
    protected org.spincast.core.routing.Router<R,W>
     
    protected org.spincast.core.server.Server
     
    protected final Class<? extends org.spincast.core.config.SpincastConfig>
    The implementation to use for the SpincastConfig binding, when running tests.
    protected org.spincast.plugins.httpclient.builders.HeadRequestBuilder
    HEAD(String path)
    Starts an Https Client builder for a HEAD method.
    protected org.spincast.plugins.httpclient.builders.HeadRequestBuilder
    HEAD(String pathOrUrl, boolean isFullUrl)
    Starts an Https Client builder for a HEAD method.
    protected org.spincast.plugins.httpclient.builders.HeadRequestBuilder
    HEAD(String pathOrUrl, boolean isFullUrl, boolean isHttps)
    Starts an Http(s) Client builder for a HEAD method.
    protected final boolean
     
    protected boolean
    By default, for the tests, by disable the SSL certificate errors.
    protected boolean
     
    protected boolean
    Will set Cookie.setSecure(boolean) to false on cookies added to the getPreviousResponseCookies() so their can be resend in tests file using HTTP (not HTTPS).
    protected org.spincast.plugins.httpclient.builders.OptionsRequestBuilder
    Starts an Https Client builder for a OPTIONS method.
    protected org.spincast.plugins.httpclient.builders.OptionsRequestBuilder
    OPTIONS(String pathOrUrl, boolean isFullUrl)
    Starts an Https Client builder for a OPTIONS method.
    protected org.spincast.plugins.httpclient.builders.OptionsRequestBuilder
    OPTIONS(String pathOrUrl, boolean isFullUrl, boolean isHttps)
    Starts an Http(s) Client builder for a OPTIONS method.
    protected Date
    parseDate(String dateHeaderValue)
    Parse a date from a HTTP header to a Date object.
    protected org.spincast.plugins.httpclient.builders.PatchRequestBuilder
    PATCH(String path)
    Starts an Https Client builder for a PATCH method.
    protected org.spincast.plugins.httpclient.builders.PatchRequestBuilder
    PATCH(String pathOrUrl, boolean isFullUrl)
    Starts an Https Client builder for a PATCH method.
    protected org.spincast.plugins.httpclient.builders.PatchRequestBuilder
    PATCH(String pathOrUrl, boolean isFullUrl, boolean isHttps)
    Starts an Http(s) Client builder for a PATCH method.
    protected org.spincast.plugins.httpclient.builders.PostRequestBuilder
    POST(String path)
    Starts an Https Client builder for a POST method.
    protected org.spincast.plugins.httpclient.builders.PostRequestBuilder
    POST(String pathOrUrl, boolean isFullUrl)
    Starts an Https Client builder for a POST method.
    protected org.spincast.plugins.httpclient.builders.PostRequestBuilder
    POST(String pathOrUrl, boolean isFullUrl, boolean isHttps)
    Starts an Http(s) Client builder for a POST method.
    protected org.spincast.plugins.httpclient.builders.PutRequestBuilder
    PUT(String path)
    Starts an Https Client builder for a PUT method.
    protected org.spincast.plugins.httpclient.builders.PutRequestBuilder
    PUT(String pathOrUrl, boolean isFullUrl)
    Starts an Https Client builder for a PUT method.
    protected org.spincast.plugins.httpclient.builders.PutRequestBuilder
    PUT(String pathOrUrl, boolean isFullUrl, boolean isHttps)
    Starts an Http(s) Client builder for a PUT method.
    protected void
    saveResponseCookies(org.spincast.plugins.httpclient.HttpResponse response)
    Saves the current response's cookies.
    protected void
     
    protected org.spincast.plugins.httpclient.builders.TraceRequestBuilder
    TRACE(String path)
    Starts an Https Client builder for a TRACE method.
    protected org.spincast.plugins.httpclient.builders.TraceRequestBuilder
    TRACE(String pathOrUrl, boolean isFullUrl)
    Starts an Https Client builder for a TRACE method.
    protected org.spincast.plugins.httpclient.builders.TraceRequestBuilder
    TRACE(String pathOrUrl, boolean isFullUrl, boolean isHttps)
    Starts an Http(s) Client builder for a TRACE method.
    protected void
    tweakConfigurations(org.spincast.core.guice.GuiceTweaker guiceTweaker)
    Since an App is used, it will probably use it own AppConfig interface for the config.
    protected void
    validateCreatedInjector(com.google.inject.Injector guice)
    Validates the created Injector, before the dependencies are injected in the test class.
    protected org.spincast.plugins.httpclient.websocket.builders.WebsocketRequestBuilder
     
    protected org.spincast.plugins.httpclient.websocket.builders.WebsocketRequestBuilder
    websocket(String pathOrUrl, boolean isFullUrl)
     
    protected org.spincast.plugins.httpclient.websocket.builders.WebsocketRequestBuilder
    websocket(String pathOrUrl, boolean isFullUrl, boolean isHttps)
     

    Methods inherited from class java.lang.Object

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

    • AppBasedTestingBase

      public AppBasedTestingBase()
  • Method Details

    • beforeClass

      public void beforeClass()
      Specified by:
      beforeClass in interface org.spincast.testing.junitrunner.BeforeAfterClassMethodsProvider
      Overrides:
      beforeClass in class SpincastTestBase
    • createInjector

      protected final com.google.inject.Injector createInjector()
      Description copied from class: SpincastTestBase
      The test class must implement this method to create the Guice injector. It can be done by starting a real application (with a main(...) method) or by creating a custom Injector.
      Specified by:
      createInjector in class SpincastTestBase
    • getTestingConfigImplementationClass

      protected final Class<? extends org.spincast.core.config.SpincastConfig> getTestingConfigImplementationClass()
      Description copied from class: SpincastTestBase
      The implementation to use for the SpincastConfig binding, when running tests.
      Overrides:
      getTestingConfigImplementationClass in class SpincastTestBase
    • isDisableBindCurrentClass

      protected final boolean isDisableBindCurrentClass()
      Overrides:
      isDisableBindCurrentClass in class SpincastTestBase
    • getExtraExactBindingsToRemoveBeforePlugins

      protected Set<com.google.inject.Key<?>> getExtraExactBindingsToRemoveBeforePlugins()
      Description copied from class: SpincastTestBase
      Extra exact bindings to remvoe before the plugins are applied.
      Overrides:
      getExtraExactBindingsToRemoveBeforePlugins in class SpincastTestBase
    • getGuiceTweakerExtraOverridingModule

      protected final com.google.inject.Module getGuiceTweakerExtraOverridingModule()
      Description copied from class: SpincastTestBase
      If an overriding Module is to be added using the Guice tweaker.

      Can be overriden with something like :

       return Modules.override(super.getGuiceTweakerExtraOverridingModule()).with(new SpincastGuiceModuleBase() {
           protected void configure() {
               // ...
           }
       });
       
      Overrides:
      getGuiceTweakerExtraOverridingModule in class SpincastTestBase
    • tweakConfigurations

      protected void tweakConfigurations(org.spincast.core.guice.GuiceTweaker guiceTweaker)
      Since an App is used, it will probably use it own AppConfig interface for the config. Often, this interface will extends SpincastConfig so all configs are available from the same instance: those for the application and the default ones required by Spincast.

      But, during tests, we also want to easily reuse the testing configs values defined in SpincastConfigTestingDefault (for example for a free port to be used to start the HTTPS server)... Without having to extends AppConfig and add a binding that redefine all those testing values available in SpincastConfigTestingDefault.

      But that means that two bound interfaces must use those testing configs, AppConfig and SpincastConfig. To be able to defined testing configs *once*, we add an AOP interceptor: all methods on AppConfig inherited from SpincastConfig (such as "getHttpsServerPort()") will be intercepted and the ones from the testing impl bound to SpincastConfig will be used instead!

      Overrides:
      tweakConfigurations in class SpincastTestBase
    • isIgnoreMethodsAnnotatedWithInjectDuringConfigurationsTweaking

      protected boolean isIgnoreMethodsAnnotatedWithInjectDuringConfigurationsTweaking()
    • getExtraOverridingModule

      protected com.google.inject.Module getExtraOverridingModule()
      Can be overriden with something like :
       return Modules.override(super.getExtraOverridingModule()).with(new SpincastGuiceModuleBase() {
           protected void configure() {
               // ...
           }
       });
       
    • getGuiceTweakerExtraPlugins

      protected final List<org.spincast.core.guice.SpincastPlugin> getGuiceTweakerExtraPlugins()
      The extra required plugins.
      Overrides:
      getGuiceTweakerExtraPlugins in class SpincastTestBase
    • getExtraPlugins

      protected List<org.spincast.core.guice.SpincastPlugin> getExtraPlugins()
      The extra required plugins. Example:
       List<SpincastPlugin> extraPlugins = super.getExtraPlugins();
       extraPlugins.add(new XXX());
       return extraPlugins;
       
    • validateCreatedInjector

      protected void validateCreatedInjector(com.google.inject.Injector guice)
      Description copied from class: SpincastTestBase
      Validates the created Injector, before the dependencies are injected in the test class.
      Overrides:
      validateCreatedInjector in class SpincastTestBase
    • afterClass

      public void afterClass()
      Specified by:
      afterClass in interface org.spincast.testing.junitrunner.BeforeAfterClassMethodsProvider
      Overrides:
      afterClass in class SpincastTestBase
    • stopServer

      protected void stopServer()
    • getHttpClient

      protected org.spincast.plugins.httpclient.websocket.HttpClient getHttpClient()
    • getRouter

      protected org.spincast.core.routing.Router<R,W> getRouter()
    • getCookieFactory

      protected org.spincast.core.cookies.CookieFactory getCookieFactory()
    • getServer

      protected org.spincast.core.server.Server getServer()
    • createTestUrl

      protected String createTestUrl(String path)
      Creates an URL to the started HTTPS server.
      Parameters:
      path - the relative path to be appended to the base test URL.
    • createTestUrl

      protected String createTestUrl(String path, boolean isHttps)
      Creates an URL to the started HTTP(S) server.
      Parameters:
      path - the relative path to be appended to the base test URL.
      isHttps - if true, "https:" will be used instead of "http:".
    • createTestUrl

      protected String createTestUrl(String pathOrUrl, boolean isFullUrl, boolean isHttps)
      Creates an URL to the started HTTP(S) server.
      Parameters:
      pathOrUrl - a relative path OR a full URL.
      isFullUrl - if the 'pathOrUrl' parameter a full URL? If so, it will be used as is. Otherwise it will be appended to the base test URL.
      isHttps - if true, "https:" will be used instead of "http:".
    • createTestUrl

      protected String createTestUrl(String host, String path, boolean isHttps)
    • websocket

      protected org.spincast.plugins.httpclient.websocket.builders.WebsocketRequestBuilder websocket(String path)
    • websocket

      protected org.spincast.plugins.httpclient.websocket.builders.WebsocketRequestBuilder websocket(String pathOrUrl, boolean isFullUrl)
    • websocket

      protected org.spincast.plugins.httpclient.websocket.builders.WebsocketRequestBuilder websocket(String pathOrUrl, boolean isFullUrl, boolean isHttps)
    • GET

      protected org.spincast.plugins.httpclient.builders.GetRequestBuilder GET(String path)
      Starts an Https Client builder for a GET method. A cookie store is automatically added.
      Parameters:
      path - the relative path to be appended to the base test URL.
    • GET

      protected org.spincast.plugins.httpclient.builders.GetRequestBuilder GET(String pathOrUrl, boolean isFullUrl)
      Starts an Https Client builder for a GET method. A cookie store is automatically added.
      Parameters:
      pathOrUrl - a relative path or a full URL.
      isFullUrl - if the 'pathOrUrl' parameter a full URL? If so, it will be used as is. Otherwise it will be appended to the base test URL.
    • GET

      protected org.spincast.plugins.httpclient.builders.GetRequestBuilder GET(String pathOrUrl, boolean isFullUrl, boolean isHttps)
      Starts an Http(s) Client builder for a GET method. A cookie store is automatically added.
      Parameters:
      pathOrUrl - a relative path or a full URL.
      isFullUrl - if the 'pathOrUrl' parameter a full URL? If so, it will be used as is. Otherwise it will be appended to the base test URL.
      isHttps - if true, "https:" will be used instead of "http:".
    • isDisableSllCetificateErrors

      protected boolean isDisableSllCetificateErrors()
      By default, for the tests, by disable the SSL certificate errors.
    • POST

      protected org.spincast.plugins.httpclient.builders.PostRequestBuilder POST(String path)
      Starts an Https Client builder for a POST method. A cookie store is automatically added.
      Parameters:
      path - the relative path to be appended to the base test URL.
    • POST

      protected org.spincast.plugins.httpclient.builders.PostRequestBuilder POST(String pathOrUrl, boolean isFullUrl)
      Starts an Https Client builder for a POST method. A cookie store is automatically added.
      Parameters:
      pathOrUrl - a relative path or a full URL.
      isFullUrl - if the 'pathOrUrl' parameter a full URL? If so, it will be used as is. Otherwise it will be appended to the base test URL.
    • POST

      protected org.spincast.plugins.httpclient.builders.PostRequestBuilder POST(String pathOrUrl, boolean isFullUrl, boolean isHttps)
      Starts an Http(s) Client builder for a POST method. A cookie store is automatically added.
      Parameters:
      pathOrUrl - a relative path or a full URL.
      isFullUrl - if the 'pathOrUrl' parameter a full URL? If so, it will be used as is. Otherwise it will be appended to the base test URL.
      isHttps - if true, "https:" will be used instead of "http:".
    • PUT

      protected org.spincast.plugins.httpclient.builders.PutRequestBuilder PUT(String path)
      Starts an Https Client builder for a PUT method. A cookie store is automatically added.
      Parameters:
      path - the relative path to be appended to the base test URL.
    • PUT

      protected org.spincast.plugins.httpclient.builders.PutRequestBuilder PUT(String pathOrUrl, boolean isFullUrl)
      Starts an Https Client builder for a PUT method. A cookie store is automatically added.
      Parameters:
      pathOrUrl - a relative path or a full URL.
      isFullUrl - if the 'pathOrUrl' parameter a full URL? If so, it will be used as is. Otherwise it will be appended to the base test URL.
    • PUT

      protected org.spincast.plugins.httpclient.builders.PutRequestBuilder PUT(String pathOrUrl, boolean isFullUrl, boolean isHttps)
      Starts an Http(s) Client builder for a PUT method. A cookie store is automatically added.
      Parameters:
      pathOrUrl - a relative path or a full URL.
      isFullUrl - if the 'pathOrUrl' parameter a full URL? If so, it will be used as is. Otherwise it will be appended to the base test URL.
      isHttps - if true, "https:" will be used instead of "http:".
    • DELETE

      protected org.spincast.plugins.httpclient.builders.DeleteRequestBuilder DELETE(String path)
      Starts an Https Client builder for a DELETE method. A cookie store is automatically added.
      Parameters:
      path - the relative path to be appended to the base test URL.
    • DELETE

      protected org.spincast.plugins.httpclient.builders.DeleteRequestBuilder DELETE(String pathOrUrl, boolean isFullUrl)
      Starts an Https Client builder for a DELETE method. A cookie store is automatically added.
      Parameters:
      pathOrUrl - a relative path or a full URL.
      isFullUrl - if the 'pathOrUrl' parameter a full URL? If so, it will be used as is. Otherwise it will be appended to the base test URL.
    • DELETE

      protected org.spincast.plugins.httpclient.builders.DeleteRequestBuilder DELETE(String pathOrUrl, boolean isFullUrl, boolean isHttps)
      Starts an Http(s) Client builder for a DELETE method. A cookie store is automatically added.
      Parameters:
      pathOrUrl - a relative path or a full URL.
      isFullUrl - if the 'pathOrUrl' parameter a full URL? If so, it will be used as is. Otherwise it will be appended to the base test URL.
      isHttps - if true, "https:" will be used instead of "http:".
    • OPTIONS

      protected org.spincast.plugins.httpclient.builders.OptionsRequestBuilder OPTIONS(String path)
      Starts an Https Client builder for a OPTIONS method. A cookie store is automatically added.
      Parameters:
      path - the relative path to be appended to the base test URL.
    • OPTIONS

      protected org.spincast.plugins.httpclient.builders.OptionsRequestBuilder OPTIONS(String pathOrUrl, boolean isFullUrl)
      Starts an Https Client builder for a OPTIONS method. A cookie store is automatically added.
      Parameters:
      pathOrUrl - a relative path or a full URL.
      isFullUrl - if the 'pathOrUrl' parameter a full URL? If so, it will be used as is. Otherwise it will be appended to the base test URL.
    • OPTIONS

      protected org.spincast.plugins.httpclient.builders.OptionsRequestBuilder OPTIONS(String pathOrUrl, boolean isFullUrl, boolean isHttps)
      Starts an Http(s) Client builder for a OPTIONS method. A cookie store is automatically added.
      Parameters:
      pathOrUrl - a relative path or a full URL.
      isFullUrl - if the 'pathOrUrl' parameter a full URL? If so, it will be used as is. Otherwise it will be appended to the base test URL.
      isHttps - if true, "https:" will be used instead of "http:".
    • TRACE

      protected org.spincast.plugins.httpclient.builders.TraceRequestBuilder TRACE(String path)
      Starts an Https Client builder for a TRACE method. A cookie store is automatically added.
      Parameters:
      path - the relative path to be appended to the base test URL.
    • TRACE

      protected org.spincast.plugins.httpclient.builders.TraceRequestBuilder TRACE(String pathOrUrl, boolean isFullUrl)
      Starts an Https Client builder for a TRACE method. A cookie store is automatically added.
      Parameters:
      pathOrUrl - a relative path or a full URL.
      isFullUrl - if the 'pathOrUrl' parameter a full URL? If so, it will be used as is. Otherwise it will be appended to the base test URL.
    • TRACE

      protected org.spincast.plugins.httpclient.builders.TraceRequestBuilder TRACE(String pathOrUrl, boolean isFullUrl, boolean isHttps)
      Starts an Http(s) Client builder for a TRACE method. A cookie store is automatically added.
      Parameters:
      pathOrUrl - a relative path or a full URL.
      isFullUrl - if the 'pathOrUrl' parameter a full URL? If so, it will be used as is. Otherwise it will be appended to the base test URL.
      isHttps - if true, "https:" will be used instead of "http:".
    • CONNECT

      protected org.spincast.plugins.httpclient.builders.ConnectRequestBuilder CONNECT(String path)
      Starts an Https Client builder for a CONNECT method. A cookie store is automatically added.
      Parameters:
      path - the relative path to be appended to the base test URL.
    • CONNECT

      protected org.spincast.plugins.httpclient.builders.ConnectRequestBuilder CONNECT(String pathOrUrl, boolean isFullUrl)
      Starts an Https Client builder for a CONNECT method. A cookie store is automatically added.
      Parameters:
      pathOrUrl - a relative path or a full URL.
      isFullUrl - if the 'pathOrUrl' parameter a full URL? If so, it will be used as is. Otherwise it will be appended to the base test URL.
    • CONNECT

      protected org.spincast.plugins.httpclient.builders.ConnectRequestBuilder CONNECT(String pathOrUrl, boolean isFullUrl, boolean isHttps)
      Starts an Http(s) Client builder for a CONNECT method. A cookie store is automatically added.
      Parameters:
      pathOrUrl - a relative path or a full URL.
      isFullUrl - if the 'pathOrUrl' parameter a full URL? If so, it will be used as is. Otherwise it will be appended to the base test URL.
      isHttps - if true, "https:" will be used instead of "http:".
    • PATCH

      protected org.spincast.plugins.httpclient.builders.PatchRequestBuilder PATCH(String path)
      Starts an Https Client builder for a PATCH method. A cookie store is automatically added.
      Parameters:
      path - the relative path to be appended to the base test URL.
    • PATCH

      protected org.spincast.plugins.httpclient.builders.PatchRequestBuilder PATCH(String pathOrUrl, boolean isFullUrl)
      Starts an Https Client builder for a PATCH method. A cookie store is automatically added.
      Parameters:
      pathOrUrl - a relative path or a full URL.
      isFullUrl - if the 'pathOrUrl' parameter a full URL? If so, it will be used as is. Otherwise it will be appended to the base test URL.
    • PATCH

      protected org.spincast.plugins.httpclient.builders.PatchRequestBuilder PATCH(String pathOrUrl, boolean isFullUrl, boolean isHttps)
      Starts an Http(s) Client builder for a PATCH method. A cookie store is automatically added.
      Parameters:
      pathOrUrl - a relative path or a full URL.
      isFullUrl - if the 'pathOrUrl' parameter a full URL? If so, it will be used as is. Otherwise it will be appended to the base test URL.
      isHttps - if true, "https:" will be used instead of "http:".
    • HEAD

      protected org.spincast.plugins.httpclient.builders.HeadRequestBuilder HEAD(String path)
      Starts an Https Client builder for a HEAD method. A cookie store is automatically added.
      Parameters:
      path - the relative path to be appended to the base test URL.
    • HEAD

      protected org.spincast.plugins.httpclient.builders.HeadRequestBuilder HEAD(String pathOrUrl, boolean isFullUrl)
      Starts an Https Client builder for a HEAD method. A cookie store is automatically added.
      Parameters:
      pathOrUrl - a relative path or a full URL.
      isFullUrl - if the 'pathOrUrl' parameter a full URL? If so, it will be used as is. Otherwise it will be appended to the base test URL.
    • HEAD

      protected org.spincast.plugins.httpclient.builders.HeadRequestBuilder HEAD(String pathOrUrl, boolean isFullUrl, boolean isHttps)
      Starts an Http(s) Client builder for a HEAD method. A cookie store is automatically added.
      Parameters:
      pathOrUrl - a relative path or a full URL.
      isFullUrl - if the 'pathOrUrl' parameter a full URL? If so, it will be used as is. Otherwise it will be appended to the base test URL.
      isHttps - if true, "https:" will be used instead of "http:".
    • formatDate

      protected String formatDate(Date date)
      Format a date so it can be used in a HTTP header.
    • parseDate

      protected Date parseDate(String dateHeaderValue)
      Parse a date from a HTTP header to a Date object.
    • getPreviousResponseCookies

      protected Set<org.spincast.core.cookies.Cookie> getPreviousResponseCookies()
      The Cookies returned by the previous HttpResponse. This allows you to simulate a real browser which would automatically resend cookies on a particular domain. Example:
       GET("/").addCookies(getPreviousResponseCookies())...
       

      Note that for this to work, you have to manually save the cookies using saveResponseCookies(HttpResponse) when a response is received!

    • getPreviousResponseCookie

      protected org.spincast.core.cookies.Cookie getPreviousResponseCookie(String cookieName)
    • clearPreviousResponseCookies

      protected void clearPreviousResponseCookies()
      Removes all the cookies saved from a previous response.
    • saveResponseCookies

      protected void saveResponseCookies(org.spincast.plugins.httpclient.HttpResponse response)
      Saves the current response's cookies.

      You would then be able to resend them in a request by using getPreviousResponseCookies(). Example:

       GET("/").addCookies(getPreviousResponseCookies())...
       
    • isSetSecureFalseOnCookiesFromBag

      protected boolean isSetSecureFalseOnCookiesFromBag()
      Will set Cookie.setSecure(boolean) to false on cookies added to the getPreviousResponseCookies() so their can be resend in tests file using HTTP (not HTTPS).
    • getAppTestingConfigs

      protected abstract AppTestingConfigs getAppTestingConfigs()
      We force test classes to provide information about the required testing configurations.

      The bindings for those components will be automatically created.

      Returns:
      the testing configs informations or null to disable this process (you will then have to add the required config bindings by yourself).
    • callAppMainMethod

      protected abstract void callAppMainMethod()
      Starts the application.

      In this method, you should call your application main() method.

      There is no need to start the Server here, since the target application is supposed to do it by itself, in general in an "@Inject init()" method!