Reset cache index
This commit is contained in:
parent
3803b8f284
commit
20b5f0e681
|
@ -140,7 +140,7 @@ public class AccountsManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getAccountEntityKey(UUID uuid) {
|
private String getAccountEntityKey(UUID uuid) {
|
||||||
return "Account2::" + uuid.toString();
|
return "Account3::" + uuid.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void redisSet(Account account) {
|
private void redisSet(Account account) {
|
||||||
|
|
|
@ -32,7 +32,7 @@ public class AccountsManagerTest {
|
||||||
|
|
||||||
when(cacheClient.getReadResource()).thenReturn(jedis);
|
when(cacheClient.getReadResource()).thenReturn(jedis);
|
||||||
when(jedis.get(eq("AccountMap::+14152222222"))).thenReturn(uuid.toString());
|
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);
|
AccountsManager accountsManager = new AccountsManager(accounts, directoryManager, cacheClient);
|
||||||
Optional<Account> account = accountsManager.get("+14152222222");
|
Optional<Account> account = accountsManager.get("+14152222222");
|
||||||
|
@ -42,7 +42,7 @@ public class AccountsManagerTest {
|
||||||
assertEquals(account.get().getProfileName(), "test");
|
assertEquals(account.get().getProfileName(), "test");
|
||||||
|
|
||||||
verify(jedis, times(1)).get(eq("AccountMap::+14152222222"));
|
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();
|
verify(jedis, times(1)).close();
|
||||||
verifyNoMoreInteractions(jedis);
|
verifyNoMoreInteractions(jedis);
|
||||||
verifyNoMoreInteractions(accounts);
|
verifyNoMoreInteractions(accounts);
|
||||||
|
@ -58,7 +58,7 @@ public class AccountsManagerTest {
|
||||||
UUID uuid = UUID.randomUUID();
|
UUID uuid = UUID.randomUUID();
|
||||||
|
|
||||||
when(cacheClient.getReadResource()).thenReturn(jedis);
|
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);
|
AccountsManager accountsManager = new AccountsManager(accounts, directoryManager, cacheClient);
|
||||||
Optional<Account> account = accountsManager.get(uuid);
|
Optional<Account> account = accountsManager.get(uuid);
|
||||||
|
@ -68,7 +68,7 @@ public class AccountsManagerTest {
|
||||||
assertEquals(account.get().getUuid(), uuid);
|
assertEquals(account.get().getUuid(), uuid);
|
||||||
assertEquals(account.get().getProfileName(), "test");
|
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();
|
verify(jedis, times(1)).close();
|
||||||
verifyNoMoreInteractions(jedis);
|
verifyNoMoreInteractions(jedis);
|
||||||
verifyNoMoreInteractions(accounts);
|
verifyNoMoreInteractions(accounts);
|
||||||
|
@ -97,7 +97,7 @@ public class AccountsManagerTest {
|
||||||
|
|
||||||
verify(jedis, times(1)).get(eq("AccountMap::+14152222222"));
|
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("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();
|
verify(jedis, times(2)).close();
|
||||||
verifyNoMoreInteractions(jedis);
|
verifyNoMoreInteractions(jedis);
|
||||||
|
|
||||||
|
@ -116,7 +116,7 @@ public class AccountsManagerTest {
|
||||||
|
|
||||||
when(cacheClient.getReadResource()).thenReturn(jedis);
|
when(cacheClient.getReadResource()).thenReturn(jedis);
|
||||||
when(cacheClient.getWriteResource()).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));
|
when(accounts.get(eq(uuid))).thenReturn(Optional.of(account));
|
||||||
|
|
||||||
AccountsManager accountsManager = new AccountsManager(accounts, directoryManager, cacheClient);
|
AccountsManager accountsManager = new AccountsManager(accounts, directoryManager, cacheClient);
|
||||||
|
@ -125,9 +125,9 @@ public class AccountsManagerTest {
|
||||||
assertTrue(retrieved.isPresent());
|
assertTrue(retrieved.isPresent());
|
||||||
assertSame(retrieved.get(), account);
|
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("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();
|
verify(jedis, times(2)).close();
|
||||||
verifyNoMoreInteractions(jedis);
|
verifyNoMoreInteractions(jedis);
|
||||||
|
|
||||||
|
@ -157,7 +157,7 @@ public class AccountsManagerTest {
|
||||||
|
|
||||||
verify(jedis, times(1)).get(eq("AccountMap::+14152222222"));
|
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("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();
|
verify(jedis, times(2)).close();
|
||||||
verifyNoMoreInteractions(jedis);
|
verifyNoMoreInteractions(jedis);
|
||||||
|
|
||||||
|
@ -176,7 +176,7 @@ public class AccountsManagerTest {
|
||||||
|
|
||||||
when(cacheClient.getReadResource()).thenReturn(jedis);
|
when(cacheClient.getReadResource()).thenReturn(jedis);
|
||||||
when(cacheClient.getWriteResource()).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));
|
when(accounts.get(eq(uuid))).thenReturn(Optional.of(account));
|
||||||
|
|
||||||
AccountsManager accountsManager = new AccountsManager(accounts, directoryManager, cacheClient);
|
AccountsManager accountsManager = new AccountsManager(accounts, directoryManager, cacheClient);
|
||||||
|
@ -185,9 +185,9 @@ public class AccountsManagerTest {
|
||||||
assertTrue(retrieved.isPresent());
|
assertTrue(retrieved.isPresent());
|
||||||
assertSame(retrieved.get(), account);
|
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("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();
|
verify(jedis, times(2)).close();
|
||||||
verifyNoMoreInteractions(jedis);
|
verifyNoMoreInteractions(jedis);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue