use of com.yahoo.athenz.common.server.notification.DomainRoleMembersFetcher in project athenz by yahoo.
the class DomainRoleMembersFetcherTest method testNoDomain.
@Test
public void testNoDomain() {
DBService dbsvc = Mockito.mock(DBService.class);
DomainRoleMembersFetcher domainRoleMembersFetcher = new DomainRoleMembersFetcher(dbsvc, USER_DOMAIN_PREFIX);
Set<String> domainRoleMembers = domainRoleMembersFetcher.getDomainRoleMembers("domain1", "domain1:role.admin");
assertEquals(new HashSet<>(), domainRoleMembers);
}
use of com.yahoo.athenz.common.server.notification.DomainRoleMembersFetcher in project athenz by yahoo.
the class DomainRoleMembersFetcherTest method testNoDataStore.
@Test
public void testNoDataStore() {
DomainRoleMembersFetcher domainRoleMembersFetcher = new DomainRoleMembersFetcher(null, USER_DOMAIN_PREFIX);
Set<String> domainRoleMembers = domainRoleMembersFetcher.getDomainRoleMembers("domain1", "domain1:role.admin");
assertEquals(new HashSet<>(), domainRoleMembers);
}
use of com.yahoo.athenz.common.server.notification.DomainRoleMembersFetcher in project athenz by yahoo.
the class DomainRoleMembersFetcherTest method testNoDataStore.
@Test
public void testNoDataStore() {
DomainRoleMembersFetcher domainRoleMembersFetcher = new DomainRoleMembersFetcher(null, USER_DOMAIN_PREFIX);
Set<String> domainRoleMembers = domainRoleMembersFetcher.getDomainRoleMembers("domain1", "domain1:role.admin");
assertEquals(new HashSet<>(), domainRoleMembers);
}
use of com.yahoo.athenz.common.server.notification.DomainRoleMembersFetcher in project athenz by yahoo.
the class DomainRoleMembersFetcherTest method testGetDomainRoleMembers.
@Test
public void testGetDomainRoleMembers() {
DBService dbsvc = Mockito.mock(DBService.class);
String domainName = "domain1";
AthenzDomain domainData = new AthenzDomain(domainName);
Role adminRole = new Role();
adminRole.setName(domainName + ":role.admin");
RoleMember roleMember1 = new RoleMember();
roleMember1.setMemberName("user.domain1rolemember1");
RoleMember roleMember2 = new RoleMember();
roleMember2.setMemberName("user.domain1rolemember2");
adminRole.setRoleMembers(Arrays.asList(roleMember1, roleMember2));
domainData.setRoles(Collections.singletonList(adminRole));
Mockito.when(dbsvc.getRolesByDomain(eq("domain1"))).thenReturn(domainData.getRoles());
DomainRoleMembersFetcher domainRoleMembersFetcher = new DomainRoleMembersFetcher(dbsvc, USER_DOMAIN_PREFIX);
Set<String> domainRoleMembers = domainRoleMembersFetcher.getDomainRoleMembers("domain1", "domain1:role.admin");
assertEquals(2, domainRoleMembers.size());
assertTrue(domainRoleMembers.contains("user.domain1rolemember1"));
assertTrue(domainRoleMembers.contains("user.domain1rolemember2"));
}
use of com.yahoo.athenz.common.server.notification.DomainRoleMembersFetcher in project athenz by yahoo.
the class DomainRoleMembersFetcherTest method testGetDomainRoleMembers.
@Test
public void testGetDomainRoleMembers() {
DataStore dataStore = mock(DataStore.class);
NotificationTestsCommon.mockDomainData(1, dataStore);
DomainRoleMembersFetcher domainRoleMembersFetcher = new DomainRoleMembersFetcher(dataStore, USER_DOMAIN_PREFIX);
Set<String> domainRoleMembers = domainRoleMembersFetcher.getDomainRoleMembers("domain1", "domain1:role.admin");
assertEquals(2, domainRoleMembers.size());
assertTrue(domainRoleMembers.contains("user.domain1rolemember1"));
assertTrue(domainRoleMembers.contains("user.domain1rolemember2"));
}
Aggregations