@Test public void testStore() { final UUID userId = storeUser(); runWithRetry(store -> { UserProfile storedData = store.getUserData(userId); Assert.assertEquals(USER, storedData); return userId; }); }
public UserProfile getUserData(UUID userId) { UserProfileTable table = tables.getUserProfileTable(tx); Map<UserProfileRow, UserProfile> result = table.getMetadatas(ImmutableSet.of(UserProfileRow.of(userId))); if (result.isEmpty()) { return null; } else { return Iterables.getOnlyElement(result.values()); } }
ProfileStore { public UserProfile getUserData(UUID userId) { UserProfileTable table = tables.getUserProfileTable(tx); Map<UserProfileRow, UserProfile> result = table.getMetadatas(ImmutableSet.of(UserProfileRow.of(userId))); if (result.isEmpty()) { return null; } else { return Iterables.getOnlyElement(result.values()); } } }
ProfileStore { public UserProfile getUserData(UUID userId) { UserProfileTable table = tables.getUserProfileTable(tx); Map<UserProfileRow, UserProfile> result = table.getMetadatas(ImmutableSet.of(UserProfileRow.of(userId))); if (result.isEmpty()) { return null; } else { return Iterables.getOnlyElement(result.values()); } } ProfileStore(TransactionManager txnMgr, Transaction tx); }
ProfileStore { public UserProfile getUserData(UUID userId) { UserProfileTable table = tables.getUserProfileTable(tx); Map<UserProfileRow, UserProfile> result = table.getMetadatas(ImmutableSet.of(UserProfileRow.of(userId))); if (result.isEmpty()) { return null; } else { return Iterables.getOnlyElement(result.values()); } } ProfileStore(TransactionManager txnMgr, Transaction tx); UUID storeNewUser(UserProfile data); UserProfile getUserData(UUID userId); InputStream getImageForUser(UUID userId); void updateImage(UUID userId, Sha256Hash hash, InputStream imageData); void deleteImage(UUID userId); Set<UUID> getUsersWithBirthday(long birthEpochDays); }
ProfileStore { public UserProfile getUserData(UUID userId) { UserProfileTable table = tables.getUserProfileTable(tx); Map<UserProfileRow, UserProfile> result = table.getMetadatas(ImmutableSet.of(UserProfileRow.of(userId))); if (result.isEmpty()) { return null; } else { return Iterables.getOnlyElement(result.values()); } } ProfileStore(TransactionManager txnMgr, Transaction tx); UUID storeNewUser(UserProfile data); UserProfile getUserData(UUID userId); InputStream getImageForUser(UUID userId); void updateImage(UUID userId, Sha256Hash hash, InputStream imageData); void deleteImage(UUID userId); Set<UUID> getUsersWithBirthday(long birthEpochDays);  }