Small code cleanups.

This commit is contained in:
akwizgran
2019-04-18 13:42:59 +01:00
parent f82294527f
commit 56fb20f257
4 changed files with 11 additions and 16 deletions

View File

@@ -141,7 +141,7 @@ public class KeyManagerImplTest extends BrambleMockTestCase {
public void testContactRemovedEvent() { public void testContactRemovedEvent() {
ContactRemovedEvent event = new ContactRemovedEvent(contactId); ContactRemovedEvent event = new ContactRemovedEvent(contactId);
context.checking(new DbExpectations() {{ context.checking(new Expectations() {{
oneOf(transportKeyManager).removeContact(contactId); oneOf(transportKeyManager).removeContact(contactId);
}}); }});

View File

@@ -75,10 +75,8 @@ class RevealContactsControllerImpl extends DbControllerImpl
@DatabaseExecutor @DatabaseExecutor
private Collection<RevealableContactItem> getItems(GroupId g, private Collection<RevealableContactItem> getItems(GroupId g,
Collection<ContactId> selection) throws DbException { Collection<ContactId> selection) throws DbException {
Collection<GroupMember> members = Collection<GroupMember> members = groupManager.getMembers(g);
groupManager.getMembers(g); Collection<Contact> contacts = contactManager.getContacts();
Collection<Contact> contacts =
contactManager.getContacts();
Collection<RevealableContactItem> items = Collection<RevealableContactItem> items =
new ArrayList<>(members.size()); new ArrayList<>(members.size());
for (GroupMember m : members) { for (GroupMember m : members) {

View File

@@ -432,22 +432,20 @@ class IntroduceeProtocolEngine
Map<TransportId, TransportKeySetId> keys = null; Map<TransportId, TransportKeySetId> keys = null;
try { try {
contactManager contactManager.addContact(txn, s.getRemote().author,
.addContact(txn, s.getRemote().author, localAuthor.getId(), localAuthor.getId(), false);
false);
// Only add transport properties and keys when the contact was added // Only add transport properties and keys when the contact was added
// This will be changed once we have a way to reset state for peers // This will be changed once we have a way to reset state for peers
// that were contacts already at some point in the past. // that were contacts already at some point in the past.
Contact c = contactManager Contact c = contactManager.getContact(txn,
.getContact(txn, s.getRemote().author.getId(), s.getRemote().author.getId(), localAuthor.getId());
localAuthor.getId());
// add the keys to the new contact // add the keys to the new contact
//noinspection ConstantConditions //noinspection ConstantConditions
keys = keyManager keys = keyManager.addContact(txn, c.getId(),
.addContact(txn, c.getId(), new SecretKey(s.getMasterKey()), new SecretKey(s.getMasterKey()), timestamp,
timestamp, s.getLocal().alice, false); s.getLocal().alice, false);
// add signed transport properties for the contact // add signed transport properties for the contact
//noinspection ConstantConditions //noinspection ConstantConditions

View File

@@ -91,8 +91,7 @@ public class BlogManagerImplTest extends BriarTestCase {
public BlogManagerImplTest() { public BlogManagerImplTest() {
MetadataParser metadataParser = context.mock(MetadataParser.class); MetadataParser metadataParser = context.mock(MetadataParser.class);
blogManager = new BlogManagerImpl(db, contactManager, identityManager, blogManager = new BlogManagerImpl(db, contactManager, identityManager,
clientHelper, clientHelper, metadataParser, blogFactory, blogPostFactory);
metadataParser, blogFactory, blogPostFactory);
localAuthor1 = getLocalAuthor(); localAuthor1 = getLocalAuthor();
localAuthor2 = getLocalAuthor(); localAuthor2 = getLocalAuthor();