mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-14 19:59:05 +01:00
@@ -111,7 +111,7 @@ public class DatabaseComponentImplTest extends BriarTestCase {
|
||||
transportId = new TransportId("id");
|
||||
maxLatency = Integer.MAX_VALUE;
|
||||
contactId = new ContactId(234);
|
||||
contact = new Contact(contactId, author, localAuthorId, true);
|
||||
contact = new Contact(contactId, author, localAuthorId, true, true);
|
||||
}
|
||||
|
||||
private DatabaseComponent createDatabaseComponent(Database<Object> database,
|
||||
@@ -149,7 +149,7 @@ public class DatabaseComponentImplTest extends BriarTestCase {
|
||||
will(returnValue(false));
|
||||
oneOf(database).containsContact(txn, authorId, localAuthorId);
|
||||
will(returnValue(false));
|
||||
oneOf(database).addContact(txn, author, localAuthorId, true);
|
||||
oneOf(database).addContact(txn, author, localAuthorId, true, true);
|
||||
will(returnValue(contactId));
|
||||
oneOf(eventBus).broadcast(with(any(ContactAddedEvent.class)));
|
||||
oneOf(eventBus).broadcast(with(any(
|
||||
@@ -201,7 +201,8 @@ public class DatabaseComponentImplTest extends BriarTestCase {
|
||||
try {
|
||||
db.addLocalAuthor(transaction, localAuthor);
|
||||
assertEquals(contactId,
|
||||
db.addContact(transaction, author, localAuthorId, true));
|
||||
db.addContact(transaction, author, localAuthorId, true,
|
||||
true));
|
||||
assertEquals(Collections.singletonList(contact),
|
||||
db.getContacts(transaction));
|
||||
db.addGroup(transaction, group); // First time - listeners called
|
||||
@@ -519,7 +520,7 @@ public class DatabaseComponentImplTest extends BriarTestCase {
|
||||
|
||||
Transaction transaction = db.startTransaction(false);
|
||||
try {
|
||||
db.addContact(transaction, author, localAuthorId, true);
|
||||
db.addContact(transaction, author, localAuthorId, true, true);
|
||||
fail();
|
||||
} catch (NoSuchLocalAuthorException expected) {
|
||||
// Expected
|
||||
@@ -815,7 +816,7 @@ public class DatabaseComponentImplTest extends BriarTestCase {
|
||||
will(returnValue(false));
|
||||
oneOf(database).containsContact(txn, authorId, localAuthorId);
|
||||
will(returnValue(false));
|
||||
oneOf(database).addContact(txn, author, localAuthorId, true);
|
||||
oneOf(database).addContact(txn, author, localAuthorId, true, true);
|
||||
will(returnValue(contactId));
|
||||
oneOf(eventBus).broadcast(with(any(ContactAddedEvent.class)));
|
||||
oneOf(eventBus).broadcast(with(any(
|
||||
@@ -838,7 +839,8 @@ public class DatabaseComponentImplTest extends BriarTestCase {
|
||||
try {
|
||||
db.addLocalAuthor(transaction, localAuthor);
|
||||
assertEquals(contactId,
|
||||
db.addContact(transaction, author, localAuthorId, true));
|
||||
db.addContact(transaction, author, localAuthorId, true,
|
||||
true));
|
||||
transaction.setComplete();
|
||||
} finally {
|
||||
db.endTransaction(transaction);
|
||||
@@ -1569,7 +1571,7 @@ public class DatabaseComponentImplTest extends BriarTestCase {
|
||||
|
||||
Transaction transaction = db.startTransaction(false);
|
||||
try {
|
||||
db.addContact(transaction, author, localAuthorId, true);
|
||||
db.addContact(transaction, author, localAuthorId, true, true);
|
||||
fail();
|
||||
} catch (ContactExistsException expected) {
|
||||
// Expected
|
||||
@@ -1606,7 +1608,7 @@ public class DatabaseComponentImplTest extends BriarTestCase {
|
||||
|
||||
Transaction transaction = db.startTransaction(false);
|
||||
try {
|
||||
db.addContact(transaction, author, localAuthorId, true);
|
||||
db.addContact(transaction, author, localAuthorId, true, true);
|
||||
fail();
|
||||
} catch (ContactExistsException expected) {
|
||||
// Expected
|
||||
|
||||
@@ -111,7 +111,7 @@ public class H2DatabaseTest extends BriarTestCase {
|
||||
assertFalse(db.containsContact(txn, contactId));
|
||||
db.addLocalAuthor(txn, localAuthor);
|
||||
assertEquals(contactId, db.addContact(txn, author, localAuthorId,
|
||||
true));
|
||||
true, true));
|
||||
assertTrue(db.containsContact(txn, contactId));
|
||||
assertFalse(db.containsGroup(txn, groupId));
|
||||
db.addGroup(txn, group);
|
||||
@@ -174,7 +174,7 @@ public class H2DatabaseTest extends BriarTestCase {
|
||||
// Add a contact, a group and a message
|
||||
db.addLocalAuthor(txn, localAuthor);
|
||||
assertEquals(contactId, db.addContact(txn, author, localAuthorId,
|
||||
true));
|
||||
true, true));
|
||||
db.addGroup(txn, group);
|
||||
db.addVisibility(txn, contactId, groupId);
|
||||
db.addMessage(txn, message, DELIVERED, true);
|
||||
@@ -212,7 +212,7 @@ public class H2DatabaseTest extends BriarTestCase {
|
||||
// Add a contact, a group and an unvalidated message
|
||||
db.addLocalAuthor(txn, localAuthor);
|
||||
assertEquals(contactId, db.addContact(txn, author, localAuthorId,
|
||||
true));
|
||||
true, true));
|
||||
db.addGroup(txn, group);
|
||||
db.addVisibility(txn, contactId, groupId);
|
||||
db.addMessage(txn, message, UNKNOWN, true);
|
||||
@@ -267,7 +267,7 @@ public class H2DatabaseTest extends BriarTestCase {
|
||||
// Add a contact, a group and an unshared message
|
||||
db.addLocalAuthor(txn, localAuthor);
|
||||
assertEquals(contactId, db.addContact(txn, author, localAuthorId,
|
||||
true));
|
||||
true, true));
|
||||
db.addGroup(txn, group);
|
||||
db.addVisibility(txn, contactId, groupId);
|
||||
db.addMessage(txn, message, DELIVERED, false);
|
||||
@@ -306,7 +306,7 @@ public class H2DatabaseTest extends BriarTestCase {
|
||||
// Add a contact, a group and a message
|
||||
db.addLocalAuthor(txn, localAuthor);
|
||||
assertEquals(contactId, db.addContact(txn, author, localAuthorId,
|
||||
true));
|
||||
true, true));
|
||||
db.addGroup(txn, group);
|
||||
db.addVisibility(txn, contactId, groupId);
|
||||
db.addMessage(txn, message, DELIVERED, true);
|
||||
@@ -333,7 +333,7 @@ public class H2DatabaseTest extends BriarTestCase {
|
||||
// Add a contact and a group
|
||||
db.addLocalAuthor(txn, localAuthor);
|
||||
assertEquals(contactId, db.addContact(txn, author, localAuthorId,
|
||||
true));
|
||||
true, true));
|
||||
db.addGroup(txn, group);
|
||||
db.addVisibility(txn, contactId, groupId);
|
||||
|
||||
@@ -370,7 +370,7 @@ public class H2DatabaseTest extends BriarTestCase {
|
||||
// Add a contact, a group and a message
|
||||
db.addLocalAuthor(txn, localAuthor);
|
||||
assertEquals(contactId, db.addContact(txn, author, localAuthorId,
|
||||
true));
|
||||
true, true));
|
||||
db.addGroup(txn, group);
|
||||
db.addVisibility(txn, contactId, groupId);
|
||||
db.addMessage(txn, message, DELIVERED, true);
|
||||
@@ -534,7 +534,7 @@ public class H2DatabaseTest extends BriarTestCase {
|
||||
// Add a contact and a group
|
||||
db.addLocalAuthor(txn, localAuthor);
|
||||
assertEquals(contactId, db.addContact(txn, author, localAuthorId,
|
||||
true));
|
||||
true, true));
|
||||
db.addGroup(txn, group);
|
||||
db.addVisibility(txn, contactId, groupId);
|
||||
|
||||
@@ -554,7 +554,7 @@ public class H2DatabaseTest extends BriarTestCase {
|
||||
// Add a contact
|
||||
db.addLocalAuthor(txn, localAuthor);
|
||||
assertEquals(contactId, db.addContact(txn, author, localAuthorId,
|
||||
true));
|
||||
true, true));
|
||||
|
||||
// The group is not in the database
|
||||
assertFalse(db.containsVisibleMessage(txn, contactId, messageId));
|
||||
@@ -572,7 +572,7 @@ public class H2DatabaseTest extends BriarTestCase {
|
||||
// Add a contact, a group and a message
|
||||
db.addLocalAuthor(txn, localAuthor);
|
||||
assertEquals(contactId, db.addContact(txn, author, localAuthorId,
|
||||
true));
|
||||
true, true));
|
||||
db.addGroup(txn, group);
|
||||
db.addMessage(txn, message, DELIVERED, true);
|
||||
db.addStatus(txn, contactId, messageId, false, false);
|
||||
@@ -592,7 +592,7 @@ public class H2DatabaseTest extends BriarTestCase {
|
||||
// Add a contact and a group
|
||||
db.addLocalAuthor(txn, localAuthor);
|
||||
assertEquals(contactId, db.addContact(txn, author, localAuthorId,
|
||||
true));
|
||||
true, true));
|
||||
db.addGroup(txn, group);
|
||||
|
||||
// The group should not be visible to the contact
|
||||
@@ -628,7 +628,7 @@ public class H2DatabaseTest extends BriarTestCase {
|
||||
// Add a contact and the groups
|
||||
db.addLocalAuthor(txn, localAuthor);
|
||||
assertEquals(contactId, db.addContact(txn, author, localAuthorId,
|
||||
true));
|
||||
true, true));
|
||||
for (Group g : groups) db.addGroup(txn, g);
|
||||
|
||||
// Make the groups visible to the contact
|
||||
@@ -661,7 +661,7 @@ public class H2DatabaseTest extends BriarTestCase {
|
||||
// Add the contact, the transport and the transport keys
|
||||
db.addLocalAuthor(txn, localAuthor);
|
||||
assertEquals(contactId, db.addContact(txn, author, localAuthorId,
|
||||
true));
|
||||
true, true));
|
||||
db.addTransport(txn, transportId, 123);
|
||||
db.addTransportKeys(txn, contactId, keys);
|
||||
|
||||
@@ -723,7 +723,7 @@ public class H2DatabaseTest extends BriarTestCase {
|
||||
// Add the contact, transport and transport keys
|
||||
db.addLocalAuthor(txn, localAuthor);
|
||||
assertEquals(contactId, db.addContact(txn, author, localAuthorId,
|
||||
true));
|
||||
true, true));
|
||||
db.addTransport(txn, transportId, 123);
|
||||
db.updateTransportKeys(txn, Collections.singletonMap(contactId, keys));
|
||||
|
||||
@@ -759,7 +759,7 @@ public class H2DatabaseTest extends BriarTestCase {
|
||||
// Add the contact, transport and transport keys
|
||||
db.addLocalAuthor(txn, localAuthor);
|
||||
assertEquals(contactId, db.addContact(txn, author, localAuthorId,
|
||||
true));
|
||||
true, true));
|
||||
db.addTransport(txn, transportId, 123);
|
||||
db.updateTransportKeys(txn, Collections.singletonMap(contactId, keys));
|
||||
|
||||
@@ -796,7 +796,7 @@ public class H2DatabaseTest extends BriarTestCase {
|
||||
|
||||
// Add a contact associated with the local author
|
||||
assertEquals(contactId, db.addContact(txn, author, localAuthorId,
|
||||
true));
|
||||
true, true));
|
||||
contacts = db.getContacts(txn, localAuthorId);
|
||||
assertEquals(Collections.singletonList(contactId), contacts);
|
||||
|
||||
@@ -818,7 +818,7 @@ public class H2DatabaseTest extends BriarTestCase {
|
||||
// Add a contact - initially there should be no offered messages
|
||||
db.addLocalAuthor(txn, localAuthor);
|
||||
assertEquals(contactId, db.addContact(txn, author, localAuthorId,
|
||||
true));
|
||||
true, true));
|
||||
assertEquals(0, db.countOfferedMessages(txn, contactId));
|
||||
|
||||
// Add some offered messages and count them
|
||||
@@ -1377,7 +1377,7 @@ public class H2DatabaseTest extends BriarTestCase {
|
||||
// Add a contact
|
||||
db.addLocalAuthor(txn, localAuthor);
|
||||
assertEquals(contactId, db.addContact(txn, author, localAuthorId,
|
||||
true));
|
||||
true, true));
|
||||
|
||||
// Add a group and make it visible to the contact
|
||||
db.addGroup(txn, group);
|
||||
@@ -1454,7 +1454,7 @@ public class H2DatabaseTest extends BriarTestCase {
|
||||
// Add a contact and a group
|
||||
db.addLocalAuthor(txn, localAuthor);
|
||||
assertEquals(contactId, db.addContact(txn, author, localAuthorId,
|
||||
true));
|
||||
true, true));
|
||||
db.addGroup(txn, group);
|
||||
|
||||
// The group should not be visible to the contact
|
||||
@@ -1487,8 +1487,10 @@ public class H2DatabaseTest extends BriarTestCase {
|
||||
db.addLocalAuthor(txn, localAuthor1);
|
||||
|
||||
// Add the same contact for each local pseudonym
|
||||
ContactId contactId = db.addContact(txn, author, localAuthorId, true);
|
||||
ContactId contactId1 = db.addContact(txn, author, localAuthorId1, true);
|
||||
ContactId contactId =
|
||||
db.addContact(txn, author, localAuthorId, true, true);
|
||||
ContactId contactId1 =
|
||||
db.addContact(txn, author, localAuthorId1, true, true);
|
||||
|
||||
// The contacts should be distinct
|
||||
assertNotEquals(contactId, contactId1);
|
||||
@@ -1508,7 +1510,7 @@ public class H2DatabaseTest extends BriarTestCase {
|
||||
// Add a contact, a group and a message
|
||||
db.addLocalAuthor(txn, localAuthor);
|
||||
assertEquals(contactId, db.addContact(txn, author, localAuthorId,
|
||||
true));
|
||||
true, true));
|
||||
db.addGroup(txn, group);
|
||||
db.addVisibility(txn, contactId, groupId);
|
||||
db.addMessage(txn, message, DELIVERED, true);
|
||||
@@ -1554,7 +1556,7 @@ public class H2DatabaseTest extends BriarTestCase {
|
||||
// Add a contact
|
||||
db.addLocalAuthor(txn, localAuthor);
|
||||
assertEquals(contactId, db.addContact(txn, author, localAuthorId,
|
||||
true));
|
||||
true, true));
|
||||
|
||||
// The contact should be active
|
||||
Contact contact = db.getContact(txn, contactId);
|
||||
|
||||
Reference in New Issue
Block a user