mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-13 03:09:04 +01:00
RemoteWipeModule and beginnings of integration test
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
package org.briarproject.briar.remotewipe;
|
||||
|
||||
import org.briarproject.bramble.api.lifecycle.LifecycleManager;
|
||||
import org.briarproject.bramble.api.sync.validation.ValidationManager;
|
||||
import org.briarproject.briar.api.conversation.ConversationManager;
|
||||
import org.briarproject.briar.api.remotewipe.RemoteWipeManager;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
|
||||
import dagger.Module;
|
||||
import dagger.Provides;
|
||||
|
||||
@Module
|
||||
public class RemoteWipeModule {
|
||||
public static class EagerSingletons {
|
||||
@Inject
|
||||
RemoteWipeManager remoteWipeManager;
|
||||
}
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
RemoteWipeManager remoteWipeManager(
|
||||
LifecycleManager lifecycleManager,
|
||||
ValidationManager validationManager,
|
||||
ConversationManager conversationManager,
|
||||
RemoteWipeManagerImpl remoteWipeManager) {
|
||||
lifecycleManager.registerOpenDatabaseHook(remoteWipeManager);
|
||||
validationManager
|
||||
.registerIncomingMessageHook(RemoteWipeManager.CLIENT_ID,
|
||||
RemoteWipeManager.MAJOR_VERSION, remoteWipeManager);
|
||||
conversationManager.registerConversationClient(remoteWipeManager);
|
||||
return remoteWipeManager;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
package org.briarproject.briar.remotewipe;
|
||||
|
||||
import org.briarproject.bramble.api.sync.Group;
|
||||
import org.briarproject.bramble.test.TestDatabaseConfigModule;
|
||||
import org.briarproject.briar.api.remotewipe.RemoteWipeManager;
|
||||
import org.briarproject.briar.test.BriarIntegrationTest;
|
||||
import org.briarproject.briar.test.BriarIntegrationTestComponent;
|
||||
import org.briarproject.briar.test.DaggerBriarIntegrationTestComponent;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
public class RemoteWipeIntegrationTest extends BriarIntegrationTest<BriarIntegrationTestComponent> {
|
||||
|
||||
private RemoteWipeManager remoteWipeManager0;
|
||||
private RemoteWipeManager remoteWipeManager1;
|
||||
private RemoteWipeManager remoteWipeManager2;
|
||||
|
||||
private Group g1From0;
|
||||
private Group g0From1;
|
||||
private Group g2From0;
|
||||
private Group g0From2;
|
||||
|
||||
@Before
|
||||
@Override
|
||||
public void setUp() throws Exception {
|
||||
super.setUp();
|
||||
remoteWipeManager0 = c0.getRemoteWipeManager();
|
||||
remoteWipeManager1 = c1.getRemoteWipeManager();
|
||||
remoteWipeManager2 = c2.getRemoteWipeManager();
|
||||
|
||||
g1From0 = remoteWipeManager0.getContactGroup(contact1From0);
|
||||
g0From1 = remoteWipeManager1.getContactGroup(contact0From1);
|
||||
g2From0 = remoteWipeManager0.getContactGroup(contact2From0);
|
||||
g0From2 = remoteWipeManager2.getContactGroup(contact0From2);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void createComponents() {
|
||||
BriarIntegrationTestComponent component =
|
||||
DaggerBriarIntegrationTestComponent.builder().build();
|
||||
BriarIntegrationTestComponent.Helper.injectEagerSingletons(component);
|
||||
component.inject(this);
|
||||
|
||||
c0 = DaggerBriarIntegrationTestComponent.builder()
|
||||
.testDatabaseConfigModule(new TestDatabaseConfigModule(t0Dir))
|
||||
.build();
|
||||
BriarIntegrationTestComponent.Helper.injectEagerSingletons(c0);
|
||||
|
||||
c1 = DaggerBriarIntegrationTestComponent.builder()
|
||||
.testDatabaseConfigModule(new TestDatabaseConfigModule(t1Dir))
|
||||
.build();
|
||||
BriarIntegrationTestComponent.Helper.injectEagerSingletons(c1);
|
||||
|
||||
c2 = DaggerBriarIntegrationTestComponent.builder()
|
||||
.testDatabaseConfigModule(new TestDatabaseConfigModule(t2Dir))
|
||||
.build();
|
||||
BriarIntegrationTestComponent.Helper.injectEagerSingletons(c2);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRemoteWipe() throws Exception {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -27,6 +27,7 @@ import org.briarproject.briar.api.messaging.MessagingManager;
|
||||
import org.briarproject.briar.api.messaging.PrivateMessageFactory;
|
||||
import org.briarproject.briar.api.privategroup.PrivateGroupManager;
|
||||
import org.briarproject.briar.api.privategroup.invitation.GroupInvitationManager;
|
||||
import org.briarproject.briar.api.remotewipe.RemoteWipeManager;
|
||||
import org.briarproject.briar.api.socialbackup.SocialBackupManager;
|
||||
import org.briarproject.briar.avatar.AvatarModule;
|
||||
import org.briarproject.briar.blog.BlogModule;
|
||||
@@ -36,6 +37,7 @@ import org.briarproject.briar.introduction.IntroductionModule;
|
||||
import org.briarproject.briar.messaging.MessagingModule;
|
||||
import org.briarproject.briar.privategroup.PrivateGroupModule;
|
||||
import org.briarproject.briar.privategroup.invitation.GroupInvitationModule;
|
||||
import org.briarproject.briar.remotewipe.RemoteWipeModule;
|
||||
import org.briarproject.briar.sharing.SharingModule;
|
||||
import org.briarproject.briar.socialbackup.DefaultDarkCrystalModule;
|
||||
import org.briarproject.briar.socialbackup.SocialBackupModule;
|
||||
@@ -76,6 +78,8 @@ public interface BriarIntegrationTestComponent
|
||||
|
||||
void inject(SocialBackupModule.EagerSingletons init);
|
||||
|
||||
void inject(RemoteWipeModule.EagerSingletons init);
|
||||
|
||||
LifecycleManager getLifecycleManager();
|
||||
|
||||
EventBus getEventBus();
|
||||
@@ -124,6 +128,8 @@ public interface BriarIntegrationTestComponent
|
||||
|
||||
SocialBackupManager getSocialBackupManager();
|
||||
|
||||
RemoteWipeManager getRemoteWipeManager();
|
||||
|
||||
class Helper {
|
||||
|
||||
public static void injectEagerSingletons(
|
||||
@@ -140,6 +146,7 @@ public interface BriarIntegrationTestComponent
|
||||
c.inject(new PrivateGroupModule.EagerSingletons());
|
||||
c.inject(new SharingModule.EagerSingletons());
|
||||
c.inject(new SocialBackupModule.EagerSingletons());
|
||||
c.inject(new RemoteWipeModule.EagerSingletons());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user