예제 #1
0
        protected internal virtual void verifyBatchStatisticsListJson(string batchStatisticsListJson)
        {
            IList <object> batches = from(batchStatisticsListJson).get();

            assertEquals("There should be one batch statistics returned.", 1, batches.Count);

            BatchStatisticsDto batchStatistics = from(batchStatisticsListJson).getObject("[0]", typeof(BatchStatisticsDto));

            assertNotNull("The returned batch statistics should not be null.", batchStatistics);
            assertEquals(MockProvider.EXAMPLE_BATCH_ID, batchStatistics.Id);
            assertEquals(MockProvider.EXAMPLE_BATCH_TYPE, batchStatistics.Type);
            assertEquals(MockProvider.EXAMPLE_BATCH_TOTAL_JOBS, batchStatistics.TotalJobs);
            assertEquals(MockProvider.EXAMPLE_BATCH_JOBS_CREATED, batchStatistics.JobsCreated);
            assertEquals(MockProvider.EXAMPLE_BATCH_JOBS_PER_SEED, batchStatistics.BatchJobsPerSeed);
            assertEquals(MockProvider.EXAMPLE_INVOCATIONS_PER_BATCH_JOB, batchStatistics.InvocationsPerBatchJob);
            assertEquals(MockProvider.EXAMPLE_SEED_JOB_DEFINITION_ID, batchStatistics.SeedJobDefinitionId);
            assertEquals(MockProvider.EXAMPLE_MONITOR_JOB_DEFINITION_ID, batchStatistics.MonitorJobDefinitionId);
            assertEquals(MockProvider.EXAMPLE_BATCH_JOB_DEFINITION_ID, batchStatistics.BatchJobDefinitionId);
            assertEquals(MockProvider.EXAMPLE_TENANT_ID, batchStatistics.TenantId);
            assertEquals(MockProvider.EXAMPLE_USER_ID, batchStatistics.CreateUserId);
            assertEquals(MockProvider.EXAMPLE_BATCH_REMAINING_JOBS, batchStatistics.RemainingJobs);
            assertEquals(MockProvider.EXAMPLE_BATCH_COMPLETED_JOBS, batchStatistics.CompletedJobs);
            assertEquals(MockProvider.EXAMPLE_BATCH_FAILED_JOBS, batchStatistics.FailedJobs);
            assertTrue(batchStatistics.Suspended);
        }
예제 #2
0
        public virtual IList <BatchStatisticsDto> getStatistics(UriInfo uriInfo, int?firstResult, int?maxResults)
        {
            BatchStatisticsQueryDto queryDto = new BatchStatisticsQueryDto(ObjectMapper, uriInfo.QueryParameters);
            BatchStatisticsQuery    query    = queryDto.toQuery(ProcessEngine);

            IList <BatchStatistics> batchStatisticsList;

            if (firstResult != null || maxResults != null)
            {
                batchStatisticsList = executePaginatedStatisticsQuery(query, firstResult, maxResults);
            }
            else
            {
                batchStatisticsList = query.list();
            }

            IList <BatchStatisticsDto> statisticsResults = new List <BatchStatisticsDto>();

            foreach (BatchStatistics batchStatistics in batchStatisticsList)
            {
                statisticsResults.Add(BatchStatisticsDto.fromBatchStatistics(batchStatistics));
            }

            return(statisticsResults);
        }