diff options
author | Haakon Dybdahl <dybdahl@yahoo-inc.com> | 2016-09-26 13:34:45 +0200 |
---|---|---|
committer | Haakon Dybdahl <dybdahl@yahoo-inc.com> | 2016-09-26 13:34:45 +0200 |
commit | 3f3eac749739ae2ae3070d2f94751f633ce8c2f8 (patch) | |
tree | ab28dd688ed0abaf3f8ec32056f1be1b0492d061 /vespa-http-client/src/test/java/com | |
parent | 6ae99ee49edc13bcdc6829ea085d5911b7985f17 (diff) |
Improve time-out handling for close call.
Diffstat (limited to 'vespa-http-client/src/test/java/com')
-rw-r--r-- | vespa-http-client/src/test/java/com/yahoo/vespa/http/client/core/api/FeedClientImplTest.java | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/vespa-http-client/src/test/java/com/yahoo/vespa/http/client/core/api/FeedClientImplTest.java b/vespa-http-client/src/test/java/com/yahoo/vespa/http/client/core/api/FeedClientImplTest.java new file mode 100644 index 00000000000..79d66be9f97 --- /dev/null +++ b/vespa-http-client/src/test/java/com/yahoo/vespa/http/client/core/api/FeedClientImplTest.java @@ -0,0 +1,31 @@ +package com.yahoo.vespa.http.client.core.api; + +import org.junit.Test; + +import java.time.Instant; + +import static org.hamcrest.CoreMatchers.is; +import static org.junit.Assert.*; + +/** + * @author dybis + */ +public class FeedClientImplTest { + + int sleepValueMillis = 1; + + @Test + public void testCloseWaitTimeOldTimestamp() { + assertThat(FeedClientImpl.waitForOperations(Instant.now().minusSeconds(1000), 1, sleepValueMillis, 10), is(false)); + } + + @Test + public void testCloseWaitTimeOutInFutureStillOperations() { + assertThat(FeedClientImpl.waitForOperations(Instant.now(), 1, sleepValueMillis, 2000), is(true)); + } + + @Test + public void testCloseWaitZeroOperations() { + assertThat(FeedClientImpl.waitForOperations(Instant.now(), 0, sleepValueMillis, 2000), is(false)); + } +}
\ No newline at end of file |