Address review feedback

This commit is contained in:
Torsten Grote
2022-10-31 18:16:27 -03:00
parent bab6ec70f5
commit 324ca1b50b
2 changed files with 23 additions and 29 deletions

View File

@@ -15,9 +15,6 @@ import org.briarproject.bramble.api.mailbox.MailboxPairingState;
import org.briarproject.bramble.api.mailbox.MailboxPairingTask;
import org.briarproject.bramble.api.mailbox.MailboxProperties;
import org.briarproject.bramble.api.mailbox.MailboxUpdateWithMailbox;
import org.briarproject.bramble.api.plugin.Plugin;
import org.briarproject.bramble.api.plugin.PluginException;
import org.briarproject.bramble.api.plugin.TorConstants;
import org.briarproject.bramble.api.sync.GroupId;
import org.briarproject.bramble.test.BrambleIntegrationTest;
import org.briarproject.bramble.test.TestDatabaseConfigModule;
@@ -86,7 +83,6 @@ abstract class AbstractMailboxIntegrationTest
.testDatabaseConfigModule(dbModule)
.build();
injectEagerSingletons(component);
component.getPluginManager().setPluginEnabled(TorConstants.ID, false);
setUp(component, name);
return component;
@@ -121,37 +117,43 @@ abstract class AbstractMailboxIntegrationTest
if (!latch.await(10, SECONDS)) {
fail("Timeout reached when waiting for pairing.");
}
return c.getDatabaseComponent()
MailboxProperties properties = c.getDatabaseComponent()
.transactionWithNullableResult(true, txn ->
c.getMailboxSettingsManager()
.getOwnMailboxProperties(txn)
);
assertNotNull(properties);
return properties;
}
void addContacts() throws Exception {
LocalAuthor author1 = c1.getIdentityManager().getLocalAuthor();
LocalAuthor author2 = c2.getIdentityManager().getLocalAuthor();
ContactId contactId1 = c1.getContactManager().addContact(author2,
author1.getId(), rootKey, c1.getClock().currentTimeMillis(),
ContactId contactId2From1 =
c1.getContactManager().addContact(author2,
author1.getId(), rootKey,
c1.getClock().currentTimeMillis(),
true, true, true);
ContactId contactId2 = c2.getContactManager().addContact(author1,
author2.getId(), rootKey, c2.getClock().currentTimeMillis(),
ContactId contactId1From2 =
c2.getContactManager().addContact(author1,
author2.getId(), rootKey,
c2.getClock().currentTimeMillis(),
false, true, true);
contact2From1 = c1.getContactManager().getContact(contactId2);
contact1From2 = c2.getContactManager().getContact(contactId1);
contact2From1 = c1.getContactManager().getContact(contactId2From1);
contact1From2 = c2.getContactManager().getContact(contactId1From2);
// Sync client versioning update from 0 to 1
// Sync client versioning update from 1 to 2
sync1To2(1, true);
// Sync client versioning update and ack from 1 to 0
// Sync client versioning update and ack from 2 to 1
sync2To1(1, true);
// Sync second client versioning update, mailbox properties and ack
// from 0 to 1
// from 1 to 2
sync1To2(2, true);
// Sync mailbox properties and ack from 1 to 0
// Sync mailbox properties and ack from 2 to 1
sync2To1(1, true);
// Sync final ack from 0 to 1
// Sync final ack from 1 to 2
ack1To2(1);
}
@@ -161,14 +163,6 @@ abstract class AbstractMailboxIntegrationTest
.transactionWithResult(true, callable::call);
}
void restartTor(MailboxIntegrationTestComponent device)
throws PluginException {
Plugin torPlugin = device.getPluginManager().getPlugin(TorConstants.ID);
assertNotNull(torPlugin);
torPlugin.stop();
torPlugin.start();
}
MailboxProperties getMailboxProperties(
MailboxIntegrationTestComponent device, ContactId contactId)
throws DbException {

View File

@@ -15,16 +15,16 @@ class TestMailboxConfigImpl implements MailboxConfig {
@Override
public long getApiCallerMinRetryInterval() {
return 1000; // MailboxApiCaller.MIN_RETRY_INTERVAL_MS;
return 1000;
}
@Override
public long getApiCallerMaxRetryInterval() {
return 2000; // MailboxApiCaller.MAX_RETRY_INTERVAL_MS;
return 2000;
}
@Override
public long getTorReachabilityPeriod() {
return 5000; // TorReachabilityMonitor.REACHABILITY_PERIOD_MS;
return 10_000;
}
}