use of org.activiti.engine.ActivitiIllegalArgumentException in project Activiti by Activiti.
the class ExecutionQueryTest method testQueryLikeIgnoreCase.
@Deployment(resources = { "org/activiti/engine/test/api/oneTaskProcess.bpmn20.xml" })
public void testQueryLikeIgnoreCase() {
Map<String, Object> vars = new HashMap<String, Object>();
vars.put("mixed", "AbCdEfG");
vars.put("lower", "ABCDEFG");
vars.put("upper", "abcdefg");
ProcessInstance processInstance1 = runtimeService.startProcessInstanceByKey("oneTaskProcess", vars);
Execution execution = runtimeService.createExecutionQuery().variableValueLikeIgnoreCase("mixed", "abcde%").singleResult();
assertNotNull(execution);
assertEquals(processInstance1.getId(), execution.getId());
execution = runtimeService.createExecutionQuery().variableValueLikeIgnoreCase("lower", "abcd%").singleResult();
assertNotNull(execution);
assertEquals(processInstance1.getId(), execution.getId());
execution = runtimeService.createExecutionQuery().variableValueLikeIgnoreCase("upper", "abcd%").singleResult();
assertNotNull(execution);
assertEquals(processInstance1.getId(), execution.getId());
// Pass in non-lower-case string
execution = runtimeService.createExecutionQuery().variableValueLikeIgnoreCase("upper", "ABCde%").singleResult();
assertNotNull(execution);
assertEquals(processInstance1.getId(), execution.getId());
// Pass in null-value, should cause exception
try {
execution = runtimeService.createExecutionQuery().variableValueEqualsIgnoreCase("upper", null).singleResult();
fail("Exception expected");
} catch (ActivitiIllegalArgumentException ae) {
assertEquals("value is null", ae.getMessage());
}
// Pass in null name, should cause exception
try {
execution = runtimeService.createExecutionQuery().variableValueEqualsIgnoreCase(null, "abcdefg").singleResult();
fail("Exception expected");
} catch (ActivitiIllegalArgumentException ae) {
assertEquals("name is null", ae.getMessage());
}
}
use of org.activiti.engine.ActivitiIllegalArgumentException in project Activiti by Activiti.
the class ExecutionQueryTest method testQueryEqualsIgnoreCase.
@Deployment(resources = { "org/activiti/engine/test/api/oneTaskProcess.bpmn20.xml" })
public void testQueryEqualsIgnoreCase() {
Map<String, Object> vars = new HashMap<String, Object>();
vars.put("mixed", "AbCdEfG");
vars.put("lower", "ABCDEFG");
vars.put("upper", "abcdefg");
ProcessInstance processInstance1 = runtimeService.startProcessInstanceByKey("oneTaskProcess", vars);
Execution execution = runtimeService.createExecutionQuery().variableValueEqualsIgnoreCase("mixed", "abcdefg").singleResult();
assertNotNull(execution);
assertEquals(processInstance1.getId(), execution.getId());
execution = runtimeService.createExecutionQuery().variableValueEqualsIgnoreCase("lower", "abcdefg").singleResult();
assertNotNull(execution);
assertEquals(processInstance1.getId(), execution.getId());
execution = runtimeService.createExecutionQuery().variableValueEqualsIgnoreCase("upper", "abcdefg").singleResult();
assertNotNull(execution);
assertEquals(processInstance1.getId(), execution.getId());
// Pass in non-lower-case string
execution = runtimeService.createExecutionQuery().variableValueEqualsIgnoreCase("upper", "ABCdefg").singleResult();
assertNotNull(execution);
assertEquals(processInstance1.getId(), execution.getId());
// Pass in null-value, should cause exception
try {
execution = runtimeService.createExecutionQuery().variableValueEqualsIgnoreCase("upper", null).singleResult();
fail("Exception expected");
} catch (ActivitiIllegalArgumentException ae) {
assertEquals("value is null", ae.getMessage());
}
// Pass in null name, should cause exception
try {
execution = runtimeService.createExecutionQuery().variableValueEqualsIgnoreCase(null, "abcdefg").singleResult();
fail("Exception expected");
} catch (ActivitiIllegalArgumentException ae) {
assertEquals("name is null", ae.getMessage());
}
// Test NOT equals
execution = runtimeService.createExecutionQuery().variableValueNotEqualsIgnoreCase("upper", "UIOP").singleResult();
assertNotNull(execution);
// Should return result when using "ABCdefg" case-insensitive while normal not-equals won't
execution = runtimeService.createExecutionQuery().variableValueNotEqualsIgnoreCase("upper", "ABCdefg").singleResult();
assertNull(execution);
execution = runtimeService.createExecutionQuery().variableValueNotEquals("upper", "ABCdefg").singleResult();
assertNotNull(execution);
// Pass in null-value, should cause exception
try {
execution = runtimeService.createExecutionQuery().variableValueNotEqualsIgnoreCase("upper", null).singleResult();
fail("Exception expected");
} catch (ActivitiIllegalArgumentException ae) {
assertEquals("value is null", ae.getMessage());
}
// Pass in null name, should cause exception
try {
execution = runtimeService.createExecutionQuery().variableValueNotEqualsIgnoreCase(null, "abcdefg").singleResult();
fail("Exception expected");
} catch (ActivitiIllegalArgumentException ae) {
assertEquals("name is null", ae.getMessage());
}
}
use of org.activiti.engine.ActivitiIllegalArgumentException in project Activiti by Activiti.
the class ProcessInstanceQueryTest method testQueryLikeIgnoreCase.
@Deployment(resources = { "org/activiti/engine/test/api/oneTaskProcess.bpmn20.xml" })
public void testQueryLikeIgnoreCase() {
Map<String, Object> vars = new HashMap<String, Object>();
vars.put("mixed", "AbCdEfG");
vars.put("upper", "ABCDEFG");
vars.put("lower", "abcdefg");
ProcessInstance processInstance1 = runtimeService.startProcessInstanceByKey("oneTaskProcess", vars);
ProcessInstance instance = runtimeService.createProcessInstanceQuery().variableValueLikeIgnoreCase("mixed", "abcd%").singleResult();
assertNotNull(instance);
assertEquals(processInstance1.getId(), instance.getId());
instance = runtimeService.createProcessInstanceQuery().variableValueLikeIgnoreCase("lower", "abcde%").singleResult();
assertNotNull(instance);
assertEquals(processInstance1.getId(), instance.getId());
instance = runtimeService.createProcessInstanceQuery().variableValueLikeIgnoreCase("upper", "abcd%").singleResult();
assertNotNull(instance);
assertEquals(processInstance1.getId(), instance.getId());
// Pass in non-lower-case string
instance = runtimeService.createProcessInstanceQuery().variableValueLikeIgnoreCase("upper", "ABCde%").singleResult();
assertNotNull(instance);
assertEquals(processInstance1.getId(), instance.getId());
// Pass in null-value, should cause exception
try {
runtimeService.createProcessInstanceQuery().variableValueEqualsIgnoreCase("upper", null).singleResult();
fail("Exception expected");
} catch (ActivitiIllegalArgumentException ae) {
assertEquals("value is null", ae.getMessage());
}
// Pass in null name, should cause exception
try {
runtimeService.createProcessInstanceQuery().variableValueEqualsIgnoreCase(null, "abcdefg").singleResult();
fail("Exception expected");
} catch (ActivitiIllegalArgumentException ae) {
assertEquals("name is null", ae.getMessage());
}
}
use of org.activiti.engine.ActivitiIllegalArgumentException in project Activiti by Activiti.
the class ProcessInstanceQueryTest method testQueryInvalidTypes.
@Deployment(resources = { "org/activiti/engine/test/api/oneTaskProcess.bpmn20.xml" })
public void testQueryInvalidTypes() throws Exception {
Map<String, Object> vars = new HashMap<String, Object>();
vars.put("bytesVar", "test".getBytes());
vars.put("serializableVar", new DummySerializable());
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("oneTaskProcess", vars);
try {
runtimeService.createProcessInstanceQuery().variableValueEquals("bytesVar", "test".getBytes()).list();
fail("Expected exception");
} catch (ActivitiIllegalArgumentException ae) {
assertTextPresent("Variables of type ByteArray cannot be used to query", ae.getMessage());
}
try {
runtimeService.createProcessInstanceQuery().variableValueEquals("serializableVar", new DummySerializable()).list();
fail("Expected exception");
} catch (ActivitiIllegalArgumentException ae) {
assertTextPresent("Variables of type ByteArray cannot be used to query", ae.getMessage());
}
runtimeService.deleteProcessInstance(processInstance.getId(), "test");
}
use of org.activiti.engine.ActivitiIllegalArgumentException 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) {
}
}
Aggregations