Class TestingUtilities

java.lang.Object
org.springframework.integration.ip.util.TestingUtilities

public final class TestingUtilities extends Object
Convenience class providing methods for testing IP components. Provided in the main branch so that it is available for use in user test code, samples etc.
Since:
2.2
Author:
Gary Russell
  • Method Details

    • waitListening

      public static void waitListening(AbstractServerConnectionFactory serverConnectionFactory, @Nullable Long delayArg) throws IllegalStateException
      Wait for a server connection factory to actually start listening before starting a test. Waits for up to 10 seconds by default.
      Parameters:
      serverConnectionFactory - The server connection factory.
      delayArg - How long to wait in milliseconds; default 10000 (10 seconds) if null.
      Throws:
      IllegalStateException - If the server does not start listening in time.
    • waitListening

      public static void waitListening(AbstractInternetProtocolReceivingChannelAdapter adapter, @Nullable Long delayArg) throws IllegalStateException
      Wait for a server connection factory to actually start listening before starting a test. Waits for up to 10 seconds by default.
      Parameters:
      adapter - The server connection factory.
      delayArg - How long to wait in milliseconds; default 10000 (10 seconds) if null.
      Throws:
      IllegalStateException - If the server does not start listening in time.
    • waitStopListening

      public static void waitStopListening(AbstractServerConnectionFactory serverConnectionFactory, @Nullable Long delayArg) throws IllegalStateException
      Wait for a server connection factory to stop listening. Waits for up to 10 seconds by default.
      Parameters:
      serverConnectionFactory - The server connection factory.
      delayArg - How long to wait in milliseconds; default 10000 (10 seconds) if null.
      Throws:
      IllegalStateException - If the server doesn't stop listening in time.
    • waitUntilFactoryHasThisNumberOfConnections

      public static void waitUntilFactoryHasThisNumberOfConnections(AbstractConnectionFactory factory, int n) throws InterruptedException
      Wait for up to 10 seconds for the connection factory to have the specified number of connections.
      Parameters:
      factory - The factory.
      n - The required number of connections.
      Throws:
      InterruptedException - if interrupted.
      IllegalStateException - if the count does not match.