use of org.camunda.bpm.engine.repository.DecisionDefinitionQuery in project camunda-bpm-platform by camunda.
the class DecisionDefinitionQueryTest method testInvalidUsageOfLatest.
public void testInvalidUsageOfLatest() {
DecisionDefinitionQuery query = repositoryService.createDecisionDefinitionQuery();
try {
query.decisionDefinitionId("test").latestVersion().list();
fail();
} catch (NotValidException e) {
// Expected exception
}
try {
query.decisionDefinitionName("test").latestVersion().list();
fail();
} catch (NotValidException e) {
// Expected exception
}
try {
query.decisionDefinitionNameLike("test").latestVersion().list();
fail();
} catch (NotValidException e) {
// Expected exception
}
try {
query.decisionDefinitionVersion(1).latestVersion().list();
fail();
} catch (NotValidException e) {
// Expected exception
}
try {
query.deploymentId("test").latestVersion().list();
fail();
} catch (NotValidException e) {
// Expected exception
}
}
use of org.camunda.bpm.engine.repository.DecisionDefinitionQuery in project camunda-bpm-platform by camunda.
the class DecisionDefinitionQueryTest method queryByInvalidDeploymentId.
@Test
public void queryByInvalidDeploymentId() {
DecisionDefinitionQuery query = repositoryService.createDecisionDefinitionQuery();
query.deploymentId("invalid");
verifyQueryResults(query, 0);
try {
query.deploymentId(null);
fail();
} catch (NotValidException e) {
// Expected exception
}
}
use of org.camunda.bpm.engine.repository.DecisionDefinitionQuery in project camunda-bpm-platform by camunda.
the class DecisionDefinitionQueryTest method queryByInvalidName.
@Test
public void queryByInvalidName() {
DecisionDefinitionQuery query = repositoryService.createDecisionDefinitionQuery();
query.decisionDefinitionName("invalid");
verifyQueryResults(query, 0);
try {
query.decisionDefinitionName(null);
fail();
} catch (NotValidException e) {
// Expected exception
}
}
use of org.camunda.bpm.engine.repository.DecisionDefinitionQuery in project camunda-bpm-platform by camunda.
the class DecisionDefinitionQueryTest method queryByResourceNameLike.
@Test
public void queryByResourceNameLike() {
DecisionDefinitionQuery query = repositoryService.createDecisionDefinitionQuery();
query.decisionDefinitionResourceNameLike("%ree%");
verifyQueryResults(query, 1);
query.decisionDefinitionResourceNameLike("%ee\\_%");
verifyQueryResults(query, 1);
}
use of org.camunda.bpm.engine.repository.DecisionDefinitionQuery in project camunda-bpm-platform by camunda.
the class DecisionDefinitionQueryTest method querySorting.
@Test
public void querySorting() {
DecisionDefinitionQuery query = repositoryService.createDecisionDefinitionQuery();
// asc
query.orderByDecisionDefinitionId().asc();
verifyQueryResults(query, 4);
query = repositoryService.createDecisionDefinitionQuery();
query.orderByDeploymentId().asc();
verifyQueryResults(query, 4);
query = repositoryService.createDecisionDefinitionQuery();
query.orderByDecisionDefinitionKey().asc();
verifyQueryResults(query, 4);
query = repositoryService.createDecisionDefinitionQuery();
query.orderByDecisionDefinitionVersion().asc();
verifyQueryResults(query, 4);
// desc
query = repositoryService.createDecisionDefinitionQuery();
query.orderByDecisionDefinitionId().desc();
verifyQueryResults(query, 4);
query = repositoryService.createDecisionDefinitionQuery();
query.orderByDeploymentId().desc();
verifyQueryResults(query, 4);
query = repositoryService.createDecisionDefinitionQuery();
query.orderByDecisionDefinitionKey().desc();
verifyQueryResults(query, 4);
query = repositoryService.createDecisionDefinitionQuery();
query.orderByDecisionDefinitionVersion().desc();
verifyQueryResults(query, 4);
query = repositoryService.createDecisionDefinitionQuery();
// Typical use decision
query.orderByDecisionDefinitionKey().asc().orderByDecisionDefinitionVersion().desc();
List<DecisionDefinition> decisionDefinitions = query.list();
assertEquals(4, decisionDefinitions.size());
assertEquals("one", decisionDefinitions.get(0).getKey());
assertEquals(2, decisionDefinitions.get(0).getVersion());
assertEquals("one", decisionDefinitions.get(1).getKey());
assertEquals(1, decisionDefinitions.get(1).getVersion());
assertEquals("two", decisionDefinitions.get(2).getKey());
assertEquals(1, decisionDefinitions.get(2).getVersion());
}
Aggregations