Class MockSiteStarter

  • All Implemented Interfaces:
    java.lang.AutoCloseable

    
    public final class MockSiteStarter
     implements AutoCloseable
                        

    Reusable utility to wait for a demo/mock site to become available.

    Features:

    • Tries a health endpoint first (default /actuator/health) then falls back to root / (optional)

    • Configurable timeouts & intervals

    • Returns true if any probe gets a 2xx/3xx response

    This logic was extracted from SessionInstructionsExample so other demos/examples can share it.

    • Field Summary

      Fields 
      Modifier and Type Field Description
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      final Unit start(String url) Ensure the mock site serving the given url is started.
      final Boolean wait(String pageUrl, MockSiteStarter.Options options) Wait for the site referred to by a full page URL (any path under host).
      final Unit stop()
      Unit close()
      • Methods inherited from class java.lang.Object

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

      • MockSiteStarter

        MockSiteStarter()
    • Method Detail

      • start

         final Unit start(String url)

        Ensure the mock site serving the given url is started. Extracts the explicit port from the URL; if absent uses system/env configured port or sensible fallbacks (8182, then 8080) instead of the protocol default (80).

      • wait

         final Boolean wait(String pageUrl, MockSiteStarter.Options options)

        Wait for the site referred to by a full page URL (any path under host). Only host/port are probed.

        Parameters:
        pageUrl - Any URL within the target host (ex: http://localhost:8182/generated/tta/instructions/instructions-demo.