Odo Java Client - groupon/odo GitHub Wiki

Java Configuration Interface

There is a Java interface available to configure settings in Odo while tests are running.

The Odo Java client and Plugin artifacts are also released through Central repository. You can incorporate them into your maven project using the following dependency.

<dependency>
    <groupId>com.groupon.odo</groupId>
    <artifactId>client</artifactId>
    <version>1.0.0-beta.3</version>
</dependency>

API Summary:

Namespace: com.groupon.odo.client.Client

Instantiation:
	Client cli = new Client("My Profile", true); // Create a new configuration client using Odo Parallel Clients
	Client cli = new Client("My Profile", false); // Create a new configuration client using the default profile client

Destruction:
	cli.destroy(); // Destroy the configuration client and delete the parallel client if necessary

Functions:
    cli.createPath("My Path", "/path/value", "GET") // Create a new path
	cli.getClientUUID(); // Get the UUID for the parallel client
	cli.toggleProfile(true or false); // Enable or disable the profile
	cli.toggleRequestOverride("My Path", true or false); // Enable or disable a specific request path
	cli.toggleResponseOverride("My Path", true or false); // Enable or disable a specific response path
	cli.resetProfile(); // Reset all path settings
	cli.resetRequestOverride("My Path"); // Reset all of the path settings for a specific request path
	cli.resetResponseOverride("My Path"); // Reset all of the path settings for a specific response path
	cli.setCustomRequest("My Path", "stuff=things"); // Set the custom request data for a specific path
	cli.setCustomResponse("My Path", "bunch of json"); // Add a custom response data for a specific path
	cli.setOverrideRepeatCount("My Path", "com.proxy.override.MyOverride", "1", "-1"); // Set the repeat count for an override on a Path. "1" is the ordinal - so the first override of this type on the path. "-1" is the new repeat count.
	cli.removeCustomRequest("My Path"); // remove the custom request data for a specific path
	cli.removeCustomResponse("My Path"); // remove the custom response data for a specific path
	cli.addMethodToResponseOverride("My Path", "com.proxy.override.MyOverride"); // enable the specific override method on the specified path
	cli.setMethodArguments("My Path", "com.proxy.override.MyOverride", 5, "Stuff"); // Set the arguments for a method that has already been added to a path
	cli.removeMethodFromResponseOverride("My Path", "com.proxy.override.MyOverride"); // remove the specific override method on the specified path
    cli.clearHistory(); //clear the proxy history for the active profile
    cli.filterHistory(String... filters); //retrieve the request history based on the specified filters
    cli.refreshHistory(); // Obtain the last (Default count) of history entries
    cli.refreshHistory(100, 10); // Obtain 100 history entries, starting from after the 10th most recent

Static Functions:
    Client.setCustomRequestForDefaultClient("My Profile", "My Path", "bunch of json");
    Client.setCustomResponseForDefaultClient("My Profile", "My Path", "bunch of json");
    Client.setCustomRequestForDefaultProfile("My Path", "bunch of json);
    Client.setCustomResponseForDefaultProfile("My Path", "bunch of json);

Namespace: com.groupon.odo.client.PathValueClient

PathValueClient exists for using Odo as a simple mock/stub server. It simplifies the steps of configuring a stub server through automation.

Instantiation:
    PathValueClient pvc = new PathValueClient("My Profile", true); // Create a new PathValueClient, creating a new client for the profile
    PathValueClient pvc = new PathValueClient("My Profile", false);  // Create a new PathValueClient, using the default client

Functions:
    pvc.getPathFromEndpoint("/path/value", "GET"); // Get Path information from the path's value
    pvc.removeCustomResponse("/path/value", "GET"); // Reset all of the path settings for a specific response path
    pvc.setCustomResponse("/path/value", "GET", "bunch of json"); // Sets the custom response for a path, or creates a new path if path value does not exist.

Static Functions:
    PathValueClient.setDefaultCustomResponse("My Path", "GET", "bunch of json"); // Sets the custom response for a path using a default profile, or creates a new path if path value does not exist.
    PathValueClient.removeDefaultCustomResponse("My Path", "GET"); // Reset all of the path settings for a specific response path of a default profile
⚠️ **GitHub.com Fallback** ⚠️