use of tech.aroma.thrift.User in project aroma-data-operations by RedRoma.
the class CassandraUserRepositoryIT method testGetRecentlyCreatedUsers.
@Test
public void testGetRecentlyCreatedUsers() throws Exception {
instance.saveUser(user);
List<User> result = instance.getRecentlyCreatedUsers();
Map<String, User> mapping = result.stream().collect(() -> Maps.<String, User>create(), (map, user) -> map.put(user.userId, user), (left, right) -> left.putAll(right));
assertThat(result, notNullValue());
assertThat(result, not(empty()));
if (mapping.containsKey(user.userId)) {
User savedUser = mapping.get(user.userId);
assertMostlyMatch(savedUser, user);
}
}
use of tech.aroma.thrift.User in project aroma-data-operations by RedRoma.
the class CassandraOrganizationRepositoryTest method testGetOrganizationOwners.
@Test
public void testGetOrganizationOwners() throws Exception {
List<User> response = instance.getOrganizationOwners(orgId);
Set<User> expected = org.owners.stream().map(id -> new User().setUserId(id)).collect(toSet());
assertThat(Sets.toSet(response), is(expected));
}
use of tech.aroma.thrift.User in project aroma-data-operations by RedRoma.
the class CassandraOrganizationRepositoryIT method testSaveMemberInOrganization.
@Test
public void testSaveMemberInOrganization() throws Exception {
instance.saveMemberInOrganization(orgId, user);
List<User> members = instance.getOrganizationMembers(orgId);
User match = members.stream().filter(u -> Objects.equal(u.userId, user.userId)).findFirst().get();
assertUserMostlyMatch(match, user);
}
use of tech.aroma.thrift.User in project aroma-data-operations by RedRoma.
the class CassandraFollowerRepository method getApplicationFollowers.
@Override
public List<User> getApplicationFollowers(String applicationId) throws TException {
checkAppId(applicationId);
Statement query = createQueryForFollowersOfApp(applicationId);
ResultSet results;
try {
results = cassandra.execute(query);
} catch (Exception ex) {
LOG.error("Failed to query for App's followed: App: [{}]", applicationId, ex);
throw new OperationFailedException("Could not query for App's Followers: " + ex.getMessage());
}
List<User> followers = Lists.create();
for (Row row : results) {
User follower = createUserFromRow(row);
followers.add(follower);
}
LOG.debug("Found {} Users followed App [{}]", followers.size(), applicationId);
return followers;
}
Aggregations