Class ProxyRegistry

java.lang.Object
io.camunda.zeebe.qa.util.testcontainers.ProxyRegistry

public final class ProxyRegistry extends Object
A utility registry to keep track of proxies that were created for a given ToxiproxyContainer. Proxies are identified by their upstream target, and cannot be removed from the registry for now.

NOTE: before proxies can be created, the associated container must be started!

NOTE: this class should be extended based on usage, i.e. as needed.

  • Constructor Details

    • ProxyRegistry

      public ProxyRegistry(org.testcontainers.containers.ToxiproxyContainer toxiproxy)
  • Method Details

    • addExposedPorts

      public static org.testcontainers.containers.ToxiproxyContainer addExposedPorts(org.testcontainers.containers.ToxiproxyContainer container)
    • getOrCreateProxy

      public ProxyRegistry.ContainerProxy getOrCreateProxy(String upstream)
      Returns the proxy associated with the given upstream, or creates a new instance.
      Parameters:
      upstream - the upstream endpoint that the proxy points to
      Returns:
      a ProxyRegistry.ContainerProxy which can be used to access the proxy
    • getOrCreateHostProxy

      public ProxyRegistry.ContainerProxy getOrCreateHostProxy(int port)
      Returns the proxy associated with the given port on the local host, or creates a new instance.
      Parameters:
      port - the upstream port that the proxy points to
      Returns:
      a ProxyRegistry.ContainerProxy which can be used to access the proxy