avoid TestUtil name clash

This commit is contained in:
Vaci Koblizek 2020-11-09 16:18:17 +00:00
parent 8457c38623
commit 7b79ab8ab2
3 changed files with 20 additions and 20 deletions

View file

@ -25,7 +25,7 @@ import org.capnproto.AnyPointer;
import org.capnproto.CallContext;
import org.capnproto.Capability;
import org.capnproto.RpcException;
import org.capnproto.test.Test;
import org.capnproto.rpctest.Test;
import org.junit.Assert;
@ -61,7 +61,7 @@ class TestExtendsImpl extends Test.TestExtends2.Server {
protected CompletableFuture<java.lang.Void> grault(CallContext<Test.TestExtends.GraultParams.Reader, Test.TestAllTypes.Builder> context) {
counter.inc();
context.releaseParams();
TestUtil.initTestMessage(context.getResults());
RpcTestUtil.initTestMessage(context.getResults());
return CompletableFuture.completedFuture(null);
}
}
@ -84,7 +84,7 @@ public class CapabilityTest {
public void testBasic() {
var callCount = new Counter();
var client = new Test.TestInterface.Client(
new TestUtil.TestInterfaceImpl(callCount));
new RpcTestUtil.TestInterfaceImpl(callCount));
var request1 = client.fooRequest();
request1.getParams().setI(123);
@ -92,7 +92,7 @@ public class CapabilityTest {
var promise1 = request1.send();
var request2 = client.bazRequest();
TestUtil.initTestMessage(request2.getParams().initS());
RpcTestUtil.initTestMessage(request2.getParams().initS());
var promise2 = request2.send();
boolean barFailed = false;
@ -126,7 +126,7 @@ public class CapabilityTest {
//Assert.assertEquals(0, callCount.value());
var response2 = promise2.get();
TestUtil.checkTestMessage(response2);
RpcTestUtil.checkTestMessage(response2);
var response1 = promise1.get();
Assert.assertEquals("bar", response1.getX().toString());
@ -139,13 +139,13 @@ public class CapabilityTest {
var chainedCallCount = new Counter();
var client = new Test.TestPipeline.Client(
new TestUtil.TestPipelineImpl(callCount));
new RpcTestUtil.TestPipelineImpl(callCount));
var request = client.getCapRequest();
var params = request.getParams();
params.setN(234);
params.setInCap(new Test.TestInterface.Client(
new TestUtil.TestInterfaceImpl(chainedCallCount)));
new RpcTestUtil.TestInterfaceImpl(chainedCallCount)));
var promise = request.send();
var outbox = promise.getOutBox();
@ -164,7 +164,7 @@ public class CapabilityTest {
var response = pipelinePromise.get();
Assert.assertEquals("bar", response.getX().toString());
var response2 = pipelinePromise2.get();
TestUtil.checkTestMessage(response2);
RpcTestUtil.checkTestMessage(response2);
Assert.assertEquals(3, callCount.value());
Assert.assertEquals(1, chainedCallCount.value());
}

View file

@ -21,7 +21,7 @@
package org.capnproto;
import org.capnproto.test.Test;
import org.capnproto.rpctest.Test;
import org.junit.Assert;
@ -276,17 +276,17 @@ public class RpcTest {
var tag = objectId.getTag();
switch (tag) {
case TEST_INTERFACE:
return new Capability.Client(new TestUtil.TestInterfaceImpl(callCount));
return new Capability.Client(new RpcTestUtil.TestInterfaceImpl(callCount));
case TEST_EXTENDS:
return new Capability.Client(Capability.newBrokenCap("No TestExtends implemented."));
case TEST_PIPELINE:
return new Capability.Client(new TestUtil.TestPipelineImpl(callCount));
return new Capability.Client(new RpcTestUtil.TestPipelineImpl(callCount));
case TEST_TAIL_CALLEE:
return new Capability.Client(new TestUtil.TestTailCalleeImpl(callCount));
return new Capability.Client(new RpcTestUtil.TestTailCalleeImpl(callCount));
case TEST_TAIL_CALLER:
return new Capability.Client(new TestUtil.TestTailCallerImpl(callCount));
return new Capability.Client(new RpcTestUtil.TestTailCallerImpl(callCount));
case TEST_MORE_STUFF:
return new Capability.Client(new TestUtil.TestMoreStuffImpl(callCount, handleCount));
return new Capability.Client(new RpcTestUtil.TestMoreStuffImpl(callCount, handleCount));
default:
return new Capability.Client();
}
@ -312,7 +312,7 @@ public class RpcTest {
});
var request2 = client.bazRequest();
TestUtil.initTestMessage(request2.getParams().initS());
RpcTestUtil.initTestMessage(request2.getParams().initS());
var promise2 = request2.send();
var response1 = promise1.join();
@ -333,7 +333,7 @@ public class RpcTest {
var request = client.getCapRequest();
request.getParams().setN(234);
request.getParams().setInCap(new TestUtil.TestInterfaceImpl(chainedCallCount));
request.getParams().setInCap(new RpcTestUtil.TestInterfaceImpl(chainedCallCount));
var promise = request.send();
@ -353,7 +353,7 @@ public class RpcTest {
Assert.assertEquals("bar", response.getX().toString());
var response2 = pipelinePromise2.join();
TestUtil.checkTestMessage(response2);
RpcTestUtil.checkTestMessage(response2);
Assert.assertEquals(1, chainedCallCount.value());
}
@ -397,7 +397,7 @@ public class RpcTest {
//Assert.assertEquals(3, context.restorer.callCount);
// OK, now fulfill the local promise.
paf.complete(new Test.TestInterface.Client(new TestUtil.TestInterfaceImpl(chainedCallCount)));
paf.complete(new Test.TestInterface.Client(new RpcTestUtil.TestInterfaceImpl(chainedCallCount)));
// We should now be able to wait for getCap() to finish.
Assert.assertEquals("bar", promise.join().getS().toString());

View file

@ -3,12 +3,12 @@ package org.capnproto;
import org.capnproto.CallContext;
import org.capnproto.Capability;
import org.capnproto.Void;
import org.capnproto.test.Test;
import org.capnproto.rpctest.Test;
import org.junit.Assert;
import java.util.concurrent.CompletableFuture;
class TestUtil {
class RpcTestUtil {
static void initTestMessage(Test.TestAllTypes.Builder builder) {