//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldSetRemovalTime_ByQuery() public virtual void shouldSetRemovalTime_ByQuery() { SetRemovalTimeSelectModeForHistoricProcessInstancesBuilder builderMock = mock(typeof(SetRemovalTimeSelectModeForHistoricProcessInstancesBuilder), RETURNS_DEEP_STUBS); when(historyServiceMock.setRemovalTimeToHistoricProcessInstances()).thenReturn(builderMock); HistoricProcessInstanceQuery query = mock(typeof(HistoricProcessInstanceQueryImpl), RETURNS_DEEP_STUBS); when(historyServiceMock.createHistoricProcessInstanceQuery()).thenReturn(query); IDictionary <string, object> payload = new Dictionary <string, object>(); payload["calculatedRemovalTime"] = true; payload["historicProcessInstanceQuery"] = Collections.singletonMap("processDefinitionId", EXAMPLE_PROCESS_DEFINITION_ID); given().contentType(ContentType.JSON).body(payload).then().expect().statusCode(Status.OK.StatusCode).when().post(SET_REMOVAL_TIME_HISTORIC_PROCESS_INSTANCES_ASYNC_URL); SetRemovalTimeSelectModeForHistoricProcessInstancesBuilder builder = historyServiceMock.setRemovalTimeToHistoricProcessInstances(); verify(query).processDefinitionId(EXAMPLE_PROCESS_DEFINITION_ID); verify(builder).calculatedRemovalTime(); verify(builder).byIds(null); verify(builder).byQuery(query); verify(builder).executeAsync(); verifyNoMoreInteractions(builder); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldSetRemovalTime_ThrowBadUserException() public virtual void shouldSetRemovalTime_ThrowBadUserException() { SetRemovalTimeSelectModeForHistoricProcessInstancesBuilder builderMock = mock(typeof(SetRemovalTimeSelectModeForHistoricProcessInstancesBuilder), RETURNS_DEEP_STUBS); when(historyServiceMock.setRemovalTimeToHistoricProcessInstances()).thenReturn(builderMock); doThrow(typeof(BadUserRequestException)).when(builderMock).executeAsync(); given().contentType(ContentType.JSON).body(Collections.emptyMap()).then().expect().statusCode(Status.BAD_REQUEST.StatusCode).when().post(SET_REMOVAL_TIME_HISTORIC_PROCESS_INSTANCES_ASYNC_URL); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldSetRemovalTime_Response() public virtual void shouldSetRemovalTime_Response() { SetRemovalTimeSelectModeForHistoricProcessInstancesBuilder builderMock = mock(typeof(SetRemovalTimeSelectModeForHistoricProcessInstancesBuilder), RETURNS_DEEP_STUBS); when(historyServiceMock.setRemovalTimeToHistoricProcessInstances()).thenReturn(builderMock); Batch batchEntity = MockProvider.createMockBatch(); when(builderMock.executeAsync()).thenReturn(batchEntity); Response response = given().contentType(ContentType.JSON).body(Collections.emptyMap()).then().expect().statusCode(Status.OK.StatusCode).when().post(SET_REMOVAL_TIME_HISTORIC_PROCESS_INSTANCES_ASYNC_URL); verifyBatchJson(response.asString()); }
public virtual BatchDto setRemovalTimeAsync(SetRemovalTimeToHistoricProcessInstancesDto dto) { HistoryService historyService = processEngine.HistoryService; HistoricProcessInstanceQuery historicProcessInstanceQuery = null; if (dto.HistoricProcessInstanceQuery != null) { historicProcessInstanceQuery = dto.HistoricProcessInstanceQuery.toQuery(processEngine); } SetRemovalTimeSelectModeForHistoricProcessInstancesBuilder builder = historyService.setRemovalTimeToHistoricProcessInstances(); if (dto.CalculatedRemovalTime) { builder.calculatedRemovalTime(); } DateTime removalTime = dto.AbsoluteRemovalTime; if (dto.AbsoluteRemovalTime != null) { builder.absoluteRemovalTime(removalTime); } if (dto.ClearedRemovalTime) { builder.clearedRemovalTime(); } builder.byIds(dto.HistoricProcessInstanceIds); builder.byQuery(historicProcessInstanceQuery); if (dto.Hierarchical) { builder.hierarchical(); } Batch batch = builder.executeAsync(); return(BatchDto.fromBatch(batch)); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldNotSetRemovalTime_Absolute() public virtual void shouldNotSetRemovalTime_Absolute() { SetRemovalTimeSelectModeForHistoricProcessInstancesBuilder builderMock = mock(typeof(SetRemovalTimeSelectModeForHistoricProcessInstancesBuilder), RETURNS_DEEP_STUBS); when(historyServiceMock.setRemovalTimeToHistoricProcessInstances()).thenReturn(builderMock); IDictionary <string, object> payload = new Dictionary <string, object>(); payload["historicProcessInstanceIds"] = Collections.singletonList(EXAMPLE_PROCESS_INSTANCE_ID); payload["absoluteRemovalTime"] = null; given().contentType(ContentType.JSON).body(payload).then().expect().statusCode(Status.OK.StatusCode).when().post(SET_REMOVAL_TIME_HISTORIC_PROCESS_INSTANCES_ASYNC_URL); SetRemovalTimeToHistoricProcessInstancesBuilder builder = historyServiceMock.setRemovalTimeToHistoricProcessInstances(); verify(builder).byIds(EXAMPLE_PROCESS_INSTANCE_ID); verify(builder).byQuery(null); verify(builder).executeAsync(); verifyNoMoreInteractions(builder); }