JdbcAddressRepository extends JdbcHelper implements AddressRepository { @Override public List<BitmessageAddress> getSubscriptions() { return find("subscribed = '1'"); } JdbcAddressRepository(JdbcConfig config); @Override BitmessageAddress findContact(byte[] ripeOrTag); @Override BitmessageAddress findIdentity(byte[] ripeOrTag); @Override List<BitmessageAddress> getIdentities(); @Override List<BitmessageAddress> getChans(); @Override List<BitmessageAddress> getSubscriptions(); @Override List<BitmessageAddress> getSubscriptions(long broadcastVersion); @Override List<BitmessageAddress> getContacts(); @Override void save(BitmessageAddress address); @Override void remove(BitmessageAddress address); @Override BitmessageAddress getAddress(String address);  }
@Test public void testGetSubscriptions() throws Exception { addSubscription("BM-2cXxfcSetKnbHJX2Y85rSkaVpsdNUZ5q9h"); addSubscription("BM-2D9Vc5rFxxR5vTi53T9gkLfemViHRMVLQZ"); addSubscription("BM-2D9QKN4teYRvoq2fyzpiftPh9WP9qggtzh"); List<BitmessageAddress> subscriptions = repo.getSubscriptions(); assertEquals(3, subscriptions.size()); }
@Test public void testGetSubscriptionsForVersion() throws Exception { addSubscription("BM-2cXxfcSetKnbHJX2Y85rSkaVpsdNUZ5q9h"); addSubscription("BM-2D9Vc5rFxxR5vTi53T9gkLfemViHRMVLQZ"); addSubscription("BM-2D9QKN4teYRvoq2fyzpiftPh9WP9qggtzh"); List<BitmessageAddress> subscriptions; subscriptions = repo.getSubscriptions(5); assertEquals(1, subscriptions.size()); subscriptions = repo.getSubscriptions(4); assertEquals(2, subscriptions.size()); }