use of org.osgi.service.useradmin.Group in project felix by apache.
the class RoleRepositoryTest method testAddRequiredRoleYieldsEventOk.
/**
* Tests whether adding a new role to a group causes an event to be emitted to the {@link RoleRepository}.
*/
public void testAddRequiredRoleYieldsEventOk() throws Exception {
final Group role = (Group) m_roleRepository.addRole("foo", Role.GROUP);
m_latch = new CountDownLatch(1);
new Thread(new Runnable() {
public void run() {
Role anyone = m_roleRepository.getRoleByName(Role.USER_ANYONE);
role.addRequiredMember(anyone);
}
}).start();
assertTrue(m_latch.await(1, TimeUnit.SECONDS));
}
use of org.osgi.service.useradmin.Group in project felix by apache.
the class RoleRepositoryTest method testRemoveBasicRoleYieldsEventOk.
/**
* Tests whether removing a role from a group causes an event to be emitted to the {@link RoleRepository}.
*/
public void testRemoveBasicRoleYieldsEventOk() throws Exception {
final Role anyone = m_roleRepository.getRoleByName(Role.USER_ANYONE);
final Group role = (Group) m_roleRepository.addRole("bar", Role.GROUP);
role.addMember(anyone);
m_latch = new CountDownLatch(1);
new Thread(new Runnable() {
public void run() {
role.removeMember(anyone);
}
}).start();
assertTrue(m_latch.await(1, TimeUnit.SECONDS));
}
use of org.osgi.service.useradmin.Group in project felix by apache.
the class RoleRepositoryTest method testRemoveRequiredRoleYieldsEventOk.
/**
* Tests whether removing a role from a group causes an event to be emitted to the {@link RoleRepository}.
*/
public void testRemoveRequiredRoleYieldsEventOk() throws Exception {
final Role anyone = m_roleRepository.getRoleByName(Role.USER_ANYONE);
final Group role = (Group) m_roleRepository.addRole("bar", Role.GROUP);
role.addRequiredMember(anyone);
m_latch = new CountDownLatch(1);
new Thread(new Runnable() {
public void run() {
role.removeMember(anyone);
}
}).start();
assertTrue(m_latch.await(1, TimeUnit.SECONDS));
}
use of org.osgi.service.useradmin.Group in project felix by apache.
the class RoleRepositoryTest method testAddBasicRoleYieldsEventOk.
/**
* Tests whether adding a new role to a group causes an event to be emitted to the {@link RoleRepository}.
*/
public void testAddBasicRoleYieldsEventOk() throws Exception {
final Group role = (Group) m_roleRepository.addRole("foo", Role.GROUP);
m_latch = new CountDownLatch(1);
new Thread(new Runnable() {
public void run() {
Role anyone = m_roleRepository.getRoleByName(Role.USER_ANYONE);
role.addMember(anyone);
}
}).start();
assertTrue(m_latch.await(1, TimeUnit.SECONDS));
}
use of org.osgi.service.useradmin.Group in project felix by apache.
the class UserAdminImplTest method testRemovingGroupMemberOk.
/**
* Tests that removing a basic member from a group works.
*/
public void testRemovingGroupMemberOk() {
User user1 = (User) m_userAdmin.createRole("user1", Role.USER);
Group group1 = (Group) m_userAdmin.createRole("group1", Role.GROUP);
assertTrue(group1.addMember(user1));
assertTrue(group1.removeMember(user1));
assertFalse(group1.removeMember(user1));
}
Aggregations