CassandraRegisterStore extends NoSqlDatabaseRegisterStore { @Override public Contact getContact(Endpoint addr, Endpoint contact) { HColumn<String, Object> result = queryResult(addr, contact); if (result == null) { return null; } return (Contact) result.getValue(); }  @Override void init(Map<String, String> props); @Override void add(Endpoint addr, Contact contact); @Override void update(Endpoint addr, Contact contact); @Override void remove(Endpoint addr, Contact contact); @Override void remove(Endpoint addr); @Override Collection<Contact> getContacts(Endpoint addr); @Override Iterator<Endpoint> getEndpoints(); @Override Contact getContact(Endpoint addr, Endpoint contact); @Override boolean isExisting(Endpoint addr, Contact contact); @Override boolean isExisting(Endpoint addr); @Override void destroy();  }
@Test public void testGetContact() { MockEndPoint endPoint1 = new MockEndPoint("sip:test1@voxeo.com"); MockEndPoint endPoint2 = new MockEndPoint("sip:Alex@voxeo.com"); MockContact mockContact1 = new MockContact("sip:test1@127.0.0.1"); MockContact mockContact3 = new MockContact("sip:test1@172.21.0.191"); MockContact mockContact2 = new MockContact("sip:alex@172.21.0.193"); _cassandraRegisterStore.add(endPoint1, mockContact1); _cassandraRegisterStore.add(endPoint1, mockContact3); _cassandraRegisterStore.add(endPoint2, mockContact2); Contact contact = _cassandraRegisterStore.getContact(endPoint1, new MockEndPoint("sip:test1@127.0.0.1")); assertNotNull(contact); assertEquals("sip:test1@127.0.0.1", contact.getEndpoint().getURI().toString()); Collection<Contact> contacts = _cassandraRegisterStore.getContacts(endPoint1); assertNotNull(contacts); assertTrue(contacts.size() == 2); Iterator<Contact> iterator = contacts.iterator(); assertEquals("sip:test1@127.0.0.1", iterator.next().getEndpoint().getURI().toString()); assertEquals("sip:test1@172.21.0.191", iterator.next().getEndpoint().getURI().toString()); contact = _cassandraRegisterStore.getContact(endPoint2, new MockEndPoint("sip:alex@172.21.0.193")); assertNotNull(contact); assertEquals("sip:alex@172.21.0.193", contact.getEndpoint().getURI().toString()); }