Replace Client interface with OpenDatabaseHook.

This commit is contained in:
akwizgran
2019-04-22 16:18:35 +01:00
parent 00bc8ac768
commit f6611daf7b
31 changed files with 152 additions and 130 deletions

View File

@@ -112,7 +112,7 @@ public class BlogManagerImplTest extends BriarTestCase {
}
@Test
public void testCreateLocalState() throws DbException {
public void testOpenDatabaseHook() throws DbException {
Transaction txn = new Transaction(null, false);
context.checking(new Expectations() {{
@@ -123,7 +123,7 @@ public class BlogManagerImplTest extends BriarTestCase {
oneOf(db).addGroup(txn, blog1.getGroup());
}});
blogManager.createLocalState(txn);
blogManager.onDatabaseOpened(txn);
context.assertIsSatisfied();
}

View File

@@ -149,7 +149,7 @@ public class GroupInvitationManagerImplTest extends BrambleMockTestCase {
}
@Test
public void testCreateLocalStateFirstTime() throws Exception {
public void testDatabaseOpenHookFirstTime() throws Exception {
context.checking(new Expectations() {{
oneOf(contactGroupFactory).createLocalGroup(CLIENT_ID,
MAJOR_VERSION);
@@ -161,11 +161,11 @@ public class GroupInvitationManagerImplTest extends BrambleMockTestCase {
will(returnValue(Collections.singletonList(contact)));
}});
expectAddingContact(contact);
groupInvitationManager.createLocalState(txn);
groupInvitationManager.onDatabaseOpened(txn);
}
@Test
public void testCreateLocalStateSubsequentTime() throws Exception {
public void testOpenDatabaseHookSubsequentTime() throws Exception {
context.checking(new Expectations() {{
oneOf(contactGroupFactory).createLocalGroup(CLIENT_ID,
MAJOR_VERSION);
@@ -173,7 +173,7 @@ public class GroupInvitationManagerImplTest extends BrambleMockTestCase {
oneOf(db).containsGroup(txn, localGroup.getId());
will(returnValue(true));
}});
groupInvitationManager.createLocalState(txn);
groupInvitationManager.onDatabaseOpened(txn);
}
private void expectAddingContact(Contact c) throws Exception {

View File

@@ -94,7 +94,7 @@ public class BlogSharingManagerImplTest extends BrambleMockTestCase {
}
@Test
public void testCreateLocalStateFirstTimeWithExistingContact()
public void testOpenDatabaseHookFirstTimeWithExistingContact()
throws Exception {
Transaction txn = new Transaction(null, false);
@@ -113,7 +113,7 @@ public class BlogSharingManagerImplTest extends BrambleMockTestCase {
// Set things up for the contact
expectAddingContact(txn);
blogSharingManager.createLocalState(txn);
blogSharingManager.onDatabaseOpened(txn);
}
private void expectAddingContact(Transaction txn) throws Exception {
@@ -149,7 +149,7 @@ public class BlogSharingManagerImplTest extends BrambleMockTestCase {
}
@Test
public void testCreateLocalStateSubsequentTime() throws Exception {
public void testOpenDatabaseHookSubsequentTime() throws Exception {
Transaction txn = new Transaction(null, false);
context.checking(new Expectations() {{
@@ -161,7 +161,7 @@ public class BlogSharingManagerImplTest extends BrambleMockTestCase {
will(returnValue(true));
}});
blogSharingManager.createLocalState(txn);
blogSharingManager.onDatabaseOpened(txn);
}
@Test