@Test public void testOnMemberAddedFromAwaitMember() throws Exception { JoinMessage joinMessage = new JoinMessage(messageId, contactGroupId, privateGroupId, messageTimestamp, lastRemoteMessageId); PeerSession session = getDefaultSession(AWAIT_MEMBER); expectSendJoinMessage(joinMessage, false); expectSetPrivateGroupVisibility(SHARED); expectRelationshipRevealed(true); PeerSession newSession = engine.onMemberAddedAction(txn, session); assertEquals(BOTH_JOINED, newSession.getState()); assertSessionRecordedSentMessage(newSession); assertSessionConstantsUnchanged(session, newSession); }
private PeerSession onMemberAddedFromAwaitMember(Transaction txn, PeerSession s) throws DbException { Message sent = sendJoinMessage(txn, s, false); try { setPrivateGroupVisibility(txn, s, SHARED); } catch (FormatException e) { throw new DbException(e); } try { relationshipRevealed(txn, s, true); } catch (FormatException e) { throw new DbException(e); } return new PeerSession(s.getContactGroupId(), s.getPrivateGroupId(), sent.getId(), s.getLastRemoteMessageId(), sent.getTimestamp(), BOTH_JOINED); }
PeerProtocolEngine extends AbstractProtocolEngine<PeerSession> { private PeerSession onMemberAddedFromAwaitMember(Transaction txn, PeerSession s) throws DbException { Message sent = sendJoinMessage(txn, s, false); try { setPrivateGroupVisibility(txn, s, SHARED); } catch (FormatException e) { throw new DbException(e); } try { relationshipRevealed(txn, s, true); } catch (FormatException e) { throw new DbException(e); } return new PeerSession(s.getContactGroupId(), s.getPrivateGroupId(), sent.getId(), s.getLastRemoteMessageId(), sent.getTimestamp(), BOTH_JOINED); } }
PeerProtocolEngine extends AbstractProtocolEngine<PeerSession> { private PeerSession onMemberAddedFromAwaitMember(Transaction txn, PeerSession s) throws DbException { Message sent = sendJoinMessage(txn, s, false); try { setPrivateGroupVisibility(txn, s, SHARED); } catch (FormatException e) { throw new DbException(e); } try { relationshipRevealed(txn, s, true); } catch (FormatException e) { throw new DbException(e); } return new PeerSession(s.getContactGroupId(), s.getPrivateGroupId(), sent.getId(), s.getLastRemoteMessageId(), sent.getTimestamp(), BOTH_JOINED); } 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> { private PeerSession onMemberAddedFromAwaitMember(Transaction txn, PeerSession s) throws DbException { Message sent = sendJoinMessage(txn, s, false); try { setPrivateGroupVisibility(txn, s, SHARED); } catch (FormatException e) { throw new DbException(e); } try { relationshipRevealed(txn, s, true); } catch (FormatException e) { throw new DbException(e); } return new PeerSession(s.getContactGroupId(), s.getPrivateGroupId(), sent.getId(), s.getLastRemoteMessageId(), sent.getTimestamp(), BOTH_JOINED); } 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> { private PeerSession onMemberAddedFromAwaitMember(Transaction txn, PeerSession s) throws DbException { Message sent = sendJoinMessage(txn, s, false); try { setPrivateGroupVisibility(txn, s, SHARED); } catch (FormatException e) { throw new DbException(e); } try { relationshipRevealed(txn, s, true); } catch (FormatException e) { throw new DbException(e); } return new PeerSession(s.getContactGroupId(), s.getPrivateGroupId(), sent.getId(), s.getLastRemoteMessageId(), sent.getTimestamp(), BOTH_JOINED); } 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);  }