Search in sources :

Example 11 with User

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

the class CassandraActivityRepository method saveEvent.

@Override
public void saveEvent(Event event, User forUser, LengthOfTime lifetime) throws TException {
    checkEvent(event);
    checkUser(forUser);
    checkLifetime(lifetime);
    User user = forUser;
    Statement insertStatement = createStatementToSaveEventForUser(event, user, lifetime);
    tryToExecute(insertStatement, "saveEvent");
}
Also used : User(tech.aroma.thrift.User) BooleanAssertions.trueStatement(tech.sirwellington.alchemy.arguments.assertions.BooleanAssertions.trueStatement)

Example 12 with User

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

the class MemoryInboxRepositoryTest method setUp.

@Before
public void setUp() {
    user = new User().setUserId(userId).setName(nameOfUser);
    message.messageId = messageId;
    message.applicationId = appId;
    instance = new MemoryInboxRepository();
    messages = messages.stream().map(m -> m.setApplicationId(appId)).map(m -> m.setMessageId(one(uuids))).collect(toList());
}
Also used : ThrowableAssertion(tech.sirwellington.alchemy.test.junit.ThrowableAssertion) RunWith(org.junit.runner.RunWith) TException(org.apache.thrift.TException) Matchers(org.hamcrest.Matchers) Test(org.junit.Test) AlchemyGenerator.one(tech.sirwellington.alchemy.generator.AlchemyGenerator.one) UUID(tech.sirwellington.alchemy.test.junit.runners.GenerateString.Type.UUID) InvalidArgumentException(tech.aroma.thrift.exceptions.InvalidArgumentException) Assert.assertThat(org.junit.Assert.assertThat) List(java.util.List) Collectors.toList(java.util.stream.Collectors.toList) StringGenerators.uuids(tech.sirwellington.alchemy.generator.StringGenerators.uuids) User(tech.aroma.thrift.User) ALPHABETIC(tech.sirwellington.alchemy.test.junit.runners.GenerateString.Type.ALPHABETIC) tech.sirwellington.alchemy.test.junit.runners(tech.sirwellington.alchemy.test.junit.runners) Message(tech.aroma.thrift.Message) Before(org.junit.Before) User(tech.aroma.thrift.User) Before(org.junit.Before)

Example 13 with User

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

the class MemoryActivityRepositoryTest method testDeleteAllEventsForWithBadArgs.

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

Example 14 with User

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

the class MemoryApplicationRepositoryTest method testGetApplicationOwnedByWhenNoneOwned.

@DontRepeat
@Test
public void testGetApplicationOwnedByWhenNoneOwned() throws Exception {
    User user = one(pojos(User.class));
    List<Application> result = instance.getApplicationsOwnedBy(user.userId);
    assertThat(result, notNullValue());
    assertThat(result, is(empty()));
}
Also used : User(tech.aroma.thrift.User) Application(tech.aroma.thrift.Application) Test(org.junit.Test)

Example 15 with User

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

the class MemoryUserRepositoryTest method testGetUserByEmail.

@Test
public void testGetUserByEmail() throws Exception {
    instance.saveUser(user);
    String email = user.email;
    User result = instance.getUserByEmail(email);
    assertThat(result, is(user));
}
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