use of org.activiti.engine.repository.ProcessDefinitionQuery in project Activiti by Activiti.
the class ProcessDefinitionQueryTest method testQueryByNameLike.
public void testQueryByNameLike() {
ProcessDefinitionQuery query = repositoryService.createProcessDefinitionQuery().processDefinitionNameLike("%w%");
verifyQueryResults(query, 1);
}
use of org.activiti.engine.repository.ProcessDefinitionQuery in project Activiti by Activiti.
the class ProcessDefinitionQueryTest method testQuerySorting.
public void testQuerySorting() {
// asc
ProcessDefinitionQuery query = repositoryService.createProcessDefinitionQuery().orderByProcessDefinitionId().asc();
verifyQueryResults(query, 3);
query = repositoryService.createProcessDefinitionQuery().orderByDeploymentId().asc();
verifyQueryResults(query, 3);
query = repositoryService.createProcessDefinitionQuery().orderByProcessDefinitionKey().asc();
verifyQueryResults(query, 3);
query = repositoryService.createProcessDefinitionQuery().orderByProcessDefinitionVersion().asc();
verifyQueryResults(query, 3);
// desc
query = repositoryService.createProcessDefinitionQuery().orderByProcessDefinitionId().desc();
verifyQueryResults(query, 3);
query = repositoryService.createProcessDefinitionQuery().orderByDeploymentId().desc();
verifyQueryResults(query, 3);
query = repositoryService.createProcessDefinitionQuery().orderByProcessDefinitionKey().desc();
verifyQueryResults(query, 3);
query = repositoryService.createProcessDefinitionQuery().orderByProcessDefinitionVersion().desc();
verifyQueryResults(query, 3);
// Typical use case
query = repositoryService.createProcessDefinitionQuery().orderByProcessDefinitionKey().asc().orderByProcessDefinitionVersion().desc();
List<ProcessDefinition> processDefinitions = query.list();
assertEquals(3, processDefinitions.size());
assertEquals("one", processDefinitions.get(0).getKey());
assertEquals(2, processDefinitions.get(0).getVersion());
assertEquals("one", processDefinitions.get(1).getKey());
assertEquals(1, processDefinitions.get(1).getVersion());
assertEquals("two", processDefinitions.get(2).getKey());
assertEquals(1, processDefinitions.get(2).getVersion());
}
use of org.activiti.engine.repository.ProcessDefinitionQuery in project Activiti by Activiti.
the class ProcessDefinitionQueryByLatestTest method testQueryByLatestAndName.
public void testQueryByLatestAndName() 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);
// name
ProcessDefinitionQuery nameQuery = repositoryService.createProcessDefinitionQuery().processDefinitionName("one").latestVersion();
List<ProcessDefinition> processDefinitions = nameQuery.list();
assertEquals(1, processDefinitions.size());
assertEquals(1, processDefinitions.get(0).getVersion());
assertEquals("testProcess2", processDefinitions.get(0).getKey());
// nameLike
ProcessDefinitionQuery nameLikeQuery = repositoryService.createProcessDefinitionQuery().processDefinitionName("one").latestVersion();
processDefinitions = nameLikeQuery.list();
assertEquals(1, processDefinitions.size());
assertEquals(1, processDefinitions.get(0).getVersion());
assertEquals("testProcess2", processDefinitions.get(0).getKey());
// Undeploy
unDeploy(deploymentIdList);
}
use of org.activiti.engine.repository.ProcessDefinitionQuery in project Activiti by Activiti.
the class ProcessDefinitionQueryEscapeClauseTest method testQueryByCategoryLike.
public void testQueryByCategoryLike() {
ProcessDefinitionQuery query = repositoryService.createProcessDefinitionQuery().processDefinitionCategoryLike("%\\_%");
assertEquals("Examples_", query.singleResult().getCategory());
assertEquals(1, query.list().size());
assertEquals(1, query.count());
}
Aggregations