Ejemplo n.º 1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testReportWithZeroHistoryTTL()
        public virtual void testReportWithZeroHistoryTTL()
        {
            // given
            prepareProcessInstances(PROCESS_DEFINITION_KEY, -6, 0, 5);
            prepareProcessInstances(PROCESS_DEFINITION_KEY, 0, 0, 5);

            // when
            CleanableHistoricProcessInstanceReportResult result = historyService.createCleanableHistoricProcessInstanceReport().singleResult();

            // then
            checkResultNumbers(result, 10, 10);
        }
Ejemplo n.º 2
0
        private void setupHistoryReportMock()
        {
            CleanableHistoricProcessInstanceReport report = mock(typeof(CleanableHistoricProcessInstanceReport));

            when(report.processDefinitionIdIn(anyString())).thenReturn(report);
            when(report.processDefinitionKeyIn(anyString())).thenReturn(report);

            CleanableHistoricProcessInstanceReportResult reportResult = mock(typeof(CleanableHistoricProcessInstanceReportResult));

            when(reportResult.ProcessDefinitionId).thenReturn(EXAMPLE_PROCESS_DEFINITION_ID);
            when(reportResult.ProcessDefinitionKey).thenReturn(EXAMPLE_PD_KEY);
            when(reportResult.ProcessDefinitionName).thenReturn(EXAMPLE_PD_NAME);
            when(reportResult.ProcessDefinitionVersion).thenReturn(EXAMPLE_PD_VERSION);
            when(reportResult.HistoryTimeToLive).thenReturn(EXAMPLE_TTL);
            when(reportResult.FinishedProcessInstanceCount).thenReturn(EXAMPLE_FINISHED_PI_COUNT);
            when(reportResult.CleanableProcessInstanceCount).thenReturn(EXAMPLE_CLEANABLE_PI_COUNT);
            when(reportResult.TenantId).thenReturn(EXAMPLE_TENANT_ID);

            CleanableHistoricProcessInstanceReportResult anotherReportResult = mock(typeof(CleanableHistoricProcessInstanceReportResult));

            when(anotherReportResult.ProcessDefinitionId).thenReturn(ANOTHER_EXAMPLE_PROCESS_DEFINITION_ID);
            when(anotherReportResult.ProcessDefinitionKey).thenReturn(ANOTHER_EXAMPLE_PD_KEY);
            when(anotherReportResult.ProcessDefinitionName).thenReturn("pdName");
            when(anotherReportResult.ProcessDefinitionVersion).thenReturn(33);
            when(anotherReportResult.HistoryTimeToLive).thenReturn(null);
            when(anotherReportResult.FinishedProcessInstanceCount).thenReturn(13l);
            when(anotherReportResult.CleanableProcessInstanceCount).thenReturn(0l);
            when(anotherReportResult.TenantId).thenReturn(ANOTHER_EXAMPLE_TENANT_ID);

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

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

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

            historicProcessInstanceReport = report;
            when(processEngine.HistoryService.createCleanableHistoricProcessInstanceReport()).thenReturn(historicProcessInstanceReport);
        }
Ejemplo n.º 3
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testReportComplex()
        public virtual void testReportComplex()
        {
            testRule.deploy(createProcessWithUserTask(SECOND_PROCESS_DEFINITION_KEY));
            testRule.deploy(createProcessWithUserTask(THIRD_PROCESS_DEFINITION_KEY));
            testRule.deploy(createProcessWithUserTask(FOURTH_PROCESS_DEFINITION_KEY));
            // given
            prepareProcessInstances(PROCESS_DEFINITION_KEY, 0, 5, 10);
            prepareProcessInstances(PROCESS_DEFINITION_KEY, -6, 5, 10);
            prepareProcessInstances(SECOND_PROCESS_DEFINITION_KEY, -6, 5, 10);
            prepareProcessInstances(THIRD_PROCESS_DEFINITION_KEY, -6, null, 10);
            prepareProcessInstances(FOURTH_PROCESS_DEFINITION_KEY, -6, 0, 10);

            repositoryService.deleteProcessDefinition(repositoryService.createProcessDefinitionQuery().processDefinitionKey(SECOND_PROCESS_DEFINITION_KEY).singleResult().Id, false);

            // when
            IList <CleanableHistoricProcessInstanceReportResult> reportResults      = historyService.createCleanableHistoricProcessInstanceReport().list();
            CleanableHistoricProcessInstanceReportResult         secondReportResult = historyService.createCleanableHistoricProcessInstanceReport().processDefinitionIdIn(repositoryService.createProcessDefinitionQuery().processDefinitionKey(THIRD_PROCESS_DEFINITION_KEY).singleResult().Id).singleResult();
            CleanableHistoricProcessInstanceReportResult         thirdReportResult  = historyService.createCleanableHistoricProcessInstanceReport().processDefinitionKeyIn(FOURTH_PROCESS_DEFINITION_KEY).singleResult();

            // then
            assertEquals(3, reportResults.Count);
            foreach (CleanableHistoricProcessInstanceReportResult result in reportResults)
            {
                if (result.ProcessDefinitionKey.Equals(PROCESS_DEFINITION_KEY))
                {
                    checkResultNumbers(result, 10, 20);
                }
                else if (result.ProcessDefinitionKey.Equals(THIRD_PROCESS_DEFINITION_KEY))
                {
                    checkResultNumbers(result, 0, 10);
                }
                else if (result.ProcessDefinitionKey.Equals(FOURTH_PROCESS_DEFINITION_KEY))
                {
                    checkResultNumbers(result, 10, 10);
                }
            }
            checkResultNumbers(secondReportResult, 0, 10);
            checkResultNumbers(thirdReportResult, 10, 10);
        }
Ejemplo n.º 4
0
 private void checkResultNumbers(CleanableHistoricProcessInstanceReportResult result, int expectedCleanable, int expectedFinished)
 {
     assertEquals(expectedCleanable, result.CleanableProcessInstanceCount);
     assertEquals(expectedFinished, result.FinishedProcessInstanceCount);
 }