use of org.whispersystems.signalservice.api.push.ACI in project Signal-Android by WhisperSystems.
the class RecipientIdCacheTest method full_recipient_id_learned_by_two_puts.
@Test
public void full_recipient_id_learned_by_two_puts() {
RecipientId recipientId1 = recipientId();
ACI aci1 = ACI.from(UUID.randomUUID());
String e164 = "+1555123456";
recipientIdCache.put(recipient(recipientId1, aci1, null));
recipientIdCache.put(recipient(recipientId1, null, e164));
RecipientId recipientId = recipientIdCache.get(aci1, e164);
assertEquals(recipientId1, recipientId);
}
use of org.whispersystems.signalservice.api.push.ACI in project Signal-Android by WhisperSystems.
the class RecipientIdCacheTest method cache_hit_by_uuid.
@Test
public void cache_hit_by_uuid() {
RecipientId recipientId1 = recipientId();
ACI aci1 = ACI.from(UUID.randomUUID());
recipientIdCache.put(recipient(recipientId1, aci1, null));
RecipientId recipientId = recipientIdCache.get(aci1, null);
assertEquals(recipientId1, recipientId);
}
use of org.whispersystems.signalservice.api.push.ACI in project Signal-Android by WhisperSystems.
the class RecipientIdCacheTest method multiple_entries.
@Test
public void multiple_entries() {
RecipientId recipientId1 = recipientId();
RecipientId recipientId2 = recipientId();
ACI aci1 = ACI.from(UUID.randomUUID());
ACI aci2 = ACI.from(UUID.randomUUID());
recipientIdCache.put(recipient(recipientId1, aci1, null));
recipientIdCache.put(recipient(recipientId2, aci2, null));
assertEquals(recipientId1, recipientIdCache.get(aci1, null));
assertEquals(recipientId2, recipientIdCache.get(aci2, null));
}
use of org.whispersystems.signalservice.api.push.ACI in project Signal-Android by WhisperSystems.
the class RecipientIdCacheTest method after_invalid_cache_hit_entries_are_cleared_up.
@Test
public void after_invalid_cache_hit_entries_are_cleared_up() {
RecipientId recipientId1 = recipientId();
RecipientId recipientId2 = recipientId();
ACI aci = ACI.from(UUID.randomUUID());
String e164 = "+1555123456";
recipientIdCache.put(recipient(recipientId1, null, e164));
recipientIdCache.put(recipient(recipientId2, aci, null));
recipientIdCache.get(aci, e164);
assertNull(recipientIdCache.get(aci, null));
assertNull(recipientIdCache.get(null, e164));
}
use of org.whispersystems.signalservice.api.push.ACI in project Signal-Android by WhisperSystems.
the class RecipientIdCacheTest method drops_oldest_when_reaches_cache_limit.
@Test
public void drops_oldest_when_reaches_cache_limit() {
RecipientId recipientId1 = recipientId();
ACI aci1 = ACI.from(UUID.randomUUID());
recipientIdCache.put(recipient(recipientId1, aci1, null));
for (int i = 0; i < TEST_CACHE_LIMIT; i++) {
recipientIdCache.put(recipient(recipientId(), ACI.from(UUID.randomUUID()), null));
}
assertNull(recipientIdCache.get(aci1, null));
}
Aggregations