use of tech.aroma.thrift.User in project aroma-data-operations by RedRoma.
the class CassandraOrganizationRepositoryIT method testGetOrganizationMembers.
@Test
public void testGetOrganizationMembers() throws Exception {
saveMembers(members);
deleteMembersAtEnd = true;
List<User> response = instance.getOrganizationMembers(orgId);
for (User member : response) {
User expected = mapOfMembers.get(member.userId);
assertThat(expected, notNullValue());
assertUserMostlyMatch(member, expected);
}
}
use of tech.aroma.thrift.User in project aroma-data-operations by RedRoma.
the class CassandraFollowerRepositoryTest method testSaveFollowingWithBadArgs.
@Test
public void testSaveFollowingWithBadArgs() throws Exception {
User emptyUser = new User();
Application emptyApp = new Application();
assertThrows(() -> instance.saveFollowing(emptyUser, app)).isInstanceOf(InvalidArgumentException.class);
assertThrows(() -> instance.saveFollowing(user, emptyApp)).isInstanceOf(InvalidArgumentException.class);
User userWithBadId = user.setUserId(one(alphabeticString()));
Application appWithBadId = app.setApplicationId(one(alphabeticString()));
assertThrows(() -> instance.saveFollowing(userWithBadId, app)).isInstanceOf(InvalidArgumentException.class);
assertThrows(() -> instance.saveFollowing(user, appWithBadId)).isInstanceOf(InvalidArgumentException.class);
}
use of tech.aroma.thrift.User in project aroma-data-operations by RedRoma.
the class CassandraActivityRepositoryTest method testDeleteAllEventsForWithBadArgs.
@Test
public void testDeleteAllEventsForWithBadArgs() throws Exception {
assertThrows(() -> instance.deleteAllEventsFor(null)).isInstanceOf(InvalidArgumentException.class);
assertThrows(() -> instance.deleteAllEventsFor(new User())).isInstanceOf(InvalidArgumentException.class);
User userWithBadId = new User(user).setUserId(badId);
assertThrows(() -> instance.deleteAllEventsFor(userWithBadId)).isInstanceOf(InvalidArgumentException.class);
}
use of tech.aroma.thrift.User in project aroma-data-operations by RedRoma.
the class CassandraActivityRepositoryTest method testDeleteEventWithBadArgs.
@Test
public void testDeleteEventWithBadArgs() throws Exception {
assertThrows(() -> instance.deleteEvent("", user)).isInstanceOf(InvalidArgumentException.class);
assertThrows(() -> instance.deleteEvent(eventId, null)).isInstanceOf(InvalidArgumentException.class);
assertThrows(() -> instance.deleteEvent(eventId, new User())).isInstanceOf(InvalidArgumentException.class);
User userWithBadId = new User(user).setUserId(badId);
assertThrows(() -> instance.deleteEvent(eventId, userWithBadId)).isInstanceOf(InvalidArgumentException.class);
}
use of tech.aroma.thrift.User in project aroma-data-operations by RedRoma.
the class MemoryUserRepository method deleteUser.
@Override
public void deleteUser(String userId) throws TException {
checkThat(userId).throwing(InvalidArgumentException.class).is(nonEmptyString()).throwing(UserDoesNotExistException.class).is(keyInMap(users));
User removedUser = users.remove(userId);
String email = removedUser.email;
if (!isNullOrEmpty(email)) {
this.usersByEmail.remove(email);
}
String githubProfile = removedUser.githubProfile;
if (!isNullOrEmpty(githubProfile)) {
this.usersByGithubProfile.remove(githubProfile);
}
}
Aggregations