StatisticsResource extends JaxRsResource { @GET @Path("/workflow/{type}") @ApiOperation(value = "Get workflow definition statistics", response = WorkflowDefinitionStatisticsResponse.class) public Response getStatistics(@PathParam("type") @ApiParam(value = "Workflow definition type", required = true) String type, @QueryParam("createdAfter") @ApiParam(value = "Include only workflow instances created after given time") DateTime createdAfter, @QueryParam("createdBefore") @ApiParam("Include only workflow instances created before given time") DateTime createdBefore, @QueryParam("modifiedAfter") @ApiParam("Include only workflow instances modified after given time") DateTime modifiedAfter, @QueryParam("modifiedBefore") @ApiParam("Include only workflow instances modified before given time") DateTime modifiedBefore) { return handleExceptions(() -> ok(statisticsConverter.convert( statisticsService.getWorkflowDefinitionStatistics(type, createdAfter, createdBefore, modifiedAfter, modifiedBefore)))); }  @GET @ApiOperation(value = "Get executor group statistics", response = StatisticsResponse.class, notes = "Returns counts of queued and executing workflow instances.") Response queryStatistics(); @GET @Path("/workflow/{type}") @ApiOperation(value = "Get workflow definition statistics", response = WorkflowDefinitionStatisticsResponse.class) Response getStatistics(@PathParam("type") @ApiParam(value = "Workflow definition type", required = true) String type,
      @QueryParam("createdAfter") @ApiParam(value = "Include only workflow instances created after given time") DateTime createdAfter,
      @QueryParam("createdBefore") @ApiParam("Include only workflow instances created before given time") DateTime createdBefore,
      @QueryParam("modifiedAfter") @ApiParam("Include only workflow instances modified after given time") DateTime modifiedAfter,
      @QueryParam("modifiedBefore") @ApiParam("Include only workflow instances modified before given time") DateTime modifiedBefore);  }
@Test public void getWorkflowDefinitionStatisticsDelegatesToStatisticsService() { Map<String, Map<String, WorkflowDefinitionStatistics>> statsMap = emptyMap(); when(service.getWorkflowDefinitionStatistics("dummy", createdAfter, createdBefore, modifiedAfter, modifiedBefore)).thenReturn(statsMap); when(converter.convert(statsMap)).thenReturn(new WorkflowDefinitionStatisticsResponse()); WorkflowDefinitionStatisticsResponse statistics = resource.getStatistics("dummy", createdAfter, createdBefore, modifiedAfter, modifiedBefore) .readEntity(WorkflowDefinitionStatisticsResponse.class); verify(service).getWorkflowDefinitionStatistics("dummy", createdAfter, createdBefore, modifiedAfter, modifiedBefore); assertThat(statistics.stateStatistics.size(), is(0)); }