use of org.activiti.engine.repository.ProcessDefinitionQuery in project Activiti by Activiti.
the class ProcessDefinitionQueryByLatestTest method testQueryByLatestAndVersion.
public void testQueryByLatestAndVersion() throws Exception {
// Deploy
List<String> xmlFileNameList = Arrays.asList("version_testProcess1_one.bpmn20.xml", "version_testProcess1_two.bpmn20.xml", "version_testProcess2_one.bpmn20.xml");
List<String> deploymentIdList = deploy(xmlFileNameList);
// version
ProcessDefinitionQuery nameQuery = repositoryService.createProcessDefinitionQuery().processDefinitionVersion(1).latestVersion();
List<ProcessDefinition> processDefinitions = nameQuery.list();
assertEquals(1, processDefinitions.size());
assertEquals("testProcess2", processDefinitions.get(0).getKey());
// Undeploy
unDeploy(deploymentIdList);
}
use of org.activiti.engine.repository.ProcessDefinitionQuery 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.ProcessDefinitionQuery 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.ProcessDefinitionQuery in project Activiti by Activiti.
the class ProcessDefinitionQueryTest method testQueryByInvalidDeploymentId.
public void testQueryByInvalidDeploymentId() {
ProcessDefinitionQuery query = repositoryService.createProcessDefinitionQuery().deploymentId("invalid");
verifyQueryResults(query, 0);
try {
repositoryService.createProcessDefinitionQuery().deploymentId(null);
fail();
} catch (ActivitiIllegalArgumentException e) {
}
}
use of org.activiti.engine.repository.ProcessDefinitionQuery in project Activiti by Activiti.
the class ProcessDefinitionQueryTest method testQueryByName.
public void testQueryByName() {
ProcessDefinitionQuery query = repositoryService.createProcessDefinitionQuery().processDefinitionName("Two");
verifyQueryResults(query, 1);
query = repositoryService.createProcessDefinitionQuery().processDefinitionName("One");
verifyQueryResults(query, 2);
}
Aggregations