@Test public void testOnLeaveMessageFromStart() throws Exception { LeaveMessage leaveMessage = new LeaveMessage(messageId, contactGroupId, privateGroupId, inviteTimestamp, lastLocalMessageId); CreatorSession session = getDefaultSession(START); expectAbortWhenSubscribedToGroup(); CreatorSession newSession = engine.onLeaveMessage(txn, session, leaveMessage); assertSessionAborted(session, newSession); }
@Override public CreatorSession onLeaveMessage(Transaction txn, CreatorSession s, LeaveMessage m) throws DbException, FormatException { switch (s.getState()) { case START: case LEFT: return abort(txn, s); case INVITED: return onRemoteDecline(txn, s, m); case JOINED: return onRemoteLeave(txn, s, m); case DISSOLVED: case ERROR: return s; default: throw new AssertionError(); } }
CreatorProtocolEngine extends AbstractProtocolEngine<CreatorSession> { @Override public CreatorSession onLeaveMessage(Transaction txn, CreatorSession s, LeaveMessage m) throws DbException, FormatException { switch (s.getState()) { case START: case LEFT: return abort(txn, s); case INVITED: return onRemoteDecline(txn, s, m); case JOINED: return onRemoteLeave(txn, s, m); case DISSOLVED: case ERROR: return s; default: throw new AssertionError(); } } }
CreatorProtocolEngine extends AbstractProtocolEngine<CreatorSession> { @Override public CreatorSession onLeaveMessage(Transaction txn, CreatorSession s, LeaveMessage m) throws DbException, FormatException { switch (s.getState()) { case START: case LEFT: return abort(txn, s); case INVITED: return onRemoteDecline(txn, s, m); case JOINED: return onRemoteLeave(txn, s, m); case DISSOLVED: case ERROR: return s; default: throw new AssertionError(); } } CreatorProtocolEngine(DatabaseComponent db, ClientHelper clientHelper,
			ClientVersioningManager clientVersioningManager,
			PrivateGroupManager privateGroupManager,
			PrivateGroupFactory privateGroupFactory,
			GroupMessageFactory groupMessageFactory,
			IdentityManager identityManager, MessageParser messageParser,
			MessageEncoder messageEncoder, MessageTracker messageTracker,
			Clock clock); }
CreatorProtocolEngine extends AbstractProtocolEngine<CreatorSession> { @Override public CreatorSession onLeaveMessage(Transaction txn, CreatorSession s, LeaveMessage m) throws DbException, FormatException { switch (s.getState()) { case START: case LEFT: return abort(txn, s); case INVITED: return onRemoteDecline(txn, s, m); case JOINED: return onRemoteLeave(txn, s, m); case DISSOLVED: case ERROR: return s; default: throw new AssertionError(); } } CreatorProtocolEngine(DatabaseComponent db, ClientHelper clientHelper,
			ClientVersioningManager clientVersioningManager,
			PrivateGroupManager privateGroupManager,
			PrivateGroupFactory privateGroupFactory,
			GroupMessageFactory groupMessageFactory,
			IdentityManager identityManager, MessageParser messageParser,
			MessageEncoder messageEncoder, MessageTracker messageTracker,
			Clock clock); @Override CreatorSession onInviteAction(Transaction txn, CreatorSession s,
			@Nullable String message, long timestamp, byte[] signature); @Override CreatorSession onJoinAction(Transaction txn, CreatorSession s); @Override CreatorSession onLeaveAction(Transaction txn, CreatorSession s); @Override CreatorSession onMemberAddedAction(Transaction txn, CreatorSession s); @Override CreatorSession onInviteMessage(Transaction txn, CreatorSession s,
			InviteMessage m); @Override CreatorSession onJoinMessage(Transaction txn, CreatorSession s,
			JoinMessage m); @Override CreatorSession onLeaveMessage(Transaction txn, CreatorSession s,
			LeaveMessage m); @Override CreatorSession onAbortMessage(Transaction txn, CreatorSession s,
			AbortMessage m); }
CreatorProtocolEngine extends AbstractProtocolEngine<CreatorSession> { @Override public CreatorSession onLeaveMessage(Transaction txn, CreatorSession s, LeaveMessage m) throws DbException, FormatException { switch (s.getState()) { case START: case LEFT: return abort(txn, s); case INVITED: return onRemoteDecline(txn, s, m); case JOINED: return onRemoteLeave(txn, s, m); case DISSOLVED: case ERROR: return s; default: throw new AssertionError(); } } CreatorProtocolEngine(DatabaseComponent db, ClientHelper clientHelper,
			ClientVersioningManager clientVersioningManager,
			PrivateGroupManager privateGroupManager,
			PrivateGroupFactory privateGroupFactory,
			GroupMessageFactory groupMessageFactory,
			IdentityManager identityManager, MessageParser messageParser,
			MessageEncoder messageEncoder, MessageTracker messageTracker,
			Clock clock); @Override CreatorSession onInviteAction(Transaction txn, CreatorSession s,
			@Nullable String message, long timestamp, byte[] signature); @Override CreatorSession onJoinAction(Transaction txn, CreatorSession s); @Override CreatorSession onLeaveAction(Transaction txn, CreatorSession s); @Override CreatorSession onMemberAddedAction(Transaction txn, CreatorSession s); @Override CreatorSession onInviteMessage(Transaction txn, CreatorSession s,
			InviteMessage m); @Override CreatorSession onJoinMessage(Transaction txn, CreatorSession s,
			JoinMessage m); @Override CreatorSession onLeaveMessage(Transaction txn, CreatorSession s,
			LeaveMessage m); @Override CreatorSession onAbortMessage(Transaction txn, CreatorSession s,
			AbortMessage m);  }