mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-15 20:29:52 +01:00
Miscellaneous code cleanups.
This commit is contained in:
@@ -25,6 +25,7 @@ public class MessageTreeImpl<T extends MessageTree.MessageNode>
|
||||
private final List<T> roots = new ArrayList<>();
|
||||
private final List<List<T>> unsortedLists = new ArrayList<>();
|
||||
|
||||
@SuppressWarnings("UseCompareMethod")
|
||||
private Comparator<T> comparator = (o1, o2) ->
|
||||
Long.valueOf(o1.getTimestamp()).compareTo(o2.getTimestamp());
|
||||
|
||||
@@ -71,6 +72,7 @@ public class MessageTreeImpl<T extends MessageTree.MessageNode>
|
||||
|
||||
private void sortUnsorted() {
|
||||
for (List<T> list : unsortedLists) {
|
||||
//noinspection Java8ListSort
|
||||
sort(list, comparator);
|
||||
}
|
||||
unsortedLists.clear();
|
||||
@@ -85,6 +87,7 @@ public class MessageTreeImpl<T extends MessageTree.MessageNode>
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("Java8ListSort")
|
||||
@Override
|
||||
public synchronized void setComparator(Comparator<T> comparator) {
|
||||
this.comparator = comparator;
|
||||
|
||||
@@ -385,6 +385,7 @@ class FeedManagerImpl implements FeedManager, Client, EventListener,
|
||||
long lastEntryTime = feed.getLastEntryTime();
|
||||
Transaction txn = db.startTransaction(false);
|
||||
try {
|
||||
//noinspection Java8ListSort
|
||||
sort(entries, getEntryComparator());
|
||||
for (SyndEntry entry : entries) {
|
||||
long entryTime;
|
||||
@@ -453,6 +454,7 @@ class FeedManagerImpl implements FeedManager, Client, EventListener,
|
||||
if (date == null) time = now;
|
||||
else time = Math.max(0, Math.min(date.getTime(), now));
|
||||
String text = getPostText(b.toString());
|
||||
//noinspection TryWithIdenticalCatches
|
||||
try {
|
||||
// create and store post
|
||||
LocalAuthor localAuthor = feed.getLocalAuthor();
|
||||
|
||||
@@ -1,21 +1,26 @@
|
||||
package org.briarproject.briar.feed;
|
||||
|
||||
import org.briarproject.bramble.api.nullsafety.NotNullByDefault;
|
||||
|
||||
import java.net.InetAddress;
|
||||
import java.net.UnknownHostException;
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.concurrent.Immutable;
|
||||
import javax.inject.Inject;
|
||||
|
||||
import okhttp3.Dns;
|
||||
|
||||
import static java.util.Collections.singletonList;
|
||||
|
||||
@Immutable
|
||||
@NotNullByDefault
|
||||
class NoDns implements Dns {
|
||||
|
||||
private static final byte[] UNSPECIFIED_ADDRESS = new byte[4];
|
||||
|
||||
@Inject
|
||||
public NoDns() {
|
||||
NoDns() {
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -176,8 +176,7 @@ abstract class AbstractProtocolEngine<S extends Session>
|
||||
boolean isInvalidDependency(@Nullable MessageId lastRemoteMessageId,
|
||||
@Nullable MessageId dependency) {
|
||||
if (dependency == null) return lastRemoteMessageId != null;
|
||||
return lastRemoteMessageId == null ||
|
||||
!dependency.equals(lastRemoteMessageId);
|
||||
return !dependency.equals(lastRemoteMessageId);
|
||||
}
|
||||
|
||||
long getLocalTimestamp(long localTimestamp, long requestTimestamp) {
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package org.briarproject.briar.introduction;
|
||||
|
||||
import org.briarproject.bramble.api.FormatException;
|
||||
import org.briarproject.bramble.api.db.DbException;
|
||||
import org.briarproject.bramble.api.db.Transaction;
|
||||
import org.briarproject.bramble.api.nullsafety.NotNullByDefault;
|
||||
@@ -20,21 +19,21 @@ interface ProtocolEngine<S extends Session> {
|
||||
throws DbException;
|
||||
|
||||
S onRequestMessage(Transaction txn, S session, RequestMessage m)
|
||||
throws DbException, FormatException;
|
||||
throws DbException;
|
||||
|
||||
S onAcceptMessage(Transaction txn, S session, AcceptMessage m)
|
||||
throws DbException, FormatException;
|
||||
throws DbException;
|
||||
|
||||
S onDeclineMessage(Transaction txn, S session, DeclineMessage m)
|
||||
throws DbException, FormatException;
|
||||
throws DbException;
|
||||
|
||||
S onAuthMessage(Transaction txn, S session, AuthMessage m)
|
||||
throws DbException, FormatException;
|
||||
throws DbException;
|
||||
|
||||
S onActivateMessage(Transaction txn, S session, ActivateMessage m)
|
||||
throws DbException, FormatException;
|
||||
throws DbException;
|
||||
|
||||
S onAbortMessage(Transaction txn, S session, AbortMessage m)
|
||||
throws DbException, FormatException;
|
||||
throws DbException;
|
||||
|
||||
}
|
||||
|
||||
@@ -90,10 +90,11 @@ abstract class AbstractProtocolEngine<S extends Session>
|
||||
return group.getClientId().equals(PrivateGroupManager.CLIENT_ID);
|
||||
}
|
||||
|
||||
@SuppressWarnings("BooleanMethodIsAlwaysInverted")
|
||||
boolean isValidDependency(S session, @Nullable MessageId dependency) {
|
||||
MessageId expected = session.getLastRemoteMessageId();
|
||||
if (dependency == null) return expected == null;
|
||||
return expected != null && dependency.equals(expected);
|
||||
return dependency.equals(expected);
|
||||
}
|
||||
|
||||
void setPrivateGroupVisibility(Transaction txn, S session,
|
||||
|
||||
@@ -627,7 +627,7 @@ abstract class ProtocolEngineImpl<S extends Shareable>
|
||||
@Nullable MessageId dependency) {
|
||||
MessageId expected = session.getLastRemoteMessageId();
|
||||
if (dependency == null) return expected != null;
|
||||
return expected == null || !dependency.equals(expected);
|
||||
return !dependency.equals(expected);
|
||||
}
|
||||
|
||||
private long getLocalTimestamp(Session session) {
|
||||
|
||||
@@ -7,8 +7,8 @@ import org.jsoup.safety.Whitelist;
|
||||
@NotNullByDefault
|
||||
public class HtmlUtils {
|
||||
|
||||
public static Whitelist STRIP_ALL = Whitelist.none();
|
||||
public static Whitelist ARTICLE =
|
||||
public static final Whitelist STRIP_ALL = Whitelist.none();
|
||||
public static final Whitelist ARTICLE =
|
||||
Whitelist.basic().addTags("h1", "h2", "h3", "h4", "h5", "h6");
|
||||
|
||||
public static String clean(String s, Whitelist list) {
|
||||
|
||||
@@ -31,6 +31,7 @@ import static org.briarproject.briar.privategroup.invitation.InviteeState.LEFT;
|
||||
import static org.briarproject.briar.privategroup.invitation.InviteeState.START;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertNotEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
@@ -53,43 +54,43 @@ public class InviteeProtocolEngineTest extends AbstractProtocolEngineTest {
|
||||
// onInviteAction
|
||||
|
||||
@Test(expected = UnsupportedOperationException.class)
|
||||
public void testOnInviteActionFromStart() throws Exception {
|
||||
public void testOnInviteActionFromStart() {
|
||||
engine.onInviteAction(txn, getDefaultSession(START), null,
|
||||
messageTimestamp, signature);
|
||||
}
|
||||
|
||||
@Test(expected = UnsupportedOperationException.class)
|
||||
public void testOnInviteActionFromLeft() throws Exception {
|
||||
public void testOnInviteActionFromLeft() {
|
||||
engine.onInviteAction(txn, getDefaultSession(ACCEPTED), null,
|
||||
messageTimestamp, signature);
|
||||
}
|
||||
|
||||
@Test(expected = UnsupportedOperationException.class)
|
||||
public void testOnInviteActionFromInvited() throws Exception {
|
||||
public void testOnInviteActionFromInvited() {
|
||||
engine.onInviteAction(txn, getDefaultSession(INVITED), null,
|
||||
messageTimestamp, signature);
|
||||
}
|
||||
|
||||
@Test(expected = UnsupportedOperationException.class)
|
||||
public void testOnInviteActionFromDissolved() throws Exception {
|
||||
public void testOnInviteActionFromDissolved() {
|
||||
engine.onInviteAction(txn, getDefaultSession(DISSOLVED), null,
|
||||
messageTimestamp, signature);
|
||||
}
|
||||
|
||||
@Test(expected = UnsupportedOperationException.class)
|
||||
public void testOnInviteActionFromAccepted() throws Exception {
|
||||
public void testOnInviteActionFromAccepted() {
|
||||
engine.onInviteAction(txn, getDefaultSession(ACCEPTED), null,
|
||||
messageTimestamp, signature);
|
||||
}
|
||||
|
||||
@Test(expected = UnsupportedOperationException.class)
|
||||
public void testOnInviteActionFromJoined() throws Exception {
|
||||
public void testOnInviteActionFromJoined() {
|
||||
engine.onInviteAction(txn, getDefaultSession(JOINED), null,
|
||||
messageTimestamp, signature);
|
||||
}
|
||||
|
||||
@Test(expected = UnsupportedOperationException.class)
|
||||
public void testOnInviteActionFromError() throws Exception {
|
||||
public void testOnInviteActionFromError() {
|
||||
engine.onInviteAction(txn, getDefaultSession(ERROR), null,
|
||||
messageTimestamp, signature);
|
||||
}
|
||||
@@ -263,43 +264,43 @@ public class InviteeProtocolEngineTest extends AbstractProtocolEngineTest {
|
||||
// onMemberAddedAction
|
||||
|
||||
@Test
|
||||
public void testOnMemberAddedFromStart() throws Exception {
|
||||
public void testOnMemberAddedFromStart() {
|
||||
InviteeSession session = getDefaultSession(START);
|
||||
assertEquals(session, engine.onMemberAddedAction(txn, session));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testOnMemberAddedFromInvited() throws Exception {
|
||||
public void testOnMemberAddedFromInvited() {
|
||||
InviteeSession session = getDefaultSession(INVITED);
|
||||
assertEquals(session, engine.onMemberAddedAction(txn, session));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testOnMemberAddedFromAccepted() throws Exception {
|
||||
public void testOnMemberAddedFromAccepted() {
|
||||
InviteeSession session = getDefaultSession(ACCEPTED);
|
||||
assertEquals(session, engine.onMemberAddedAction(txn, session));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testOnMemberAddedFromJoined() throws Exception {
|
||||
public void testOnMemberAddedFromJoined() {
|
||||
InviteeSession session = getDefaultSession(JOINED);
|
||||
assertEquals(session, engine.onMemberAddedAction(txn, session));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testOnMemberAddedFromLeft() throws Exception {
|
||||
public void testOnMemberAddedFromLeft() {
|
||||
InviteeSession session = getDefaultSession(LEFT);
|
||||
assertEquals(session, engine.onMemberAddedAction(txn, session));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testOnMemberAddedFromDissolved() throws Exception {
|
||||
public void testOnMemberAddedFromDissolved() {
|
||||
InviteeSession session = getDefaultSession(DISSOLVED);
|
||||
assertEquals(session, engine.onMemberAddedAction(txn, session));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testOnMemberAddedFromError() throws Exception {
|
||||
public void testOnMemberAddedFromError() {
|
||||
InviteeSession session = getDefaultSession(ERROR);
|
||||
assertEquals(session, engine.onMemberAddedAction(txn, session));
|
||||
}
|
||||
@@ -510,8 +511,8 @@ public class InviteeProtocolEngineTest extends AbstractProtocolEngineTest {
|
||||
session.getInviteTimestamp());
|
||||
assertNotNull(session.getLastRemoteMessageId());
|
||||
assertNotNull(invalidJoinMessage.getPreviousMessageId());
|
||||
assertFalse(session.getLastRemoteMessageId()
|
||||
.equals(invalidJoinMessage.getPreviousMessageId()));
|
||||
assertNotEquals(session.getLastRemoteMessageId(),
|
||||
invalidJoinMessage.getPreviousMessageId());
|
||||
|
||||
expectAbortWhenSubscribedToGroup();
|
||||
InviteeSession newSession =
|
||||
@@ -530,8 +531,8 @@ public class InviteeProtocolEngineTest extends AbstractProtocolEngineTest {
|
||||
session.getInviteTimestamp());
|
||||
assertNotNull(session.getLastRemoteMessageId());
|
||||
assertNotNull(properJoinMessage.getPreviousMessageId());
|
||||
assertTrue(session.getLastRemoteMessageId()
|
||||
.equals(properJoinMessage.getPreviousMessageId()));
|
||||
assertEquals(session.getLastRemoteMessageId(),
|
||||
properJoinMessage.getPreviousMessageId());
|
||||
|
||||
expectSetPrivateGroupVisibility(SHARED);
|
||||
|
||||
@@ -646,8 +647,8 @@ public class InviteeProtocolEngineTest extends AbstractProtocolEngineTest {
|
||||
session.getInviteTimestamp());
|
||||
assertNotNull(session.getLastRemoteMessageId());
|
||||
assertNotNull(properLeaveMessage.getPreviousMessageId());
|
||||
assertTrue(session.getLastRemoteMessageId()
|
||||
.equals(properLeaveMessage.getPreviousMessageId()));
|
||||
assertEquals(session.getLastRemoteMessageId(),
|
||||
properLeaveMessage.getPreviousMessageId());
|
||||
|
||||
expectMarkInvitesUnavailableToAnswer();
|
||||
InviteeSession newSession =
|
||||
@@ -676,8 +677,8 @@ public class InviteeProtocolEngineTest extends AbstractProtocolEngineTest {
|
||||
session.getInviteTimestamp());
|
||||
assertNotNull(session.getLastRemoteMessageId());
|
||||
assertNotNull(properLeaveMessage.getPreviousMessageId());
|
||||
assertTrue(session.getLastRemoteMessageId()
|
||||
.equals(properLeaveMessage.getPreviousMessageId()));
|
||||
assertEquals(session.getLastRemoteMessageId(),
|
||||
properLeaveMessage.getPreviousMessageId());
|
||||
|
||||
expectMarkInvitesUnavailableToAnswer();
|
||||
InviteeSession newSession =
|
||||
|
||||
@@ -17,9 +17,8 @@ import static org.briarproject.briar.privategroup.invitation.PeerState.LOCAL_LEF
|
||||
import static org.briarproject.briar.privategroup.invitation.PeerState.NEITHER_JOINED;
|
||||
import static org.briarproject.briar.privategroup.invitation.PeerState.START;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertNotEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
public class PeerProtocolEngineTest extends AbstractProtocolEngineTest {
|
||||
|
||||
@@ -37,43 +36,43 @@ public class PeerProtocolEngineTest extends AbstractProtocolEngineTest {
|
||||
// onInviteAction
|
||||
|
||||
@Test(expected = UnsupportedOperationException.class)
|
||||
public void testOnInviteActionFromStart() throws Exception {
|
||||
public void testOnInviteActionFromStart() {
|
||||
engine.onInviteAction(txn, getDefaultSession(START), null,
|
||||
messageTimestamp, signature);
|
||||
}
|
||||
|
||||
@Test(expected = UnsupportedOperationException.class)
|
||||
public void testOnInviteActionFromAwaitMember() throws Exception {
|
||||
public void testOnInviteActionFromAwaitMember() {
|
||||
engine.onInviteAction(txn, getDefaultSession(AWAIT_MEMBER), null,
|
||||
messageTimestamp, signature);
|
||||
}
|
||||
|
||||
@Test(expected = UnsupportedOperationException.class)
|
||||
public void testOnInviteActionFromNeitherJoined() throws Exception {
|
||||
public void testOnInviteActionFromNeitherJoined() {
|
||||
engine.onInviteAction(txn, getDefaultSession(NEITHER_JOINED), null,
|
||||
messageTimestamp, signature);
|
||||
}
|
||||
|
||||
@Test(expected = UnsupportedOperationException.class)
|
||||
public void testOnInviteActionFromLocalJoined() throws Exception {
|
||||
public void testOnInviteActionFromLocalJoined() {
|
||||
engine.onInviteAction(txn, getDefaultSession(LOCAL_JOINED), null,
|
||||
messageTimestamp, signature);
|
||||
}
|
||||
|
||||
@Test(expected = UnsupportedOperationException.class)
|
||||
public void testOnInviteActionFromBothJoined() throws Exception {
|
||||
public void testOnInviteActionFromBothJoined() {
|
||||
engine.onInviteAction(txn, getDefaultSession(BOTH_JOINED), null,
|
||||
messageTimestamp, signature);
|
||||
}
|
||||
|
||||
@Test(expected = UnsupportedOperationException.class)
|
||||
public void testOnInviteActionFromLocalLeft() throws Exception {
|
||||
public void testOnInviteActionFromLocalLeft() {
|
||||
engine.onInviteAction(txn, getDefaultSession(LOCAL_LEFT), null,
|
||||
messageTimestamp, signature);
|
||||
}
|
||||
|
||||
@Test(expected = UnsupportedOperationException.class)
|
||||
public void testOnInviteActionFromError() throws Exception {
|
||||
public void testOnInviteActionFromError() {
|
||||
engine.onInviteAction(txn, getDefaultSession(ERROR), null,
|
||||
messageTimestamp, signature);
|
||||
}
|
||||
@@ -365,8 +364,8 @@ public class PeerProtocolEngineTest extends AbstractProtocolEngineTest {
|
||||
PeerSession session = getDefaultSession(START);
|
||||
assertNotNull(invalidJoinMessage.getPreviousMessageId());
|
||||
assertNotNull(session.getLastRemoteMessageId());
|
||||
assertFalse(invalidJoinMessage.getPreviousMessageId()
|
||||
.equals(session.getLastRemoteMessageId()));
|
||||
assertNotEquals(invalidJoinMessage.getPreviousMessageId(),
|
||||
session.getLastRemoteMessageId());
|
||||
|
||||
expectAbortWhenNotSubscribedToGroup();
|
||||
PeerSession newSession =
|
||||
@@ -379,8 +378,8 @@ public class PeerProtocolEngineTest extends AbstractProtocolEngineTest {
|
||||
PeerSession session = getDefaultSession(START);
|
||||
assertNotNull(joinMessage.getPreviousMessageId());
|
||||
assertNotNull(session.getLastRemoteMessageId());
|
||||
assertTrue(joinMessage.getPreviousMessageId()
|
||||
.equals(session.getLastRemoteMessageId()));
|
||||
assertEquals(joinMessage.getPreviousMessageId(),
|
||||
session.getLastRemoteMessageId());
|
||||
|
||||
PeerSession newSession =
|
||||
engine.onJoinMessage(txn, session, joinMessage);
|
||||
@@ -403,8 +402,8 @@ public class PeerProtocolEngineTest extends AbstractProtocolEngineTest {
|
||||
PeerSession session = getDefaultSession(NEITHER_JOINED);
|
||||
assertNotNull(invalidJoinMessage.getPreviousMessageId());
|
||||
assertNotNull(session.getLastRemoteMessageId());
|
||||
assertFalse(invalidJoinMessage.getPreviousMessageId()
|
||||
.equals(session.getLastRemoteMessageId()));
|
||||
assertNotEquals(invalidJoinMessage.getPreviousMessageId(),
|
||||
session.getLastRemoteMessageId());
|
||||
|
||||
expectAbortWhenNotSubscribedToGroup();
|
||||
PeerSession newSession =
|
||||
@@ -417,8 +416,8 @@ public class PeerProtocolEngineTest extends AbstractProtocolEngineTest {
|
||||
PeerSession session = getDefaultSession(NEITHER_JOINED);
|
||||
assertNotNull(joinMessage.getPreviousMessageId());
|
||||
assertNotNull(session.getLastRemoteMessageId());
|
||||
assertTrue(joinMessage.getPreviousMessageId()
|
||||
.equals(session.getLastRemoteMessageId()));
|
||||
assertEquals(joinMessage.getPreviousMessageId(),
|
||||
session.getLastRemoteMessageId());
|
||||
JoinMessage myJoinMessage = new JoinMessage(messageId, contactGroupId,
|
||||
privateGroupId, messageTimestamp, lastRemoteMessageId);
|
||||
|
||||
@@ -445,8 +444,8 @@ public class PeerProtocolEngineTest extends AbstractProtocolEngineTest {
|
||||
PeerSession session = getDefaultSession(LOCAL_JOINED);
|
||||
assertNotNull(invalidJoinMessage.getPreviousMessageId());
|
||||
assertNotNull(session.getLastRemoteMessageId());
|
||||
assertFalse(invalidJoinMessage.getPreviousMessageId()
|
||||
.equals(session.getLastRemoteMessageId()));
|
||||
assertNotEquals(invalidJoinMessage.getPreviousMessageId(),
|
||||
session.getLastRemoteMessageId());
|
||||
|
||||
expectAbortWhenNotSubscribedToGroup();
|
||||
PeerSession newSession =
|
||||
@@ -459,8 +458,8 @@ public class PeerProtocolEngineTest extends AbstractProtocolEngineTest {
|
||||
PeerSession session = getDefaultSession(LOCAL_JOINED);
|
||||
assertNotNull(joinMessage.getPreviousMessageId());
|
||||
assertNotNull(session.getLastRemoteMessageId());
|
||||
assertTrue(joinMessage.getPreviousMessageId()
|
||||
.equals(session.getLastRemoteMessageId()));
|
||||
assertEquals(joinMessage.getPreviousMessageId(),
|
||||
session.getLastRemoteMessageId());
|
||||
|
||||
expectSetPrivateGroupVisibility(SHARED);
|
||||
expectRelationshipRevealed(false);
|
||||
@@ -524,8 +523,8 @@ public class PeerProtocolEngineTest extends AbstractProtocolEngineTest {
|
||||
PeerSession session = getDefaultSession(AWAIT_MEMBER);
|
||||
assertNotNull(invalidLeaveMessage.getPreviousMessageId());
|
||||
assertNotNull(session.getLastRemoteMessageId());
|
||||
assertFalse(invalidLeaveMessage.getPreviousMessageId()
|
||||
.equals(session.getLastRemoteMessageId()));
|
||||
assertNotEquals(invalidLeaveMessage.getPreviousMessageId(),
|
||||
session.getLastRemoteMessageId());
|
||||
|
||||
expectAbortWhenSubscribedToGroup();
|
||||
PeerSession newSession =
|
||||
@@ -538,8 +537,8 @@ public class PeerProtocolEngineTest extends AbstractProtocolEngineTest {
|
||||
PeerSession session = getDefaultSession(AWAIT_MEMBER);
|
||||
assertNotNull(leaveMessage.getPreviousMessageId());
|
||||
assertNotNull(session.getLastRemoteMessageId());
|
||||
assertTrue(leaveMessage.getPreviousMessageId()
|
||||
.equals(session.getLastRemoteMessageId()));
|
||||
assertEquals(leaveMessage.getPreviousMessageId(),
|
||||
session.getLastRemoteMessageId());
|
||||
|
||||
PeerSession newSession =
|
||||
engine.onLeaveMessage(txn, session, leaveMessage);
|
||||
@@ -562,8 +561,8 @@ public class PeerProtocolEngineTest extends AbstractProtocolEngineTest {
|
||||
PeerSession session = getDefaultSession(LOCAL_LEFT);
|
||||
assertNotNull(invalidLeaveMessage.getPreviousMessageId());
|
||||
assertNotNull(session.getLastRemoteMessageId());
|
||||
assertFalse(invalidLeaveMessage.getPreviousMessageId()
|
||||
.equals(session.getLastRemoteMessageId()));
|
||||
assertNotEquals(invalidLeaveMessage.getPreviousMessageId(),
|
||||
session.getLastRemoteMessageId());
|
||||
|
||||
expectAbortWhenSubscribedToGroup();
|
||||
PeerSession newSession =
|
||||
@@ -576,8 +575,8 @@ public class PeerProtocolEngineTest extends AbstractProtocolEngineTest {
|
||||
PeerSession session = getDefaultSession(LOCAL_LEFT);
|
||||
assertNotNull(leaveMessage.getPreviousMessageId());
|
||||
assertNotNull(session.getLastRemoteMessageId());
|
||||
assertTrue(leaveMessage.getPreviousMessageId()
|
||||
.equals(session.getLastRemoteMessageId()));
|
||||
assertEquals(leaveMessage.getPreviousMessageId(),
|
||||
session.getLastRemoteMessageId());
|
||||
|
||||
PeerSession newSession =
|
||||
engine.onLeaveMessage(txn, session, leaveMessage);
|
||||
@@ -600,8 +599,8 @@ public class PeerProtocolEngineTest extends AbstractProtocolEngineTest {
|
||||
PeerSession session = getDefaultSession(BOTH_JOINED);
|
||||
assertNotNull(invalidLeaveMessage.getPreviousMessageId());
|
||||
assertNotNull(session.getLastRemoteMessageId());
|
||||
assertFalse(invalidLeaveMessage.getPreviousMessageId()
|
||||
.equals(session.getLastRemoteMessageId()));
|
||||
assertNotEquals(invalidLeaveMessage.getPreviousMessageId(),
|
||||
session.getLastRemoteMessageId());
|
||||
|
||||
expectAbortWhenSubscribedToGroup();
|
||||
PeerSession newSession =
|
||||
@@ -614,8 +613,8 @@ public class PeerProtocolEngineTest extends AbstractProtocolEngineTest {
|
||||
PeerSession session = getDefaultSession(BOTH_JOINED);
|
||||
assertNotNull(leaveMessage.getPreviousMessageId());
|
||||
assertNotNull(session.getLastRemoteMessageId());
|
||||
assertTrue(leaveMessage.getPreviousMessageId()
|
||||
.equals(session.getLastRemoteMessageId()));
|
||||
assertEquals(leaveMessage.getPreviousMessageId(),
|
||||
session.getLastRemoteMessageId());
|
||||
|
||||
expectSetPrivateGroupVisibility(VISIBLE); // FIXME correct?
|
||||
PeerSession newSession =
|
||||
@@ -685,7 +684,7 @@ public class PeerProtocolEngineTest extends AbstractProtocolEngineTest {
|
||||
}
|
||||
|
||||
private void assertSessionAborted(PeerSession oldSession,
|
||||
PeerSession newSession) throws Exception {
|
||||
PeerSession newSession) {
|
||||
assertEquals(ERROR, newSession.getState());
|
||||
assertSessionRecordedSentMessage(newSession);
|
||||
assertSessionConstantsUnchanged(oldSession, newSession);
|
||||
|
||||
@@ -148,9 +148,9 @@ public abstract class BriarIntegrationTest<C extends BriarIntegrationTestCompone
|
||||
private final String AUTHOR1 = "Author 1";
|
||||
private final String AUTHOR2 = "Author 2";
|
||||
|
||||
protected File t0Dir = new File(testDir, AUTHOR0);
|
||||
protected File t1Dir = new File(testDir, AUTHOR1);
|
||||
protected File t2Dir = new File(testDir, AUTHOR2);
|
||||
protected final File t0Dir = new File(testDir, AUTHOR0);
|
||||
protected final File t1Dir = new File(testDir, AUTHOR1);
|
||||
protected final File t2Dir = new File(testDir, AUTHOR2);
|
||||
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
|
||||
Reference in New Issue
Block a user