use of org.activiti.engine.repository.ProcessDefinition in project Activiti by Activiti.
the class ProcessDefinitionQueryByLatestTest method testQueryByLatestAndId.
public void testQueryByLatestAndId() throws Exception {
// Deploy
List<String> xmlFileNameList = Arrays.asList("name_testProcess1_one.bpmn20.xml", "name_testProcess1_two.bpmn20.xml", "name_testProcess2_one.bpmn20.xml");
List<String> deploymentIdList = deploy(xmlFileNameList);
List<String> processDefinitionIdList = new ArrayList<String>();
for (String deploymentId : deploymentIdList) {
String processDefinitionId = repositoryService.createProcessDefinitionQuery().deploymentId(deploymentId).list().get(0).getId();
processDefinitionIdList.add(processDefinitionId);
}
ProcessDefinitionQuery idQuery1 = repositoryService.createProcessDefinitionQuery().processDefinitionId(processDefinitionIdList.get(0)).latestVersion();
List<ProcessDefinition> processDefinitions = idQuery1.list();
assertEquals(0, processDefinitions.size());
ProcessDefinitionQuery idQuery2 = repositoryService.createProcessDefinitionQuery().processDefinitionId(processDefinitionIdList.get(1)).latestVersion();
processDefinitions = idQuery2.list();
assertEquals(1, processDefinitions.size());
assertEquals("testProcess1", processDefinitions.get(0).getKey());
ProcessDefinitionQuery idQuery3 = repositoryService.createProcessDefinitionQuery().processDefinitionId(processDefinitionIdList.get(2)).latestVersion();
processDefinitions = idQuery3.list();
assertEquals(1, processDefinitions.size());
assertEquals("testProcess2", processDefinitions.get(0).getKey());
// Undeploy
unDeploy(deploymentIdList);
}
use of org.activiti.engine.repository.ProcessDefinition in project Activiti by Activiti.
the class ProcessDefinitionQueryByLatestTest method testQueryByLatestAndDeploymentId.
public void testQueryByLatestAndDeploymentId() throws Exception {
// Deploy
List<String> xmlFileNameList = Arrays.asList("name_testProcess1_one.bpmn20.xml", "name_testProcess1_two.bpmn20.xml", "name_testProcess2_one.bpmn20.xml");
List<String> deploymentIdList = deploy(xmlFileNameList);
// deploymentId
ProcessDefinitionQuery deploymentQuery1 = repositoryService.createProcessDefinitionQuery().deploymentId(deploymentIdList.get(0)).latestVersion();
List<ProcessDefinition> processDefinitions = deploymentQuery1.list();
assertEquals(0, processDefinitions.size());
ProcessDefinitionQuery deploymentQuery2 = repositoryService.createProcessDefinitionQuery().deploymentId(deploymentIdList.get(1)).latestVersion();
processDefinitions = deploymentQuery2.list();
assertEquals(1, processDefinitions.size());
assertEquals("testProcess1", processDefinitions.get(0).getKey());
// Undeploy
unDeploy(deploymentIdList);
}
use of org.activiti.engine.repository.ProcessDefinition in project Activiti by Activiti.
the class LaneExtensionTest method testLaneExtensionElement.
@Test
@Deployment
public void testLaneExtensionElement() {
ProcessDefinition processDefinition = activitiRule.getRepositoryService().createProcessDefinitionQuery().processDefinitionKey("swimlane-extension").singleResult();
BpmnModel bpmnModel = activitiRule.getRepositoryService().getBpmnModel(processDefinition.getId());
byte[] xml = new BpmnXMLConverter().convertToXML(bpmnModel);
System.out.println(new String(xml));
Process bpmnProcess = bpmnModel.getMainProcess();
for (Lane l : bpmnProcess.getLanes()) {
Map<String, List<ExtensionElement>> extensions = l.getExtensionElements();
Assert.assertTrue(extensions.size() > 0);
}
}
use of org.activiti.engine.repository.ProcessDefinition in project Activiti by Activiti.
the class CallServiceInServiceTaskTest method testStartProcessFromDelegate.
@Deployment
public void testStartProcessFromDelegate() {
runtimeService.startProcessInstanceByKey("startProcessFromDelegate");
// Starting the process should lead to two processes being started,
// The other one started from the java delegate in the service task
List<ProcessInstance> processInstances = runtimeService.createProcessInstanceQuery().list();
assertEquals(2, processInstances.size());
boolean startProcessFromDelegateFound = false;
boolean oneTaskProcessFound = false;
for (ProcessInstance processInstance : processInstances) {
ProcessDefinition processDefinition = repositoryService.getProcessDefinition(processInstance.getProcessDefinitionId());
if (processDefinition.getKey().equals("startProcessFromDelegate")) {
startProcessFromDelegateFound = true;
} else if (processDefinition.getKey().equals("oneTaskProcess")) {
oneTaskProcessFound = true;
}
}
assertTrue(startProcessFromDelegateFound);
assertTrue(oneTaskProcessFound);
}
use of org.activiti.engine.repository.ProcessDefinition in project Activiti by Activiti.
the class ProcessDefinitionsMBean method getProcessDefinitionById.
@ManagedOperation(description = "get a specific process definition")
public List<String> getProcessDefinitionById(String id) {
ProcessDefinition pd = repositoryService.createProcessDefinitionQuery().processDefinitionId(id).singleResult();
List<String> item = new ArrayList<String>(3);
item.add(pd.getId());
item.add(pd.getName());
item.add(Integer.toString(pd.getVersion()));
item.add(Boolean.toString(pd.isSuspended()));
item.add(pd.getDescription());
return item;
}
Aggregations