use of org.activiti.engine.repository.Deployment in project Activiti by Activiti.
the class CallActivityTest method testInstantiateSuspendedChildProcess.
public void testInstantiateSuspendedChildProcess() throws Exception {
BpmnModel childBpmnModel = loadBPMNModel(CHILD_PROCESS_RESOURCE);
Deployment childDeployment = processEngine.getRepositoryService().createDeployment().name("childProcessDeployment").addBpmnModel("childProcess.bpmn20.xml", childBpmnModel).deploy();
suspendProcessDefinitions(childDeployment);
try {
ProcessInstance childProcessInstance = runtimeService.startProcessInstanceByKey("childProcess");
fail("Exception expected");
} catch (ActivitiException ae) {
assertTextPresent("Cannot start process instance. Process definition Child Process", ae.getMessage());
}
}
use of org.activiti.engine.repository.Deployment in project Activiti by Activiti.
the class CallActivityTest method testInstantiateProcessByMessage.
public void testInstantiateProcessByMessage() throws Exception {
BpmnModel messageTriggeredBpmnModel = loadBPMNModel(MESSAGE_TRIGGERED_PROCESS_RESOURCE);
Deployment messageTriggeredBpmnDeployment = processEngine.getRepositoryService().createDeployment().name("messageTriggeredProcessDeployment").addBpmnModel("messageTriggered.bpmn20.xml", messageTriggeredBpmnModel).deploy();
ProcessInstance childProcessInstance = runtimeService.startProcessInstanceByMessage("TRIGGER_PROCESS_MESSAGE");
assertNotNull(childProcessInstance);
}
use of org.activiti.engine.repository.Deployment in project Activiti by Activiti.
the class CallActivityTest method testInstantiateSuspendedProcessByMessage.
public void testInstantiateSuspendedProcessByMessage() throws Exception {
BpmnModel messageTriggeredBpmnModel = loadBPMNModel(MESSAGE_TRIGGERED_PROCESS_RESOURCE);
Deployment messageTriggeredBpmnDeployment = processEngine.getRepositoryService().createDeployment().name("messageTriggeredProcessDeployment").addBpmnModel("messageTriggered.bpmn20.xml", messageTriggeredBpmnModel).deploy();
suspendProcessDefinitions(messageTriggeredBpmnDeployment);
try {
ProcessInstance childProcessInstance = runtimeService.startProcessInstanceByMessage("TRIGGER_PROCESS_MESSAGE");
fail("Exception expected");
} catch (ActivitiException ae) {
assertTextPresent("Cannot start process instance. Process definition Message Triggered Process", ae.getMessage());
}
}
use of org.activiti.engine.repository.Deployment in project Activiti by Activiti.
the class DeploymentResourceCollectionResource method getDeploymentResources.
@RequestMapping(value = "/repository/deployments/{deploymentId}/resources", method = RequestMethod.GET, produces = "application/json")
public List<DeploymentResourceResponse> getDeploymentResources(@PathVariable String deploymentId, HttpServletRequest request) {
// Check if deployment exists
Deployment deployment = repositoryService.createDeploymentQuery().deploymentId(deploymentId).singleResult();
if (deployment == null) {
throw new ActivitiObjectNotFoundException("Could not find a deployment with id '" + deploymentId + "'.", Deployment.class);
}
List<String> resourceList = repositoryService.getDeploymentResourceNames(deploymentId);
return restResponseFactory.createDeploymentResourceResponseList(deploymentId, resourceList, contentTypeResolver);
}
use of org.activiti.engine.repository.Deployment in project Activiti by Activiti.
the class DeploymentResourceResource method getDeploymentResource.
@RequestMapping(value = "/repository/deployments/{deploymentId}/resources/**", method = RequestMethod.GET, produces = "application/json")
public DeploymentResourceResponse getDeploymentResource(@PathVariable("deploymentId") String deploymentId, HttpServletRequest request) {
// Check if deployment exists
Deployment deployment = repositoryService.createDeploymentQuery().deploymentId(deploymentId).singleResult();
if (deployment == null) {
throw new ActivitiObjectNotFoundException("Could not find a deployment with id '" + deploymentId + "'.");
}
String pathInfo = request.getPathInfo();
String resourceName = pathInfo.replace("/repository/deployments/" + deploymentId + "/resources/", "");
List<String> resourceList = repositoryService.getDeploymentResourceNames(deploymentId);
if (resourceList.contains(resourceName)) {
// Build resource representation
DeploymentResourceResponse response = restResponseFactory.createDeploymentResourceResponse(deploymentId, resourceName, contentTypeResolver.resolveContentType(resourceName));
return response;
} else {
// Resource not found in deployment
throw new ActivitiObjectNotFoundException("Could not find a resource with id '" + resourceName + "' in deployment '" + deploymentId + "'.");
}
}
Aggregations