mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-15 04:18:53 +01:00
Use key set ID to increment stream counter.
This commit is contained in:
@@ -285,11 +285,11 @@ public class DatabaseComponentImplTest extends BrambleMockTestCase {
|
||||
throws Exception {
|
||||
context.checking(new Expectations() {{
|
||||
// Check whether the contact is in the DB (which it's not)
|
||||
exactly(18).of(database).startTransaction();
|
||||
exactly(17).of(database).startTransaction();
|
||||
will(returnValue(txn));
|
||||
exactly(18).of(database).containsContact(txn, contactId);
|
||||
exactly(17).of(database).containsContact(txn, contactId);
|
||||
will(returnValue(false));
|
||||
exactly(18).of(database).abortTransaction(txn);
|
||||
exactly(17).of(database).abortTransaction(txn);
|
||||
}});
|
||||
DatabaseComponent db = createDatabaseComponent(database, eventBus,
|
||||
shutdown);
|
||||
@@ -384,16 +384,6 @@ public class DatabaseComponentImplTest extends BrambleMockTestCase {
|
||||
db.endTransaction(transaction);
|
||||
}
|
||||
|
||||
transaction = db.startTransaction(false);
|
||||
try {
|
||||
db.incrementStreamCounter(transaction, contactId, transportId, 0);
|
||||
fail();
|
||||
} catch (NoSuchContactException expected) {
|
||||
// Expected
|
||||
} finally {
|
||||
db.endTransaction(transaction);
|
||||
}
|
||||
|
||||
transaction = db.startTransaction(false);
|
||||
try {
|
||||
db.getGroupVisibility(transaction, contactId, groupId);
|
||||
@@ -781,7 +771,7 @@ public class DatabaseComponentImplTest extends BrambleMockTestCase {
|
||||
// Check whether the transport is in the DB (which it's not)
|
||||
exactly(6).of(database).startTransaction();
|
||||
will(returnValue(txn));
|
||||
exactly(2).of(database).containsContact(txn, contactId);
|
||||
oneOf(database).containsContact(txn, contactId);
|
||||
will(returnValue(true));
|
||||
exactly(6).of(database).containsTransport(txn, transportId);
|
||||
will(returnValue(false));
|
||||
@@ -822,7 +812,7 @@ public class DatabaseComponentImplTest extends BrambleMockTestCase {
|
||||
|
||||
transaction = db.startTransaction(false);
|
||||
try {
|
||||
db.incrementStreamCounter(transaction, contactId, transportId, 0);
|
||||
db.incrementStreamCounter(transaction, transportId, keySetId);
|
||||
fail();
|
||||
} catch (NoSuchTransportException expected) {
|
||||
// Expected
|
||||
|
||||
@@ -825,8 +825,8 @@ public abstract class JdbcDatabaseTest extends BrambleTestCase {
|
||||
singletonList(new KeySet(keySetId, contactId, keys)));
|
||||
|
||||
// Increment the stream counter twice and retrieve the transport keys
|
||||
db.incrementStreamCounter(txn, contactId, transportId, rotationPeriod);
|
||||
db.incrementStreamCounter(txn, contactId, transportId, rotationPeriod);
|
||||
db.incrementStreamCounter(txn, transportId, keySetId);
|
||||
db.incrementStreamCounter(txn, transportId, keySetId);
|
||||
Collection<KeySet> newKeys = db.getTransportKeys(txn, transportId);
|
||||
assertEquals(1, newKeys.size());
|
||||
KeySet ks = newKeys.iterator().next();
|
||||
|
||||
@@ -227,7 +227,7 @@ public class TransportKeyManagerImplTest extends BrambleMockTestCase {
|
||||
|
||||
context.checking(new Expectations() {{
|
||||
// Increment the stream counter
|
||||
oneOf(db).incrementStreamCounter(txn, contactId, transportId, 1000);
|
||||
oneOf(db).incrementStreamCounter(txn, transportId, keySetId);
|
||||
}});
|
||||
|
||||
TransportKeyManager transportKeyManager = new TransportKeyManagerImpl(
|
||||
@@ -441,7 +441,7 @@ public class TransportKeyManagerImplTest extends BrambleMockTestCase {
|
||||
// Activate the keys
|
||||
oneOf(db).setTransportKeysActive(txn, transportId, keySetId);
|
||||
// Increment the stream counter
|
||||
oneOf(db).incrementStreamCounter(txn, contactId, transportId, 1000);
|
||||
oneOf(db).incrementStreamCounter(txn, transportId, keySetId);
|
||||
}});
|
||||
|
||||
TransportKeyManager transportKeyManager = new TransportKeyManagerImpl(
|
||||
|
||||
Reference in New Issue
Block a user