if (!cachePurgeReport.isEmpty()) { builder.append(CACHE_IS_NOT_CLEAN).append(cachePurgeReport.getPurgeReportAsString());
@Override public String getPurgeReportAsString() { StringBuilder builder = new StringBuilder(); for (String key : deletedCache.keySet()) { builder.append("Cache: ").append(key) .append(" contains: ").append(getReportValue(key)) .append("\n"); } return builder.toString(); }
public CachePurgeReport purgeCache() { CachePurgeReport result = new CachePurgeReport(); Cache<String, ProcessDefinitionEntity> processDefinitionCache = getProcessDefinitionCache(); if (!processDefinitionCache.isEmpty()) { result.addPurgeInformation(CachePurgeReport.PROCESS_DEF_CACHE, processDefinitionCache.keySet()); processDefinitionCache.clear(); result.addPurgeInformation(CachePurgeReport.BPMN_MODEL_INST_CACHE, bpmnModelInstanceCache.keySet()); bpmnModelInstanceCache.clear(); result.addPurgeInformation(CachePurgeReport.CASE_DEF_CACHE, caseDefinitionCache.keySet()); caseDefinitionCache.clear(); result.addPurgeInformation(CachePurgeReport.CASE_MODEL_INST_CACHE, cmmnModelInstanceCache.keySet()); cmmnModelInstanceCache.clear(); result.addPurgeInformation(CachePurgeReport.DMN_DEF_CACHE, decisionDefinitionCache.keySet()); decisionDefinitionCache.clear(); result.addPurgeInformation(CachePurgeReport.DMN_MODEL_INST_CACHE, dmnModelInstanceCache.keySet()); dmnModelInstanceCache.clear(); result.addPurgeInformation(CachePurgeReport.DMN_REQ_DEF_CACHE, decisionRequirementsDefinitionCache.keySet()); decisionRequirementsDefinitionCache.clear();
public boolean isEmpty() { return cachePurgeReport.isEmpty() && databasePurgeReport.isEmpty(); } }
/** * Ensures that the deployment cache is empty after a test. If not the cache * will be cleared. * * @param processEngine the {@link ProcessEngine} to test * @param fail if true the method will throw an {@link AssertionError} if the deployment cache is not clean * @return the deployment cache summary if fail is set to false or null if deployment cache was clean * @throws AssertionError if the deployment cache was not clean and fail is set to true */ public static String assertAndEnsureCleanDeploymentCache(ProcessEngine processEngine, boolean fail) { StringBuilder outputMessage = new StringBuilder(); ProcessEngineConfigurationImpl processEngineConfiguration = ((ProcessEngineImpl) processEngine).getProcessEngineConfiguration(); CachePurgeReport cachePurgeReport = processEngineConfiguration.getDeploymentCache().purgeCache(); outputMessage.append(cachePurgeReport.getPurgeReportAsString()); if (outputMessage.length() > 0) { outputMessage.insert(0, "Deployment cache not clean:\n"); LOG.error(outputMessage.toString()); if (fail) { Assert.fail(outputMessage.toString()); } return outputMessage.toString(); } else { LOG.debug("Deployment cache was clean"); return null; } }
public CachePurgeReport purgeCache() { CachePurgeReport result = new CachePurgeReport(); Cache<String, ProcessDefinitionEntity> processDefinitionCache = getProcessDefinitionCache(); if (!processDefinitionCache.isEmpty()) { result.addPurgeInformation(CachePurgeReport.PROCESS_DEF_CACHE, processDefinitionCache.keySet()); processDefinitionCache.clear(); result.addPurgeInformation(CachePurgeReport.BPMN_MODEL_INST_CACHE, bpmnModelInstanceCache.keySet()); bpmnModelInstanceCache.clear(); result.addPurgeInformation(CachePurgeReport.CASE_DEF_CACHE, caseDefinitionCache.keySet()); caseDefinitionCache.clear(); result.addPurgeInformation(CachePurgeReport.CASE_MODEL_INST_CACHE, cmmnModelInstanceCache.keySet()); cmmnModelInstanceCache.clear(); result.addPurgeInformation(CachePurgeReport.DMN_DEF_CACHE, decisionDefinitionCache.keySet()); decisionDefinitionCache.clear(); result.addPurgeInformation(CachePurgeReport.DMN_MODEL_INST_CACHE, dmnModelInstanceCache.keySet()); dmnModelInstanceCache.clear(); result.addPurgeInformation(CachePurgeReport.DMN_REQ_DEF_CACHE, decisionRequirementsDefinitionCache.keySet()); decisionRequirementsDefinitionCache.clear();
public boolean isEmpty() { return cachePurgeReport.isEmpty() && databasePurgeReport.isEmpty(); } }
/** * Ensures that the deployment cache is empty after a test. If not the cache * will be cleared. * * @param processEngine the {@link ProcessEngine} to test * @param fail if true the method will throw an {@link AssertionError} if the deployment cache is not clean * @return the deployment cache summary if fail is set to false or null if deployment cache was clean * @throws AssertionError if the deployment cache was not clean and fail is set to true */ public static String assertAndEnsureCleanDeploymentCache(ProcessEngine processEngine, boolean fail) { StringBuilder outputMessage = new StringBuilder(); ProcessEngineConfigurationImpl processEngineConfiguration = ((ProcessEngineImpl) processEngine).getProcessEngineConfiguration(); CachePurgeReport cachePurgeReport = processEngineConfiguration.getDeploymentCache().purgeCache(); outputMessage.append(cachePurgeReport.getPurgeReportAsString()); if (outputMessage.length() > 0) { outputMessage.insert(0, "Deployment cache not clean:\n"); LOG.error(outputMessage.toString()); if (fail) { Assert.fail(outputMessage.toString()); } return outputMessage.toString(); } else { LOG.debug("Deployment cache was clean"); return null; } }
if (!cachePurgeReport.isEmpty()) { message.append("Deployment cache is not clean:\n") .append(cachePurgeReport.getPurgeReportAsString()); } else { LOG.debug("Deployment cache was clean.");
@Override public String getPurgeReportAsString() { StringBuilder builder = new StringBuilder(); for (String key : deletedCache.keySet()) { builder.append("Cache: ").append(key) .append(" contains: ").append(getReportValue(key)) .append("\n"); } return builder.toString(); }
public CachePurgeReport purgeCache() { CachePurgeReport result = new CachePurgeReport(); Cache<String, ProcessDefinitionEntity> processDefinitionCache = getProcessDefinitionCache(); if (!processDefinitionCache.isEmpty()) { result.addPurgeInformation(CachePurgeReport.PROCESS_DEF_CACHE, processDefinitionCache.keySet()); processDefinitionCache.clear(); result.addPurgeInformation(CachePurgeReport.BPMN_MODEL_INST_CACHE, bpmnModelInstanceCache.keySet()); bpmnModelInstanceCache.clear(); result.addPurgeInformation(CachePurgeReport.CASE_DEF_CACHE, caseDefinitionCache.keySet()); caseDefinitionCache.clear(); result.addPurgeInformation(CachePurgeReport.CASE_MODEL_INST_CACHE, cmmnModelInstanceCache.keySet()); cmmnModelInstanceCache.clear(); result.addPurgeInformation(CachePurgeReport.DMN_DEF_CACHE, decisionDefinitionCache.keySet()); decisionDefinitionCache.clear(); result.addPurgeInformation(CachePurgeReport.DMN_MODEL_INST_CACHE, dmnModelInstanceCache.keySet()); dmnModelInstanceCache.clear(); result.addPurgeInformation(CachePurgeReport.DMN_REQ_DEF_CACHE, decisionRequirementsDefinitionCache.keySet()); decisionRequirementsDefinitionCache.clear();
public boolean isEmpty() { return cachePurgeReport.isEmpty() && databasePurgeReport.isEmpty(); } }
/** * Ensures that the deployment cache is empty after a test. If not the cache * will be cleared. * * @param processEngine the {@link ProcessEngine} to test * @param fail if true the method will throw an {@link AssertionError} if the deployment cache is not clean * @return the deployment cache summary if fail is set to false or null if deployment cache was clean * @throws AssertionError if the deployment cache was not clean and fail is set to true */ public static String assertAndEnsureCleanDeploymentCache(ProcessEngine processEngine, boolean fail) { StringBuilder outputMessage = new StringBuilder(); ProcessEngineConfigurationImpl processEngineConfiguration = ((ProcessEngineImpl) processEngine).getProcessEngineConfiguration(); CachePurgeReport cachePurgeReport = processEngineConfiguration.getDeploymentCache().purgeCache(); outputMessage.append(cachePurgeReport.getPurgeReportAsString()); if (outputMessage.length() > 0) { outputMessage.insert(0, "Deployment cache not clean:\n"); LOG.error(outputMessage.toString()); if (fail) { Assert.fail(outputMessage.toString()); } return outputMessage.toString(); } else { LOG.debug("Deployment cache was clean"); return null; } }
if (!cachePurgeReport.isEmpty()) { message.append("Deployment cache is not clean:\n") .append(cachePurgeReport.getPurgeReportAsString()); } else { LOG.debug("Deployment cache was clean.");
@Override public String getPurgeReportAsString() { StringBuilder builder = new StringBuilder(); for (String key : deletedCache.keySet()) { builder.append("Cache: ").append(key) .append(" contains: ").append(getReportValue(key)) .append("\n"); } return builder.toString(); }
if (!cachePurgeReport.isEmpty()) { message.append("Deployment cache is not clean:\n") .append(cachePurgeReport.getPurgeReportAsString()); } else { LOG.debug("Deployment cache was clean.");
assertEquals(2, cachePurgeReport.getReportValue(CachePurgeReport.DMN_DEF_CACHE).size()); assertEquals(1, cachePurgeReport.getReportValue(CachePurgeReport.DMN_REQ_DEF_CACHE).size());
assertEquals(1, cachePurgeReport.getReportValue(CachePurgeReport.CASE_DEF_CACHE).size());
assertEquals(1, cachePurgeReport.getReportValue(CachePurgeReport.PROCESS_DEF_CACHE).size());
assertEquals(2, cachePurgeReport.getReportValue(CachePurgeReport.DMN_DEF_CACHE).size()); assertEquals(1, cachePurgeReport.getReportValue(CachePurgeReport.DMN_REQ_DEF_CACHE).size());