stub handlers and test cases for incoming rpc messages
This commit is contained in:
parent
10f8f5e7d5
commit
7ee0a60b5e
2 changed files with 100 additions and 0 deletions
|
@ -84,6 +84,64 @@ final class RpcState {
|
||||||
|
|
||||||
private final HashMap<ClientHook, Integer> exportsByCap = new HashMap<>();
|
private final HashMap<ClientHook, Integer> exportsByCap = new HashMap<>();
|
||||||
|
|
||||||
|
void handleMessage(IncomingRpcMessage message) {
|
||||||
|
var reader = message.getBody().getAs(RpcProtocol.Message.factory);
|
||||||
|
|
||||||
|
switch (reader.which()) {
|
||||||
|
case UNIMPLEMENTED:
|
||||||
|
handleUnimplemented(reader.getUnimplemented());
|
||||||
|
break;
|
||||||
|
case ABORT:
|
||||||
|
handleAbort(reader.getAbort());
|
||||||
|
break;
|
||||||
|
case BOOTSTRAP:
|
||||||
|
handleBootstrap(message, reader.getBootstrap());
|
||||||
|
break;
|
||||||
|
case CALL:
|
||||||
|
handleCall(message, reader.getCall());
|
||||||
|
return;
|
||||||
|
case RETURN:
|
||||||
|
handleReturn(message, reader.getReturn());
|
||||||
|
break;
|
||||||
|
case FINISH:
|
||||||
|
handleFinish(reader.getFinish());
|
||||||
|
break;
|
||||||
|
case RESOLVE:
|
||||||
|
handleResolve(message, reader.getResolve());
|
||||||
|
break;
|
||||||
|
case DISEMBARGO:
|
||||||
|
handleDisembargo(reader.getDisembargo());
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
// TODO send unimplemented response
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void handleUnimplemented(RpcProtocol.Message.Reader message) {
|
||||||
|
}
|
||||||
|
|
||||||
|
void handleAbort(RpcProtocol.Exception.Reader abort) {
|
||||||
|
}
|
||||||
|
|
||||||
|
void handleBootstrap(IncomingRpcMessage message, RpcProtocol.Bootstrap.Reader bootstrap) {
|
||||||
|
}
|
||||||
|
|
||||||
|
void handleCall(IncomingRpcMessage message, RpcProtocol.Call.Reader call) {
|
||||||
|
}
|
||||||
|
|
||||||
|
void handleReturn(IncomingRpcMessage message, RpcProtocol.Return.Reader callReturn) {
|
||||||
|
}
|
||||||
|
|
||||||
|
void handleFinish(RpcProtocol.Finish.Reader finish) {
|
||||||
|
}
|
||||||
|
|
||||||
|
void handleResolve(IncomingRpcMessage message, RpcProtocol.Resolve.Reader resolve) {
|
||||||
|
}
|
||||||
|
|
||||||
|
void handleDisembargo(RpcProtocol.Disembargo.Reader disembargo) {
|
||||||
|
}
|
||||||
|
|
||||||
interface RpcResponse extends ResponseHook {
|
interface RpcResponse extends ResponseHook {
|
||||||
AnyPointer.Reader getResults();
|
AnyPointer.Reader getResults();
|
||||||
}
|
}
|
||||||
|
@ -185,4 +243,6 @@ final class RpcState {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
40
runtime/src/test/java/org/capnproto/RpcStateTest.java
Normal file
40
runtime/src/test/java/org/capnproto/RpcStateTest.java
Normal file
|
@ -0,0 +1,40 @@
|
||||||
|
package org.capnproto;
|
||||||
|
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
|
import static org.junit.Assert.*;
|
||||||
|
|
||||||
|
public class RpcStateTest {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void handleUnimplemented() {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void handleAbort() {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void handleBootstrap() {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void handleCall() {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void handleReturn() {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void handleFinish() {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void handleResolve() {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void handleDisembargo() {
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue