JdbcAddressRepository extends JdbcHelper implements AddressRepository { @Override public BitmessageAddress findIdentity(byte[] ripeOrTag) { for (BitmessageAddress address : find("private_key is not null")) { if (address.getVersion() > 3) { if (Arrays.equals(ripeOrTag, address.getTag())) return address; } else { if (Arrays.equals(ripeOrTag, address.getRipe())) return address; } } return null; } 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 testFindIdentity() throws Exception { BitmessageAddress identity = new BitmessageAddress(IDENTITY_A); assertEquals(4, identity.getVersion()); assertNull(repo.findContact(identity.getTag())); BitmessageAddress storedIdentity = repo.findIdentity(identity.getTag()); assertEquals(identity, storedIdentity); assertTrue(storedIdentity.has(Pubkey.Feature.DOES_ACK)); }