@Test public void testParseInvalidProcessDefinition() { try { repositoryService .createDeployment() .addClasspathResource(PROCESS_DEFINITION_DIRECTORY + processDefinitionResource) .deploy(); fail("exception expected: " + expectedErrorMessage); } catch (Exception e) { assertTextPresent(expectedErrorMessage, e.getMessage()); } }
protected void autoDeployResources(ProcessEngine processEngine) { if (deploymentResources != null && deploymentResources.length > 0) { RepositoryService repositoryService = processEngine.getRepositoryService(); DeploymentBuilder deploymentBuilder = repositoryService .createDeployment() .enableDuplicateFiltering(false) .name(deploymentName) .tenantId(deploymentTenantId); for (Resource resource : deploymentResources) { String resourceName = null; if (resource instanceof ContextResource) { resourceName = ((ContextResource) resource).getPathWithinContext(); } else if (resource instanceof ByteArrayResource) { resourceName = resource.getDescription(); } else { try { resourceName = resource.getFile().getAbsolutePath(); } catch (IOException e) { resourceName = resource.getFilename(); } } try { if (resourceName.endsWith(".bar") || resourceName.endsWith(".zip") || resourceName.endsWith(".jar")) { deploymentBuilder.addZipInputStream(new ZipInputStream(resource.getInputStream())); } else { deploymentBuilder.addInputStream(resourceName, resource.getInputStream()); } } catch (IOException e) { throw new ProcessEngineException( "couldn't auto deploy resource '" + resource + "': " + e.getMessage(), e); } } deploymentBuilder.deploy(); } }