diff --git a/client/src/test/groovy/com/netflix/conductor/client/http/MetadataClientSpec.groovy b/client/src/test/groovy/com/netflix/conductor/client/http/MetadataClientSpec.groovy index 2f53305f8..f41064ec3 100644 --- a/client/src/test/groovy/com/netflix/conductor/client/http/MetadataClientSpec.groovy +++ b/client/src/test/groovy/com/netflix/conductor/client/http/MetadataClientSpec.groovy @@ -11,11 +11,11 @@ * specific language governing permissions and limitations under the License. */ package com.netflix.conductor.client.http -import org.glassfish.jersey.client.ClientResponse import com.netflix.conductor.client.exception.ConductorClientException import com.netflix.conductor.common.metadata.workflow.WorkflowDef +import jakarta.ws.rs.core.GenericType import spock.lang.Subject class MetadataClientSpec extends ClientSpecification { @@ -82,13 +82,13 @@ class MetadataClientSpec extends ClientSpecification { given: List result = new ArrayList() URI uri = createURI("metadata/workflow/latest-versions") + GenericType> workflowDefList = + new GenericType>() {}; when: metadataClient.getAllWorkflowsWithLatestVersions() then: - 1 * requestHandler.get(uri) >> Mock(ClientResponse.class) { - getEntity(_) >> result - } + 1 * requestHandler.getWithGenericType(uri, workflowDefList) >> result } } diff --git a/client/src/test/groovy/com/netflix/conductor/client/http/TaskClientSpec.groovy b/client/src/test/groovy/com/netflix/conductor/client/http/TaskClientSpec.groovy index f4a2d5e87..62d30aa4b 100644 --- a/client/src/test/groovy/com/netflix/conductor/client/http/TaskClientSpec.groovy +++ b/client/src/test/groovy/com/netflix/conductor/client/http/TaskClientSpec.groovy @@ -12,12 +12,11 @@ */ package com.netflix.conductor.client.http -import org.glassfish.jersey.client.ClientResponse - import com.netflix.conductor.common.metadata.tasks.Task import com.netflix.conductor.common.run.SearchResult import com.netflix.conductor.common.run.TaskSummary +import jakarta.ws.rs.core.GenericType import spock.lang.Subject class TaskClientSpec extends ClientSpecification { @@ -36,16 +35,15 @@ class TaskClientSpec extends ClientSpecification { SearchResult result = new SearchResult<>() result.totalHits = 1 result.results = [new TaskSummary()] - + GenericType> searchResultTaskSummary = + new GenericType>() {} URI uri = createURI("tasks/search?query=$query") when: SearchResult searchResult = taskClient.search(query) then: - 1 * requestHandler.get(uri) >> Mock(ClientResponse.class) { - readEntity(_) >> result - } + 1 * requestHandler.getWithGenericType(uri, searchResultTaskSummary) >> result searchResult.totalHits == result.totalHits searchResult.results && searchResult.results.size() == 1 @@ -58,6 +56,8 @@ class TaskClientSpec extends ClientSpecification { SearchResult result = new SearchResult<>() result.totalHits = 1 result.results = [new Task()] + GenericType> searchResultTask = + new GenericType>() {} URI uri = createURI("tasks/search-v2?query=$query") @@ -65,9 +65,7 @@ class TaskClientSpec extends ClientSpecification { SearchResult searchResult = taskClient.searchV2('my_complex_query') then: - 1 * requestHandler.get(uri) >> Mock(ClientResponse.class) { - readEntity(_) >> result - } + 1 * requestHandler.getWithGenericType(uri, searchResultTask) >> result searchResult.totalHits == result.totalHits searchResult.results && searchResult.results.size() == 1 @@ -84,6 +82,8 @@ class TaskClientSpec extends ClientSpecification { SearchResult result = new SearchResult<>() result.totalHits = 1 result.results = [new TaskSummary()] + GenericType> searchResultTaskSummary = + new GenericType>() {} URI uri = createURI("tasks/search?start=$start&size=$size&sort=$sort&freeText=$freeText&query=$query") @@ -91,9 +91,7 @@ class TaskClientSpec extends ClientSpecification { SearchResult searchResult = taskClient.search(start, size, sort, freeText, query) then: - 1 * requestHandler.get(uri) >> Mock(ClientResponse.class) { - readEntity(_) >> result - } + 1 * requestHandler.getWithGenericType(uri, searchResultTaskSummary) >> result searchResult.totalHits == result.totalHits searchResult.results && searchResult.results.size() == 1 @@ -110,6 +108,8 @@ class TaskClientSpec extends ClientSpecification { SearchResult result = new SearchResult<>() result.totalHits = 1 result.results = [new Task()] + GenericType> searchResultTask = + new GenericType>() {} URI uri = createURI("tasks/search-v2?start=$start&size=$size&sort=$sort&freeText=$freeText&query=$query") @@ -117,9 +117,7 @@ class TaskClientSpec extends ClientSpecification { SearchResult searchResult = taskClient.searchV2(start, size, sort, freeText, query) then: - 1 * requestHandler.get(uri) >> Mock(ClientResponse.class) { - readEntity(_) >> result - } + 1 * requestHandler.getWithGenericType(uri, searchResultTask) >> result searchResult.totalHits == result.totalHits searchResult.results && searchResult.results.size() == 1 diff --git a/client/src/test/groovy/com/netflix/conductor/client/http/WorkflowClientSpec.groovy b/client/src/test/groovy/com/netflix/conductor/client/http/WorkflowClientSpec.groovy index e58cc64f1..06c7e27e9 100644 --- a/client/src/test/groovy/com/netflix/conductor/client/http/WorkflowClientSpec.groovy +++ b/client/src/test/groovy/com/netflix/conductor/client/http/WorkflowClientSpec.groovy @@ -12,13 +12,12 @@ */ package com.netflix.conductor.client.http -import org.glassfish.jersey.client.ClientResponse - import com.netflix.conductor.common.metadata.workflow.WorkflowDef import com.netflix.conductor.common.run.SearchResult import com.netflix.conductor.common.run.Workflow import com.netflix.conductor.common.run.WorkflowSummary +import jakarta.ws.rs.core.GenericType import spock.lang.Subject class WorkflowClientSpec extends ClientSpecification { @@ -37,16 +36,15 @@ class WorkflowClientSpec extends ClientSpecification { SearchResult result = new SearchResult<>() result.totalHits = 1 result.results = [new WorkflowSummary()] - + GenericType> searchResultWorkflowSummary = + new GenericType>() {} URI uri = createURI("workflow/search?query=$query") when: SearchResult searchResult = workflowClient.search(query) then: - 1 * requestHandler.get(uri) >> Mock(ClientResponse.class) { - readEntity(_) >> result - } + 1 * requestHandler.getWithGenericType(uri, searchResultWorkflowSummary) >> result searchResult.totalHits == result.totalHits searchResult.results && searchResult.results.size() == 1 @@ -58,17 +56,16 @@ class WorkflowClientSpec extends ClientSpecification { String query = 'my_complex_query' SearchResult result = new SearchResult<>() result.totalHits = 1 - result.results = [new Workflow(workflowDefinition: new WorkflowDef(), createTime: System.currentTimeMillis() )] - + result.results = [new Workflow(workflowDefinition: new WorkflowDef(), createTime: System.currentTimeMillis())] + GenericType> searchResultWorkflow = + new GenericType>() {} URI uri = createURI("workflow/search-v2?query=$query") when: SearchResult searchResult = workflowClient.searchV2('my_complex_query') then: - 1 * requestHandler.get(uri) >> Mock(ClientResponse.class) { - readEntity(_) >> result - } + 1 * requestHandler.getWithGenericType(uri, searchResultWorkflow) >> result searchResult.totalHits == result.totalHits searchResult.results && searchResult.results.size() == 1 @@ -85,16 +82,15 @@ class WorkflowClientSpec extends ClientSpecification { SearchResult result = new SearchResult<>() result.totalHits = 1 result.results = [new WorkflowSummary()] - + GenericType> searchResultWorkflowSummary = + new GenericType>() {} URI uri = createURI("workflow/search?start=$start&size=$size&sort=$sort&freeText=$freeText&query=$query") when: SearchResult searchResult = workflowClient.search(start, size, sort, freeText, query) then: - 1 * requestHandler.get(uri) >> Mock(ClientResponse.class) { - readEntity(_) >> result - } + 1 * requestHandler.getWithGenericType(uri, searchResultWorkflowSummary) >> result searchResult.totalHits == result.totalHits searchResult.results && searchResult.results.size() == 1 @@ -110,17 +106,16 @@ class WorkflowClientSpec extends ClientSpecification { String freeText = 'text' SearchResult result = new SearchResult<>() result.totalHits = 1 - result.results = [new Workflow(workflowDefinition: new WorkflowDef(), createTime: System.currentTimeMillis() )] - + result.results = [new Workflow(workflowDefinition: new WorkflowDef(), createTime: System.currentTimeMillis())] + GenericType> searchResultWorkflow = + new GenericType>() {} URI uri = createURI("workflow/search-v2?start=$start&size=$size&sort=$sort&freeText=$freeText&query=$query") when: SearchResult searchResult = workflowClient.searchV2(start, size, sort, freeText, query) then: - 1 * requestHandler.get(uri) >> Mock(ClientResponse.class) { - readEntity(_) >> result - } + 1 * requestHandler.getWithGenericType(uri,searchResultWorkflow) >> result searchResult.totalHits == result.totalHits searchResult.results && searchResult.results.size() == 1