add testEmbargoNull test
throw RpcExceptions rather than RuntimeExceptions
This commit is contained in:
parent
3ba96956a8
commit
772108ff12
6 changed files with 31 additions and 6 deletions
BIN
foo.raw
Normal file
BIN
foo.raw
Normal file
Binary file not shown.
|
@ -301,6 +301,11 @@ final class RpcState<VatId> {
|
|||
answer.redirectedResults = null;
|
||||
}
|
||||
|
||||
if (answer.pipeline != null) {
|
||||
pipelinesToRelease.add(answer.pipeline);
|
||||
answer.pipeline = null;
|
||||
}
|
||||
|
||||
if (answer.callContext != null) {
|
||||
answer.callContext.requestCancel();
|
||||
}
|
||||
|
|
|
@ -567,17 +567,16 @@ public class RpcTest {
|
|||
response.thenRun(() -> Assert.fail("Never completing call returned?"));
|
||||
}
|
||||
catch (CompletionException exc) {
|
||||
Assert.assertTrue(exc instanceof CompletionException);
|
||||
Assert.assertNotNull(exc.getCause());
|
||||
Assert.assertTrue(exc.getCause() instanceof RpcException);
|
||||
Assert.assertTrue(((RpcException)exc.getCause()).getType() == RpcException.Type.FAILED);
|
||||
Assert.assertSame(((RpcException) exc.getCause()).getType(), RpcException.Type.FAILED);
|
||||
}
|
||||
catch (Exception exc) {
|
||||
Assert.fail(exc.toString());
|
||||
}
|
||||
|
||||
// check that the connection is still open
|
||||
getCallSequence(client, 1);
|
||||
this.context.runUntil(getCallSequence(client, 1)).join();
|
||||
}
|
||||
|
||||
@org.junit.Test
|
||||
|
@ -625,5 +624,21 @@ public class RpcTest {
|
|||
int unwrappedAt = this.context.runUntil(unwrap).join();
|
||||
Assert.assertTrue(unwrappedAt >= 0);
|
||||
}
|
||||
|
||||
@org.junit.Test
|
||||
public void testEmbargoNull() {
|
||||
var client = new Test.TestMoreStuff.Client(context.connect(Test.TestSturdyRefObjectId.Tag.TEST_MORE_STUFF));
|
||||
var promise = client.getNullRequest().send();
|
||||
var cap = promise.getNullCap();
|
||||
var call0 = cap.getCallSequenceRequest().send();
|
||||
this.context.runUntil(promise);
|
||||
var call1 = cap.getCallSequenceRequest().send();
|
||||
|
||||
Assert.assertThrows(CompletionException.class, () -> this.context.runUntil(call0).join());
|
||||
Assert.assertThrows(CompletionException.class, () -> this.context.runUntil(call1).join());
|
||||
|
||||
// check that the connection is still open
|
||||
this.context.runUntil(getCallSequence(client, 0)).join();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -220,6 +220,11 @@ class RpcTestUtil {
|
|||
System.out.println(cap);
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
protected CompletableFuture<java.lang.Void> getNull(CallContext<Test.TestMoreStuff.GetNullParams.Reader, Test.TestMoreStuff.GetNullResults.Builder> context) {
|
||||
return READY_NOW;
|
||||
}
|
||||
}
|
||||
|
||||
static class TestTailCalleeImpl extends Test.TestTailCallee.Server {
|
||||
|
|
|
@ -111,7 +111,7 @@ public class TwoPartyTest {
|
|||
}
|
||||
|
||||
@org.junit.Test
|
||||
public void testDisconnect() throws IOException {
|
||||
public void testDisconnect() {
|
||||
//this.serverSocket.shutdownOutput();
|
||||
//this.serverNetwork.close();
|
||||
//this.serverNetwork.onDisconnect().join();
|
||||
|
|
|
@ -562,11 +562,11 @@ public final class Capability {
|
|||
}
|
||||
|
||||
public static ClientHook newNullCap() {
|
||||
return newBrokenClient(new RuntimeException("Called null capability"), true, ClientHook.NULL_CAPABILITY_BRAND);
|
||||
return newBrokenClient(RpcException.failed("Called null capability"), true, ClientHook.NULL_CAPABILITY_BRAND);
|
||||
}
|
||||
|
||||
static private ClientHook newBrokenClient(String reason, boolean resolved, Object brand) {
|
||||
return newBrokenClient(new RuntimeException(reason), resolved, brand);
|
||||
return newBrokenClient(RpcException.failed(reason), resolved, brand);
|
||||
}
|
||||
|
||||
static private ClientHook newBrokenClient(Throwable exc, boolean resolved, Object brand) {
|
||||
|
|
Loading…
Reference in a new issue