@Test public void testOnJoinActionFromNeitherJoined() throws Exception { JoinMessage joinMessage = new JoinMessage(messageId, contactGroupId, privateGroupId, messageTimestamp, lastRemoteMessageId); PeerSession session = getDefaultSession(NEITHER_JOINED); expectSendJoinMessage(joinMessage, false); expectSetPrivateGroupVisibility(VISIBLE); PeerSession newSession = engine.onJoinAction(txn, session); assertEquals(LOCAL_JOINED, newSession.getState()); assertSessionRecordedSentMessage(newSession); assertSessionConstantsUnchanged(session, newSession); }
@Override public PeerSession onJoinAction(Transaction txn, PeerSession s) throws DbException { switch (s.getState()) { case START: case AWAIT_MEMBER: case LOCAL_JOINED: case BOTH_JOINED: case ERROR: throw new ProtocolStateException(); case NEITHER_JOINED: return onLocalJoinFromNeitherJoined(txn, s); case LOCAL_LEFT: return onLocalJoinFromLocalLeft(txn, s); default: throw new AssertionError(); } }
PeerProtocolEngine extends AbstractProtocolEngine<PeerSession> { @Override public PeerSession onJoinAction(Transaction txn, PeerSession s) throws DbException { switch (s.getState()) { case START: case AWAIT_MEMBER: case LOCAL_JOINED: case BOTH_JOINED: case ERROR: throw new ProtocolStateException(); case NEITHER_JOINED: return onLocalJoinFromNeitherJoined(txn, s); case LOCAL_LEFT: return onLocalJoinFromLocalLeft(txn, s); default: throw new AssertionError(); } } }
PeerProtocolEngine extends AbstractProtocolEngine<PeerSession> { @Override public PeerSession onJoinAction(Transaction txn, PeerSession s) throws DbException { switch (s.getState()) { case START: case AWAIT_MEMBER: case LOCAL_JOINED: case BOTH_JOINED: case ERROR: throw new ProtocolStateException(); case NEITHER_JOINED: return onLocalJoinFromNeitherJoined(txn, s); case LOCAL_LEFT: return onLocalJoinFromLocalLeft(txn, s); default: throw new AssertionError(); } } PeerProtocolEngine(DatabaseComponent db, ClientHelper clientHelper,
			ClientVersioningManager clientVersioningManager,
			PrivateGroupManager privateGroupManager,
			PrivateGroupFactory privateGroupFactory,
			GroupMessageFactory groupMessageFactory,
			IdentityManager identityManager, MessageParser messageParser,
			MessageEncoder messageEncoder, MessageTracker messageTracker,
			Clock clock); }
PeerProtocolEngine extends AbstractProtocolEngine<PeerSession> { @Override public PeerSession onJoinAction(Transaction txn, PeerSession s) throws DbException { switch (s.getState()) { case START: case AWAIT_MEMBER: case LOCAL_JOINED: case BOTH_JOINED: case ERROR: throw new ProtocolStateException(); case NEITHER_JOINED: return onLocalJoinFromNeitherJoined(txn, s); case LOCAL_LEFT: return onLocalJoinFromLocalLeft(txn, s); default: throw new AssertionError(); } } PeerProtocolEngine(DatabaseComponent db, ClientHelper clientHelper,
			ClientVersioningManager clientVersioningManager,
			PrivateGroupManager privateGroupManager,
			PrivateGroupFactory privateGroupFactory,
			GroupMessageFactory groupMessageFactory,
			IdentityManager identityManager, MessageParser messageParser,
			MessageEncoder messageEncoder, MessageTracker messageTracker,
			Clock clock); @Override PeerSession onInviteAction(Transaction txn, PeerSession s,
			@Nullable String message, long timestamp, byte[] signature); @Override PeerSession onJoinAction(Transaction txn, PeerSession s); @Override PeerSession onLeaveAction(Transaction txn, PeerSession s); @Override PeerSession onMemberAddedAction(Transaction txn, PeerSession s); @Override PeerSession onInviteMessage(Transaction txn, PeerSession s,
			InviteMessage m); @Override PeerSession onJoinMessage(Transaction txn, PeerSession s,
			JoinMessage m); @Override PeerSession onLeaveMessage(Transaction txn, PeerSession s,
			LeaveMessage m); @Override PeerSession onAbortMessage(Transaction txn, PeerSession s,
			AbortMessage m); }
PeerProtocolEngine extends AbstractProtocolEngine<PeerSession> { @Override public PeerSession onJoinAction(Transaction txn, PeerSession s) throws DbException { switch (s.getState()) { case START: case AWAIT_MEMBER: case LOCAL_JOINED: case BOTH_JOINED: case ERROR: throw new ProtocolStateException(); case NEITHER_JOINED: return onLocalJoinFromNeitherJoined(txn, s); case LOCAL_LEFT: return onLocalJoinFromLocalLeft(txn, s); default: throw new AssertionError(); } } PeerProtocolEngine(DatabaseComponent db, ClientHelper clientHelper,
			ClientVersioningManager clientVersioningManager,
			PrivateGroupManager privateGroupManager,
			PrivateGroupFactory privateGroupFactory,
			GroupMessageFactory groupMessageFactory,
			IdentityManager identityManager, MessageParser messageParser,
			MessageEncoder messageEncoder, MessageTracker messageTracker,
			Clock clock); @Override PeerSession onInviteAction(Transaction txn, PeerSession s,
			@Nullable String message, long timestamp, byte[] signature); @Override PeerSession onJoinAction(Transaction txn, PeerSession s); @Override PeerSession onLeaveAction(Transaction txn, PeerSession s); @Override PeerSession onMemberAddedAction(Transaction txn, PeerSession s); @Override PeerSession onInviteMessage(Transaction txn, PeerSession s,
			InviteMessage m); @Override PeerSession onJoinMessage(Transaction txn, PeerSession s,
			JoinMessage m); @Override PeerSession onLeaveMessage(Transaction txn, PeerSession s,
			LeaveMessage m); @Override PeerSession onAbortMessage(Transaction txn, PeerSession s,
			AbortMessage m);  }