//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() { SetRemovalTimeSelectModeForHistoricDecisionInstancesBuilder builderMock = mock(typeof(SetRemovalTimeSelectModeForHistoricDecisionInstancesBuilder), RETURNS_DEEP_STUBS); when(historyServiceMock.setRemovalTimeToHistoricDecisionInstances()).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_DECISION_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() { SetRemovalTimeSelectModeForHistoricDecisionInstancesBuilder builderMock = mock(typeof(SetRemovalTimeSelectModeForHistoricDecisionInstancesBuilder), RETURNS_DEEP_STUBS); when(historyServiceMock.setRemovalTimeToHistoricDecisionInstances()).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_DECISION_INSTANCES_ASYNC_URL); verifyBatchJson(response.asString()); }
public virtual BatchDto setRemovalTimeAsync(SetRemovalTimeToHistoricDecisionInstancesDto dto) { HistoryService historyService = processEngine.HistoryService; HistoricDecisionInstanceQuery historicDecisionInstanceQuery = null; if (dto.HistoricDecisionInstanceQuery != null) { historicDecisionInstanceQuery = dto.HistoricDecisionInstanceQuery.toQuery(processEngine); } SetRemovalTimeSelectModeForHistoricDecisionInstancesBuilder builder = historyService.setRemovalTimeToHistoricDecisionInstances(); if (dto.CalculatedRemovalTime) { builder.calculatedRemovalTime(); } DateTime removalTime = dto.AbsoluteRemovalTime; if (dto.AbsoluteRemovalTime != null) { builder.absoluteRemovalTime(removalTime); } if (dto.ClearedRemovalTime) { builder.clearedRemovalTime(); } builder.byIds(dto.HistoricDecisionInstanceIds); builder.byQuery(historicDecisionInstanceQuery); 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() { SetRemovalTimeSelectModeForHistoricDecisionInstancesBuilder builderMock = mock(typeof(SetRemovalTimeSelectModeForHistoricDecisionInstancesBuilder), RETURNS_DEEP_STUBS); when(historyServiceMock.setRemovalTimeToHistoricDecisionInstances()).thenReturn(builderMock); IDictionary <string, object> payload = new Dictionary <string, object>(); payload["historicDecisionInstanceIds"] = Collections.singletonList(EXAMPLE_DECISION_INSTANCE_ID); payload["absoluteRemovalTime"] = null; given().contentType(ContentType.JSON).body(payload).then().expect().statusCode(Status.OK.StatusCode).when().post(SET_REMOVAL_TIME_HISTORIC_DECISION_INSTANCES_ASYNC_URL); SetRemovalTimeToHistoricDecisionInstancesBuilder builder = historyServiceMock.setRemovalTimeToHistoricDecisionInstances(); verify(builder).byIds(EXAMPLE_DECISION_INSTANCE_ID); verify(builder).byQuery(null); verify(builder).executeAsync(); verifyNoMoreInteractions(builder); }