Search in sources :

Example 46 with ActivitiIllegalArgumentException

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());
    }
}
Also used : Execution(org.activiti.engine.runtime.Execution) HashMap(java.util.HashMap) ActivitiIllegalArgumentException(org.activiti.engine.ActivitiIllegalArgumentException) ProcessInstance(org.activiti.engine.runtime.ProcessInstance) Deployment(org.activiti.engine.test.Deployment)

Example 47 with ActivitiIllegalArgumentException

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());
    }
}
Also used : Execution(org.activiti.engine.runtime.Execution) HashMap(java.util.HashMap) ActivitiIllegalArgumentException(org.activiti.engine.ActivitiIllegalArgumentException) ProcessInstance(org.activiti.engine.runtime.ProcessInstance) Deployment(org.activiti.engine.test.Deployment)

Example 48 with ActivitiIllegalArgumentException

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());
    }
}
Also used : HashMap(java.util.HashMap) ActivitiIllegalArgumentException(org.activiti.engine.ActivitiIllegalArgumentException) ProcessInstance(org.activiti.engine.runtime.ProcessInstance) Deployment(org.activiti.engine.test.Deployment)

Example 49 with ActivitiIllegalArgumentException

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");
}
Also used : HashMap(java.util.HashMap) ActivitiIllegalArgumentException(org.activiti.engine.ActivitiIllegalArgumentException) ProcessInstance(org.activiti.engine.runtime.ProcessInstance) Deployment(org.activiti.engine.test.Deployment)

Example 50 with ActivitiIllegalArgumentException

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) {
    }
}
Also used : ActivitiIllegalArgumentException(org.activiti.engine.ActivitiIllegalArgumentException) ProcessDefinitionQuery(org.activiti.engine.repository.ProcessDefinitionQuery)

Aggregations

ActivitiIllegalArgumentException (org.activiti.engine.ActivitiIllegalArgumentException)154 ActivitiException (org.activiti.engine.ActivitiException)32 ActivitiObjectNotFoundException (org.activiti.engine.ActivitiObjectNotFoundException)31 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)27 HashMap (java.util.HashMap)24 ProcessInstance (org.activiti.engine.runtime.ProcessInstance)20 Deployment (org.activiti.engine.test.Deployment)16 ArrayList (java.util.ArrayList)12 TaskQuery (org.activiti.engine.task.TaskQuery)12 ExecutionEntity (org.activiti.engine.impl.persistence.entity.ExecutionEntity)11 MultipartHttpServletRequest (org.springframework.web.multipart.MultipartHttpServletRequest)10 ProcessDefinitionEntity (org.activiti.engine.impl.persistence.entity.ProcessDefinitionEntity)9 RestVariable (org.activiti.rest.service.api.engine.variable.RestVariable)9 UserQuery (org.activiti.engine.identity.UserQuery)8 Execution (org.activiti.engine.runtime.Execution)8 QueryVariable (org.activiti.rest.service.api.engine.variable.QueryVariable)8 ProcessDefinition (org.activiti.engine.repository.ProcessDefinition)7 HistoricProcessInstance (org.activiti.engine.history.HistoricProcessInstance)6 RestVariableScope (org.activiti.rest.service.api.engine.variable.RestVariable.RestVariableScope)6 MultipartFile (org.springframework.web.multipart.MultipartFile)6