mirror of
https://github.com/signalapp/Signal-Server
synced 2026-04-22 22:48:02 +01:00
Reset cache index
This commit is contained in:
@@ -32,7 +32,7 @@ public class AccountsManagerTest {
|
||||
|
||||
when(cacheClient.getReadResource()).thenReturn(jedis);
|
||||
when(jedis.get(eq("AccountMap::+14152222222"))).thenReturn(uuid.toString());
|
||||
when(jedis.get(eq("Account2::" + uuid.toString()))).thenReturn("{\"number\": \"+14152222222\", \"name\": \"test\"}");
|
||||
when(jedis.get(eq("Account3::" + uuid.toString()))).thenReturn("{\"number\": \"+14152222222\", \"name\": \"test\"}");
|
||||
|
||||
AccountsManager accountsManager = new AccountsManager(accounts, directoryManager, cacheClient);
|
||||
Optional<Account> account = accountsManager.get("+14152222222");
|
||||
@@ -42,7 +42,7 @@ public class AccountsManagerTest {
|
||||
assertEquals(account.get().getProfileName(), "test");
|
||||
|
||||
verify(jedis, times(1)).get(eq("AccountMap::+14152222222"));
|
||||
verify(jedis, times(1)).get(eq("Account2::" + uuid.toString()));
|
||||
verify(jedis, times(1)).get(eq("Account3::" + uuid.toString()));
|
||||
verify(jedis, times(1)).close();
|
||||
verifyNoMoreInteractions(jedis);
|
||||
verifyNoMoreInteractions(accounts);
|
||||
@@ -58,7 +58,7 @@ public class AccountsManagerTest {
|
||||
UUID uuid = UUID.randomUUID();
|
||||
|
||||
when(cacheClient.getReadResource()).thenReturn(jedis);
|
||||
when(jedis.get(eq("Account2::" + uuid.toString()))).thenReturn("{\"number\": \"+14152222222\", \"name\": \"test\"}");
|
||||
when(jedis.get(eq("Account3::" + uuid.toString()))).thenReturn("{\"number\": \"+14152222222\", \"name\": \"test\"}");
|
||||
|
||||
AccountsManager accountsManager = new AccountsManager(accounts, directoryManager, cacheClient);
|
||||
Optional<Account> account = accountsManager.get(uuid);
|
||||
@@ -68,7 +68,7 @@ public class AccountsManagerTest {
|
||||
assertEquals(account.get().getUuid(), uuid);
|
||||
assertEquals(account.get().getProfileName(), "test");
|
||||
|
||||
verify(jedis, times(1)).get(eq("Account2::" + uuid.toString()));
|
||||
verify(jedis, times(1)).get(eq("Account3::" + uuid.toString()));
|
||||
verify(jedis, times(1)).close();
|
||||
verifyNoMoreInteractions(jedis);
|
||||
verifyNoMoreInteractions(accounts);
|
||||
@@ -97,7 +97,7 @@ public class AccountsManagerTest {
|
||||
|
||||
verify(jedis, times(1)).get(eq("AccountMap::+14152222222"));
|
||||
verify(jedis, times(1)).set(eq("AccountMap::+14152222222"), eq(uuid.toString()));
|
||||
verify(jedis, times(1)).set(eq("Account2::" + uuid.toString()), anyString());
|
||||
verify(jedis, times(1)).set(eq("Account3::" + uuid.toString()), anyString());
|
||||
verify(jedis, times(2)).close();
|
||||
verifyNoMoreInteractions(jedis);
|
||||
|
||||
@@ -116,7 +116,7 @@ public class AccountsManagerTest {
|
||||
|
||||
when(cacheClient.getReadResource()).thenReturn(jedis);
|
||||
when(cacheClient.getWriteResource()).thenReturn(jedis);
|
||||
when(jedis.get(eq("Account2::" + uuid))).thenReturn(null);
|
||||
when(jedis.get(eq("Account3::" + uuid))).thenReturn(null);
|
||||
when(accounts.get(eq(uuid))).thenReturn(Optional.of(account));
|
||||
|
||||
AccountsManager accountsManager = new AccountsManager(accounts, directoryManager, cacheClient);
|
||||
@@ -125,9 +125,9 @@ public class AccountsManagerTest {
|
||||
assertTrue(retrieved.isPresent());
|
||||
assertSame(retrieved.get(), account);
|
||||
|
||||
verify(jedis, times(1)).get(eq("Account2::" + uuid));
|
||||
verify(jedis, times(1)).get(eq("Account3::" + uuid));
|
||||
verify(jedis, times(1)).set(eq("AccountMap::+14152222222"), eq(uuid.toString()));
|
||||
verify(jedis, times(1)).set(eq("Account2::" + uuid.toString()), anyString());
|
||||
verify(jedis, times(1)).set(eq("Account3::" + uuid.toString()), anyString());
|
||||
verify(jedis, times(2)).close();
|
||||
verifyNoMoreInteractions(jedis);
|
||||
|
||||
@@ -157,7 +157,7 @@ public class AccountsManagerTest {
|
||||
|
||||
verify(jedis, times(1)).get(eq("AccountMap::+14152222222"));
|
||||
verify(jedis, times(1)).set(eq("AccountMap::+14152222222"), eq(uuid.toString()));
|
||||
verify(jedis, times(1)).set(eq("Account2::" + uuid.toString()), anyString());
|
||||
verify(jedis, times(1)).set(eq("Account3::" + uuid.toString()), anyString());
|
||||
verify(jedis, times(2)).close();
|
||||
verifyNoMoreInteractions(jedis);
|
||||
|
||||
@@ -176,7 +176,7 @@ public class AccountsManagerTest {
|
||||
|
||||
when(cacheClient.getReadResource()).thenReturn(jedis);
|
||||
when(cacheClient.getWriteResource()).thenReturn(jedis);
|
||||
when(jedis.get(eq("Account2::" + uuid))).thenThrow(new JedisException("Connection lost!"));
|
||||
when(jedis.get(eq("Account3::" + uuid))).thenThrow(new JedisException("Connection lost!"));
|
||||
when(accounts.get(eq(uuid))).thenReturn(Optional.of(account));
|
||||
|
||||
AccountsManager accountsManager = new AccountsManager(accounts, directoryManager, cacheClient);
|
||||
@@ -185,9 +185,9 @@ public class AccountsManagerTest {
|
||||
assertTrue(retrieved.isPresent());
|
||||
assertSame(retrieved.get(), account);
|
||||
|
||||
verify(jedis, times(1)).get(eq("Account2::" + uuid));
|
||||
verify(jedis, times(1)).get(eq("Account3::" + uuid));
|
||||
verify(jedis, times(1)).set(eq("AccountMap::+14152222222"), eq(uuid.toString()));
|
||||
verify(jedis, times(1)).set(eq("Account2::" + uuid.toString()), anyString());
|
||||
verify(jedis, times(1)).set(eq("Account3::" + uuid.toString()), anyString());
|
||||
verify(jedis, times(2)).close();
|
||||
verifyNoMoreInteractions(jedis);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user