mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-11 18:29:05 +01:00
Move integration tests to their proper packages
This commit is contained in:
@@ -1,4 +1,8 @@
|
|||||||
apply plugin: 'java'
|
plugins {
|
||||||
|
id "java"
|
||||||
|
id "net.ltgt.apt" version "0.9"
|
||||||
|
id "idea"
|
||||||
|
}
|
||||||
sourceCompatibility = 1.6
|
sourceCompatibility = 1.6
|
||||||
targetCompatibility = 1.6
|
targetCompatibility = 1.6
|
||||||
|
|
||||||
@@ -9,6 +13,11 @@ dependencies {
|
|||||||
compile fileTree(dir: 'libs', include: '*.jar')
|
compile fileTree(dir: 'libs', include: '*.jar')
|
||||||
compile 'com.madgag.spongycastle:core:1.54.0.0'
|
compile 'com.madgag.spongycastle:core:1.54.0.0'
|
||||||
compile 'com.h2database:h2:1.4.190'
|
compile 'com.h2database:h2:1.4.190'
|
||||||
|
|
||||||
|
testCompile project(':briar-tests') // TODO remove when moving unit tests (#778)
|
||||||
|
testCompile 'junit:junit:4.12'
|
||||||
|
testCompile 'com.google.dagger:dagger-compiler:2.8'
|
||||||
|
testApt 'com.google.dagger:dagger-compiler:2.8'
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencyVerification {
|
dependencyVerification {
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
package org.briarproject;
|
package org.briarproject.bramble.sync;
|
||||||
|
|
||||||
|
import org.briarproject.BriarTestCase;
|
||||||
|
import org.briarproject.TestUtils;
|
||||||
import org.briarproject.bramble.api.contact.ContactId;
|
import org.briarproject.bramble.api.contact.ContactId;
|
||||||
import org.briarproject.bramble.api.crypto.CryptoComponent;
|
import org.briarproject.bramble.api.crypto.CryptoComponent;
|
||||||
import org.briarproject.bramble.api.crypto.SecretKey;
|
import org.briarproject.bramble.api.crypto.SecretKey;
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
package org.briarproject;
|
package org.briarproject.bramble.sync;
|
||||||
|
|
||||||
|
import org.briarproject.TestSeedProviderModule;
|
||||||
import org.briarproject.bramble.crypto.CryptoModule;
|
import org.briarproject.bramble.crypto.CryptoModule;
|
||||||
import org.briarproject.bramble.sync.SyncModule;
|
|
||||||
import org.briarproject.bramble.transport.TransportModule;
|
import org.briarproject.bramble.transport.TransportModule;
|
||||||
|
|
||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
5
briar-android-tests/.gitignore
vendored
5
briar-android-tests/.gitignore
vendored
@@ -1,5 +0,0 @@
|
|||||||
bin
|
|
||||||
gen
|
|
||||||
build
|
|
||||||
local.properties
|
|
||||||
.settings
|
|
||||||
@@ -1,27 +0,0 @@
|
|||||||
apply plugin: 'com.android.library'
|
|
||||||
apply plugin: 'com.neenbedankt.android-apt'
|
|
||||||
|
|
||||||
android {
|
|
||||||
compileSdkVersion 23
|
|
||||||
buildToolsVersion "23.0.3"
|
|
||||||
|
|
||||||
defaultConfig {
|
|
||||||
minSdkVersion 14
|
|
||||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), '../briar-android/proguard-rules.txt'
|
|
||||||
consumerProguardFiles getDefaultProguardFile('proguard-android.txt'), '../briar-android/proguard-rules.txt'
|
|
||||||
}
|
|
||||||
|
|
||||||
compileOptions {
|
|
||||||
sourceCompatibility JavaVersion.VERSION_1_7
|
|
||||||
targetCompatibility JavaVersion.VERSION_1_7
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
dependencies {
|
|
||||||
testCompile project(':briar-tests')
|
|
||||||
testCompile 'junit:junit:4.12'
|
|
||||||
testCompile 'net.jodah:concurrentunit:0.4.2'
|
|
||||||
testCompile 'com.android.support:appcompat-v7:23.2.1'
|
|
||||||
testApt 'com.google.dagger:dagger-compiler:2.0.2'
|
|
||||||
provided 'javax.annotation:jsr250-api:1.0'
|
|
||||||
}
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
<manifest package="org.briarproject"
|
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
|
||||||
|
|
||||||
<application
|
|
||||||
android:allowBackup="true"
|
|
||||||
android:label="@string/app_name"
|
|
||||||
android:supportsRtl="true"
|
|
||||||
>
|
|
||||||
|
|
||||||
</application>
|
|
||||||
|
|
||||||
</manifest>
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
<resources>
|
|
||||||
<string name="app_name">briar-android-tests</string>
|
|
||||||
</resources>
|
|
||||||
@@ -37,8 +37,6 @@ dependencies {
|
|||||||
compile 'uk.co.samuelwall:material-tap-target-prompt:1.3.0'
|
compile 'uk.co.samuelwall:material-tap-target-prompt:1.3.0'
|
||||||
|
|
||||||
testCompile 'junit:junit:4.12'
|
testCompile 'junit:junit:4.12'
|
||||||
testCompile 'net.jodah:concurrentunit:0.4.2'
|
|
||||||
testApt 'com.google.dagger:dagger-compiler:2.0.2'
|
|
||||||
testCompile project(path: ':briar-tests')
|
testCompile project(path: ':briar-tests')
|
||||||
testCompile 'org.robolectric:robolectric:3.0'
|
testCompile 'org.robolectric:robolectric:3.0'
|
||||||
testCompile 'org.mockito:mockito-core:1.10.19'
|
testCompile 'org.mockito:mockito-core:1.10.19'
|
||||||
|
|||||||
@@ -1,4 +1,8 @@
|
|||||||
apply plugin: 'java'
|
plugins {
|
||||||
|
id "java"
|
||||||
|
id "net.ltgt.apt" version "0.9"
|
||||||
|
id "idea"
|
||||||
|
}
|
||||||
sourceCompatibility = 1.6
|
sourceCompatibility = 1.6
|
||||||
targetCompatibility = 1.6
|
targetCompatibility = 1.6
|
||||||
|
|
||||||
@@ -11,6 +15,12 @@ dependencies {
|
|||||||
compile 'org.jdom:jdom2:2.0.6'
|
compile 'org.jdom:jdom2:2.0.6'
|
||||||
compile 'com.squareup.okhttp3:okhttp:3.3.1'
|
compile 'com.squareup.okhttp3:okhttp:3.3.1'
|
||||||
compile 'org.jsoup:jsoup:1.9.2'
|
compile 'org.jsoup:jsoup:1.9.2'
|
||||||
|
|
||||||
|
testCompile project(':briar-tests') // TODO remove when moving unit tests (#778)
|
||||||
|
testCompile 'junit:junit:4.12'
|
||||||
|
testCompile 'net.jodah:concurrentunit:0.4.2'
|
||||||
|
testCompile 'com.google.dagger:dagger-compiler:2.8'
|
||||||
|
testApt 'com.google.dagger:dagger-compiler:2.8'
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencyVerification {
|
dependencyVerification {
|
||||||
@@ -24,4 +34,3 @@ dependencyVerification {
|
|||||||
'org.slf4j:slf4j-api:e56288031f5e60652c06e7bb6e9fa410a61231ab54890f7b708fc6adc4107c5b'
|
'org.slf4j:slf4j-api:e56288031f5e60652c06e7bb6e9fa410a61231ab54890f7b708fc6adc4107c5b'
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
package org.briarproject;
|
package org.briarproject.briar;
|
||||||
|
|
||||||
import android.support.annotation.CallSuper;
|
|
||||||
|
|
||||||
import net.jodah.concurrentunit.Waiter;
|
import net.jodah.concurrentunit.Waiter;
|
||||||
|
|
||||||
|
import org.briarproject.BriarTestCase;
|
||||||
|
import org.briarproject.TestUtils;
|
||||||
import org.briarproject.bramble.api.client.ClientHelper;
|
import org.briarproject.bramble.api.client.ClientHelper;
|
||||||
import org.briarproject.bramble.api.client.ContactGroupFactory;
|
import org.briarproject.bramble.api.client.ContactGroupFactory;
|
||||||
import org.briarproject.bramble.api.contact.Contact;
|
import org.briarproject.bramble.api.contact.Contact;
|
||||||
@@ -101,19 +101,19 @@ public abstract class BriarIntegrationTest<C extends BriarIntegrationTestCompone
|
|||||||
@Inject
|
@Inject
|
||||||
protected AuthorFactory authorFactory;
|
protected AuthorFactory authorFactory;
|
||||||
@Inject
|
@Inject
|
||||||
ContactGroupFactory contactGroupFactory;
|
protected ContactGroupFactory contactGroupFactory;
|
||||||
@Inject
|
@Inject
|
||||||
PrivateGroupFactory privateGroupFactory;
|
protected PrivateGroupFactory privateGroupFactory;
|
||||||
@Inject
|
@Inject
|
||||||
GroupMessageFactory groupMessageFactory;
|
protected GroupMessageFactory groupMessageFactory;
|
||||||
@Inject
|
@Inject
|
||||||
GroupInvitationFactory groupInvitationFactory;
|
protected GroupInvitationFactory groupInvitationFactory;
|
||||||
@Inject
|
@Inject
|
||||||
BlogFactory blogFactory;
|
protected BlogFactory blogFactory;
|
||||||
@Inject
|
@Inject
|
||||||
BlogPostFactory blogPostFactory;
|
protected BlogPostFactory blogPostFactory;
|
||||||
@Inject
|
@Inject
|
||||||
ForumPostFactory forumPostFactory;
|
protected ForumPostFactory forumPostFactory;
|
||||||
|
|
||||||
// objects accessed from background threads need to be volatile
|
// objects accessed from background threads need to be volatile
|
||||||
private volatile Waiter validationWaiter;
|
private volatile Waiter validationWaiter;
|
||||||
@@ -132,7 +132,6 @@ public abstract class BriarIntegrationTest<C extends BriarIntegrationTestCompone
|
|||||||
protected File t2Dir = new File(testDir, AUTHOR2);
|
protected File t2Dir = new File(testDir, AUTHOR2);
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
@CallSuper
|
|
||||||
public void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
assertTrue(testDir.mkdirs());
|
assertTrue(testDir.mkdirs());
|
||||||
createComponents();
|
createComponents();
|
||||||
@@ -1,5 +1,8 @@
|
|||||||
package org.briarproject;
|
package org.briarproject.briar;
|
||||||
|
|
||||||
|
import org.briarproject.TestDatabaseModule;
|
||||||
|
import org.briarproject.TestPluginConfigModule;
|
||||||
|
import org.briarproject.TestSeedProviderModule;
|
||||||
import org.briarproject.bramble.api.client.ClientHelper;
|
import org.briarproject.bramble.api.client.ClientHelper;
|
||||||
import org.briarproject.bramble.api.contact.ContactManager;
|
import org.briarproject.bramble.api.contact.ContactManager;
|
||||||
import org.briarproject.bramble.api.db.DatabaseComponent;
|
import org.briarproject.bramble.api.db.DatabaseComponent;
|
||||||
@@ -1,7 +1,11 @@
|
|||||||
package org.briarproject;
|
package org.briarproject.briar.blog;
|
||||||
|
|
||||||
|
import org.briarproject.TestDatabaseModule;
|
||||||
import org.briarproject.bramble.api.db.DbException;
|
import org.briarproject.bramble.api.db.DbException;
|
||||||
import org.briarproject.bramble.api.sync.MessageId;
|
import org.briarproject.bramble.api.sync.MessageId;
|
||||||
|
import org.briarproject.briar.BriarIntegrationTest;
|
||||||
|
import org.briarproject.briar.BriarIntegrationTestComponent;
|
||||||
|
import org.briarproject.briar.DaggerBriarIntegrationTestComponent;
|
||||||
import org.briarproject.briar.api.blog.Blog;
|
import org.briarproject.briar.api.blog.Blog;
|
||||||
import org.briarproject.briar.api.blog.BlogCommentHeader;
|
import org.briarproject.briar.api.blog.BlogCommentHeader;
|
||||||
import org.briarproject.briar.api.blog.BlogManager;
|
import org.briarproject.briar.api.blog.BlogManager;
|
||||||
@@ -17,6 +21,7 @@ import java.util.Iterator;
|
|||||||
|
|
||||||
import static junit.framework.Assert.assertFalse;
|
import static junit.framework.Assert.assertFalse;
|
||||||
import static junit.framework.Assert.assertNotNull;
|
import static junit.framework.Assert.assertNotNull;
|
||||||
|
import static org.briarproject.TestUtils.getRandomString;
|
||||||
import static org.briarproject.briar.api.blog.MessageType.COMMENT;
|
import static org.briarproject.briar.api.blog.MessageType.COMMENT;
|
||||||
import static org.briarproject.briar.api.blog.MessageType.POST;
|
import static org.briarproject.briar.api.blog.MessageType.POST;
|
||||||
import static org.briarproject.briar.api.blog.MessageType.WRAPPED_COMMENT;
|
import static org.briarproject.briar.api.blog.MessageType.WRAPPED_COMMENT;
|
||||||
@@ -24,7 +29,7 @@ import static org.briarproject.briar.api.blog.MessageType.WRAPPED_POST;
|
|||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
import static org.junit.Assert.assertTrue;
|
import static org.junit.Assert.assertTrue;
|
||||||
|
|
||||||
public class BlogManagerTest
|
public class BlogManagerIntegrationTest
|
||||||
extends BriarIntegrationTest<BriarIntegrationTestComponent> {
|
extends BriarIntegrationTest<BriarIntegrationTestComponent> {
|
||||||
|
|
||||||
private BlogManager blogManager0, blogManager1;
|
private BlogManager blogManager0, blogManager1;
|
||||||
@@ -101,7 +106,7 @@ public class BlogManagerTest
|
|||||||
@Test
|
@Test
|
||||||
public void testBlogPost() throws Exception {
|
public void testBlogPost() throws Exception {
|
||||||
// check that blog0 has no posts
|
// check that blog0 has no posts
|
||||||
final String body = TestUtils.getRandomString(42);
|
final String body = getRandomString(42);
|
||||||
Collection<BlogPostHeader> headers0 =
|
Collection<BlogPostHeader> headers0 =
|
||||||
blogManager0.getPostHeaders(blog0.getId());
|
blogManager0.getPostHeaders(blog0.getId());
|
||||||
assertEquals(0, headers0.size());
|
assertEquals(0, headers0.size());
|
||||||
@@ -139,7 +144,7 @@ public class BlogManagerTest
|
|||||||
@Test
|
@Test
|
||||||
public void testBlogPostInWrongBlog() throws Exception {
|
public void testBlogPostInWrongBlog() throws Exception {
|
||||||
// add a post to blog1
|
// add a post to blog1
|
||||||
final String body = TestUtils.getRandomString(42);
|
final String body = getRandomString(42);
|
||||||
BlogPost p = blogPostFactory
|
BlogPost p = blogPostFactory
|
||||||
.createBlogPost(blog1.getId(), clock.currentTimeMillis(), null,
|
.createBlogPost(blog1.getId(), clock.currentTimeMillis(), null,
|
||||||
author0, body);
|
author0, body);
|
||||||
@@ -178,7 +183,7 @@ public class BlogManagerTest
|
|||||||
@Test
|
@Test
|
||||||
public void testBlogComment() throws Exception {
|
public void testBlogComment() throws Exception {
|
||||||
// add a post to blog0
|
// add a post to blog0
|
||||||
final String body = TestUtils.getRandomString(42);
|
final String body = getRandomString(42);
|
||||||
BlogPost p = blogPostFactory
|
BlogPost p = blogPostFactory
|
||||||
.createBlogPost(blog0.getId(), clock.currentTimeMillis(), null,
|
.createBlogPost(blog0.getId(), clock.currentTimeMillis(), null,
|
||||||
author0, body);
|
author0, body);
|
||||||
@@ -223,7 +228,7 @@ public class BlogManagerTest
|
|||||||
@Test
|
@Test
|
||||||
public void testBlogCommentOnOwnPost() throws Exception {
|
public void testBlogCommentOnOwnPost() throws Exception {
|
||||||
// add a post to blog0
|
// add a post to blog0
|
||||||
final String body = TestUtils.getRandomString(42);
|
final String body = getRandomString(42);
|
||||||
BlogPost p = blogPostFactory
|
BlogPost p = blogPostFactory
|
||||||
.createBlogPost(blog0.getId(), clock.currentTimeMillis(), null,
|
.createBlogPost(blog0.getId(), clock.currentTimeMillis(), null,
|
||||||
author0, body);
|
author0, body);
|
||||||
@@ -259,7 +264,7 @@ public class BlogManagerTest
|
|||||||
@Test
|
@Test
|
||||||
public void testCommentOnComment() throws Exception {
|
public void testCommentOnComment() throws Exception {
|
||||||
// add a post to blog0
|
// add a post to blog0
|
||||||
final String body = TestUtils.getRandomString(42);
|
final String body = getRandomString(42);
|
||||||
BlogPost p = blogPostFactory
|
BlogPost p = blogPostFactory
|
||||||
.createBlogPost(blog0.getId(), clock.currentTimeMillis(), null,
|
.createBlogPost(blog0.getId(), clock.currentTimeMillis(), null,
|
||||||
author0, body);
|
author0, body);
|
||||||
@@ -349,7 +354,7 @@ public class BlogManagerTest
|
|||||||
@Test
|
@Test
|
||||||
public void testCommentOnOwnComment() throws Exception {
|
public void testCommentOnOwnComment() throws Exception {
|
||||||
// add a post to blog0
|
// add a post to blog0
|
||||||
final String body = TestUtils.getRandomString(42);
|
final String body = getRandomString(42);
|
||||||
BlogPost p = blogPostFactory
|
BlogPost p = blogPostFactory
|
||||||
.createBlogPost(blog0.getId(), clock.currentTimeMillis(), null,
|
.createBlogPost(blog0.getId(), clock.currentTimeMillis(), null,
|
||||||
author0, body);
|
author0, body);
|
||||||
@@ -1,8 +1,10 @@
|
|||||||
package org.briarproject;
|
package org.briarproject.briar.forum;
|
||||||
|
|
||||||
import junit.framework.Assert;
|
|
||||||
|
|
||||||
|
import org.briarproject.TestDatabaseModule;
|
||||||
import org.briarproject.bramble.api.sync.GroupId;
|
import org.briarproject.bramble.api.sync.GroupId;
|
||||||
|
import org.briarproject.briar.BriarIntegrationTest;
|
||||||
|
import org.briarproject.briar.BriarIntegrationTestComponent;
|
||||||
|
import org.briarproject.briar.DaggerBriarIntegrationTestComponent;
|
||||||
import org.briarproject.briar.api.forum.Forum;
|
import org.briarproject.briar.api.forum.Forum;
|
||||||
import org.briarproject.briar.api.forum.ForumManager;
|
import org.briarproject.briar.api.forum.ForumManager;
|
||||||
import org.briarproject.briar.api.forum.ForumPost;
|
import org.briarproject.briar.api.forum.ForumPost;
|
||||||
@@ -15,10 +17,10 @@ import java.util.Collection;
|
|||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
import static junit.framework.Assert.assertEquals;
|
|
||||||
import static junit.framework.Assert.assertNull;
|
|
||||||
import static junit.framework.TestCase.assertFalse;
|
|
||||||
import static org.briarproject.TestUtils.assertGroupCount;
|
import static org.briarproject.TestUtils.assertGroupCount;
|
||||||
|
import static org.junit.Assert.assertEquals;
|
||||||
|
import static org.junit.Assert.assertFalse;
|
||||||
|
import static org.junit.Assert.assertNull;
|
||||||
import static org.junit.Assert.assertTrue;
|
import static org.junit.Assert.assertTrue;
|
||||||
|
|
||||||
public class ForumManagerTest
|
public class ForumManagerTest
|
||||||
@@ -110,7 +112,7 @@ public class ForumManagerTest
|
|||||||
|
|
||||||
boolean isPost1 = h.getId().equals(post1.getMessage().getId());
|
boolean isPost1 = h.getId().equals(post1.getMessage().getId());
|
||||||
boolean isPost2 = h.getId().equals(post2.getMessage().getId());
|
boolean isPost2 = h.getId().equals(post2.getMessage().getId());
|
||||||
Assert.assertTrue(isPost1 || isPost2);
|
assertTrue(isPost1 || isPost2);
|
||||||
if (isPost1) {
|
if (isPost1) {
|
||||||
assertEquals(h.getTimestamp(), ms1);
|
assertEquals(h.getTimestamp(), ms1);
|
||||||
assertEquals(body1, hBody);
|
assertEquals(body1, hBody);
|
||||||
@@ -2,7 +2,6 @@ package org.briarproject.briar.introduction;
|
|||||||
|
|
||||||
import net.jodah.concurrentunit.Waiter;
|
import net.jodah.concurrentunit.Waiter;
|
||||||
|
|
||||||
import org.briarproject.BriarIntegrationTest;
|
|
||||||
import org.briarproject.TestDatabaseModule;
|
import org.briarproject.TestDatabaseModule;
|
||||||
import org.briarproject.TestUtils;
|
import org.briarproject.TestUtils;
|
||||||
import org.briarproject.bramble.api.FormatException;
|
import org.briarproject.bramble.api.FormatException;
|
||||||
@@ -27,6 +26,7 @@ import org.briarproject.bramble.api.properties.TransportPropertyManager;
|
|||||||
import org.briarproject.bramble.api.sync.Group;
|
import org.briarproject.bramble.api.sync.Group;
|
||||||
import org.briarproject.bramble.api.sync.GroupId;
|
import org.briarproject.bramble.api.sync.GroupId;
|
||||||
import org.briarproject.bramble.api.sync.MessageId;
|
import org.briarproject.bramble.api.sync.MessageId;
|
||||||
|
import org.briarproject.briar.BriarIntegrationTest;
|
||||||
import org.briarproject.briar.api.client.SessionId;
|
import org.briarproject.briar.api.client.SessionId;
|
||||||
import org.briarproject.briar.api.introduction.IntroductionManager;
|
import org.briarproject.briar.api.introduction.IntroductionManager;
|
||||||
import org.briarproject.briar.api.introduction.IntroductionMessage;
|
import org.briarproject.briar.api.introduction.IntroductionMessage;
|
||||||
@@ -454,7 +454,7 @@ public class IntroductionIntegrationTest
|
|||||||
assertTrue(listener1.requestReceived);
|
assertTrue(listener1.requestReceived);
|
||||||
|
|
||||||
// get SessionId
|
// get SessionId
|
||||||
List<IntroductionMessage> list = new ArrayList<>(
|
List<IntroductionMessage> list = new ArrayList<IntroductionMessage>(
|
||||||
introductionManager1.getIntroductionMessages(contactId0From1));
|
introductionManager1.getIntroductionMessages(contactId0From1));
|
||||||
assertEquals(2, list.size());
|
assertEquals(2, list.size());
|
||||||
assertTrue(list.get(0) instanceof IntroductionRequest);
|
assertTrue(list.get(0) instanceof IntroductionRequest);
|
||||||
@@ -906,7 +906,9 @@ public class IntroductionIntegrationTest
|
|||||||
time);
|
time);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (DbException | IOException exception) {
|
} catch (DbException exception) {
|
||||||
|
eventWaiter.rethrow(exception);
|
||||||
|
} catch (FormatException exception) {
|
||||||
eventWaiter.rethrow(exception);
|
eventWaiter.rethrow(exception);
|
||||||
} finally {
|
} finally {
|
||||||
eventWaiter.resume();
|
eventWaiter.resume();
|
||||||
@@ -1,6 +1,5 @@
|
|||||||
package org.briarproject.briar.introduction;
|
package org.briarproject.briar.introduction;
|
||||||
|
|
||||||
import org.briarproject.BriarIntegrationTestComponent;
|
|
||||||
import org.briarproject.TestDatabaseModule;
|
import org.briarproject.TestDatabaseModule;
|
||||||
import org.briarproject.TestPluginConfigModule;
|
import org.briarproject.TestPluginConfigModule;
|
||||||
import org.briarproject.TestSeedProviderModule;
|
import org.briarproject.TestSeedProviderModule;
|
||||||
@@ -16,6 +15,7 @@ import org.briarproject.bramble.properties.PropertiesModule;
|
|||||||
import org.briarproject.bramble.sync.SyncModule;
|
import org.briarproject.bramble.sync.SyncModule;
|
||||||
import org.briarproject.bramble.system.SystemModule;
|
import org.briarproject.bramble.system.SystemModule;
|
||||||
import org.briarproject.bramble.transport.TransportModule;
|
import org.briarproject.bramble.transport.TransportModule;
|
||||||
|
import org.briarproject.briar.BriarIntegrationTestComponent;
|
||||||
import org.briarproject.briar.blog.BlogModule;
|
import org.briarproject.briar.blog.BlogModule;
|
||||||
import org.briarproject.briar.client.BriarClientModule;
|
import org.briarproject.briar.client.BriarClientModule;
|
||||||
import org.briarproject.briar.forum.ForumModule;
|
import org.briarproject.briar.forum.ForumModule;
|
||||||
@@ -1,5 +1,7 @@
|
|||||||
package org.briarproject;
|
package org.briarproject.briar.messaging;
|
||||||
|
|
||||||
|
import org.briarproject.BriarTestCase;
|
||||||
|
import org.briarproject.TestUtils;
|
||||||
import org.briarproject.bramble.api.UniqueId;
|
import org.briarproject.bramble.api.UniqueId;
|
||||||
import org.briarproject.bramble.api.crypto.CryptoComponent;
|
import org.briarproject.bramble.api.crypto.CryptoComponent;
|
||||||
import org.briarproject.bramble.api.crypto.PrivateKey;
|
import org.briarproject.bramble.api.crypto.PrivateKey;
|
||||||
@@ -18,6 +20,7 @@ import org.junit.Test;
|
|||||||
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
|
||||||
|
import static org.briarproject.TestUtils.getRandomId;
|
||||||
import static org.briarproject.bramble.api.identity.AuthorConstants.MAX_AUTHOR_NAME_LENGTH;
|
import static org.briarproject.bramble.api.identity.AuthorConstants.MAX_AUTHOR_NAME_LENGTH;
|
||||||
import static org.briarproject.bramble.api.identity.AuthorConstants.MAX_PUBLIC_KEY_LENGTH;
|
import static org.briarproject.bramble.api.identity.AuthorConstants.MAX_PUBLIC_KEY_LENGTH;
|
||||||
import static org.briarproject.bramble.api.sync.SyncConstants.MAX_PACKET_PAYLOAD_LENGTH;
|
import static org.briarproject.bramble.api.sync.SyncConstants.MAX_PACKET_PAYLOAD_LENGTH;
|
||||||
@@ -46,7 +49,7 @@ public class MessageSizeIntegrationTest extends BriarTestCase {
|
|||||||
@Test
|
@Test
|
||||||
public void testPrivateMessageFitsIntoPacket() throws Exception {
|
public void testPrivateMessageFitsIntoPacket() throws Exception {
|
||||||
// Create a maximum-length private message
|
// Create a maximum-length private message
|
||||||
GroupId groupId = new GroupId(TestUtils.getRandomId());
|
GroupId groupId = new GroupId(getRandomId());
|
||||||
long timestamp = Long.MAX_VALUE;
|
long timestamp = Long.MAX_VALUE;
|
||||||
String body =
|
String body =
|
||||||
StringUtils.fromUtf8(new byte[MAX_PRIVATE_MESSAGE_BODY_LENGTH]);
|
StringUtils.fromUtf8(new byte[MAX_PRIVATE_MESSAGE_BODY_LENGTH]);
|
||||||
@@ -70,9 +73,9 @@ public class MessageSizeIntegrationTest extends BriarTestCase {
|
|||||||
.createLocalAuthor(authorName, authorPublic,
|
.createLocalAuthor(authorName, authorPublic,
|
||||||
privateKey.getEncoded());
|
privateKey.getEncoded());
|
||||||
// Create a maximum-length forum post
|
// Create a maximum-length forum post
|
||||||
GroupId groupId = new GroupId(TestUtils.getRandomId());
|
GroupId groupId = new GroupId(getRandomId());
|
||||||
long timestamp = Long.MAX_VALUE;
|
long timestamp = Long.MAX_VALUE;
|
||||||
MessageId parent = new MessageId(TestUtils.getRandomId());
|
MessageId parent = new MessageId(getRandomId());
|
||||||
String body = TestUtils.getRandomString(MAX_FORUM_POST_BODY_LENGTH);
|
String body = TestUtils.getRandomString(MAX_FORUM_POST_BODY_LENGTH);
|
||||||
ForumPost post = forumPostFactory.createPost(groupId,
|
ForumPost post = forumPostFactory.createPost(groupId,
|
||||||
timestamp, parent, author, body);
|
timestamp, parent, author, body);
|
||||||
@@ -1,5 +1,8 @@
|
|||||||
package org.briarproject;
|
package org.briarproject.briar.messaging;
|
||||||
|
|
||||||
|
import org.briarproject.TestDatabaseModule;
|
||||||
|
import org.briarproject.TestLifecycleModule;
|
||||||
|
import org.briarproject.TestSeedProviderModule;
|
||||||
import org.briarproject.bramble.client.ClientModule;
|
import org.briarproject.bramble.client.ClientModule;
|
||||||
import org.briarproject.bramble.crypto.CryptoModule;
|
import org.briarproject.bramble.crypto.CryptoModule;
|
||||||
import org.briarproject.bramble.data.DataModule;
|
import org.briarproject.bramble.data.DataModule;
|
||||||
@@ -10,7 +13,6 @@ import org.briarproject.bramble.sync.SyncModule;
|
|||||||
import org.briarproject.bramble.system.SystemModule;
|
import org.briarproject.bramble.system.SystemModule;
|
||||||
import org.briarproject.briar.client.BriarClientModule;
|
import org.briarproject.briar.client.BriarClientModule;
|
||||||
import org.briarproject.briar.forum.ForumModule;
|
import org.briarproject.briar.forum.ForumModule;
|
||||||
import org.briarproject.briar.messaging.MessagingModule;
|
|
||||||
|
|
||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
@@ -1,5 +1,8 @@
|
|||||||
package org.briarproject;
|
package org.briarproject.briar.messaging;
|
||||||
|
|
||||||
|
import org.briarproject.BriarTestCase;
|
||||||
|
import org.briarproject.TestDatabaseModule;
|
||||||
|
import org.briarproject.TestUtils;
|
||||||
import org.briarproject.bramble.api.contact.ContactId;
|
import org.briarproject.bramble.api.contact.ContactId;
|
||||||
import org.briarproject.bramble.api.contact.ContactManager;
|
import org.briarproject.bramble.api.contact.ContactManager;
|
||||||
import org.briarproject.bramble.api.crypto.SecretKey;
|
import org.briarproject.bramble.api.crypto.SecretKey;
|
||||||
@@ -23,7 +26,6 @@ import org.briarproject.bramble.system.SystemModule;
|
|||||||
import org.briarproject.briar.api.messaging.MessagingManager;
|
import org.briarproject.briar.api.messaging.MessagingManager;
|
||||||
import org.briarproject.briar.api.messaging.PrivateMessage;
|
import org.briarproject.briar.api.messaging.PrivateMessage;
|
||||||
import org.briarproject.briar.api.messaging.PrivateMessageFactory;
|
import org.briarproject.briar.api.messaging.PrivateMessageFactory;
|
||||||
import org.briarproject.briar.messaging.MessagingModule;
|
|
||||||
import org.junit.After;
|
import org.junit.After;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
@@ -1,5 +1,8 @@
|
|||||||
package org.briarproject;
|
package org.briarproject.briar.messaging;
|
||||||
|
|
||||||
|
import org.briarproject.TestDatabaseModule;
|
||||||
|
import org.briarproject.TestPluginConfigModule;
|
||||||
|
import org.briarproject.TestSeedProviderModule;
|
||||||
import org.briarproject.bramble.api.contact.ContactManager;
|
import org.briarproject.bramble.api.contact.ContactManager;
|
||||||
import org.briarproject.bramble.api.event.EventBus;
|
import org.briarproject.bramble.api.event.EventBus;
|
||||||
import org.briarproject.bramble.api.identity.IdentityManager;
|
import org.briarproject.bramble.api.identity.IdentityManager;
|
||||||
@@ -22,7 +25,6 @@ import org.briarproject.bramble.transport.TransportModule;
|
|||||||
import org.briarproject.briar.api.messaging.MessagingManager;
|
import org.briarproject.briar.api.messaging.MessagingManager;
|
||||||
import org.briarproject.briar.api.messaging.PrivateMessageFactory;
|
import org.briarproject.briar.api.messaging.PrivateMessageFactory;
|
||||||
import org.briarproject.briar.client.BriarClientModule;
|
import org.briarproject.briar.client.BriarClientModule;
|
||||||
import org.briarproject.briar.messaging.MessagingModule;
|
|
||||||
|
|
||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
@@ -1,7 +1,11 @@
|
|||||||
package org.briarproject;
|
package org.briarproject.briar.privategroup;
|
||||||
|
|
||||||
|
import org.briarproject.TestDatabaseModule;
|
||||||
import org.briarproject.bramble.api.db.DbException;
|
import org.briarproject.bramble.api.db.DbException;
|
||||||
import org.briarproject.bramble.api.sync.Group;
|
import org.briarproject.bramble.api.sync.Group;
|
||||||
|
import org.briarproject.briar.BriarIntegrationTest;
|
||||||
|
import org.briarproject.briar.BriarIntegrationTestComponent;
|
||||||
|
import org.briarproject.briar.DaggerBriarIntegrationTestComponent;
|
||||||
import org.briarproject.briar.api.client.ProtocolStateException;
|
import org.briarproject.briar.api.client.ProtocolStateException;
|
||||||
import org.briarproject.briar.api.privategroup.GroupMessage;
|
import org.briarproject.briar.api.privategroup.GroupMessage;
|
||||||
import org.briarproject.briar.api.privategroup.PrivateGroup;
|
import org.briarproject.briar.api.privategroup.PrivateGroup;
|
||||||
@@ -18,11 +22,11 @@ import java.util.Collection;
|
|||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
import static junit.framework.TestCase.fail;
|
|
||||||
import static org.briarproject.TestUtils.assertGroupCount;
|
import static org.briarproject.TestUtils.assertGroupCount;
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
import static org.junit.Assert.assertFalse;
|
import static org.junit.Assert.assertFalse;
|
||||||
import static org.junit.Assert.assertTrue;
|
import static org.junit.Assert.assertTrue;
|
||||||
|
import static org.junit.Assert.fail;
|
||||||
|
|
||||||
public class GroupInvitationIntegrationTest
|
public class GroupInvitationIntegrationTest
|
||||||
extends BriarIntegrationTest<BriarIntegrationTestComponent> {
|
extends BriarIntegrationTest<BriarIntegrationTestComponent> {
|
||||||
@@ -1,11 +1,15 @@
|
|||||||
package org.briarproject;
|
package org.briarproject.briar.privategroup;
|
||||||
|
|
||||||
|
import org.briarproject.TestDatabaseModule;
|
||||||
import org.briarproject.bramble.api.contact.Contact;
|
import org.briarproject.bramble.api.contact.Contact;
|
||||||
import org.briarproject.bramble.api.contact.ContactId;
|
import org.briarproject.bramble.api.contact.ContactId;
|
||||||
import org.briarproject.bramble.api.db.DbException;
|
import org.briarproject.bramble.api.db.DbException;
|
||||||
import org.briarproject.bramble.api.identity.AuthorId;
|
import org.briarproject.bramble.api.identity.AuthorId;
|
||||||
import org.briarproject.bramble.api.sync.GroupId;
|
import org.briarproject.bramble.api.sync.GroupId;
|
||||||
import org.briarproject.bramble.api.sync.MessageId;
|
import org.briarproject.bramble.api.sync.MessageId;
|
||||||
|
import org.briarproject.briar.BriarIntegrationTest;
|
||||||
|
import org.briarproject.briar.BriarIntegrationTestComponent;
|
||||||
|
import org.briarproject.briar.DaggerBriarIntegrationTestComponent;
|
||||||
import org.briarproject.briar.api.privategroup.GroupMember;
|
import org.briarproject.briar.api.privategroup.GroupMember;
|
||||||
import org.briarproject.briar.api.privategroup.GroupMessage;
|
import org.briarproject.briar.api.privategroup.GroupMessage;
|
||||||
import org.briarproject.briar.api.privategroup.GroupMessageHeader;
|
import org.briarproject.briar.api.privategroup.GroupMessageHeader;
|
||||||
@@ -1,10 +1,14 @@
|
|||||||
package org.briarproject;
|
package org.briarproject.briar.privategroup;
|
||||||
|
|
||||||
|
import org.briarproject.TestDatabaseModule;
|
||||||
import org.briarproject.bramble.api.contact.Contact;
|
import org.briarproject.bramble.api.contact.Contact;
|
||||||
import org.briarproject.bramble.api.data.BdfList;
|
import org.briarproject.bramble.api.data.BdfList;
|
||||||
import org.briarproject.bramble.api.db.Transaction;
|
import org.briarproject.bramble.api.db.Transaction;
|
||||||
import org.briarproject.bramble.api.sync.GroupId;
|
import org.briarproject.bramble.api.sync.GroupId;
|
||||||
import org.briarproject.bramble.api.sync.MessageId;
|
import org.briarproject.bramble.api.sync.MessageId;
|
||||||
|
import org.briarproject.briar.BriarIntegrationTest;
|
||||||
|
import org.briarproject.briar.BriarIntegrationTestComponent;
|
||||||
|
import org.briarproject.briar.DaggerBriarIntegrationTestComponent;
|
||||||
import org.briarproject.briar.api.client.MessageTracker.GroupCount;
|
import org.briarproject.briar.api.client.MessageTracker.GroupCount;
|
||||||
import org.briarproject.briar.api.privategroup.GroupMember;
|
import org.briarproject.briar.api.privategroup.GroupMember;
|
||||||
import org.briarproject.briar.api.privategroup.GroupMessage;
|
import org.briarproject.briar.api.privategroup.GroupMessage;
|
||||||
@@ -18,6 +22,7 @@ import org.junit.Test;
|
|||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
|
||||||
import static org.briarproject.TestUtils.getRandomBytes;
|
import static org.briarproject.TestUtils.getRandomBytes;
|
||||||
|
import static org.briarproject.TestUtils.getRandomId;
|
||||||
import static org.briarproject.bramble.api.identity.Author.Status.VERIFIED;
|
import static org.briarproject.bramble.api.identity.Author.Status.VERIFIED;
|
||||||
import static org.briarproject.bramble.api.sync.Group.Visibility.SHARED;
|
import static org.briarproject.bramble.api.sync.Group.Visibility.SHARED;
|
||||||
import static org.briarproject.briar.api.privategroup.Visibility.INVISIBLE;
|
import static org.briarproject.briar.api.privategroup.Visibility.INVISIBLE;
|
||||||
@@ -29,7 +34,7 @@ import static org.junit.Assert.assertEquals;
|
|||||||
import static org.junit.Assert.assertFalse;
|
import static org.junit.Assert.assertFalse;
|
||||||
import static org.junit.Assert.assertTrue;
|
import static org.junit.Assert.assertTrue;
|
||||||
|
|
||||||
public class PrivateGroupManagerTest
|
public class PrivateGroupManagerIntegrationTest
|
||||||
extends BriarIntegrationTest<BriarIntegrationTestComponent> {
|
extends BriarIntegrationTest<BriarIntegrationTestComponent> {
|
||||||
|
|
||||||
private PrivateGroup privateGroup0;
|
private PrivateGroup privateGroup0;
|
||||||
@@ -127,7 +132,7 @@ public class PrivateGroupManagerTest
|
|||||||
assertEquals(2, groupManager1.getHeaders(groupId0).size());
|
assertEquals(2, groupManager1.getHeaders(groupId0).size());
|
||||||
|
|
||||||
// create and add test message with random previousMsgId
|
// create and add test message with random previousMsgId
|
||||||
MessageId previousMsgId = new MessageId(TestUtils.getRandomId());
|
MessageId previousMsgId = new MessageId(getRandomId());
|
||||||
msg = groupMessageFactory
|
msg = groupMessageFactory
|
||||||
.createGroupMessage(groupId0, clock.currentTimeMillis(), null,
|
.createGroupMessage(groupId0, clock.currentTimeMillis(), null,
|
||||||
author0, "test", previousMsgId);
|
author0, "test", previousMsgId);
|
||||||
@@ -158,7 +163,7 @@ public class PrivateGroupManagerTest
|
|||||||
addGroup();
|
addGroup();
|
||||||
|
|
||||||
// create and add test message with random parentMsgId
|
// create and add test message with random parentMsgId
|
||||||
MessageId parentMsgId = new MessageId(TestUtils.getRandomId());
|
MessageId parentMsgId = new MessageId(getRandomId());
|
||||||
MessageId previousMsgId = groupManager0.getPreviousMsgId(groupId0);
|
MessageId previousMsgId = groupManager0.getPreviousMsgId(groupId0);
|
||||||
GroupMessage msg = groupMessageFactory
|
GroupMessage msg = groupMessageFactory
|
||||||
.createGroupMessage(groupId0, clock.currentTimeMillis(),
|
.createGroupMessage(groupId0, clock.currentTimeMillis(),
|
||||||
@@ -1,7 +1,8 @@
|
|||||||
package org.briarproject;
|
package org.briarproject.briar.sharing;
|
||||||
|
|
||||||
import net.jodah.concurrentunit.Waiter;
|
import net.jodah.concurrentunit.Waiter;
|
||||||
|
|
||||||
|
import org.briarproject.TestDatabaseModule;
|
||||||
import org.briarproject.bramble.api.contact.Contact;
|
import org.briarproject.bramble.api.contact.Contact;
|
||||||
import org.briarproject.bramble.api.db.DbException;
|
import org.briarproject.bramble.api.db.DbException;
|
||||||
import org.briarproject.bramble.api.db.NoSuchGroupException;
|
import org.briarproject.bramble.api.db.NoSuchGroupException;
|
||||||
@@ -9,6 +10,9 @@ import org.briarproject.bramble.api.event.Event;
|
|||||||
import org.briarproject.bramble.api.event.EventListener;
|
import org.briarproject.bramble.api.event.EventListener;
|
||||||
import org.briarproject.bramble.api.nullsafety.NotNullByDefault;
|
import org.briarproject.bramble.api.nullsafety.NotNullByDefault;
|
||||||
import org.briarproject.bramble.api.sync.GroupId;
|
import org.briarproject.bramble.api.sync.GroupId;
|
||||||
|
import org.briarproject.briar.BriarIntegrationTest;
|
||||||
|
import org.briarproject.briar.BriarIntegrationTestComponent;
|
||||||
|
import org.briarproject.briar.DaggerBriarIntegrationTestComponent;
|
||||||
import org.briarproject.briar.api.blog.Blog;
|
import org.briarproject.briar.api.blog.Blog;
|
||||||
import org.briarproject.briar.api.blog.BlogInvitationRequest;
|
import org.briarproject.briar.api.blog.BlogInvitationRequest;
|
||||||
import org.briarproject.briar.api.blog.BlogInvitationResponse;
|
import org.briarproject.briar.api.blog.BlogInvitationResponse;
|
||||||
@@ -147,7 +151,7 @@ public class BlogSharingIntegrationTest
|
|||||||
|
|
||||||
// invitee has one invitation message from sharer
|
// invitee has one invitation message from sharer
|
||||||
List<InvitationMessage> list =
|
List<InvitationMessage> list =
|
||||||
new ArrayList<>(blogSharingManager1
|
new ArrayList<InvitationMessage>(blogSharingManager1
|
||||||
.getInvitationMessages(contactId0From1));
|
.getInvitationMessages(contactId0From1));
|
||||||
assertEquals(2, list.size());
|
assertEquals(2, list.size());
|
||||||
// check other things are alright with the message
|
// check other things are alright with the message
|
||||||
@@ -210,7 +214,7 @@ public class BlogSharingIntegrationTest
|
|||||||
|
|
||||||
// invitee has one invitation message from sharer and one response
|
// invitee has one invitation message from sharer and one response
|
||||||
List<InvitationMessage> list =
|
List<InvitationMessage> list =
|
||||||
new ArrayList<>(blogSharingManager1
|
new ArrayList<InvitationMessage>(blogSharingManager1
|
||||||
.getInvitationMessages(contactId0From1));
|
.getInvitationMessages(contactId0From1));
|
||||||
assertEquals(2, list.size());
|
assertEquals(2, list.size());
|
||||||
// check things are alright with the message
|
// check things are alright with the message
|
||||||
@@ -1,7 +1,8 @@
|
|||||||
package org.briarproject;
|
package org.briarproject.briar.sharing;
|
||||||
|
|
||||||
import net.jodah.concurrentunit.Waiter;
|
import net.jodah.concurrentunit.Waiter;
|
||||||
|
|
||||||
|
import org.briarproject.TestDatabaseModule;
|
||||||
import org.briarproject.bramble.api.Bytes;
|
import org.briarproject.bramble.api.Bytes;
|
||||||
import org.briarproject.bramble.api.contact.Contact;
|
import org.briarproject.bramble.api.contact.Contact;
|
||||||
import org.briarproject.bramble.api.data.BdfList;
|
import org.briarproject.bramble.api.data.BdfList;
|
||||||
@@ -12,6 +13,9 @@ import org.briarproject.bramble.api.event.Event;
|
|||||||
import org.briarproject.bramble.api.event.EventListener;
|
import org.briarproject.bramble.api.event.EventListener;
|
||||||
import org.briarproject.bramble.api.nullsafety.NotNullByDefault;
|
import org.briarproject.bramble.api.nullsafety.NotNullByDefault;
|
||||||
import org.briarproject.bramble.api.sync.Group;
|
import org.briarproject.bramble.api.sync.Group;
|
||||||
|
import org.briarproject.briar.BriarIntegrationTest;
|
||||||
|
import org.briarproject.briar.BriarIntegrationTestComponent;
|
||||||
|
import org.briarproject.briar.DaggerBriarIntegrationTestComponent;
|
||||||
import org.briarproject.briar.api.client.MessageQueueManager;
|
import org.briarproject.briar.api.client.MessageQueueManager;
|
||||||
import org.briarproject.briar.api.client.SessionId;
|
import org.briarproject.briar.api.client.SessionId;
|
||||||
import org.briarproject.briar.api.forum.Forum;
|
import org.briarproject.briar.api.forum.Forum;
|
||||||
@@ -35,6 +39,8 @@ import java.util.Collection;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import static junit.framework.Assert.assertNotNull;
|
import static junit.framework.Assert.assertNotNull;
|
||||||
|
import static org.briarproject.TestUtils.getRandomBytes;
|
||||||
|
import static org.briarproject.TestUtils.getRandomString;
|
||||||
import static org.briarproject.briar.api.forum.ForumConstants.FORUM_SALT_LENGTH;
|
import static org.briarproject.briar.api.forum.ForumConstants.FORUM_SALT_LENGTH;
|
||||||
import static org.briarproject.briar.api.forum.ForumSharingManager.CLIENT_ID;
|
import static org.briarproject.briar.api.forum.ForumSharingManager.CLIENT_ID;
|
||||||
import static org.briarproject.briar.api.sharing.SharingConstants.SHARE_MSG_TYPE_INVITATION;
|
import static org.briarproject.briar.api.sharing.SharingConstants.SHARE_MSG_TYPE_INVITATION;
|
||||||
@@ -127,7 +133,7 @@ public class ForumSharingIntegrationTest
|
|||||||
|
|
||||||
// invitee has one invitation message from sharer
|
// invitee has one invitation message from sharer
|
||||||
List<InvitationMessage> list =
|
List<InvitationMessage> list =
|
||||||
new ArrayList<>(forumSharingManager1
|
new ArrayList<InvitationMessage>(forumSharingManager1
|
||||||
.getInvitationMessages(contactId0From1));
|
.getInvitationMessages(contactId0From1));
|
||||||
assertEquals(2, list.size());
|
assertEquals(2, list.size());
|
||||||
// check other things are alright with the forum message
|
// check other things are alright with the forum message
|
||||||
@@ -185,7 +191,7 @@ public class ForumSharingIntegrationTest
|
|||||||
|
|
||||||
// invitee has one invitation message from sharer and one response
|
// invitee has one invitation message from sharer and one response
|
||||||
List<InvitationMessage> list =
|
List<InvitationMessage> list =
|
||||||
new ArrayList<>(forumSharingManager1
|
new ArrayList<InvitationMessage>(forumSharingManager1
|
||||||
.getInvitationMessages(contactId0From1));
|
.getInvitationMessages(contactId0From1));
|
||||||
assertEquals(2, list.size());
|
assertEquals(2, list.size());
|
||||||
// check things are alright with the forum message
|
// check things are alright with the forum message
|
||||||
@@ -395,7 +401,7 @@ public class ForumSharingIntegrationTest
|
|||||||
listener1.requestReceived = false;
|
listener1.requestReceived = false;
|
||||||
|
|
||||||
// get SessionId from invitation
|
// get SessionId from invitation
|
||||||
List<InvitationMessage> list = new ArrayList<>(
|
List<InvitationMessage> list = new ArrayList<InvitationMessage>(
|
||||||
forumSharingManager1
|
forumSharingManager1
|
||||||
.getInvitationMessages(contactId0From1));
|
.getInvitationMessages(contactId0From1));
|
||||||
assertEquals(2, list.size());
|
assertEquals(2, list.size());
|
||||||
@@ -408,11 +414,9 @@ public class ForumSharingIntegrationTest
|
|||||||
Contact c1 = contactManager0.getContact(contactId1From0);
|
Contact c1 = contactManager0.getContact(contactId1From0);
|
||||||
Group group = contactGroupFactory.createContactGroup(CLIENT_ID, c1);
|
Group group = contactGroupFactory.createContactGroup(CLIENT_ID, c1);
|
||||||
long time = clock.currentTimeMillis();
|
long time = clock.currentTimeMillis();
|
||||||
BdfList bodyList = BdfList.of(SHARE_MSG_TYPE_INVITATION,
|
BdfList bodyList =
|
||||||
sessionId.getBytes(),
|
BdfList.of(SHARE_MSG_TYPE_INVITATION, sessionId.getBytes(),
|
||||||
TestUtils.getRandomString(42),
|
getRandomString(42), getRandomBytes(FORUM_SALT_LENGTH));
|
||||||
TestUtils.getRandomBytes(FORUM_SALT_LENGTH)
|
|
||||||
);
|
|
||||||
byte[] body = clientHelper.toByteArray(bodyList);
|
byte[] body = clientHelper.toByteArray(bodyList);
|
||||||
|
|
||||||
// add the message to the queue
|
// add the message to the queue
|
||||||
@@ -561,7 +565,7 @@ public class ForumSharingIntegrationTest
|
|||||||
forumSharingManager0.getSharedWith(forum0.getId()).size());
|
forumSharingManager0.getSharedWith(forum0.getId()).size());
|
||||||
|
|
||||||
// remember SessionId from invitation
|
// remember SessionId from invitation
|
||||||
List<InvitationMessage> list = new ArrayList<>(
|
List<InvitationMessage> list = new ArrayList<InvitationMessage>(
|
||||||
forumSharingManager1
|
forumSharingManager1
|
||||||
.getInvitationMessages(contactId0From1));
|
.getInvitationMessages(contactId0From1));
|
||||||
assertEquals(2, list.size());
|
assertEquals(2, list.size());
|
||||||
@@ -589,8 +593,8 @@ public class ForumSharingIntegrationTest
|
|||||||
// construct a new message re-using the old SessionId
|
// construct a new message re-using the old SessionId
|
||||||
BdfList bodyList = BdfList.of(SHARE_MSG_TYPE_INVITATION,
|
BdfList bodyList = BdfList.of(SHARE_MSG_TYPE_INVITATION,
|
||||||
sessionId.getBytes(),
|
sessionId.getBytes(),
|
||||||
TestUtils.getRandomString(42),
|
getRandomString(42),
|
||||||
TestUtils.getRandomBytes(FORUM_SALT_LENGTH)
|
getRandomBytes(FORUM_SALT_LENGTH)
|
||||||
);
|
);
|
||||||
byte[] body = clientHelper.toByteArray(bodyList);
|
byte[] body = clientHelper.toByteArray(bodyList);
|
||||||
|
|
||||||
@@ -692,7 +696,7 @@ public class ForumSharingIntegrationTest
|
|||||||
|
|
||||||
// sharer posts into the forum
|
// sharer posts into the forum
|
||||||
long time = clock.currentTimeMillis();
|
long time = clock.currentTimeMillis();
|
||||||
String body = TestUtils.getRandomString(42);
|
String body = getRandomString(42);
|
||||||
ForumPost p = forumPostFactory
|
ForumPost p = forumPostFactory
|
||||||
.createPost(forum0.getId(), time, null, author0,
|
.createPost(forum0.getId(), time, null, author0,
|
||||||
body);
|
body);
|
||||||
@@ -711,7 +715,7 @@ public class ForumSharingIntegrationTest
|
|||||||
|
|
||||||
// now invitee creates a post
|
// now invitee creates a post
|
||||||
time = clock.currentTimeMillis();
|
time = clock.currentTimeMillis();
|
||||||
body = TestUtils.getRandomString(42);
|
body = getRandomString(42);
|
||||||
p = forumPostFactory
|
p = forumPostFactory
|
||||||
.createPost(forum0.getId(), time, null, author1,
|
.createPost(forum0.getId(), time, null, author1,
|
||||||
body);
|
body);
|
||||||
@@ -753,7 +757,7 @@ public class ForumSharingIntegrationTest
|
|||||||
|
|
||||||
// now invitee creates a post
|
// now invitee creates a post
|
||||||
time = clock.currentTimeMillis();
|
time = clock.currentTimeMillis();
|
||||||
body = TestUtils.getRandomString(42);
|
body = getRandomString(42);
|
||||||
p = forumPostFactory
|
p = forumPostFactory
|
||||||
.createPost(forum0.getId(), time, null, author1,
|
.createPost(forum0.getId(), time, null, author1,
|
||||||
body);
|
body);
|
||||||
@@ -18,7 +18,7 @@ import dagger.Module;
|
|||||||
import dagger.Provides;
|
import dagger.Provides;
|
||||||
|
|
||||||
@Module
|
@Module
|
||||||
class TestLifecycleModule {
|
public class TestLifecycleModule {
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
LifecycleManager provideLifecycleManager() {
|
LifecycleManager provideLifecycleManager() {
|
||||||
@@ -5,4 +5,3 @@ include ':briar-api'
|
|||||||
include ':briar-core'
|
include ':briar-core'
|
||||||
include ':briar-tests'
|
include ':briar-tests'
|
||||||
include ':briar-android'
|
include ':briar-android'
|
||||||
include ':briar-android-tests'
|
|
||||||
|
|||||||
Reference in New Issue
Block a user