public virtual void testQueryByTenantId() { HistoricDetailQuery query = historyService.createHistoricDetailQuery().variableUpdates().tenantIdIn(TENANT_ONE); assertThat(query.count(), @is(2L)); query = historyService.createHistoricDetailQuery().variableUpdates().tenantIdIn(TENANT_TWO); assertThat(query.count(), @is(2L)); }
public virtual void testQueryByVariableTypeInWithCapitalLetter() { // given IDictionary <string, object> variables1 = new Dictionary <string, object>(); variables1["stringVar"] = "test"; variables1["boolVar"] = true; runtimeService.startProcessInstanceByKey("oneTaskProcess", variables1); // when HistoricDetailQuery query = historyService.createHistoricDetailQuery().variableTypeIn("Boolean"); // then assertEquals(1, query.list().size()); assertEquals(1, query.count()); HistoricDetail historicDetail = query.list().get(0); if (historicDetail is HistoricVariableUpdate) { HistoricVariableUpdate variableUpdate = (HistoricVariableUpdate)historicDetail; assertEquals(variableUpdate.VariableName, "boolVar"); assertEquals(variableUpdate.TypeName, "boolean"); } else { fail("Historic detail should be a variable update!"); } }
public virtual void testQueryNoAuthenticatedTenants() { identityService.setAuthentication("user", null, null); HistoricDetailQuery query = historyService.createHistoricDetailQuery(); assertThat(query.count(), @is(0L)); }
public virtual void testQueryDisabledTenantCheck() { processEngineConfiguration.TenantCheckEnabled = false; identityService.setAuthentication("user", null, null); HistoricDetailQuery query = historyService.createHistoricDetailQuery(); assertThat(query.count(), @is(4L)); }
public virtual void testQueryAuthenticatedTenants() { identityService.setAuthentication("user", null, Arrays.asList(TENANT_ONE, TENANT_TWO)); HistoricDetailQuery query = historyService.createHistoricDetailQuery(); assertThat(query.count(), @is(4L)); assertThat(query.tenantIdIn(TENANT_ONE).count(), @is(2L)); assertThat(query.tenantIdIn(TENANT_TWO).count(), @is(2L)); }
public virtual CountResultDto getHistoricDetailsCount(UriInfo uriInfo) { HistoricDetailQueryDto queryDto = new HistoricDetailQueryDto(objectMapper, uriInfo.QueryParameters); HistoricDetailQuery query = queryDto.toQuery(processEngine); long count = query.count(); CountResultDto result = new CountResultDto(); result.Count = count; return(result); }
public virtual void testQueryByNonExistingProcessInstanceId() { // given IDictionary <string, object> variables = new Dictionary <string, object>(); variables["stringVar"] = "test"; runtimeService.startProcessInstanceByKey(PROCESS_KEY, variables); // when HistoricDetailQuery query = historyService.createHistoricDetailQuery().processInstanceIdIn("foo"); // then assertEquals(0, query.count()); }
public virtual void testQueryBySingleProcessInstanceId() { // given IDictionary <string, object> variables = new Dictionary <string, object>(); variables["stringVar"] = "test"; ProcessInstance processInstance = runtimeService.startProcessInstanceByKey(PROCESS_KEY, variables); // when HistoricDetailQuery query = historyService.createHistoricDetailQuery().variableUpdates().processInstanceIdIn(processInstance.ProcessInstanceId); // then assertEquals(1, query.count()); assertEquals(query.list().get(0).ProcessInstanceId, processInstance.Id); }
public virtual void testQueryByInvalidExecutionId() { startProcessInstance(PROCESS_KEY); string taskId = taskService.createTaskQuery().singleResult().Id; // when taskService.resolveTask(taskId, Variables); //then HistoricDetailQuery query = historyService.createHistoricDetailQuery().executionId("invalid"); assertEquals(0, query.list().size()); assertEquals(0, query.count()); }
public virtual void testQueryByUserOperationId() { startProcessInstance(PROCESS_KEY); identityService.AuthenticatedUserId = "demo"; string taskId = taskService.createTaskQuery().singleResult().Id; // when taskService.resolveTask(taskId, Variables); //then string userOperationId = historyService.createHistoricDetailQuery().singleResult().UserOperationId; HistoricDetailQuery query = historyService.createHistoricDetailQuery().userOperationId(userOperationId); assertEquals(1, query.list().size()); assertEquals(1, query.count()); }
public virtual void testQueryByInvalidVariableTypeIn() { // given IDictionary <string, object> variables1 = new Dictionary <string, object>(); variables1["stringVar"] = "test"; variables1["boolVar"] = true; variables1["intVar"] = 5; runtimeService.startProcessInstanceByKey("oneTaskProcess", variables1); // when HistoricDetailQuery query = historyService.createHistoricDetailQuery().variableTypeIn("invalid"); // then assertEquals(0, query.count()); try { // when query.variableTypeIn(null); fail("A ProcessEngineException was expected."); } catch (ProcessEngineException) { // then fails } try { // when query.variableTypeIn((string)null); fail("A ProcessEngineException was expected."); } catch (ProcessEngineException) { // then fails } }
public virtual void testQueryBySeveralProcessInstanceIds() { // given IDictionary <string, object> variables = new Dictionary <string, object>(); variables["stringVar"] = "test"; ProcessInstance processInstance = runtimeService.startProcessInstanceByKey(PROCESS_KEY, variables); ProcessInstance processInstance2 = runtimeService.startProcessInstanceByKey(PROCESS_KEY, variables); runtimeService.startProcessInstanceByKey(PROCESS_KEY, variables); // when HistoricDetailQuery query = historyService.createHistoricDetailQuery().variableUpdates().processInstanceIdIn(processInstance.ProcessInstanceId, processInstance2.ProcessInstanceId); // then ISet <string> expectedProcessInstanceIds = new HashSet <string>(); expectedProcessInstanceIds.Add(processInstance.Id); expectedProcessInstanceIds.Add(processInstance2.Id); assertEquals(2, query.count()); assertTrue(expectedProcessInstanceIds.Contains(query.list().get(0).ProcessInstanceId)); assertTrue(expectedProcessInstanceIds.Contains(query.list().get(1).ProcessInstanceId)); }
public virtual void testQueryByInvalidUserOperationId() { startProcessInstance(PROCESS_KEY); string taskId = taskService.createTaskQuery().singleResult().Id; // when taskService.resolveTask(taskId, Variables); //then HistoricDetailQuery query = historyService.createHistoricDetailQuery().userOperationId("invalid"); assertEquals(0, query.list().size()); assertEquals(0, query.count()); try { query.userOperationId(null); fail("It was possible to set a null value as userOperationId."); } catch (ProcessEngineException) { } }
public virtual void testQueryByVariableTypeInWithSeveralTypes() { // given IDictionary <string, object> variables1 = new Dictionary <string, object>(); variables1["stringVar"] = "test"; variables1["boolVar"] = true; variables1["intVar"] = 5; variables1["nullVar"] = null; variables1["pojoVar"] = new TestPojo("str", .0); runtimeService.startProcessInstanceByKey("oneTaskProcess", variables1); // when HistoricDetailQuery query = historyService.createHistoricDetailQuery().variableTypeIn("boolean", "integer", "Serializable"); // then assertEquals(3, query.list().size()); assertEquals(3, query.count()); ISet <string> allowedVariableTypes = new HashSet <string>(); allowedVariableTypes.Add("boolean"); allowedVariableTypes.Add("integer"); allowedVariableTypes.Add("object"); foreach (HistoricDetail detail in query.list()) { if (detail is HistoricVariableUpdate) { HistoricVariableUpdate variableUpdate = (HistoricVariableUpdate)detail; assertTrue(allowedVariableTypes.Contains(variableUpdate.TypeName)); } else { fail("Historic detail should be a variable update!"); } } }
public virtual void testQueryByNonExistingTenantId() { HistoricDetailQuery query = historyService.createHistoricDetailQuery().variableUpdates().tenantIdIn("nonExisting"); assertThat(query.count(), @is(0L)); }
public virtual void testQueryByTenantIds() { HistoricDetailQuery query = historyService.createHistoricDetailQuery().formFields().tenantIdIn(TENANT_ONE, TENANT_TWO); assertThat(query.count(), @is(2L)); }
public virtual void testQueryWithoutTenantId() { HistoricDetailQuery query = historyService.createHistoricDetailQuery().variableUpdates(); assertThat(query.count(), @is(4L)); }
public virtual void testQueryWithoutTenantId() { HistoricDetailQuery query = historyService.createHistoricDetailQuery().formFields(); assertThat(query.count(), @is(2L)); }