use of tech.aroma.thrift.Application in project aroma-data-operations by RedRoma.
the class MemoryApplicationRepositoryTest method testSaveApplication.
@Test
public void testSaveApplication() throws Exception {
instance.saveApplication(app);
Application result = instance.getById(appId);
assertThat(result, is(app));
}
use of tech.aroma.thrift.Application 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()));
}
use of tech.aroma.thrift.Application in project aroma-data-operations by RedRoma.
the class MemoryApplicationRepositoryTest method testSaveApplicationWithBadArguments.
@DontRepeat
@Test
public void testSaveApplicationWithBadArguments() throws Exception {
assertThrows(() -> instance.saveApplication(null)).isInstanceOf(InvalidArgumentException.class);
Application emptyApplication = new Application();
assertThrows(() -> instance.saveApplication(emptyApplication)).isInstanceOf(InvalidArgumentException.class);
}
use of tech.aroma.thrift.Application in project aroma-data-operations by RedRoma.
the class CassandraFollowerRepository method getApplicationsFollowedBy.
@Override
public List<Application> getApplicationsFollowedBy(String userId) throws TException {
checkUserId(userId);
Statement query = createQueryForAppsFollowedBy(userId);
ResultSet results;
try {
results = cassandra.execute(query);
} catch (Exception ex) {
LOG.error("Failed to query Cassandra for apps followed by User: [{}]", userId, ex);
throw new OperationFailedException("Could not find apps followed by user: " + ex.getMessage());
}
List<Application> apps = Lists.create();
for (Row row : results) {
Application app = createAppFromRow(row);
apps.add(app);
}
LOG.debug("Found {} apps followed by {}", apps.size(), userId);
return apps;
}
use of tech.aroma.thrift.Application in project aroma-data-operations by RedRoma.
the class MemoryApplicationRepositoryTest method testSearchByName.
@Test
public void testSearchByName() throws Exception {
int length = one(integers(100, 200));
String name = one(alphabeticString(length));
String term = name.substring(length / 2);
app.setName(name);
instance.saveApplication(app);
List<Application> result = instance.searchByName(term);
assertThat(result, contains(app));
}
Aggregations