use of org.activiti.engine.repository.DeploymentBuilder in project Activiti by Activiti.
the class TestHelper method annotationDeploymentSetUp.
// Test annotation support /////////////////////////////////////////////
public static String annotationDeploymentSetUp(ProcessEngine processEngine, Class<?> testClass, String methodName) {
String deploymentId = null;
Method method = null;
try {
method = testClass.getMethod(methodName, (Class<?>[]) null);
} catch (Exception e) {
log.warn("Could not get method by reflection. This could happen if you are using @Parameters in combination with annotations.", e);
return null;
}
Deployment deploymentAnnotation = method.getAnnotation(Deployment.class);
if (deploymentAnnotation != null) {
log.debug("annotation @Deployment creates deployment for {}.{}", testClass.getSimpleName(), methodName);
String[] resources = deploymentAnnotation.resources();
if (resources.length == 0) {
String name = method.getName();
String resource = getBpmnProcessDefinitionResource(testClass, name);
resources = new String[] { resource };
}
DeploymentBuilder deploymentBuilder = processEngine.getRepositoryService().createDeployment().name(testClass.getSimpleName() + "." + methodName);
for (String resource : resources) {
deploymentBuilder.addClasspathResource(resource);
}
deploymentId = deploymentBuilder.deploy().getId();
}
return deploymentId;
}
use of org.activiti.engine.repository.DeploymentBuilder in project Activiti by Activiti.
the class ProcessDefinitionsMBean method deployProcessDefinition.
@ManagedOperation(description = "Deploy Process Definition")
public void deployProcessDefinition(String resourceName, String processDefinitionFile) throws FileNotFoundException {
DeploymentBuilder deploymentBuilder = repositoryService.createDeployment();
Deployment deployment = deploymentBuilder.addInputStream(resourceName, new FileInputStream(processDefinitionFile)).deploy();
}
Aggregations