protected internal virtual UpdateExternalTaskRetriesBuilder updateRetries(SetRetriesForExternalTasksDto retriesDto) { ExternalTaskService externalTaskService = ProcessEngine.ExternalTaskService; IList <string> externalTaskIds = retriesDto.ExternalTaskIds; IList <string> processInstanceIds = retriesDto.ProcessInstanceIds; ExternalTaskQuery externalTaskQuery = null; ProcessInstanceQuery processInstanceQuery = null; HistoricProcessInstanceQuery historicProcessInstanceQuery = null; ExternalTaskQueryDto externalTaskQueryDto = retriesDto.ExternalTaskQuery; if (externalTaskQueryDto != null) { externalTaskQuery = externalTaskQueryDto.toQuery(ProcessEngine); } ProcessInstanceQueryDto processInstanceQueryDto = retriesDto.ProcessInstanceQuery; if (processInstanceQueryDto != null) { processInstanceQuery = processInstanceQueryDto.toQuery(ProcessEngine); } HistoricProcessInstanceQueryDto historicProcessInstanceQueryDto = retriesDto.HistoricProcessInstanceQuery; if (historicProcessInstanceQueryDto != null) { historicProcessInstanceQuery = historicProcessInstanceQueryDto.toQuery(ProcessEngine); } return(externalTaskService.updateRetries().externalTaskIds(externalTaskIds).processInstanceIds(processInstanceIds).externalTaskQuery(externalTaskQuery).processInstanceQuery(processInstanceQuery).historicProcessInstanceQuery(historicProcessInstanceQuery)); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void testSetRetriesWithQueryAsync() public virtual void testSetRetriesWithQueryAsync() { // given ProcessDefinition processDefinition = testRule.deployAndGetDefinition(ExternalTaskModels.ONE_EXTERNAL_TASK_PROCESS); ProcessInstance processInstance1 = engineRule.RuntimeService.startProcessInstanceByKey("Process"); IList <ExternalTask> externalTasks; ExternalTaskQuery externalTaskQuery = engineRule.ExternalTaskService.createExternalTaskQuery(); // when authRule.init(scenario).withUser("userId").bindResource("batchId", "*").bindResource("processInstance1", processInstance1.Id).bindResource("processDefinition", processDefinition.Key).start(); Batch batch = engineRule.ExternalTaskService.setRetriesAsync(null, externalTaskQuery, 5); if (batch != null) { executeSeedAndBatchJobs(batch); } // then if (authRule.assertScenario(scenario)) { Assert.assertEquals("userId", batch.CreateUserId); externalTasks = engineRule.ExternalTaskService.createExternalTaskQuery().list(); foreach (ExternalTask task in externalTasks) { Assert.assertEquals(5, (int)task.Retries); } } }
public virtual IList <ExternalTaskDto> queryExternalTasks(ExternalTaskQueryDto queryDto, int?firstResult, int?maxResults) { ProcessEngine engine = ProcessEngine; queryDto.ObjectMapper = ObjectMapper; ExternalTaskQuery query = queryDto.toQuery(engine); IList <ExternalTask> matchingTasks; if (firstResult != null || maxResults != null) { matchingTasks = executePaginatedQuery(query, firstResult, maxResults); } else { matchingTasks = query.list(); } IList <ExternalTaskDto> taskResults = new List <ExternalTaskDto>(); foreach (ExternalTask task in matchingTasks) { ExternalTaskDto resultInstance = ExternalTaskDto.fromExternalTask(task); taskResults.Add(resultInstance); } return(taskResults); }
public virtual void shouldUpdateRetriesByAllParameters() { // given ExternalTask externalTask = externalTaskService.createExternalTaskQuery().processInstanceId(processInstanceIds[0]).singleResult(); ExternalTaskQuery externalTaskQuery = externalTaskService.createExternalTaskQuery().processInstanceId(processInstanceIds[1]); ProcessInstanceQuery processInstanceQuery = runtimeService.createProcessInstanceQuery().processInstanceId(processInstanceIds[2]); HistoricProcessInstanceQuery historicProcessInstanceQuery = historyService.createHistoricProcessInstanceQuery().processInstanceId(processInstanceIds[3]); // when Batch batch = externalTaskService.updateRetries().externalTaskIds(externalTask.Id).externalTaskQuery(externalTaskQuery).processInstanceQuery(processInstanceQuery).historicProcessInstanceQuery(historicProcessInstanceQuery).processInstanceIds(processInstanceIds[4]).setAsync(5); executeSeedAndBatchJobs(batch); // then IList <ExternalTask> tasks = externalTaskService.createExternalTaskQuery().list(); assertEquals(6, tasks.Count); foreach (ExternalTask task in tasks) { assertEquals(Convert.ToInt32(5), task.Retries); } }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void testQueryByPriorityListPost() public virtual void testQueryByPriorityListPost() { mockQuery = setUpMockExternalTaskQuery(createMockedExternalTasksWithPriorities()); IDictionary <string, object> queryParameters = new Dictionary <string, object>(); queryParameters["priorityHigherThanOrEquals"] = "3"; queryParameters["priorityLowerThanOrEquals"] = "4"; Response response = given().contentType(POST_JSON_CONTENT_TYPE).body(queryParameters).expect().statusCode(Status.OK.StatusCode).when().post(EXTERNAL_TASK_QUERY_URL); verify(mockQuery).priorityHigherThanOrEquals(EXTERNAL_TASK_LOW_BOUND_PRIORITY); verify(mockQuery).priorityLowerThanOrEquals(EXTERNAL_TASK_HIGH_BOUND_PRIORITY); verify(mockQuery).list(); string content = response.asString(); IList <string> executions = from(content).getList(""); assertThat(executions).hasSize(2); long prio1 = from(content).getLong("[0].priority"); long prio2 = from(content).getLong("[1].priority"); assertThat(prio1).isEqualTo(EXTERNAL_TASK_LOW_BOUND_PRIORITY); assertThat(prio2).isEqualTo(EXTERNAL_TASK_HIGH_BOUND_PRIORITY); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldSetExternalTaskRetriesWithDifferentListAndQueryAsync() public virtual void shouldSetExternalTaskRetriesWithDifferentListAndQueryAsync() { // given ExternalTaskQuery externalTaskQuery = externalTaskService.createExternalTaskQuery().processInstanceId(processInstanceIds[0]); IList <ExternalTask> externalTasks = externalTaskService.createExternalTaskQuery().processInstanceId(processInstanceIds[processInstanceIds.Count - 1]).list(); List <string> externalTaskIds = new List <string>(); foreach (ExternalTask task in externalTasks) { externalTaskIds.Add(task.Id); } // when Batch batch = externalTaskService.setRetriesAsync(externalTaskIds, externalTaskQuery, 8); executeSeedAndBatchJobs(batch); // then ExternalTask task = externalTaskService.createExternalTaskQuery().processInstanceId(processInstanceIds[0]).singleResult(); Assert.assertEquals(8, (int)task.Retries); IList <ExternalTask> tasks = externalTaskService.createExternalTaskQuery().processInstanceId(processInstanceIds[processInstanceIds.Count - 1]).list(); foreach (ExternalTask t in tasks) { Assert.assertEquals(8, (int)t.Retries); } }
public virtual void testQueryNoAuthenticatedTenants() { identityService.setAuthentication("user", null, null); ExternalTaskQuery query = externalTaskService.createExternalTaskQuery(); assertThat(query.count(), @is(0L)); }
private void createExternalTaskMock() { ExternalTaskQuery query = mock(typeof(ExternalTaskQuery)); IList <ExternalTask> tasks = MockProvider.createMockExternalTasks(); when(query.list()).thenReturn(tasks); when(mockExternalTaskService.createExternalTaskQuery()).thenReturn(query); }
public virtual void testQueryDisabledTenantCheck() { processEngineConfiguration.TenantCheckEnabled = false; identityService.setAuthentication("user", null, null); ExternalTaskQuery query = externalTaskService.createExternalTaskQuery(); assertThat(query.count(), @is(2L)); }
public virtual void testQueryByTenantId() { ExternalTaskQuery query = externalTaskService.createExternalTaskQuery().tenantIdIn(TENANT_ONE); assertThat(query.count(), @is(1L)); query = externalTaskService.createExternalTaskQuery().tenantIdIn(TENANT_TWO); assertThat(query.count(), @is(1L)); }
public virtual void testQueryAuthenticatedTenants() { identityService.setAuthentication("user", null, Arrays.asList(TENANT_ONE, TENANT_TWO)); ExternalTaskQuery query = externalTaskService.createExternalTaskQuery(); assertThat(query.count(), @is(2L)); assertThat(query.tenantIdIn(TENANT_ONE).count(), @is(1L)); assertThat(query.tenantIdIn(TENANT_TWO).count(), @is(1L)); }
private ExternalTaskQuery setUpMockExternalTaskQuery(IList <ExternalTask> mockedTasks) { ExternalTaskQuery sampleTaskQuery = mock(typeof(ExternalTaskQuery)); when(sampleTaskQuery.list()).thenReturn(mockedTasks); when(sampleTaskQuery.count()).thenReturn((long)mockedTasks.Count); when(processEngine.ExternalTaskService.createExternalTaskQuery()).thenReturn(sampleTaskQuery); return(sampleTaskQuery); }
protected internal virtual IList <ExternalTask> executePaginatedQuery(ExternalTaskQuery query, int?firstResult, int?maxResults) { if (firstResult == null) { firstResult = 0; } if (maxResults == null) { maxResults = int.MaxValue; } return(query.listPage(firstResult, maxResults)); }
public virtual CountResultDto queryExternalTasksCount(ExternalTaskQueryDto queryDto) { ProcessEngine engine = ProcessEngine; queryDto.ObjectMapper = ObjectMapper; ExternalTaskQuery query = queryDto.toQuery(engine); long count = query.count(); CountResultDto result = new CountResultDto(); result.Count = count; return(result); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldSetExternalTaskRetriesWithQueryAsync() public virtual void shouldSetExternalTaskRetriesWithQueryAsync() { ExternalTaskQuery externalTaskQuery = engineRule.ExternalTaskService.createExternalTaskQuery(); // when Batch batch = externalTaskService.setRetriesAsync(null, externalTaskQuery, 5); // then executeSeedAndBatchJobs(batch); foreach (ExternalTask task in externalTaskQuery.list()) { Assert.assertEquals(5, (int)task.Retries); } }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldUpdateRetriesByExternalTaskQuery() public virtual void shouldUpdateRetriesByExternalTaskQuery() { // given ExternalTaskQuery query = externalTaskService.createExternalTaskQuery(); // when Batch batch = externalTaskService.updateRetries().externalTaskQuery(query).setAsync(5); executeSeedAndBatchJobs(batch); // then IList <ExternalTask> tasks = query.list(); assertEquals(6, tasks.Count); foreach (ExternalTask task in tasks) { assertEquals(5, (int)task.Retries); } }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void testQueryByActivityIdListGet() public virtual void testQueryByActivityIdListGet() { mockQuery = setUpMockExternalTaskQuery(createMockExternalTasksTwoActivityIds()); Response response = given().queryParam("activityIdIn", MockProvider.EXAMPLE_ACTIVITY_ID_LIST).then().expect().statusCode(Status.OK.StatusCode).when().get(EXTERNAL_TASK_QUERY_URL); verify(mockQuery).activityIdIn(MockProvider.EXAMPLE_ACTIVITY_ID, MockProvider.ANOTHER_EXAMPLE_ACTIVITY_ID); verify(mockQuery).list(); string content = response.asString(); IList <string> executions = from(content).getList(""); assertThat(executions).hasSize(2); string returnedActivityId1 = from(content).getString("[0].activityId"); string returnedActivityId2 = from(content).getString("[1].activityId"); assertThat(returnedActivityId1).isEqualTo(MockProvider.EXAMPLE_ACTIVITY_ID); assertThat(returnedActivityId2).isEqualTo(MockProvider.ANOTHER_EXAMPLE_ACTIVITY_ID); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldSetExternalTaskRetriesWithListAndQueryAsync() public virtual void shouldSetExternalTaskRetriesWithListAndQueryAsync() { ExternalTaskQuery externalTaskQuery = externalTaskService.createExternalTaskQuery(); IList <ExternalTask> externalTasks = externalTaskQuery.list(); List <string> externalTaskIds = new List <string>(); foreach (ExternalTask task in externalTasks) { externalTaskIds.Add(task.Id); } // when Batch batch = externalTaskService.setRetriesAsync(externalTaskIds, externalTaskQuery, 5); // then executeSeedAndBatchJobs(batch); externalTasks = externalTaskService.createExternalTaskQuery().list(); foreach (ExternalTask task in externalTasks) { Assert.assertEquals(5, (int)task.Retries); } }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void testQueryByActivityIdListPost() public virtual void testQueryByActivityIdListPost() { mockQuery = setUpMockExternalTaskQuery(createMockExternalTasksTwoActivityIds()); IDictionary <string, object> queryParameters = new Dictionary <string, object>(); queryParameters["activityIdIn"] = MockProvider.EXAMPLE_ACTIVITY_ID_LIST.Split(",", true); Response response = given().contentType(POST_JSON_CONTENT_TYPE).body(queryParameters).expect().statusCode(Status.OK.StatusCode).when().post(EXTERNAL_TASK_QUERY_URL); verify(mockQuery).activityIdIn(MockProvider.EXAMPLE_ACTIVITY_ID, MockProvider.ANOTHER_EXAMPLE_ACTIVITY_ID); verify(mockQuery).list(); string content = response.asString(); IList <string> executions = from(content).getList(""); assertThat(executions).hasSize(2); string returnedActivityId1 = from(content).getString("[0].activityId"); string returnedActivityId2 = from(content).getString("[1].activityId"); assertThat(returnedActivityId1).isEqualTo(MockProvider.EXAMPLE_ACTIVITY_ID); assertThat(returnedActivityId2).isEqualTo(MockProvider.ANOTHER_EXAMPLE_ACTIVITY_ID); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Before public void setUpRuntimeData() public virtual void setUpRuntimeData() { mockQuery = setUpMockExternalTaskQuery(MockProvider.createMockExternalTasks()); }
public virtual Batch setRetriesAsync(IList <string> externalTaskIds, ExternalTaskQuery externalTaskQuery, int retries) { return(updateRetries().externalTaskIds(externalTaskIds).externalTaskQuery(externalTaskQuery).setAsync(retries)); }
public virtual UpdateExternalTaskRetriesBuilder externalTaskQuery(ExternalTaskQuery externalTaskQuery) { this.externalTaskQuery_Renamed = externalTaskQuery; return(this); }
public virtual void testQueryByNonExistingTenantId() { ExternalTaskQuery query = externalTaskService.createExternalTaskQuery().tenantIdIn("nonExisting"); assertThat(query.count(), @is(0L)); }
public virtual void testQueryByNonExistingProcessInstanceId() { ExternalTaskQuery query = externalTaskService.createExternalTaskQuery().processInstanceIdIn("nonExisting"); assertEquals(0, query.count()); }
public virtual void testQueryWithoutTenantId() { ExternalTaskQuery query = externalTaskService.createExternalTaskQuery(); assertThat(query.count(), @is(2L)); }