Exemple #1
0
//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()
        {
            SetRemovalTimeSelectModeForHistoricBatchesBuilder builderMock = mock(typeof(SetRemovalTimeSelectModeForHistoricBatchesBuilder), RETURNS_DEEP_STUBS);

            when(historyServiceMock.setRemovalTimeToHistoricBatches()).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_BATCHES_ASYNC_URL);
        }
Exemple #2
0
//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()
        {
            SetRemovalTimeSelectModeForHistoricBatchesBuilder builderMock = mock(typeof(SetRemovalTimeSelectModeForHistoricBatchesBuilder), RETURNS_DEEP_STUBS);

            when(historyServiceMock.setRemovalTimeToHistoricBatches()).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_BATCHES_ASYNC_URL);

            verifyBatchJson(response.asString());
        }
Exemple #3
0
//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()
        {
            SetRemovalTimeSelectModeForHistoricBatchesBuilder builderMock = mock(typeof(SetRemovalTimeSelectModeForHistoricBatchesBuilder), RETURNS_DEEP_STUBS);

            when(historyServiceMock.setRemovalTimeToHistoricBatches()).thenReturn(builderMock);

            IDictionary <string, object> payload = new Dictionary <string, object>();

            payload["historicBatchIds"]    = Collections.singletonList(EXAMPLE_BATCH_ID);
            payload["absoluteRemovalTime"] = null;

            given().contentType(ContentType.JSON).body(payload).then().expect().statusCode(Status.OK.StatusCode).when().post(SET_REMOVAL_TIME_HISTORIC_BATCHES_ASYNC_URL);

            SetRemovalTimeToHistoricBatchesBuilder builder = historyServiceMock.setRemovalTimeToHistoricBatches();

            verify(builder).byIds(EXAMPLE_BATCH_ID);
            verify(builder).byQuery(null);
            verify(builder).executeAsync();
            verifyNoMoreInteractions(builder);
        }
Exemple #4
0
        public virtual BatchDto setRemovalTimeAsync(SetRemovalTimeToHistoricBatchesDto dto)
        {
            HistoryService historyService = processEngine.HistoryService;

            HistoricBatchQuery historicBatchQuery = null;

            if (dto.HistoricBatchQuery != null)
            {
                historicBatchQuery = dto.HistoricBatchQuery.toQuery(processEngine);
            }

            SetRemovalTimeSelectModeForHistoricBatchesBuilder builder = historyService.setRemovalTimeToHistoricBatches();

            if (dto.CalculatedRemovalTime)
            {
                builder.calculatedRemovalTime();
            }

            DateTime removalTime = dto.AbsoluteRemovalTime;

            if (dto.AbsoluteRemovalTime != null)
            {
                builder.absoluteRemovalTime(removalTime);
            }

            if (dto.ClearedRemovalTime)
            {
                builder.clearedRemovalTime();
            }

            builder.byIds(dto.HistoricBatchIds);
            builder.byQuery(historicBatchQuery);

            Batch batch = builder.executeAsync();

            return(BatchDto.fromBatch(batch));
        }