Writing unit tests requiring the Petals Registry Client API


To unitary test a client of the Petals Registry Client API (as Petals Registry CLI), it is needed to use a dedicated implementation not requiring a Petals Registry Overlay.

Such an implementation was created to provide a mock for Petals Registry Client API: Petals Registry Client Mock.

It is available as JUnit Rule, and so the Petals environment is cleaned between each unit test.

No contributors found for: authors on selected page(s)

Using the Petals Registry Client Mock

Working with topologies

Each Petals Registry Client Mock instance comes with an internal registry registry. All methods of the Petals Registry Client Mock managing topologies works with this topology registry according to the Petals Registry Client API definition.

Registering a topology

A topology can be put into the topology registry at any moment of the unit test. Caution, the topology registry is cleared at the end of the unit test.

    public PetalsRegistryClientApi petalsRegistryClientApi = new PetalsRegistryClientApi();

    public void test...() {

        this.petalsRegistryClientApi.registerTopology("a-topology-id", new Topology());

        ... Your unit test source code ...

        // The topology registry will be automatically cleared leaving the unit test


The Petals Registry Client Mock implementation is available as a Maven artifact to add to the POM of your project:

Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.