Class RafikiCompose

java.lang.Object
zm.hashcode.rafiki.RafikiCompose
All Implemented Interfaces:
AutoCloseable

public class RafikiCompose extends Object implements AutoCloseable
Testcontainers wrapper for Rafiki - the open-source Interledger service.

This class manages a Docker Compose stack containing:

  • Rafiki Backend (Open Payments, Admin API, ILP Connector)
  • PostgreSQL database
  • Redis cache
  • TigerBeetle accounting database

Note: Authentication and Frontend services are not included in this testcontainer configuration for simplicity. They require additional Kratos identity server setup.

Example Usage:

@TestInstance(TestInstance.Lifecycle.PER_CLASS)
public class MyIntegrationTest {
    private RafikiCompose rafiki;

    @BeforeAll
    void setup() {
        rafiki = new RafikiCompose();
        rafiki.start();
    }

    @AfterAll
    void teardown() {
        rafiki.stop();
    }

    @Test
    void testBackend() {
        String adminUrl = rafiki.backendAdminUrl();
        // Make HTTP requests to test Rafiki
    }
}
Since:
0.1.0
See Also:
  • Constructor Details

    • RafikiCompose

      public RafikiCompose()
      Creates a new Rafiki testcontainer instance.

      The containers are not started until start() is called. All services are configured to wait up to 3 minutes for startup.

  • Method Details

    • start

      public void start()
      Starts all Rafiki containers and waits for them to be ready.

      This method blocks until all backend services are listening on their ports (up to 3 minutes per service). On first run, Docker images will be downloaded.

      Throws:
      org.testcontainers.containers.ContainerLaunchException - if containers fail to start
    • stop

      public void stop()
      Stops and removes all Rafiki containers.

      This method cleans up all containers, networks, and volumes created by this instance.

    • backendOpenPaymentsUrl

      public String backendOpenPaymentsUrl()
      Returns the URL for the Rafiki Backend Open Payments API endpoint.

      This endpoint handles Open Payments protocol operations (wallet addresses, quotes, payments).

      Returns:
      the Open Payments API URL (e.g., "http://localhost:51234")
      See Also:
    • backendAdminUrl

      public String backendAdminUrl()
      Returns the URL for the Rafiki Backend Admin API endpoint.

      This GraphQL endpoint provides administrative operations for managing wallet addresses, peers, and viewing account balances.

      Returns:
      the Admin API URL (e.g., "http://localhost:51235")
    • backendConnectorUrl

      public String backendConnectorUrl()
      Returns the URL for the Rafiki Backend ILP Connector endpoint.

      This endpoint handles Interledger Protocol (ILP) packet routing.

      Returns:
      the ILP Connector URL (e.g., "http://localhost:51236")
      See Also:
    • authServerUrl

      @Deprecated public String authServerUrl()
      Deprecated.
      Auth service not included in testcontainer configuration
      Returns the URL for the Rafiki Auth Server endpoint.

      Note: The auth service is not included in this testcontainer. This method is provided for API compatibility but will return a placeholder URL.

      Returns:
      a placeholder URL (service not running in testcontainer)
    • frontendUrl

      @Deprecated public String frontendUrl()
      Deprecated.
      Frontend service not included in testcontainer configuration
      Returns the URL for the Rafiki Frontend admin interface.

      Note: The frontend service is not included in this testcontainer. This method is provided for API compatibility but will return a placeholder URL.

      Returns:
      a placeholder URL (service not running in testcontainer)
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable