Search in sources :

Example 1 with User

use of tech.aroma.thrift.User in project aroma-data-operations by RedRoma.

the class MeasuredUserRepositoryTest method testGetUser.

@Test
public void testGetUser() throws Exception {
    when(delegate.getUser(userId)).thenReturn(user);
    User result = instance.getUser(userId);
    assertThat(result, is(user));
    verify(delegate).getUser(userId);
}
Also used : User(tech.aroma.thrift.User) Test(org.junit.Test)

Example 2 with User

use of tech.aroma.thrift.User in project aroma-data-operations by RedRoma.

the class CassandraOrganizationRepositoryTest method testGetOrganizationMembers.

@Test
public void testGetOrganizationMembers() throws Exception {
    Map<String, Row> rows = Maps.create();
    for (User member : members) {
        Row mockRow = mock(Row.class);
        when(userMapper.apply(mockRow)).thenReturn(member);
        rows.put(member.userId, mockRow);
    }
    when(results.iterator()).thenReturn(rows.values().iterator());
    List<User> response = instance.getOrganizationMembers(orgId);
    assertThat(Sets.toSet(response), is(Sets.toSet(members)));
}
Also used : User(tech.aroma.thrift.User) Test(org.junit.Test)

Example 3 with User

use of tech.aroma.thrift.User in project aroma-data-operations by RedRoma.

the class CassandraUserRepositoryIT method testFindByGithubProfile.

@Test
public void testFindByGithubProfile() throws Exception {
    instance.saveUser(user);
    User result = instance.findByGithubProfile(user.githubProfile);
    assertMostlyMatch(result, user);
}
Also used : User(tech.aroma.thrift.User) IntegrationTest(tech.sirwellington.alchemy.annotations.testing.IntegrationTest)

Example 4 with User

use of tech.aroma.thrift.User in project aroma-data-operations by RedRoma.

the class CassandraUserRepositoryIT method testGetUserByEmail.

@Test
public void testGetUserByEmail() throws Exception {
    instance.saveUser(user);
    User result = instance.getUserByEmail(user.email);
    assertMostlyMatch(result, user);
}
Also used : User(tech.aroma.thrift.User) IntegrationTest(tech.sirwellington.alchemy.annotations.testing.IntegrationTest)

Example 5 with User

use of tech.aroma.thrift.User in project aroma-data-operations by RedRoma.

the class CassandraOrganizationRepositoryIT method testDeleteAllMembers.

@Test
public void testDeleteAllMembers() throws Exception {
    saveMembers(members);
    instance.deleteAllMembers(orgId);
    for (User member : members) {
        assertThat(instance.isMemberInOrganization(orgId, member.userId), is(false));
    }
}
Also used : User(tech.aroma.thrift.User) IntegrationTest(tech.sirwellington.alchemy.annotations.testing.IntegrationTest)

Aggregations

User (tech.aroma.thrift.User)39 Test (org.junit.Test)25 IntegrationTest (tech.sirwellington.alchemy.annotations.testing.IntegrationTest)8 TException (org.apache.thrift.TException)4 InvalidArgumentException (tech.aroma.thrift.exceptions.InvalidArgumentException)4 Collectors.toList (java.util.stream.Collectors.toList)3 Application (tech.aroma.thrift.Application)3 java.util (java.util)2 Collectors.toSet (java.util.stream.Collectors.toSet)2 Matchers (org.hamcrest.Matchers)2 Assert.assertThat (org.junit.Assert.assertThat)2 Before (org.junit.Before)2 RunWith (org.junit.runner.RunWith)2 Maps (sir.wellington.alchemy.collections.maps.Maps)2 Sets (sir.wellington.alchemy.collections.sets.Sets)2 RequestAssertions.validUser (tech.aroma.data.assertions.RequestAssertions.validUser)2 Message (tech.aroma.thrift.Message)2 Organization (tech.aroma.thrift.Organization)2 Event (tech.aroma.thrift.events.Event)2 AlchemyGenerator.one (tech.sirwellington.alchemy.generator.AlchemyGenerator.one)2