Class KarafShellUtils


  • public class KarafShellUtils
    extends Object
    • Constructor Detail

      • KarafShellUtils

        public KarafShellUtils()
    • Method Detail

      • isSuccessMsg

        public static boolean isSuccessMsg​(String s)
      • isFailureMessage

        public static boolean isFailureMessage​(String s)
      • isEndMessage

        public static boolean isEndMessage​(String s)
      • awaitHealthCheckSucceeded

        public static void awaitHealthCheckSucceeded​(InetSocketAddress addr,
                                                     int timeoutMinutes,
                                                     String what)
        Awaits that the health check succeeds within the given amount of minutes.
        Throws:
        RuntimeException - if the health check does not succeed.
      • testHealthCheckSucceeded

        public static void testHealthCheckSucceeded​(InetSocketAddress sshAddr)
                                             throws Exception
        Checks if the health check succeeds.
        Throws:
        Exception - Throws if the health check could not be called, did not completed, or completed with a failure.
      • withKarafShell

        public static <T> T withKarafShell​(InetSocketAddress sshAddr,
                                           java.time.Duration waitForShellTimeout,
                                           java.util.function.Function<SshClient.Streams,​T> withStreams)
                                    throws Exception
        Calls a test function within the context of an open Karaf shell. The test function is called only once, i.e. there are no retries.
        Throws:
        Exception - If no shell could be opened or the the test function raised an exception. The thrown exception contains the content of stdout and stderr that was received so far. The thrown exception should either be propagated or logged in order to preserve this valuable debugging information.