@Test public void workflowDefinitionStatisticsConverterWorks() { Map<String, WorkflowDefinitionStatistics> stateStats = new HashMap<>(); WorkflowDefinitionStatistics created = new WorkflowDefinitionStatistics(); created.allInstances = 1; created.queuedInstances = 2; stateStats.put("created", created); WorkflowDefinitionStatistics inProgress = new WorkflowDefinitionStatistics(); inProgress.allInstances = 3; inProgress.queuedInstances = 4; stateStats.put("inProgress", inProgress); WorkflowDefinitionStatistics executing = new WorkflowDefinitionStatistics(); executing.allInstances = 5; stateStats.put("executing", executing); WorkflowDefinitionStatistics manual = new WorkflowDefinitionStatistics(); manual.allInstances = 8; stateStats.put("manual", manual); WorkflowDefinitionStatistics finished = new WorkflowDefinitionStatistics(); finished.allInstances = 9; stateStats.put("finished", finished); stateStats.put("unknown", new WorkflowDefinitionStatistics()); Map<String, Map<String, WorkflowDefinitionStatistics>> stats = singletonMap("state", stateStats); WorkflowDefinitionStatisticsResponse response = converter.convert(stats); StateStatistics stateStatistics = response.stateStatistics.get("state"); assertThat(stateStatistics.created.allInstances, is(1L)); assertThat(stateStatistics.created.queuedInstances, is(2L)); assertThat(stateStatistics.inProgress.allInstances, is(3L)); assertThat(stateStatistics.inProgress.queuedInstances, is(4L)); assertThat(stateStatistics.executing.allInstances, is(5L)); assertThat(stateStatistics.manual.allInstances, is(8L)); assertThat(stateStatistics.finished.allInstances, is(9L)); }
public StatisticsResponse convert(Statistics stats) { StatisticsResponse response = new StatisticsResponse(); response.queueStatistics.count = stats.queuedStatistics.count; response.queueStatistics.maxAge = stats.queuedStatistics.maxAgeMillis; response.queueStatistics.minAge = stats.queuedStatistics.minAgeMillis; response.executionStatistics.count = stats.executionStatistics.count; response.executionStatistics.maxAge = stats.executionStatistics.maxAgeMillis; response.executionStatistics.minAge = stats.executionStatistics.minAgeMillis; return response; }
StatisticsConverter { public StatisticsResponse convert(Statistics stats) { StatisticsResponse response = new StatisticsResponse(); response.queueStatistics.count = stats.queuedStatistics.count; response.queueStatistics.maxAge = stats.queuedStatistics.maxAgeMillis; response.queueStatistics.minAge = stats.queuedStatistics.minAgeMillis; response.executionStatistics.count = stats.executionStatistics.count; response.executionStatistics.maxAge = stats.executionStatistics.maxAgeMillis; response.executionStatistics.minAge = stats.executionStatistics.minAgeMillis; return response; } }
StatisticsConverter { public StatisticsResponse convert(Statistics stats) { StatisticsResponse response = new StatisticsResponse(); response.queueStatistics.count = stats.queuedStatistics.count; response.queueStatistics.maxAge = stats.queuedStatistics.maxAgeMillis; response.queueStatistics.minAge = stats.queuedStatistics.minAgeMillis; response.executionStatistics.count = stats.executionStatistics.count; response.executionStatistics.maxAge = stats.executionStatistics.maxAgeMillis; response.executionStatistics.minAge = stats.executionStatistics.minAgeMillis; return response; }  }
StatisticsConverter { public StatisticsResponse convert(Statistics stats) { StatisticsResponse response = new StatisticsResponse(); response.queueStatistics.count = stats.queuedStatistics.count; response.queueStatistics.maxAge = stats.queuedStatistics.maxAgeMillis; response.queueStatistics.minAge = stats.queuedStatistics.minAgeMillis; response.executionStatistics.count = stats.executionStatistics.count; response.executionStatistics.maxAge = stats.executionStatistics.maxAgeMillis; response.executionStatistics.minAge = stats.executionStatistics.minAgeMillis; return response; }  StatisticsResponse convert(Statistics stats); WorkflowDefinitionStatisticsResponse convert(Map<String, Map<String, WorkflowDefinitionStatistics>> stats); }
StatisticsConverter { public StatisticsResponse convert(Statistics stats) { StatisticsResponse response = new StatisticsResponse(); response.queueStatistics.count = stats.queuedStatistics.count; response.queueStatistics.maxAge = stats.queuedStatistics.maxAgeMillis; response.queueStatistics.minAge = stats.queuedStatistics.minAgeMillis; response.executionStatistics.count = stats.executionStatistics.count; response.executionStatistics.maxAge = stats.executionStatistics.maxAgeMillis; response.executionStatistics.minAge = stats.executionStatistics.minAgeMillis; return response; }  StatisticsResponse convert(Statistics stats); WorkflowDefinitionStatisticsResponse convert(Map<String, Map<String, WorkflowDefinitionStatistics>> stats);  }