Search in sources :

Example 21 with User

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

the class CassandraActivityRepositoryTest method testGetAllEventsForWithBadArgs.

@Test
public void testGetAllEventsForWithBadArgs() throws Exception {
    assertThrows(() -> instance.getAllEventsFor(null)).isInstanceOf(InvalidArgumentException.class);
    assertThrows(() -> instance.getAllEventsFor(new User())).isInstanceOf(InvalidArgumentException.class);
    User userWithBadId = new User(user).setUserId(badId);
    assertThrows(() -> instance.getAllEventsFor(userWithBadId)).isInstanceOf(InvalidArgumentException.class);
}
Also used : User(tech.aroma.thrift.User) Test(org.junit.Test)

Example 22 with User

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

the class CassandraActivityRepositoryTest method testGetEventWithBadArgs.

@Test
public void testGetEventWithBadArgs() throws Exception {
    assertThrows(() -> instance.getEvent("", user)).isInstanceOf(InvalidArgumentException.class);
    assertThrows(() -> instance.getEvent(badId, user)).isInstanceOf(InvalidArgumentException.class);
    assertThrows(() -> instance.getEvent(eventId, null)).isInstanceOf(InvalidArgumentException.class);
    assertThrows(() -> instance.getEvent(eventId, new User())).isInstanceOf(InvalidArgumentException.class);
    User userWithBadId = new User(user).setUserId(badId);
    assertThrows(() -> instance.getEvent(eventId, userWithBadId)).isInstanceOf(InvalidArgumentException.class);
}
Also used : User(tech.aroma.thrift.User) Test(org.junit.Test)

Example 23 with User

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

the class MemoryActivityRepository method saveEvent.

@Override
public void saveEvent(Event event, User forUser, LengthOfTime lifetime) throws TException {
    checkEvent(event);
    checkUser(forUser);
    checkLifetime(lifetime);
    User user = forUser;
    List<Event> eventsForUser = events.getOrDefault(user, Lists.create());
    eventsForUser.add(event);
    events.put(user, eventsForUser);
}
Also used : RequestAssertions.validUser(tech.aroma.data.assertions.RequestAssertions.validUser) User(tech.aroma.thrift.User) Event(tech.aroma.thrift.events.Event)

Example 24 with User

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

the class MemoryOrganizationRepositoryTest method testGetOrganizationOwners.

@Test
public void testGetOrganizationOwners() throws Exception {
    instance.saveOrganization(org);
    List<User> owners = instance.getOrganizationOwners(orgId);
    for (User owner : owners) {
        assertThat(owner.userId, isIn(org.owners));
    }
}
Also used : User(tech.aroma.thrift.User) Test(org.junit.Test)

Example 25 with User

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

the class MemoryFollowerRepositoryTest method testGetApplicationFollowers.

@Test
public void testGetApplicationFollowers() throws Exception {
    for (User follower : this.followers) {
        instance.saveFollowing(follower, application);
    }
    List<User> result = instance.getApplicationFollowers(applicationId);
    assertThat(result, notNullValue());
    assertThat(Sets.containTheSameElements(result, followers), is(true));
}
Also used : User(tech.aroma.thrift.User) Test(org.junit.Test)

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