Class ServerReload

java.lang.Object
org.jboss.as.test.shared.ServerReload

public class ServerReload extends Object
Utilities for correctly reloading a server process.
Author:
Stuart Douglas
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static class 
    ServerSetupTask that calls reloadIfRequired(ManagementClient) in the tearDown method
    static class 
    ServerSetupTask that calls reloadIfRequired(ManagementClient) in the setup method
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
    Default time in ms to wait for a server process to return to started state following a reload
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    executeReloadAndWaitForCompletion(org.jboss.as.arquillian.container.ManagementClient managementClient)
    Reload the server and wait for it to reach running state.
    static void
    executeReloadAndWaitForCompletion(org.jboss.as.arquillian.container.ManagementClient managementClient, boolean adminOnly)
    Reload the server and wait for it to reach running state, optionally reloading into admin-only mode.
    static void
    executeReloadAndWaitForCompletion(org.jboss.as.arquillian.container.ManagementClient managementClient, int timeout)
    Reload the server and wait for it to reach running state.
    static void
    executeReloadAndWaitForCompletion(org.jboss.as.arquillian.container.ManagementClient managementClient, String serverConfig)
    Reload the server and wait for it to reach running state, instructing the server to use the configuration file with the given name once it reloads.
    static void
    executeReloadAndWaitForCompletion(org.jboss.as.controller.client.ModelControllerClient client)
    Deprecated.
    Use executeReloadAndWaitForCompletion(ManagementClient) which will allow completion waiting to check on the correct address for reload completion if the server is not using the default management address or port
    static void
    executeReloadAndWaitForCompletion(org.jboss.as.controller.client.ModelControllerClient client, boolean adminOnly)
    Deprecated.
    Use {@link #executeReloadAndWaitForCompletion(ManagementClient boolean)} which will allow completion waiting to check on the correct address for reload completion if the server is not using the default management address or port
    static void
    executeReloadAndWaitForCompletion(org.jboss.as.controller.client.ModelControllerClient client, int timeout)
    Deprecated.
    Use {@link #executeReloadAndWaitForCompletion(ManagementClient int)} which will allow completion waiting to check on the correct address for reload completion if the server is not using the default management address or port
    static void
    executeReloadAndWaitForCompletion(org.jboss.as.controller.client.ModelControllerClient client, int timeout, boolean adminOnly, boolean startSuspended, String serverAddress, int serverPort, String serverConfig)
     
    static void
    executeReloadAndWaitForCompletion(org.jboss.as.controller.client.ModelControllerClient client, int timeout, boolean adminOnly, String serverAddress, int serverPort)
     
    static void
    executeReloadAndWaitForCompletion(org.jboss.as.controller.client.ModelControllerClient client, int timeout, boolean adminOnly, String serverAddress, int serverPort, String serverConfig)
     
    static void
    executeReloadAndWaitForCompletion(org.jboss.as.controller.client.ModelControllerClient client, String serverConfig)
    Deprecated.
    Use executeReloadAndWaitForCompletion(ManagementClient String) which will allow completion waiting to check on the correct address for reload completion if the server is not using the default management address or port
    static String
    getContainerRunningState(org.jboss.as.arquillian.container.ManagementClient managementClient)
    Gets the current value of the server root resource's server-state attribute.
    static String
    getContainerRunningState(org.jboss.as.controller.client.ModelControllerClient modelControllerClient)
    Gets the current value of the server root resource's server-state attribute.
    static void
    reloadIfRequired(org.jboss.as.arquillian.container.ManagementClient managementClient)
    Check if the server is in reload-required state and if it is, execute executeReloadAndWaitForCompletion(ManagementClient).
    static void
    reloadIfRequired(org.jboss.as.controller.client.ModelControllerClient controllerClient)
    Deprecated.
    Use reloadIfRequired(ManagementClient) which will allow completion waiting to check on the correct address for reload completion if the server is not using the default management address or port

    Methods inherited from class java.lang.Object

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

    • TIMEOUT

      public static final int TIMEOUT
      Default time in ms to wait for a server process to return to started state following a reload
      See Also:
  • Constructor Details

    • ServerReload

      public ServerReload()
  • Method Details

    • executeReloadAndWaitForCompletion

      @Deprecated public static void executeReloadAndWaitForCompletion(org.jboss.as.controller.client.ModelControllerClient client)
      Deprecated.
      Use executeReloadAndWaitForCompletion(ManagementClient) which will allow completion waiting to check on the correct address for reload completion if the server is not using the default management address or port
    • executeReloadAndWaitForCompletion

      @Deprecated public static void executeReloadAndWaitForCompletion(org.jboss.as.controller.client.ModelControllerClient client, String serverConfig)
      Deprecated.
      Use executeReloadAndWaitForCompletion(ManagementClient String) which will allow completion waiting to check on the correct address for reload completion if the server is not using the default management address or port
    • executeReloadAndWaitForCompletion

      @Deprecated public static void executeReloadAndWaitForCompletion(org.jboss.as.controller.client.ModelControllerClient client, boolean adminOnly)
      Deprecated.
      Use {@link #executeReloadAndWaitForCompletion(ManagementClient boolean)} which will allow completion waiting to check on the correct address for reload completion if the server is not using the default management address or port
    • executeReloadAndWaitForCompletion

      @Deprecated public static void executeReloadAndWaitForCompletion(org.jboss.as.controller.client.ModelControllerClient client, int timeout)
      Deprecated.
      Use {@link #executeReloadAndWaitForCompletion(ManagementClient int)} which will allow completion waiting to check on the correct address for reload completion if the server is not using the default management address or port
    • executeReloadAndWaitForCompletion

      public static void executeReloadAndWaitForCompletion(org.jboss.as.arquillian.container.ManagementClient managementClient)
      Reload the server and wait for it to reach running state. Reloaded server will not be in admin-only mode.
      Parameters:
      managementClient - client to use to execute the reload and to provide host and port information for reconnecting to wait for completion of the reload
    • executeReloadAndWaitForCompletion

      public static void executeReloadAndWaitForCompletion(org.jboss.as.arquillian.container.ManagementClient managementClient, String serverConfig)
      Reload the server and wait for it to reach running state, instructing the server to use the configuration file with the given name once it reloads. Reloaded server will not be in admin-only mode.
      Parameters:
      managementClient - client to use to execute the reload and to provide host and port information for * reconnecting to wait for completion of the reload
      serverConfig - the configuration file the server should use following reload. May be null in which case the server will use the same configuration file it used before the reload.
    • executeReloadAndWaitForCompletion

      public static void executeReloadAndWaitForCompletion(org.jboss.as.arquillian.container.ManagementClient managementClient, boolean adminOnly)
      Reload the server and wait for it to reach running state, optionally reloading into admin-only mode.
      Parameters:
      managementClient - client to use to execute the reload and to provide host and port information for reconnecting to wait for completion of the reload
      adminOnly - true if the server should be in admin-only mode following the reload
    • executeReloadAndWaitForCompletion

      public static void executeReloadAndWaitForCompletion(org.jboss.as.arquillian.container.ManagementClient managementClient, int timeout)
      Reload the server and wait for it to reach running state. Reloaded server will not be in admin-only mode.
      Parameters:
      managementClient - client to use to execute the reload and to provide host and port information for * reconnecting to wait for completion of the reload
      timeout - time in ms to wait for a server process to return to running state following the reload
    • executeReloadAndWaitForCompletion

      public static void executeReloadAndWaitForCompletion(org.jboss.as.controller.client.ModelControllerClient client, int timeout, boolean adminOnly, String serverAddress, int serverPort)
      Parameters:
      client - client to use to instruct the server to reload
      timeout - time in ms to wait for a server process to return to running state following the reload
      adminOnly - if true, the server will be reloaded in admin-only mode
      serverAddress - if null, use TestSuiteEnvironment.getServerAddress() to create the ModelControllerClient
      serverPort - if -1, use TestSuiteEnvironment.getServerPort() to create the ModelControllerClient
    • executeReloadAndWaitForCompletion

      public static void executeReloadAndWaitForCompletion(org.jboss.as.controller.client.ModelControllerClient client, int timeout, boolean adminOnly, String serverAddress, int serverPort, String serverConfig)
      Parameters:
      client - client to use to instruct the server to reload
      timeout - time in ms to wait for a server process to return to running state following the reload
      adminOnly - if true, the server will be reloaded in admin-only mode
      serverAddress - if null, use TestSuiteEnvironment.getServerAddress() to create the ModelControllerClient
      serverPort - if -1, use TestSuiteEnvironment.getServerPort() to create the ModelControllerClient
    • executeReloadAndWaitForCompletion

      public static void executeReloadAndWaitForCompletion(org.jboss.as.controller.client.ModelControllerClient client, int timeout, boolean adminOnly, boolean startSuspended, String serverAddress, int serverPort, String serverConfig)
      Parameters:
      client - client to use to instruct the server to reload
      timeout - time in ms to wait for a server process to return to running state following the reload
      adminOnly - if true, the server will be reloaded in admin-only mode
      startSuspended - if true, the service will be reloaded in suspended state
      serverAddress - if null, use TestSuiteEnvironment.getServerAddress() to create the ModelControllerClient
      serverPort - if -1, use TestSuiteEnvironment.getServerPort() to create the ModelControllerClient
    • getContainerRunningState

      public static String getContainerRunningState(org.jboss.as.arquillian.container.ManagementClient managementClient) throws IOException
      Gets the current value of the server root resource's server-state attribute.
      Parameters:
      managementClient - client to use to read the state
      Returns:
      the server state. Will not be null.
      Throws:
      IOException - if there is an IO problem reading the state
    • getContainerRunningState

      public static String getContainerRunningState(org.jboss.as.controller.client.ModelControllerClient modelControllerClient) throws IOException
      Gets the current value of the server root resource's server-state attribute.
      Parameters:
      modelControllerClient - client to use to read the state
      Returns:
      the server state. Will not be null.
      Throws:
      IOException - if there is an IO problem reading the state
    • reloadIfRequired

      @Deprecated public static void reloadIfRequired(org.jboss.as.controller.client.ModelControllerClient controllerClient) throws Exception
      Deprecated.
      Use reloadIfRequired(ManagementClient) which will allow completion waiting to check on the correct address for reload completion if the server is not using the default management address or port
      Checks if the container status is "reload-required" and if it's the case executes reload and waits for completion. Otherwise
      Throws:
      Exception
    • reloadIfRequired

      public static void reloadIfRequired(org.jboss.as.arquillian.container.ManagementClient managementClient) throws Exception
      Check if the server is in reload-required state and if it is, execute executeReloadAndWaitForCompletion(ManagementClient).
      Parameters:
      managementClient - client to use to execute the reload and to provide host and port information for * reconnecting to wait for completion of the reload
      Throws:
      Exception - if a failure occurs when checking if reload is required.