@Test public void knowsShares() throws Exception { Identity identity = new IdentityBuilder(new DropUrlGenerator("http: ShareNotificationMessage share = new ShareNotificationMessage("url", "key", "msg"); shareRepo.save(identity, share); ShareNotifications notifications = config.getShareNotification(identity); assertEquals(1, notifications.getNotifications().size()); assertTrue(notifications.getNotifications().contains(share)); }
@Override public ShareNotifications getShareNotification(Identity identity) { ShareNotifications result = new ShareNotifications(); try { shareRepo.find(identity).forEach(result::add); shareRepo.onAdd(result::add, identity); shareRepo.onDelete(result::remove, identity); return result; } catch (PersistenceException e) { throw new IllegalStateException("failed to load shares", e); } }
RepositoryBasedClientConfig implements ClientConfig { @Override public ShareNotifications getShareNotification(Identity identity) { ShareNotifications result = new ShareNotifications(); try { shareRepo.find(identity).forEach(result::add); shareRepo.onAdd(result::add, identity); shareRepo.onDelete(result::remove, identity); return result; } catch (PersistenceException e) { throw new IllegalStateException("failed to load shares", e); } } }
RepositoryBasedClientConfig implements ClientConfig { @Override public ShareNotifications getShareNotification(Identity identity) { ShareNotifications result = new ShareNotifications(); try { shareRepo.find(identity).forEach(result::add); shareRepo.onAdd(result::add, identity); shareRepo.onDelete(result::remove, identity); return result; } catch (PersistenceException e) { throw new IllegalStateException("failed to load shares", e); } } RepositoryBasedClientConfig(
        ClientConfigRepository configRepo,
        AccountRepository accountRepo,
        IdentityRepository identityRepo,
        DropStateRepository dropStateRepo,
        ShareNotificationRepository shareRepo,
        EventSink events
    ); }
RepositoryBasedClientConfig implements ClientConfig { @Override public ShareNotifications getShareNotification(Identity identity) { ShareNotifications result = new ShareNotifications(); try { shareRepo.find(identity).forEach(result::add); shareRepo.onAdd(result::add, identity); shareRepo.onDelete(result::remove, identity); return result; } catch (PersistenceException e) { throw new IllegalStateException("failed to load shares", e); } } RepositoryBasedClientConfig(
        ClientConfigRepository configRepo,
        AccountRepository accountRepo,
        IdentityRepository identityRepo,
        DropStateRepository dropStateRepo,
        ShareNotificationRepository shareRepo,
        EventSink events
    ); @Override boolean hasAccount(); @Override Account getAccount(); @Override void setAccount(Account account); @Override void onSetAccount(Consumer<Account> consumer); @Override Identity getSelectedIdentity(); @Override void selectIdentity(Identity identity); @Override void onSelectIdentity(Consumer<Identity> consumer); @Override boolean hasDeviceId(); @Override void setDeviceId(String deviceId); @Override String getDeviceId(); @Override Date getLastDropPoll(Identity identity); @Override void setLastDropPoll(Identity identity, Date lastDropPoll); @Override ShareNotifications getShareNotification(Identity identity); @Override boolean hasSelectedIdentity(); }
RepositoryBasedClientConfig implements ClientConfig { @Override public ShareNotifications getShareNotification(Identity identity) { ShareNotifications result = new ShareNotifications(); try { shareRepo.find(identity).forEach(result::add); shareRepo.onAdd(result::add, identity); shareRepo.onDelete(result::remove, identity); return result; } catch (PersistenceException e) { throw new IllegalStateException("failed to load shares", e); } } RepositoryBasedClientConfig(
        ClientConfigRepository configRepo,
        AccountRepository accountRepo,
        IdentityRepository identityRepo,
        DropStateRepository dropStateRepo,
        ShareNotificationRepository shareRepo,
        EventSink events
    ); @Override boolean hasAccount(); @Override Account getAccount(); @Override void setAccount(Account account); @Override void onSetAccount(Consumer<Account> consumer); @Override Identity getSelectedIdentity(); @Override void selectIdentity(Identity identity); @Override void onSelectIdentity(Consumer<Identity> consumer); @Override boolean hasDeviceId(); @Override void setDeviceId(String deviceId); @Override String getDeviceId(); @Override Date getLastDropPoll(Identity identity); @Override void setLastDropPoll(Identity identity, Date lastDropPoll); @Override ShareNotifications getShareNotification(Identity identity); @Override boolean hasSelectedIdentity(); static final String ACCOUNT_KEY; }