aboutsummaryrefslogtreecommitdiffstats
path: root/jrt/tests/com
diff options
context:
space:
mode:
Diffstat (limited to 'jrt/tests/com')
-rw-r--r--jrt/tests/com/yahoo/jrt/AbortTest.java6
-rw-r--r--jrt/tests/com/yahoo/jrt/BackTargetTest.java18
-rw-r--r--jrt/tests/com/yahoo/jrt/DetachTest.java8
-rw-r--r--jrt/tests/com/yahoo/jrt/EchoTest.java3
-rw-r--r--jrt/tests/com/yahoo/jrt/InvokeAsyncTest.java6
-rw-r--r--jrt/tests/com/yahoo/jrt/InvokeErrorTest.java4
-rw-r--r--jrt/tests/com/yahoo/jrt/InvokeSyncTest.java5
-rw-r--r--jrt/tests/com/yahoo/jrt/InvokeVoidTest.java6
-rw-r--r--jrt/tests/com/yahoo/jrt/LatencyTest.java3
-rw-r--r--jrt/tests/com/yahoo/jrt/MandatoryMethodsTest.java7
-rw-r--r--jrt/tests/com/yahoo/jrt/TimeoutTest.java8
11 files changed, 46 insertions, 28 deletions
diff --git a/jrt/tests/com/yahoo/jrt/AbortTest.java b/jrt/tests/com/yahoo/jrt/AbortTest.java
index 2f31b3a52f6..df1f207458e 100644
--- a/jrt/tests/com/yahoo/jrt/AbortTest.java
+++ b/jrt/tests/com/yahoo/jrt/AbortTest.java
@@ -4,6 +4,8 @@ package com.yahoo.jrt;
import org.junit.After;
import org.junit.Before;
+import java.time.Duration;
+
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
@@ -44,7 +46,7 @@ public class AbortTest {
Test.Waiter w = new Test.Waiter();
Request req = new Request("test");
req.parameters().add(new Int32Value(20));
- target.invokeAsync(req, 5.0, w);
+ target.invokeAsync(req, Duration.ofSeconds(5), w);
req.abort();
barrier.breakIt();
w.waitDone();
@@ -54,7 +56,7 @@ public class AbortTest {
Request req2 = new Request("test");
req2.parameters().add(new Int32Value(30));
- target.invokeSync(req2, 5.0);
+ target.invokeSync(req2, Duration.ofSeconds(5));
assertTrue(!req2.isError());
assertEquals(1, req2.returnValues().size());
assertEquals(30, req2.returnValues().get(0).asInt32());
diff --git a/jrt/tests/com/yahoo/jrt/BackTargetTest.java b/jrt/tests/com/yahoo/jrt/BackTargetTest.java
index a55a6d7f474..5b9e7ccb157 100644
--- a/jrt/tests/com/yahoo/jrt/BackTargetTest.java
+++ b/jrt/tests/com/yahoo/jrt/BackTargetTest.java
@@ -4,6 +4,8 @@ package com.yahoo.jrt;
import org.junit.After;
import org.junit.Before;
+import java.time.Duration;
+
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
@@ -81,24 +83,24 @@ public class BackTargetTest {
@org.junit.Test
public void testBackTarget() {
checkTargets(false, false);
- target.invokeSync(new Request("sample_target"), 5.0);
+ target.invokeSync(new Request("sample_target"), Duration.ofSeconds(5));
checkTargets(true, false);
- serverBackTarget.invokeSync(new Request("sample_target"), 5.0);
+ serverBackTarget.invokeSync(new Request("sample_target"), Duration.ofSeconds(5));
checkTargets(true, true);
checkValues(0, 0);
- target.invokeSync(new Request("inc"), 5.0);
+ target.invokeSync(new Request("inc"), Duration.ofSeconds(5));
checkValues(1, 0);
- serverBackTarget.invokeSync(new Request("inc"), 5.0);
+ serverBackTarget.invokeSync(new Request("inc"), Duration.ofSeconds(5));
checkValues(1, 1);
- clientBackTarget.invokeSync(new Request("inc"), 5.0);
+ clientBackTarget.invokeSync(new Request("inc"), Duration.ofSeconds(5));
checkValues(2, 1);
- target.invokeSync(new Request("back_inc"), 5.0);
+ target.invokeSync(new Request("back_inc"), Duration.ofSeconds(5));
checkValues(2, 2);
- serverBackTarget.invokeSync(new Request("back_inc"), 5.0);
+ serverBackTarget.invokeSync(new Request("back_inc"), Duration.ofSeconds(5));
checkValues(3, 2);
- clientBackTarget.invokeSync(new Request("back_inc"), 5.0);
+ clientBackTarget.invokeSync(new Request("back_inc"), Duration.ofSeconds(5));
checkValues(3, 3);
}
diff --git a/jrt/tests/com/yahoo/jrt/DetachTest.java b/jrt/tests/com/yahoo/jrt/DetachTest.java
index 3c3356b53e2..4c3ee085913 100644
--- a/jrt/tests/com/yahoo/jrt/DetachTest.java
+++ b/jrt/tests/com/yahoo/jrt/DetachTest.java
@@ -4,6 +4,8 @@ package com.yahoo.jrt;
import org.junit.After;
import org.junit.Before;
+import java.time.Duration;
+
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
@@ -66,11 +68,11 @@ public class DetachTest {
Test.Waiter w1 = new Test.Waiter();
Request req1 = new Request("d_inc");
req1.parameters().add(new Int32Value(50));
- target.invokeAsync(req1, 5.0, w1);
+ target.invokeAsync(req1, Duration.ofSeconds(5), w1);
Request req2 = new Request("d_inc_r");
req2.parameters().add(new Int32Value(60));
- target.invokeSync(req2, 5.0);
+ target.invokeSync(req2, Duration.ofSeconds(5));
assertTrue(!req2.isError());
assertEquals(1, req2.returnValues().size());
@@ -123,7 +125,7 @@ public class DetachTest {
Test.Waiter w = new Test.Waiter();
Request req3 = new Request("inc_b");
req3.parameters().add(new Int32Value(100));
- target.invokeAsync(req3, 5.0, w);
+ target.invokeAsync(req3, Duration.ofSeconds(5), w);
Request blocked = (Request) receptor.get();
try {
blocked.returnRequest();
diff --git a/jrt/tests/com/yahoo/jrt/EchoTest.java b/jrt/tests/com/yahoo/jrt/EchoTest.java
index 47c6e806635..11742fa42e2 100644
--- a/jrt/tests/com/yahoo/jrt/EchoTest.java
+++ b/jrt/tests/com/yahoo/jrt/EchoTest.java
@@ -11,6 +11,7 @@ import org.junit.runners.Parameterized.Parameter;
import org.junit.runners.Parameterized.Parameters;
import java.security.cert.X509Certificate;
+import java.time.Duration;
import java.util.List;
import static com.yahoo.jrt.CryptoUtils.createTestTlsContext;
@@ -156,7 +157,7 @@ public class EchoTest {
for (int i = 0; i < refValues.size(); i++) {
p.add(refValues.get(i));
}
- target.invokeSync(req, 60.0);
+ target.invokeSync(req, Duration.ofSeconds(60));
assertTrue(req.checkReturnTypes("bBhHiIlLfFdDxXsS"));
assertTrue(Test.equals(req.returnValues(), req.parameters()));
assertTrue(Test.equals(req.returnValues(), refValues));
diff --git a/jrt/tests/com/yahoo/jrt/InvokeAsyncTest.java b/jrt/tests/com/yahoo/jrt/InvokeAsyncTest.java
index 436b650198e..e17b6c0cfdd 100644
--- a/jrt/tests/com/yahoo/jrt/InvokeAsyncTest.java
+++ b/jrt/tests/com/yahoo/jrt/InvokeAsyncTest.java
@@ -5,6 +5,8 @@ package com.yahoo.jrt;
import org.junit.After;
import org.junit.Before;
+import java.time.Duration;
+
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
@@ -57,7 +59,7 @@ public class InvokeAsyncTest {
req.parameters().add(new StringValue("def"));
Test.Waiter w = new Test.Waiter();
- target.invokeAsync(req, 5.0, w);
+ target.invokeAsync(req, Duration.ofSeconds(5), w);
assertFalse(w.isDone());
barrier.breakIt();
w.waitDone();
@@ -75,7 +77,7 @@ public class InvokeAsyncTest {
req.parameters().add(new StringValue("def"));
assertFalse(filter.invoked);
Test.Waiter w = new Test.Waiter();
- target.invokeAsync(req, 10, w);
+ target.invokeAsync(req, Duration.ofSeconds(10), w);
assertFalse(w.isDone());
barrier.breakIt();
w.waitDone();
diff --git a/jrt/tests/com/yahoo/jrt/InvokeErrorTest.java b/jrt/tests/com/yahoo/jrt/InvokeErrorTest.java
index 3b58ba2f42e..0b75fe713c2 100644
--- a/jrt/tests/com/yahoo/jrt/InvokeErrorTest.java
+++ b/jrt/tests/com/yahoo/jrt/InvokeErrorTest.java
@@ -5,13 +5,15 @@ package com.yahoo.jrt;
import org.junit.After;
import org.junit.Before;
+import java.time.Duration;
+
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
public class InvokeErrorTest {
- final double timeout=60.0;
+ final Duration timeout = Duration.ofSeconds(60);
Supervisor server;
Acceptor acceptor;
Supervisor client;
diff --git a/jrt/tests/com/yahoo/jrt/InvokeSyncTest.java b/jrt/tests/com/yahoo/jrt/InvokeSyncTest.java
index ec196bea47c..ff44017e1bc 100644
--- a/jrt/tests/com/yahoo/jrt/InvokeSyncTest.java
+++ b/jrt/tests/com/yahoo/jrt/InvokeSyncTest.java
@@ -10,6 +10,7 @@ import java.io.FileDescriptor;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.PrintStream;
+import java.time.Duration;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
@@ -67,7 +68,7 @@ public class InvokeSyncTest {
req.parameters().add(new StringValue("abc"));
req.parameters().add(new StringValue("def"));
- target.invokeSync(req, 5.0);
+ target.invokeSync(req, Duration.ofSeconds(5));
assertTrue(!req.isError());
assertEquals(1, req.returnValues().size());
@@ -94,7 +95,7 @@ public class InvokeSyncTest {
req.parameters().add(new StringValue("abc"));
req.parameters().add(new StringValue("def"));
assertFalse(filter.invoked);
- target.invokeSync(req, 10);
+ target.invokeSync(req, Duration.ofSeconds(10));
assertFalse(req.isError());
assertEquals("abcdef", req.returnValues().get(0).asString());
assertTrue(filter.invoked);
diff --git a/jrt/tests/com/yahoo/jrt/InvokeVoidTest.java b/jrt/tests/com/yahoo/jrt/InvokeVoidTest.java
index 8b674136fe2..64c3bc91371 100644
--- a/jrt/tests/com/yahoo/jrt/InvokeVoidTest.java
+++ b/jrt/tests/com/yahoo/jrt/InvokeVoidTest.java
@@ -5,6 +5,8 @@ package com.yahoo.jrt;
import org.junit.After;
import org.junit.Before;
+import java.time.Duration;
+
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
@@ -56,7 +58,7 @@ public class InvokeVoidTest {
public void testInvokeVoid() {
Request req = new Request("set");
req.parameters().add(new Int32Value(40));
- target.invokeSync(req, 5.0);
+ target.invokeSync(req, Duration.ofSeconds(5));
assertTrue(!req.isError());
assertEquals(0, req.returnValues().size());
@@ -64,7 +66,7 @@ public class InvokeVoidTest {
target.invokeVoid(new Request("inc"));
req = new Request("get");
- target.invokeSync(req, 5.0);
+ target.invokeSync(req, Duration.ofSeconds(5));
assertTrue(!req.isError());
assertEquals(42, req.returnValues().get(0).asInt32());
diff --git a/jrt/tests/com/yahoo/jrt/LatencyTest.java b/jrt/tests/com/yahoo/jrt/LatencyTest.java
index 0df15ed400b..945833e51a8 100644
--- a/jrt/tests/com/yahoo/jrt/LatencyTest.java
+++ b/jrt/tests/com/yahoo/jrt/LatencyTest.java
@@ -2,6 +2,7 @@
package com.yahoo.jrt;
+import java.time.Duration;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.CyclicBarrier;
import java.util.logging.Logger;
@@ -116,7 +117,7 @@ public class LatencyTest {
}
Request req = new Request("inc");
req.parameters().add(new Int32Value(value));
- target.invokeSync(req, 60.0);
+ target.invokeSync(req, Duration.ofSeconds(60));
long duration = System.nanoTime() - t;
assertTrue(req.checkReturnTypes("i"));
assertEquals(value + 1, req.returnValues().get(0).asInt32());
diff --git a/jrt/tests/com/yahoo/jrt/MandatoryMethodsTest.java b/jrt/tests/com/yahoo/jrt/MandatoryMethodsTest.java
index 212447dd6da..c0ef9606b1f 100644
--- a/jrt/tests/com/yahoo/jrt/MandatoryMethodsTest.java
+++ b/jrt/tests/com/yahoo/jrt/MandatoryMethodsTest.java
@@ -5,6 +5,7 @@ package com.yahoo.jrt;
import org.junit.After;
import org.junit.Before;
+import java.time.Duration;
import java.util.HashSet;
import static org.junit.Assert.assertEquals;
@@ -38,7 +39,7 @@ public class MandatoryMethodsTest {
@org.junit.Test
public void testPing() {
Request req = new Request("frt.rpc.ping");
- target.invokeSync(req, 5.0);
+ target.invokeSync(req, Duration.ofSeconds(5));
assertFalse(req.isError());
assertEquals(0, req.returnValues().size());
@@ -47,7 +48,7 @@ public class MandatoryMethodsTest {
@org.junit.Test
public void testGetMethodList() {
Request req = new Request("frt.rpc.getMethodList");
- target.invokeSync(req, 5.0);
+ target.invokeSync(req, Duration.ofSeconds(5));
assertFalse(req.isError());
assertTrue(req.checkReturnTypes("SSS"));
@@ -81,7 +82,7 @@ public class MandatoryMethodsTest {
public void testGetMethodInfo() {
Request req = new Request("frt.rpc.getMethodInfo");
req.parameters().add(new StringValue("frt.rpc.getMethodInfo"));
- target.invokeSync(req, 5.0);
+ target.invokeSync(req, Duration.ofSeconds(5));
assertFalse(req.isError());
assertTrue(req.checkReturnTypes("sssSSSS"));
diff --git a/jrt/tests/com/yahoo/jrt/TimeoutTest.java b/jrt/tests/com/yahoo/jrt/TimeoutTest.java
index 0366020b221..1a802758e60 100644
--- a/jrt/tests/com/yahoo/jrt/TimeoutTest.java
+++ b/jrt/tests/com/yahoo/jrt/TimeoutTest.java
@@ -5,6 +5,8 @@ package com.yahoo.jrt;
import org.junit.After;
import org.junit.Before;
+import java.time.Duration;
+
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
@@ -52,11 +54,11 @@ public class TimeoutTest {
req.parameters().add(new StringValue("abc"));
req.parameters().add(new StringValue("def"));
- target.invokeSync(req, 0.1);
+ target.invokeSync(req, Duration.ofMillis(100));
barrier.breakIt();
Request flush = new Request("frt.rpc.ping");
- target.invokeSync(flush, 5.0);
+ target.invokeSync(flush, Duration.ofSeconds(5));
assertTrue(!flush.isError());
assertTrue(req.isError());
@@ -72,7 +74,7 @@ public class TimeoutTest {
req.parameters().add(new StringValue("def"));
Test.Waiter w = new Test.Waiter();
- target.invokeAsync(req, 30.0, w);
+ target.invokeAsync(req, Duration.ofSeconds(30), w);
try { Thread.sleep(2500); } catch (InterruptedException e) {}
barrier.breakIt();
w.waitDone();