use of tech.aroma.thrift.Organization in project aroma-data-operations by RedRoma.
the class CassandraOrganizationRepositoryTest method testSaveOrganizationWithBadArgs.
@Test
public void testSaveOrganizationWithBadArgs() throws Exception {
assertThrows(() -> instance.saveOrganization(null)).isInstanceOf(InvalidArgumentException.class);
Organization emptyOrg = new Organization();
assertThrows(() -> instance.saveOrganization(emptyOrg)).isInstanceOf(InvalidArgumentException.class);
Organization orgWithoutName = new Organization(org);
orgWithoutName.unsetOrganizationName();
assertThrows(() -> instance.saveOrganization(orgWithoutName)).isInstanceOf(InvalidArgumentException.class);
}
use of tech.aroma.thrift.Organization in project aroma-data-operations by RedRoma.
the class CassandraOrganizationRepositoryTest method testGetOrganization.
@Test
public void testGetOrganization() throws Exception {
Organization result = instance.getOrganization(orgId);
assertThat(result, is(org));
verify(cassandra).execute(statementCaptor.capture());
Statement statement = statementCaptor.getValue();
assertThat(statement, notNullValue());
assertThat(statement, instanceOf(Select.Where.class));
}
use of tech.aroma.thrift.Organization in project aroma-data-operations by RedRoma.
the class MemoryOrganizationRepositoryTest method testSearchByName.
@Test
public void testSearchByName() throws Exception {
List<Organization> orgs = listOf(pojos(Organization.class)).stream().map(org -> org.setOrganizationId(one(uuids))).map(org -> org.setOwners(Lists.emptyList())).collect(toList());
Set<String> orgNames = orgs.stream().map(Organization::getOrganizationName).collect(toSet());
String oneName = Sets.oneOf(orgNames);
for (Organization organization : orgs) {
instance.saveOrganization(organization);
}
List<Organization> result = instance.searchByName(oneName);
assertThat(result, not(empty()));
for (Organization organization : result) {
assertThat(organization, isIn(orgs));
}
}
use of tech.aroma.thrift.Organization in project aroma-data-operations by RedRoma.
the class MemoryOrganizationRepositoryTest method testGetOrganization.
@Test
public void testGetOrganization() throws Exception {
instance.saveOrganization(org);
Organization result = instance.getOrganization(orgId);
assertThat(result, is(org));
}
use of tech.aroma.thrift.Organization in project aroma-data-operations by RedRoma.
the class MemoryOrganizationRepository method getOrganizationOwners.
@Override
public List<User> getOrganizationOwners(String organizationId) throws TException {
checkOrgId(organizationId);
Organization org = getOrganization(organizationId);
return Sets.copyOf(org.owners).stream().map(id -> new User().setUserId(id)).collect(toList());
}
Aggregations