mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-11 18:29:05 +01:00
Address review feedback
This commit is contained in:
@@ -20,7 +20,7 @@ dependencies {
|
||||
implementation project(path: ':briar-core', configuration: 'default')
|
||||
implementation project(path: ':bramble-java', configuration: 'default')
|
||||
|
||||
implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.4.32'
|
||||
implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.7.10'
|
||||
implementation 'io.javalin:javalin:3.5.0'
|
||||
implementation 'org.slf4j:slf4j-simple:1.7.30'
|
||||
implementation "com.fasterxml.jackson.core:jackson-databind:$jackson_version"
|
||||
@@ -77,7 +77,7 @@ void jarFactory(Jar jarTask, jarArchitecture) {
|
||||
jarTask.with jar
|
||||
jarTask.doLast {
|
||||
// Rename the original jar
|
||||
File jar = jarTask.archivePath
|
||||
File jar = jarTask.archiveFile.get().asFile
|
||||
String srcPath = jar.toString().replaceFirst('\\.jar$', '.unsorted.jar')
|
||||
File srcFile = new File(srcPath)
|
||||
jar.renameTo(srcFile)
|
||||
|
||||
@@ -64,11 +64,9 @@ dependencyVerification {
|
||||
'org.jetbrains.kotlin:kotlin-scripting-compiler-embeddable:1.7.10:kotlin-scripting-compiler-embeddable-1.7.10.jar:fcb8a0b3b7a95263dab8a0ccdd34fed02888700511eabb5613f75a007a4aa802',
|
||||
'org.jetbrains.kotlin:kotlin-scripting-compiler-impl-embeddable:1.7.10:kotlin-scripting-compiler-impl-embeddable-1.7.10.jar:7119205985ebd721179fb0f35d1d511f96de14fbd48e6465119fcac6bffc8090',
|
||||
'org.jetbrains.kotlin:kotlin-scripting-jvm:1.7.10:kotlin-scripting-jvm-1.7.10.jar:cf85511ce4e26fa3286d722f95ed54f16f2513a39ce3b85f2b567e575cb45a60',
|
||||
'org.jetbrains.kotlin:kotlin-stdlib-common:1.4.32:kotlin-stdlib-common-1.4.32.jar:e1ff6f55ee9e7591dcc633f7757bac25a7edb1cc7f738b37ec652f10f66a4145',
|
||||
'org.jetbrains.kotlin:kotlin-stdlib-common:1.7.10:kotlin-stdlib-common-1.7.10.jar:19f102efe9629f8eabc63853ad15c533e47c47f91fca09285c5bde86e59f91d4',
|
||||
'org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.4.32:kotlin-stdlib-jdk7-1.4.32.jar:5f801e75ca27d8791c14b07943c608da27620d910a8093022af57f543d5d98b6',
|
||||
'org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.4.32:kotlin-stdlib-jdk8-1.4.32.jar:adc43e54757b106e0cd7b3b7aa257dff471b61efdabe067fc02b2f57e2396262',
|
||||
'org.jetbrains.kotlin:kotlin-stdlib:1.4.32:kotlin-stdlib-1.4.32.jar:13e9fd3e69dc7230ce0fc873a92a4e5d521d179bcf1bef75a6705baac3bfecba',
|
||||
'org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.7.10:kotlin-stdlib-jdk7-1.7.10.jar:54f61351b1936ad88f4e53059fe781e723eae51d78ed9e7422d8b403574ec682',
|
||||
'org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.7.10:kotlin-stdlib-jdk8-1.7.10.jar:8aafdd60c94f454c92e5066d266a5ed53ecc63c78f623b3fd9db56fea4032873',
|
||||
'org.jetbrains.kotlin:kotlin-stdlib:1.7.10:kotlin-stdlib-1.7.10.jar:e771fe74250a943e8f6346713201ff1d8cb95c3a5d1a91a22b65a9e04f6a8901',
|
||||
'org.jetbrains:annotations:13.0:annotations-13.0.jar:ace2a10dc8e2d5fd34925ecac03e4988b2c0f851650c94b8cef49ba1bd111478',
|
||||
'org.json:json:20150729:json-20150729.jar:38c21b9c3d6d24919cd15d027d20afab0a019ac9205f7ed9083b32bdd42a2353',
|
||||
|
||||
Submodule briar-mailbox updated: 7a48ccc1b8...d887c49ab3
@@ -47,7 +47,7 @@ buildscript {
|
||||
}
|
||||
}
|
||||
|
||||
if ((project.hasProperty("mailbox-integration-tests") && project.property("mailbox-integration-tests") == "true")
|
||||
if ((project.hasProperty("briar.mailbox_integration_tests") && project.property("briar.mailbox_integration_tests") == "true")
|
||||
|| System.env.MAILBOX_INTEGRATION_TESTS) {
|
||||
configure([project(':mailbox-core'), project(':mailbox-lib')]) {
|
||||
apply from: "../gradle/variables.gradle"
|
||||
|
||||
@@ -2,4 +2,4 @@ noWitness=androidApis,_internal_aapt2_binary
|
||||
org.gradle.jvmargs=-Xmx1g
|
||||
android.useAndroidX=true
|
||||
android.enableJetifier=true
|
||||
mailbox-integration-tests=false
|
||||
briar.mailbox_integration_tests=false
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
ktlint {
|
||||
version = "0.43.2"
|
||||
android = true
|
||||
enableExperimentalRules = false
|
||||
verbose = true
|
||||
disabledRules = [
|
||||
"import-ordering",
|
||||
"no-blank-line-before-rbrace",
|
||||
]
|
||||
}
|
||||
@@ -11,7 +11,6 @@ import org.briarproject.bramble.mailbox.MailboxApi.MailboxContact;
|
||||
import org.briarproject.bramble.mailbox.MailboxApi.MailboxFile;
|
||||
import org.briarproject.bramble.mailbox.MailboxApi.TolerableFailureException;
|
||||
import org.briarproject.bramble.test.BrambleTestCase;
|
||||
import org.briarproject.mailbox.lib.Mailbox;
|
||||
import org.briarproject.mailbox.lib.TestMailbox;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
@@ -47,7 +46,7 @@ public class MailboxApiIntegrationTest extends BrambleTestCase {
|
||||
@Rule
|
||||
public TemporaryFolder dataDirectory = new TemporaryFolder();
|
||||
|
||||
private Mailbox mailbox;
|
||||
private TestMailbox mailbox;
|
||||
private MailboxAuthToken setupToken;
|
||||
|
||||
private final MailboxApi api = createMailboxApi();
|
||||
@@ -58,7 +57,6 @@ public class MailboxApiIntegrationTest extends BrambleTestCase {
|
||||
public void setUp()
|
||||
throws IOException, ApiException, InvalidMailboxIdException {
|
||||
mailbox = new TestMailbox(dataDirectory.getRoot());
|
||||
mailbox.init();
|
||||
mailbox.startLifecycle();
|
||||
|
||||
setupToken = MailboxAuthToken.fromString(mailbox.getSetupToken());
|
||||
|
||||
@@ -87,7 +87,7 @@ class MailboxIntegrationTestUtils {
|
||||
}
|
||||
|
||||
interface Check {
|
||||
boolean check();
|
||||
boolean check() throws Exception;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -97,7 +97,7 @@ class MailboxIntegrationTestUtils {
|
||||
* next invocation.
|
||||
*/
|
||||
static void retryUntilSuccessOrTimeout(long totalTime, long step,
|
||||
Check check) {
|
||||
Check check) throws Exception {
|
||||
AtomicBoolean success = new AtomicBoolean(false);
|
||||
|
||||
checkRepeatedly(totalTime, step, () -> {
|
||||
@@ -119,7 +119,7 @@ class MailboxIntegrationTestUtils {
|
||||
* next invocation.
|
||||
*/
|
||||
private static void checkRepeatedly(long totalTime, long step,
|
||||
Check check) {
|
||||
Check check) throws Exception {
|
||||
long start = currentTimeMillis();
|
||||
while (currentTimeMillis() - start < totalTime) {
|
||||
if (check.check()) {
|
||||
|
||||
@@ -13,9 +13,7 @@ import org.briarproject.bramble.api.mailbox.MailboxAuthToken;
|
||||
import org.briarproject.bramble.api.mailbox.MailboxPairingState.Paired;
|
||||
import org.briarproject.bramble.api.mailbox.MailboxPairingTask;
|
||||
import org.briarproject.bramble.api.mailbox.MailboxProperties;
|
||||
import org.briarproject.bramble.mailbox.MailboxApi.ApiException;
|
||||
import org.briarproject.bramble.test.BrambleTestCase;
|
||||
import org.briarproject.mailbox.lib.Mailbox;
|
||||
import org.briarproject.mailbox.lib.TestMailbox;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
@@ -24,15 +22,11 @@ import org.junit.Test;
|
||||
import org.junit.rules.TemporaryFolder;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import static java.util.logging.Level.WARNING;
|
||||
import static java.util.logging.Logger.getLogger;
|
||||
import static org.briarproject.bramble.api.mailbox.MailboxAuthToken.fromString;
|
||||
import static org.briarproject.bramble.mailbox.MailboxIntegrationTestUtils.createMailboxApi;
|
||||
import static org.briarproject.bramble.mailbox.MailboxIntegrationTestUtils.createTestComponent;
|
||||
@@ -41,18 +35,14 @@ import static org.briarproject.bramble.mailbox.MailboxIntegrationTestUtils.retry
|
||||
import static org.briarproject.bramble.test.TestUtils.getSecretKey;
|
||||
import static org.briarproject.bramble.test.TestUtils.getTestDirectory;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.fail;
|
||||
|
||||
public class OwnMailboxContactListWorkerIntegrationTest
|
||||
extends BrambleTestCase {
|
||||
|
||||
private static final Logger LOG = getLogger(
|
||||
OwnMailboxContactListWorkerIntegrationTest.class.getName());
|
||||
|
||||
@Rule
|
||||
public TemporaryFolder mailboxDataDirectory = new TemporaryFolder();
|
||||
|
||||
private Mailbox mailbox;
|
||||
private TestMailbox mailbox;
|
||||
|
||||
private final MailboxApi api = createMailboxApi();
|
||||
|
||||
@@ -70,7 +60,6 @@ public class OwnMailboxContactListWorkerIntegrationTest
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
mailbox = new TestMailbox(mailboxDataDirectory.getRoot());
|
||||
mailbox.init();
|
||||
mailbox.startLifecycle();
|
||||
|
||||
MailboxAuthToken setupToken = fromString(mailbox.getSetupToken());
|
||||
@@ -119,24 +108,18 @@ public class OwnMailboxContactListWorkerIntegrationTest
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUploadContacts() throws DbException {
|
||||
public void testUploadContacts() throws Exception {
|
||||
int numContactsToAdd = 5;
|
||||
List<ContactId> expectedContacts =
|
||||
createContacts(component, identity, numContactsToAdd);
|
||||
|
||||
// Check for number of contacts on mailbox via API every 100ms
|
||||
retryUntilSuccessOrTimeout(1000, 100, () -> {
|
||||
try {
|
||||
Collection<ContactId> contacts =
|
||||
api.getContacts(ownerProperties);
|
||||
Collection<ContactId> contacts = api.getContacts(ownerProperties);
|
||||
if (contacts.size() == numContactsToAdd) {
|
||||
assertEquals(expectedContacts, contacts);
|
||||
return true;
|
||||
}
|
||||
} catch (IOException | ApiException e) {
|
||||
LOG.log(WARNING, "Error while fetching contacts via API", e);
|
||||
fail();
|
||||
}
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
@@ -8,9 +8,9 @@ include ':briar-android'
|
||||
include ':briar-headless'
|
||||
// Enable the mailbox integration tests by passing
|
||||
// `MAILBOX_INTEGRATION_TESTS=true ./gradlew mailbox-integration-tests:test`
|
||||
// on the command line (for CI etc) or set `mailbox-integration-tests=true`
|
||||
// on the command line (for CI etc) or set `briar.mailbox_integration_tests=true`
|
||||
// in gradle.properties to enable the modules for local development.
|
||||
if (ext.has("mailbox-integration-tests") && ext.get("mailbox-integration-tests") == "true"
|
||||
if (ext.has("briar.mailbox_integration_tests") && ext.get("briar.mailbox_integration_tests") == "true"
|
||||
|| System.env.MAILBOX_INTEGRATION_TESTS) {
|
||||
include ':mailbox-integration-tests'
|
||||
include(":mailbox-core")
|
||||
|
||||
Reference in New Issue
Block a user