private void createCaseInstanceMock() { List<CaseInstance> caseInstances = new ArrayList<CaseInstance>(); CaseInstance mockCaseInstance = MockProvider.createMockCaseInstance(); caseInstances.add(mockCaseInstance); CaseInstanceQuery mockCaseInstanceQuery = mock(CaseInstanceQuery.class); when(mockCaseInstanceQuery.list()).thenReturn(caseInstances); when(mockCaseService.createCaseInstanceQuery()).thenReturn(mockCaseInstanceQuery); }
private CaseInstanceQuery setUpMockCaseInstanceQuery(List<CaseInstance> mockedCaseInstances) { CaseInstanceQuery query = mock(CaseInstanceQuery.class); when(query.list()).thenReturn(mockedCaseInstances); when(query.count()).thenReturn((long) mockedCaseInstances.size()); when(processEngine.getCaseService().createCaseInstanceQuery()).thenReturn(query); return query; }
public void testQuerySortingDesc() { // exclude case instances without tenant id because of database-specific ordering List<CaseInstance> caseInstances = caseService.createCaseInstanceQuery() .tenantIdIn(TENANT_ONE, TENANT_TWO) .orderByTenantId() .desc() .list(); assertThat(caseInstances.size(), is(2)); assertThat(caseInstances.get(0).getTenantId(), is(TENANT_TWO)); assertThat(caseInstances.get(1).getTenantId(), is(TENANT_ONE)); }
public void testQuerySortingAsc() { // exclude case instances without tenant id because of database-specific ordering List<CaseInstance> caseInstances = caseService.createCaseInstanceQuery() .tenantIdIn(TENANT_ONE, TENANT_TWO) .orderByTenantId() .asc() .list(); assertThat(caseInstances.size(), is(2)); assertThat(caseInstances.get(0).getTenantId(), is(TENANT_ONE)); assertThat(caseInstances.get(1).getTenantId(), is(TENANT_TWO)); }
public void testQueryByByteArrayVariableValueGreaterThan() { byte[] bytes = "somebytes".getBytes(); caseService .withCaseDefinitionByKey(CASE_DEFINITION_KEY) .setVariable("aByteArrayValue", bytes) .create(); CaseInstanceQuery query = caseService.createCaseInstanceQuery(); try { query.variableValueGreaterThan("aByteArrayValue", bytes).list(); fail(); } catch (ProcessEngineException e) {} }
public void testQueryByByteArrayVariableValueLessThan() { byte[] bytes = "somebytes".getBytes(); caseService .withCaseDefinitionByKey(CASE_DEFINITION_KEY) .setVariable("aByteArrayValue", bytes) .create(); CaseInstanceQuery query = caseService.createCaseInstanceQuery(); try { query.variableValueLessThan("aByteArrayValue", bytes).list(); fail(); } catch (ProcessEngineException e) {} }
public void testQueryByByteArrayVariableValueEquals() { byte[] bytes = "somebytes".getBytes(); caseService .withCaseDefinitionByKey(CASE_DEFINITION_KEY) .setVariable("aByteArrayValue", bytes) .create(); CaseInstanceQuery query = caseService.createCaseInstanceQuery(); try { query.variableValueEquals("aByteArrayValue", bytes).list(); fail(); } catch (ProcessEngineException e) {} }
public void testQueryByByteArrayVariableValueNotEquals() { byte[] bytes = "somebytes".getBytes(); caseService .withCaseDefinitionByKey(CASE_DEFINITION_KEY) .setVariable("aByteArrayValue", bytes) .create(); CaseInstanceQuery query = caseService.createCaseInstanceQuery(); try { query.variableValueNotEquals("aByteArrayValue", bytes).list(); fail(); } catch (ProcessEngineException e) {} }
public void testQueryByByteArrayVariableValueGreaterThanOrEqual() { byte[] bytes = "somebytes".getBytes(); caseService .withCaseDefinitionByKey(CASE_DEFINITION_KEY) .setVariable("aByteArrayValue", bytes) .create(); CaseInstanceQuery query = caseService.createCaseInstanceQuery(); try { query.variableValueGreaterThanOrEqual("aByteArrayValue", bytes).list(); fail(); } catch (ProcessEngineException e) {} }
public void testQueryByByteArrayVariableValueLessThanOrEqual() { byte[] bytes = "somebytes".getBytes(); caseService .withCaseDefinitionByKey(CASE_DEFINITION_KEY) .setVariable("aByteArrayValue", bytes) .create(); CaseInstanceQuery query = caseService.createCaseInstanceQuery(); try { query.variableValueLessThanOrEqual("aByteArrayValue", bytes).list(); fail(); } catch (ProcessEngineException e) {} }
@Test public void testEmptyQuery() { String queryCaseInstanceId = ""; given() .queryParam("caseInstanceId", queryCaseInstanceId) .then() .expect() .statusCode(Status.OK.getStatusCode()) .when() .get(CASE_INSTANCE_QUERY_URL); verify(mockedQuery).list(); }
public void testQueryByNullVariableValueGreaterThan() { caseService .withCaseDefinitionByKey(CASE_DEFINITION_KEY) .setVariable("aNullValue", null) .create(); CaseInstanceQuery query = caseService.createCaseInstanceQuery(); try { query.variableValueGreaterThan("aNullValue", null).list(); fail(); } catch (ProcessEngineException e) {} }
public void testQueryByNullVariableValueGreaterThanOrEqual() { caseService .withCaseDefinitionByKey(CASE_DEFINITION_KEY) .setVariable("aNullValue", null) .create(); CaseInstanceQuery query = caseService.createCaseInstanceQuery(); try { query.variableValueGreaterThanOrEqual("aNullValue", null).list(); fail(); } catch (ProcessEngineException e) {} }
private void verifyQueryResults(CaseInstanceQuery query, int countExpected) { assertEquals(countExpected, query.list().size()); assertEquals(countExpected, query.count()); if (countExpected == 1) { assertNotNull(query.singleResult()); } else if (countExpected > 1){ verifySingleResultFails(query); } else if (countExpected == 0) { assertNull(query.singleResult()); } }
public void testQueryByBooleanVariableValueLessThan() { caseService .withCaseDefinitionByKey(CASE_DEFINITION_KEY) .setVariable("aBooleanValue", true) .create(); CaseInstanceQuery query = caseService.createCaseInstanceQuery(); try { query.variableValueLessThan("aBooleanValue", false).list(); fail(); } catch (ProcessEngineException e) {} }
public void testQueryByNullVariableValueLessThanOrEqual() { caseService .withCaseDefinitionByKey(CASE_DEFINITION_KEY) .setVariable("aNullValue", null) .create(); CaseInstanceQuery query = caseService.createCaseInstanceQuery(); try { query.variableValueLessThanOrEqual("aNullValue", null).list(); fail(); } catch (ProcessEngineException e) {} }
public void testQueryByBooleanVariableValueLessThanOrEqual() { caseService .withCaseDefinitionByKey(CASE_DEFINITION_KEY) .setVariable("aBooleanValue", true) .create(); CaseInstanceQuery query = caseService.createCaseInstanceQuery(); try { query.variableValueLessThanOrEqual("aBooleanValue", false).list(); fail(); } catch (ProcessEngineException e) {} }
public void testQueryByBooleanVariableValueGreaterThan() { caseService .withCaseDefinitionByKey(CASE_DEFINITION_KEY) .setVariable("aBooleanValue", true) .create(); CaseInstanceQuery query = caseService.createCaseInstanceQuery(); try { query.variableValueGreaterThan("aBooleanValue", false).list(); fail(); } catch (ProcessEngineException e) {} }
public void testQueryByBooleanVariableValueGreaterThanOrEqual() { caseService .withCaseDefinitionByKey(CASE_DEFINITION_KEY) .setVariable("aBooleanValue", true) .create(); CaseInstanceQuery query = caseService.createCaseInstanceQuery(); try { query.variableValueGreaterThanOrEqual("aBooleanValue", false).list(); fail(); } catch (ProcessEngineException e) {} }
public void testQueryByNullVariableValueLike() { caseService .withCaseDefinitionByKey(CASE_DEFINITION_KEY) .setVariable("aNullValue", null) .create(); CaseInstanceQuery query = caseService.createCaseInstanceQuery(); try { query.variableValueLike("aNullValue", null).list(); fail(); } catch (ProcessEngineException e) {} }