Beispiel #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldResumeAsyncResponseDueToTimeoutExpired_2()
        public virtual void shouldResumeAsyncResponseDueToTimeoutExpired_2()
        {
            // given
            doReturn(Collections.emptyList()).when(fetchTopicBuilder).execute();

            AsyncResponse asyncResponse = mock(typeof(AsyncResponse));

            handler.addPendingRequest(createDto(5000L), asyncResponse, processEngine);

            addSecondsToClock(1);
            handler.acquire();

            // assume
            assertThat(handler.PendingRequests.Count, @is(1));
            verify(handler).suspend(4000L);

            addSecondsToClock(4);

            // when
            handler.acquire();

            // then
            verify(asyncResponse).resume(argThat(IsCollectionWithSize.hasSize(0)));
            assertThat(handler.PendingRequests.Count, @is(0));
            verify(handler).suspend(long.MaxValue);
        }
Beispiel #2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldResumeAsyncResponseDueToAvailableTasks()
        public virtual void shouldResumeAsyncResponseDueToAvailableTasks()
        {
            // given
            IList <LockedExternalTask> tasks = new List <LockedExternalTask>();

            tasks.Add(lockedExternalTaskMock);
            doReturn(tasks).when(fetchTopicBuilder).execute();

            AsyncResponse asyncResponse = mock(typeof(AsyncResponse));

            handler.addPendingRequest(createDto(5000L), asyncResponse, processEngine);

            // when
            handler.acquire();

            // then
            verify(asyncResponse).resume(argThat(IsCollectionWithSize.hasSize(1)));
            assertThat(handler.PendingRequests.Count, @is(0));
            verify(handler).suspend(long.MaxValue);
        }