Skip to content

Commit

Permalink
add new endpoint to conductor-client
Browse files Browse the repository at this point in the history
  • Loading branch information
alexmay48 committed Jun 30, 2023
1 parent d3c7807 commit ebf3919
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,16 @@
import com.netflix.conductor.common.metadata.workflow.WorkflowDef;

import com.sun.jersey.api.client.ClientHandler;
import com.sun.jersey.api.client.GenericType;
import com.sun.jersey.api.client.config.ClientConfig;
import com.sun.jersey.api.client.config.DefaultClientConfig;
import com.sun.jersey.api.client.filter.ClientFilter;

public class MetadataClient extends ClientBase {

private static final GenericType<List<WorkflowDef>> workflowDefList =
new GenericType<List<WorkflowDef>>() {};

/** Creates a default metadata client */
public MetadataClient() {
this(new DefaultClientConfig(), new DefaultConductorClientConfiguration(), null);
Expand Down Expand Up @@ -122,6 +126,12 @@ public WorkflowDef getWorkflowDef(String name, Integer version) {
name);
}

/** */
public List<WorkflowDef> getAllWorkflowsWithLatestVersions() {
return getForEntity(
"metadata/workflow/latest-versions", null, workflowDefList, (Object) null);
}

/**
* Removes the workflow definition of a workflow from the conductor server. It does not remove
* associated workflows. Use with caution.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@
package com.netflix.conductor.client.http

import com.netflix.conductor.client.exception.ConductorClientException
import com.netflix.conductor.common.metadata.workflow.WorkflowDef

import com.sun.jersey.api.client.ClientResponse
import spock.lang.Subject

class MetadataClientSpec extends ClientSpecification {
Expand Down Expand Up @@ -75,4 +77,18 @@ class MetadataClientSpec extends ClientSpecification {
then:
thrown(IllegalArgumentException.class)
}

def "workflow get all definitions latest version"() {
given:
List<WorkflowDef> result = new ArrayList<WorkflowDef>()
URI uri = createURI("metadata/workflow/latest-versions")

when:
metadataClient.getAllWorkflowsWithLatestVersions()

then:
1 * requestHandler.get(uri) >> Mock(ClientResponse.class) {
getEntity(_) >> result
}
}
}

0 comments on commit ebf3919

Please sign in to comment.