Пример #1
0
        public virtual CountResultDto getCleanableHistoricCaseInstanceReportCount(UriInfo uriInfo)
        {
            CleanableHistoricCaseInstanceReportDto queryDto = new CleanableHistoricCaseInstanceReportDto(objectMapper, uriInfo.QueryParameters);

            queryDto.ObjectMapper = objectMapper;
            CleanableHistoricCaseInstanceReport query = queryDto.toQuery(processEngine);

            long           count  = query.count();
            CountResultDto result = new CountResultDto();

            result.Count = count;

            return(result);
        }
Пример #2
0
        public virtual IList <CleanableHistoricCaseInstanceReportResultDto> getCleanableHistoricCaseInstanceReport(UriInfo uriInfo, int?firstResult, int?maxResults)
        {
            CleanableHistoricCaseInstanceReportDto queryDto = new CleanableHistoricCaseInstanceReportDto(objectMapper, uriInfo.QueryParameters);
            CleanableHistoricCaseInstanceReport    query    = queryDto.toQuery(processEngine);

            IList <CleanableHistoricCaseInstanceReportResult> reportResult;

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

            return(CleanableHistoricCaseInstanceReportResultDto.convert(reportResult));
        }
Пример #3
0
        private void setupHistoryReportMock()
        {
            CleanableHistoricCaseInstanceReport report = mock(typeof(CleanableHistoricCaseInstanceReport));

            when(report.caseDefinitionIdIn(anyString())).thenReturn(report);
            when(report.caseDefinitionKeyIn(anyString())).thenReturn(report);

            CleanableHistoricCaseInstanceReportResult reportResult = mock(typeof(CleanableHistoricCaseInstanceReportResult));

            when(reportResult.CaseDefinitionId).thenReturn(EXAMPLE_CD_ID);
            when(reportResult.CaseDefinitionKey).thenReturn(EXAMPLE_CD_KEY);
            when(reportResult.CaseDefinitionName).thenReturn(EXAMPLE_CD_NAME);
            when(reportResult.CaseDefinitionVersion).thenReturn(EXAMPLE_CD_VERSION);
            when(reportResult.HistoryTimeToLive).thenReturn(EXAMPLE_TTL);
            when(reportResult.FinishedCaseInstanceCount).thenReturn(EXAMPLE_FINISHED_CI_COUNT);
            when(reportResult.CleanableCaseInstanceCount).thenReturn(EXAMPLE_CLEANABLE_CI_COUNT);
            when(reportResult.TenantId).thenReturn(EXAMPLE_TENANT_ID);

            CleanableHistoricCaseInstanceReportResult anotherReportResult = mock(typeof(CleanableHistoricCaseInstanceReportResult));

            when(anotherReportResult.CaseDefinitionId).thenReturn(ANOTHER_EXAMPLE_CD_ID);
            when(anotherReportResult.CaseDefinitionKey).thenReturn(ANOTHER_EXAMPLE_CD_KEY);
            when(anotherReportResult.CaseDefinitionName).thenReturn("cdName");
            when(anotherReportResult.CaseDefinitionVersion).thenReturn(33);
            when(anotherReportResult.HistoryTimeToLive).thenReturn(null);
            when(anotherReportResult.FinishedCaseInstanceCount).thenReturn(13l);
            when(anotherReportResult.CleanableCaseInstanceCount).thenReturn(0l);
            when(anotherReportResult.TenantId).thenReturn(ANOTHER_EXAMPLE_TENANT_ID);


            IList <CleanableHistoricCaseInstanceReportResult> mocks = new List <CleanableHistoricCaseInstanceReportResult>();

            mocks.Add(reportResult);
            mocks.Add(anotherReportResult);

            when(report.list()).thenReturn(mocks);
            when(report.count()).thenReturn((long)mocks.Count);

            historicCaseInstanceReport = report;
            when(processEngine.HistoryService.createCleanableHistoricCaseInstanceReport()).thenReturn(historicCaseInstanceReport);
        }
Пример #4
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testReportByInvalidCaseDefinitionKey()
        public virtual void testReportByInvalidCaseDefinitionKey()
        {
            CleanableHistoricCaseInstanceReport report = historyService.createCleanableHistoricCaseInstanceReport();

            try
            {
                report.caseDefinitionKeyIn(null);
                fail("Expected NotValidException");
            }
            catch (NotValidException)
            {
                // expected
            }

            try
            {
                report.caseDefinitionKeyIn("abc", null, "def");
                fail("Expected NotValidException");
            }
            catch (NotValidException)
            {
                // expected
            }
        }
Пример #5
0
 private IList <CleanableHistoricCaseInstanceReportResult> executePaginatedQuery(CleanableHistoricCaseInstanceReport query, int?firstResult, int?maxResults)
 {
     if (firstResult == null)
     {
         firstResult = 0;
     }
     if (maxResults == null)
     {
         maxResults = int.MaxValue;
     }
     return(query.listPage(firstResult, maxResults));
 }