Class SnapshotServerSetupTask

    • Constructor Detail

      • SnapshotServerSetupTask

        public SnapshotServerSetupTask()
    • Method Detail

      • setup

        public final void setup​(ManagementClient managementClient,
                                String containerId)
                         throws Exception
        Description copied from interface: ServerSetupTask
        Execute any necessary setup work that needs to happen before the first deployment to the given container.

        Note on exception handling: If an implementation of this method throws any exception, the implementation can assume the following:

        1. Any subsequent ServerSetupTasks associated with test class will not be executed.
        2. The deployment event that triggered the call to this method will be skipped.
        3. The tearDown method of the instance that threw the exception will not be invoked. Therefore, implementations that throw AssumptionViolatedException, or any other exception, should do so before altering any system state.
        4. The tearDown method for any previously executed ServerSetupTasks associated with test class will be invoked.

        If any other exception is thrown, the ServerSetupTask.tearDown(ManagementClient, String) will be executed, including this implementations tearDown(), re-throwing the original exception. The original exception will have any other exceptions thrown in the tearDown() methods add as suppressed messages.

        Specified by:
        setup in interface ServerSetupTask
        Parameters:
        managementClient - management client to use to interact with the container
        containerId - id of the container to which the deployment will be deployed
        Throws:
        Exception - if a failure occurs
      • tearDown

        public final void tearDown​(ManagementClient managementClient,
                                   String containerId)
                            throws Exception
        Description copied from interface: ServerSetupTask
        Execute any tear down work that needs to happen after the last deployment associated with the given container has been undeployed.
        Specified by:
        tearDown in interface ServerSetupTask
        Parameters:
        managementClient - management client to use to interact with the container
        containerId - id of the container to which the deployment will be deployed
        Throws:
        Exception - if a failure occurs
      • doSetup

        protected void doSetup​(ManagementClient managementClient,
                               String containerId)
                        throws Exception
        Execute any necessary setup work that needs to happen before the first deployment to the given container.

        If this method throws an exception, the tearDown(ManagementClient, String) method will be invoked.

        Parameters:
        managementClient - management client to use to interact with the container
        containerId - id of the container to which the deployment will be deployed
        Throws:
        Exception - if a failure occurs
        See Also:
        setup(ManagementClient, String)
      • beforeRestore

        protected void beforeRestore​(ManagementClient managementClient,
                                     String containerId)
                              throws Exception
        Execute any necessary work required before the restore is completed. As an example removing a messaging queue which triggers removing the queue from a remote server.
        Parameters:
        managementClient - management client to use to interact with the container
        containerId - id of the container to which the deployment will be deployed
        Throws:
        Exception - if a failure occurs
        See Also:
        tearDown(ManagementClient, String)
      • nonManagementCleanUp

        protected void nonManagementCleanUp()
                                     throws Exception
        Allows for cleaning up resources that may have been created during the setup. This is always executed even if the doSetup(ManagementClient, String) fails for some reason.
        Throws:
        Exception - if a failure occurs
      • timeout

        protected long timeout()
        The number seconds to wait for the server to reload after the server configuration has been restored or if a reload was required in the doSetup(ManagementClient, String).
        Returns:
        the number of seconds to wait for a reload, the default is 10 seconds