use of tech.aroma.thrift.Application in project aroma-data-operations by RedRoma.
the class MemoryFollowerRepositoryTest method testGetApplicationsFollowedBy.
@Test
public void testGetApplicationsFollowedBy() throws Exception {
for (Application app : this.appsFollowed) {
instance.saveFollowing(user, app);
}
List<Application> result = instance.getApplicationsFollowedBy(userId);
assertThat(result, notNullValue());
assertThat(Sets.containTheSameElements(result, appsFollowed), is(true));
}
use of tech.aroma.thrift.Application in project aroma-data-operations by RedRoma.
the class MemoryApplicationRepositoryTest method testGetById.
@Test
public void testGetById() throws Exception {
instance.saveApplication(app);
Application result = instance.getById(appId);
assertThat(result, is(app));
String randomId = one(uuids);
assertThrows(() -> instance.getById(randomId)).isInstanceOf(TException.class);
}
use of tech.aroma.thrift.Application 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));
}
use of tech.aroma.thrift.Application in project aroma-data-operations by RedRoma.
the class CassandraFollowerRepositoryIT method testGetApplicationsFollowedBy.
@Test
public void testGetApplicationsFollowedBy() throws Exception {
instance.saveFollowing(user, app);
List<Application> apps = instance.getApplicationsFollowedBy(userId);
assertThat(apps, notNullValue());
assertThat(apps, not(empty()));
assertThat(apps.size(), is(1));
Application savedApp = Lists.oneOf(apps);
assertThat(savedApp.applicationId, is(appId));
assertThat(savedApp.name, is(app.name));
}
use of tech.aroma.thrift.Application in project aroma-data-operations by RedRoma.
the class CassandraApplicationRepository method getApplicationsByOrg.
@Override
public List<Application> getApplicationsByOrg(String orgId) throws TException {
checkThat(orgId).throwing(InvalidArgumentException.class).is(validOrgId());
Statement query = createQueryForAppsWithOrg(orgId);
ResultSet results;
try {
results = cassandra.execute(query);
} catch (Exception ex) {
LOG.error("Failed to find Apps by Org with ID [{}]", orgId, ex);
throw new OperationFailedException("Could not find Org's Apps: " + orgId);
}
List<Application> apps = Lists.create();
for (Row row : results) {
Application app = createApplicationFromRow(row);
apps.add(app);
}
LOG.debug("Found {} apps in Org {}", apps.size(), orgId);
return apps;
}
Aggregations