/** * 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; } }
/** * 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; } }
builder.append(CACHE_IS_NOT_CLEAN).append(cachePurgeReport.getPurgeReportAsString());
if (!cachePurgeReport.isEmpty()) { message.append("Deployment cache is not clean:\n") .append(cachePurgeReport.getPurgeReportAsString()); } else { LOG.debug("Deployment cache was clean.");
if (!cachePurgeReport.isEmpty()) { message.append("Deployment cache is not clean:\n") .append(cachePurgeReport.getPurgeReportAsString()); } else { LOG.debug("Deployment cache was clean.");
/** * 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.");