Skip to content

Commit

Permalink
Update Raft tests to use primitive client/service APIs.
Browse files Browse the repository at this point in the history
  • Loading branch information
kuujo committed May 3, 2018
1 parent 2e003dd commit ce78bae
Show file tree
Hide file tree
Showing 2 changed files with 257 additions and 135 deletions.
Expand Up @@ -330,8 +330,12 @@ protected void acceptAll(Consumer<C> event) {
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public final void register(PrimitiveSession session) { public final void register(PrimitiveSession session) {
SessionProxyHandler sessionProxyHandler = new SessionProxyHandler(session); SessionProxyHandler sessionProxyHandler = new SessionProxyHandler(session);
C sessionProxy = (C) java.lang.reflect.Proxy.newProxyInstance(getClass().getClassLoader(), new Class[]{clientInterface}, sessionProxyHandler); if (clientInterface != null) {
sessions.put(session.sessionId(), new SessionProxy(session, sessionProxy)); C sessionProxy = (C) java.lang.reflect.Proxy.newProxyInstance(getClass().getClassLoader(), new Class[]{clientInterface}, sessionProxyHandler);
sessions.put(session.sessionId(), new SessionProxy(session, sessionProxy));
} else {
sessions.put(session.sessionId(), new SessionProxy(session, null));
}
onOpen(session); onOpen(session);
} }


Expand Down Expand Up @@ -447,7 +451,7 @@ private final class SessionProxyHandler implements InvocationHandler {


private SessionProxyHandler(PrimitiveSession session) { private SessionProxyHandler(PrimitiveSession session) {
this.session = session; this.session = session;
this.events = Events.getMethodMap(clientInterface); this.events = clientInterface != null ? Events.getMethodMap(clientInterface) : Maps.newHashMap();
} }


@Override @Override
Expand Down

0 comments on commit ce78bae

Please sign in to comment.