Esempio n. 1
0
        // DMN ///////////////////////////////////////////////////////////////////////////////////////////////////////////////

//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testPurgeDmnProcess()
        public virtual void testPurgeDmnProcess()
        {
            // given dmn process which is not managed by process engine rule
            engineRule.RepositoryService.createDeployment().addClasspathResource("org/camunda/bpm/engine/test/standalone/db/entitymanager/PurgeDatabaseTest.testPurgeDmnProcess.dmn").deploy();
            VariableMap variables = Variables.createVariables().putValue("key", "value").putValue("season", "Test");

            engineRule.DecisionService.evaluateDecisionByKey("decisionId").variables(variables).evaluate();

            // when purge is executed
            ManagementServiceImpl managementService = (ManagementServiceImpl)engineRule.ManagementService;
            PurgeReport           purge             = managementService.purge();

            // then database and cache is cleaned
            assertAndEnsureCleanDbAndCache(engineRule.ProcessEngine, true);

            // and report contains deleted entities
            assertFalse(purge.Empty);
            CachePurgeReport cachePurgeReport = purge.CachePurgeReport;

            assertEquals(2, cachePurgeReport.getReportValue(CachePurgeReport.DMN_DEF_CACHE).Count);
            assertEquals(1, cachePurgeReport.getReportValue(CachePurgeReport.DMN_REQ_DEF_CACHE).Count);

            DatabasePurgeReport databasePurgeReport = purge.DatabasePurgeReport;

            assertEquals(1, (long)databasePurgeReport.getReportValue(databaseTablePrefix + "ACT_RE_DEPLOYMENT"));
            assertEquals(1, (long)databasePurgeReport.getReportValue(databaseTablePrefix + "ACT_GE_BYTEARRAY"));
            assertEquals(1, (long)databasePurgeReport.getReportValue(databaseTablePrefix + "ACT_RE_DECISION_REQ_DEF"));
            assertEquals(2, (long)databasePurgeReport.getReportValue(databaseTablePrefix + "ACT_RE_DECISION_DEF"));

            if (processEngineConfiguration.HistoryLevel.Equals(org.camunda.bpm.engine.impl.history.HistoryLevel_Fields.HISTORY_LEVEL_FULL))
            {
                assertEquals(1, (long)databasePurgeReport.getReportValue(databaseTablePrefix + "ACT_HI_DECINST"));
                assertEquals(1, (long)databasePurgeReport.getReportValue(databaseTablePrefix + "ACT_HI_DEC_IN"));
                assertEquals(1, (long)databasePurgeReport.getReportValue(databaseTablePrefix + "ACT_HI_DEC_OUT"));
            }
        }
Esempio n. 2
0
        // CMMN //////////////////////////////////////////////////////////////////////////////////////////////////////////////

//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testPurgeCmmnProcess()
        public virtual void testPurgeCmmnProcess()
        {
            // given cmmn process which is not managed by process engine rule

            engineRule.RepositoryService.createDeployment().addClasspathResource("org/camunda/bpm/engine/test/standalone/db/entitymanager/PurgeDatabaseTest.testPurgeCmmnProcess.cmmn").deploy();
            VariableMap variables = Variables.createVariables();

            variables.put("key", "value");
            engineRule.CaseService.createCaseInstanceByKey(PROCESS_DEF_KEY, variables);

            // when purge is executed
            ManagementServiceImpl managementService = (ManagementServiceImpl)engineRule.ManagementService;
            PurgeReport           purge             = managementService.purge();

            // then database and cache is cleaned
            assertAndEnsureCleanDbAndCache(engineRule.ProcessEngine, true);

            // and report contains deleted entities
            assertFalse(purge.Empty);
            CachePurgeReport cachePurgeReport = purge.CachePurgeReport;

            assertEquals(1, cachePurgeReport.getReportValue(CachePurgeReport.CASE_DEF_CACHE).Count);

            DatabasePurgeReport databasePurgeReport = purge.DatabasePurgeReport;

            assertEquals(1, (long)databasePurgeReport.getReportValue(databaseTablePrefix + "ACT_RE_DEPLOYMENT"));
            assertEquals(1, (long)databasePurgeReport.getReportValue(databaseTablePrefix + "ACT_RU_TASK"));
            assertEquals(1, (long)databasePurgeReport.getReportValue(databaseTablePrefix + "ACT_GE_BYTEARRAY"));
            assertEquals(1, (long)databasePurgeReport.getReportValue(databaseTablePrefix + "ACT_RE_CASE_DEF"));
            assertEquals(3, (long)databasePurgeReport.getReportValue(databaseTablePrefix + "ACT_RU_CASE_EXECUTION"));
            assertEquals(1, (long)databasePurgeReport.getReportValue(databaseTablePrefix + "ACT_RU_VARIABLE"));
            assertEquals(2, (long)databasePurgeReport.getReportValue(databaseTablePrefix + "ACT_RU_CASE_SENTRY_PART"));

            if (processEngineConfiguration.HistoryLevel.Equals(org.camunda.bpm.engine.impl.history.HistoryLevel_Fields.HISTORY_LEVEL_FULL))
            {
                assertEquals(1, (long)databasePurgeReport.getReportValue(databaseTablePrefix + "ACT_HI_DETAIL"));
                assertEquals(1, (long)databasePurgeReport.getReportValue(databaseTablePrefix + "ACT_HI_TASKINST"));
                assertEquals(1, (long)databasePurgeReport.getReportValue(databaseTablePrefix + "ACT_HI_VARINST"));
                assertEquals(1, (long)databasePurgeReport.getReportValue(databaseTablePrefix + "ACT_HI_CASEINST"));
                assertEquals(2, (long)databasePurgeReport.getReportValue(databaseTablePrefix + "ACT_HI_CASEACTINST"));
            }
        }
Esempio n. 3
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testPurgeComplexProcess()
        public virtual void testPurgeComplexProcess()
        {
            // given complex process with authentication
            // process is executed two times
            // metrics are reported

            BpmnModelInstance modelInstance = Bpmn.createExecutableProcess(PROCESS_DEF_KEY).startEvent().camundaAsyncBefore().parallelGateway("parallel").serviceTask("external").camundaType("external").camundaTopic("external").boundaryEvent().message("message").moveToNode("parallel").serviceTask().camundaAsyncBefore().camundaExpression("${1/0}").moveToLastGateway().userTask().done();

            createAuthenticationData();
            engineRule.RepositoryService.createDeployment().addModelInstance(PROCESS_MODEL_NAME, modelInstance).deploy();

            executeComplexBpmnProcess(true);
            executeComplexBpmnProcess(false);

            processEngineConfiguration.DbMetricsReporter.reportNow();

            // when purge is executed
            ManagementServiceImpl managementService = (ManagementServiceImpl)engineRule.ManagementService;
            PurgeReport           purge             = managementService.purge();

            // then database and cache are empty
            assertAndEnsureCleanDbAndCache(engineRule.ProcessEngine, true);

            // and report contains deleted data
            assertFalse(purge.Empty);
            CachePurgeReport cachePurgeReport = purge.CachePurgeReport;

            assertEquals(1, cachePurgeReport.getReportValue(CachePurgeReport.PROCESS_DEF_CACHE).Count);

            DatabasePurgeReport databasePurgeReport = purge.DatabasePurgeReport;

            assertEquals(2, (long)databasePurgeReport.getReportValue(databaseTablePrefix + "ACT_ID_TENANT_MEMBER"));
            assertEquals(1, (long)databasePurgeReport.getReportValue(databaseTablePrefix + "ACT_RU_EVENT_SUBSCR"));
            assertEquals(1, (long)databasePurgeReport.getReportValue(databaseTablePrefix + "ACT_RE_DEPLOYMENT"));
            assertEquals(1, (long)databasePurgeReport.getReportValue(databaseTablePrefix + "ACT_RU_EXT_TASK"));
            assertEquals(1, (long)databasePurgeReport.getReportValue(databaseTablePrefix + "ACT_ID_MEMBERSHIP"));
            assertEquals(1, (long)databasePurgeReport.getReportValue(databaseTablePrefix + "ACT_RU_TASK"));
            assertEquals(1, (long)databasePurgeReport.getReportValue(databaseTablePrefix + "ACT_RU_JOB"));
            assertEquals(1, (long)databasePurgeReport.getReportValue(databaseTablePrefix + "ACT_GE_BYTEARRAY"));
            assertEquals(2, (long)databasePurgeReport.getReportValue(databaseTablePrefix + "ACT_RU_JOBDEF"));
            assertEquals(2, (long)databasePurgeReport.getReportValue(databaseTablePrefix + "ACT_ID_USER"));
            assertEquals(5, (long)databasePurgeReport.getReportValue(databaseTablePrefix + "ACT_RU_EXECUTION"));
            assertEquals(10, (long)databasePurgeReport.getReportValue(databaseTablePrefix + "ACT_RU_METER_LOG"));
            assertEquals(1, (long)databasePurgeReport.getReportValue(databaseTablePrefix + "ACT_RU_VARIABLE"));
            assertEquals(1, (long)databasePurgeReport.getReportValue(databaseTablePrefix + "ACT_RE_PROCDEF"));
            assertEquals(2, (long)databasePurgeReport.getReportValue(databaseTablePrefix + "ACT_ID_TENANT"));
            assertEquals(1, (long)databasePurgeReport.getReportValue(databaseTablePrefix + "ACT_ID_GROUP"));
            assertEquals(2, (long)databasePurgeReport.getReportValue(databaseTablePrefix + "ACT_RU_AUTHORIZATION"));

            if (processEngineConfiguration.HistoryLevel.Equals(org.camunda.bpm.engine.impl.history.HistoryLevel_Fields.HISTORY_LEVEL_FULL))
            {
                assertEquals(1, (long)databasePurgeReport.getReportValue(databaseTablePrefix + "ACT_HI_INCIDENT"));
                assertEquals(9, (long)databasePurgeReport.getReportValue(databaseTablePrefix + "ACT_HI_ACTINST"));
                assertEquals(2, (long)databasePurgeReport.getReportValue(databaseTablePrefix + "ACT_HI_PROCINST"));
                assertEquals(2, (long)databasePurgeReport.getReportValue(databaseTablePrefix + "ACT_HI_DETAIL"));
                assertEquals(2, (long)databasePurgeReport.getReportValue(databaseTablePrefix + "ACT_HI_TASKINST"));
                assertEquals(7, (long)databasePurgeReport.getReportValue(databaseTablePrefix + "ACT_HI_JOB_LOG"));
                assertEquals(2, (long)databasePurgeReport.getReportValue(databaseTablePrefix + "ACT_HI_VARINST"));
                assertEquals(8, (long)databasePurgeReport.getReportValue(databaseTablePrefix + "ACT_HI_OP_LOG"));
            }
        }