Search in sources :

Example 31 with User

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

the class MemoryApplicationRepositoryTest method testGetApplicationsOwnedBy.

@Test
public void testGetApplicationsOwnedBy() throws Exception {
    User user = one(UserGenerators.users());
    applications.forEach(app -> app.owners.add(user.userId));
    saveApplications(applications);
    List<Application> result = instance.getApplicationsOwnedBy(user.userId);
    assertThat(containTheSameElements(applications, result), is(true));
}
Also used : User(tech.aroma.thrift.User) Application(tech.aroma.thrift.Application) Test(org.junit.Test)

Example 32 with User

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

the class MemoryUserRepositoryTest method testFindByGithubProfile.

@Test
public void testFindByGithubProfile() throws Exception {
    instance.saveUser(user);
    String profile = user.githubProfile;
    User result = instance.findByGithubProfile(profile);
    assertThat(result, is(user));
}
Also used : User(tech.aroma.thrift.User) Test(org.junit.Test)

Example 33 with User

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

the class CassandraFollowerRepositoryIT method testGetApplicationFollowers.

@Test
public void testGetApplicationFollowers() throws Exception {
    instance.saveFollowing(user, app);
    List<User> followers = instance.getApplicationFollowers(appId);
    assertThat(followers, notNullValue());
    assertThat(followers, not(empty()));
    assertThat(followers.size(), is(1));
    User follower = Lists.oneOf(followers);
    assertThat(follower.userId, is(userId));
    assertThat(follower.firstName, is(user.firstName));
}
Also used : User(tech.aroma.thrift.User) IntegrationTest(tech.sirwellington.alchemy.annotations.testing.IntegrationTest)

Example 34 with User

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

the class CassandraFollowerRepositoryTest method testGetApplicationFollowers.

@Test
public void testGetApplicationFollowers() throws Exception {
    Map<String, Row> rows = Maps.create();
    for (User follower : followers) {
        Row mockRow = mock(Row.class);
        when(userMapper.apply(mockRow)).thenReturn(follower);
        rows.put(follower.userId, mockRow);
    }
    when(results.iterator()).thenReturn(rows.values().iterator());
    Set<User> result = toSet(instance.getApplicationFollowers(appId));
    assertThat(result, is(toSet(followers)));
}
Also used : User(tech.aroma.thrift.User) StringGenerators.alphabeticString(tech.sirwellington.alchemy.generator.StringGenerators.alphabeticString) Test(org.junit.Test)

Example 35 with User

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

the class CassandraUserRepositoryIT method testGetUser.

@Test
public void testGetUser() throws Exception {
    instance.saveUser(user);
    User result = instance.getUser(userId);
    assertMostlyMatch(result, user);
}
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