@Test public void testDisableQueryOfProcessDefinitionAddModelInstancesToDeploymentCache() { // given deploy(ProcessModels.ONE_TASK_PROCESS_WITH_DOCUMENTATION); ProcessInstance pi = runtimeService.startProcessInstanceByKey(ProcessModels.PROCESS_KEY); // when repositoryService.createProcessDefinitionQuery() .processDefinitionKey(ProcessModels.PROCESS_KEY) .singleResult() .getId(); // then DeploymentCache deploymentCache = processEngineConfiguration.getDeploymentCache(); BpmnModelInstance modelInstance = deploymentCache.getBpmnModelInstanceCache().get(pi.getProcessDefinitionId()); assertNull(modelInstance); }
@Test public void testEnableQueryOfProcessDefinitionAddModelInstancesToDeploymentCache() { // given deploy(ProcessModels.ONE_TASK_PROCESS_WITH_DOCUMENTATION); processEngineConfiguration.setEnableFetchProcessDefinitionDescription(true); ProcessInstance pi = runtimeService.startProcessInstanceByKey(ProcessModels.PROCESS_KEY); // when repositoryService.createProcessDefinitionQuery() .processDefinitionKey(ProcessModels.PROCESS_KEY) .singleResult() .getId(); // then DeploymentCache deploymentCache = processEngineConfiguration.getDeploymentCache(); BpmnModelInstance modelInstance = deploymentCache.getBpmnModelInstanceCache().get(pi.getProcessDefinitionId()); assertNotNull(modelInstance); }
@Test public void testDeleteProcessDefinitionClearsCache() { // given process definition and a process instance BpmnModelInstance bpmnModel = Bpmn.createExecutableProcess("process").startEvent().userTask().endEvent().done(); deployment = repositoryService.createDeployment() .addModelInstance("process.bpmn", bpmnModel) .deploy(); String processDefinitionId = repositoryService.createProcessDefinitionQuery() .processDefinitionKey("process") .singleResult() .getId(); DeploymentCache deploymentCache = processEngineConfiguration.getDeploymentCache(); // ensure definitions and models are part of the cache assertNotNull(deploymentCache.getProcessDefinitionCache().get(processDefinitionId)); assertNotNull(deploymentCache.getBpmnModelInstanceCache().get(processDefinitionId)); repositoryService.deleteProcessDefinition(processDefinitionId, true); // then the definitions and models are removed from the cache assertNull(deploymentCache.getProcessDefinitionCache().get(processDefinitionId)); assertNull(deploymentCache.getBpmnModelInstanceCache().get(processDefinitionId)); }
@Deployment(resources = { "org/camunda/bpm/engine/test/api/oneTaskProcess.bpmn20.xml", "org/camunda/bpm/engine/test/repository/one.cmmn"}) public void testDeleteDeploymentClearsCache() { // fetch definition ids String processDefinitionId = repositoryService.createProcessDefinitionQuery().singleResult().getId(); String caseDefinitionId = repositoryService.createCaseDefinitionQuery().singleResult().getId(); // fetch CMMN model to be placed to in the cache repositoryService.getCmmnModelInstance(caseDefinitionId); DeploymentCache deploymentCache = processEngineConfiguration.getDeploymentCache(); // ensure definitions and models are part of the cache assertNotNull(deploymentCache.getProcessDefinitionCache().get(processDefinitionId)); assertNotNull(deploymentCache.getBpmnModelInstanceCache().get(processDefinitionId)); assertNotNull(deploymentCache.getCaseDefinitionCache().get(caseDefinitionId)); assertNotNull(deploymentCache.getCmmnModelInstanceCache().get(caseDefinitionId)); // when the deployment is deleted repositoryService.deleteDeployment(deploymentId, true); // then the definitions and models are removed from the cache assertNull(deploymentCache.getProcessDefinitionCache().get(processDefinitionId)); assertNull(deploymentCache.getBpmnModelInstanceCache().get(processDefinitionId)); assertNull(deploymentCache.getCaseDefinitionCache().get(caseDefinitionId)); assertNull(deploymentCache.getCmmnModelInstanceCache().get(caseDefinitionId)); }
Cache<String, BpmnModelInstance> bpmnModelInstanceCache = getBpmnModelInstanceCache(); if (!bpmnModelInstanceCache.isEmpty()) { result.addPurgeInformation(CachePurgeReport.BPMN_MODEL_INST_CACHE, bpmnModelInstanceCache.keySet());
Cache<String, BpmnModelInstance> bpmnModelInstanceCache = getBpmnModelInstanceCache(); if (!bpmnModelInstanceCache.isEmpty()) { result.addPurgeInformation(CachePurgeReport.BPMN_MODEL_INST_CACHE, bpmnModelInstanceCache.keySet());
@Test public void testDisableQueryOfProcessDefinitionAddModelInstancesToDeploymentCache() { // given deploy(ProcessModels.ONE_TASK_PROCESS_WITH_DOCUMENTATION); ProcessInstance pi = runtimeService.startProcessInstanceByKey(ProcessModels.PROCESS_KEY); // when repositoryService.createProcessDefinitionQuery() .processDefinitionKey(ProcessModels.PROCESS_KEY) .singleResult() .getId(); // then DeploymentCache deploymentCache = processEngineConfiguration.getDeploymentCache(); BpmnModelInstance modelInstance = deploymentCache.getBpmnModelInstanceCache().get(pi.getProcessDefinitionId()); assertNull(modelInstance); }
@Test public void testEnableQueryOfProcessDefinitionAddModelInstancesToDeploymentCache() { // given deploy(ProcessModels.ONE_TASK_PROCESS_WITH_DOCUMENTATION); processEngineConfiguration.setEnableFetchProcessDefinitionDescription(true); ProcessInstance pi = runtimeService.startProcessInstanceByKey(ProcessModels.PROCESS_KEY); // when repositoryService.createProcessDefinitionQuery() .processDefinitionKey(ProcessModels.PROCESS_KEY) .singleResult() .getId(); // then DeploymentCache deploymentCache = processEngineConfiguration.getDeploymentCache(); BpmnModelInstance modelInstance = deploymentCache.getBpmnModelInstanceCache().get(pi.getProcessDefinitionId()); assertNotNull(modelInstance); }
@Test public void testDeleteProcessDefinitionClearsCache() { // given process definition and a process instance BpmnModelInstance bpmnModel = Bpmn.createExecutableProcess("process").startEvent().userTask().endEvent().done(); deployment = repositoryService.createDeployment() .addModelInstance("process.bpmn", bpmnModel) .deploy(); String processDefinitionId = repositoryService.createProcessDefinitionQuery() .processDefinitionKey("process") .singleResult() .getId(); DeploymentCache deploymentCache = processEngineConfiguration.getDeploymentCache(); // ensure definitions and models are part of the cache assertNotNull(deploymentCache.getProcessDefinitionCache().get(processDefinitionId)); assertNotNull(deploymentCache.getBpmnModelInstanceCache().get(processDefinitionId)); repositoryService.deleteProcessDefinition(processDefinitionId, true); // then the definitions and models are removed from the cache assertNull(deploymentCache.getProcessDefinitionCache().get(processDefinitionId)); assertNull(deploymentCache.getBpmnModelInstanceCache().get(processDefinitionId)); }
@Deployment(resources = { "org/camunda/bpm/engine/test/api/oneTaskProcess.bpmn20.xml", "org/camunda/bpm/engine/test/repository/one.cmmn"}) public void testDeleteDeploymentClearsCache() { // fetch definition ids String processDefinitionId = repositoryService.createProcessDefinitionQuery().singleResult().getId(); String caseDefinitionId = repositoryService.createCaseDefinitionQuery().singleResult().getId(); // fetch CMMN model to be placed to in the cache repositoryService.getCmmnModelInstance(caseDefinitionId); DeploymentCache deploymentCache = processEngineConfiguration.getDeploymentCache(); // ensure definitions and models are part of the cache assertNotNull(deploymentCache.getProcessDefinitionCache().get(processDefinitionId)); assertNotNull(deploymentCache.getBpmnModelInstanceCache().get(processDefinitionId)); assertNotNull(deploymentCache.getCaseDefinitionCache().get(caseDefinitionId)); assertNotNull(deploymentCache.getCmmnModelInstanceCache().get(caseDefinitionId)); // when the deployment is deleted repositoryService.deleteDeployment(deploymentId, true); // then the definitions and models are removed from the cache assertNull(deploymentCache.getProcessDefinitionCache().get(processDefinitionId)); assertNull(deploymentCache.getBpmnModelInstanceCache().get(processDefinitionId)); assertNull(deploymentCache.getCaseDefinitionCache().get(caseDefinitionId)); assertNull(deploymentCache.getCmmnModelInstanceCache().get(caseDefinitionId)); }
Cache<String, BpmnModelInstance> bpmnModelInstanceCache = getBpmnModelInstanceCache(); if (!bpmnModelInstanceCache.isEmpty()) { result.addPurgeInformation(CachePurgeReport.BPMN_MODEL_INST_CACHE, bpmnModelInstanceCache.keySet());