use of cz.metacentrum.perun.core.api.SecurityTeam in project perun by CESNET.
the class SecurityTeamsManagerEntryIntegrationTest method testRemoveGroupAsAdminSecurityTeamNotExists.
@Test(expected = SecurityTeamNotExistsException.class)
public void testRemoveGroupAsAdminSecurityTeamNotExists() throws Exception {
System.out.println(CLASS_NAME + "testRemoveGroupAsAdminSecurityTeamNotExists");
setUpSecurityTeams();
setUpUsers();
Group group = setUpGroup(u1, u2);
setUpAdmins(u0, u1, group);
SecurityTeam st = new SecurityTeam(0, "Name", "Desc");
securityTeamsManagerEntry.removeAdmin(sess, st, group);
}
use of cz.metacentrum.perun.core.api.SecurityTeam in project perun by CESNET.
the class SecurityTeamsManagerEntryIntegrationTest method testCreateSecurityTeamNameLength.
@Test(expected = InternalErrorException.class)
public void testCreateSecurityTeamNameLength() throws Exception {
System.out.println(CLASS_NAME + "testCreateSecurityTeamNameLength");
securityTeamsManagerEntry.createSecurityTeam(sess, new SecurityTeam("1---------2---------3---------4---------5---------6---------7---------8---------9---------10--------11--------12--------13--------", "Desc 1"));
}
use of cz.metacentrum.perun.core.api.SecurityTeam in project perun by CESNET.
the class SecurityTeamsManagerEntryIntegrationTest method testGetSecurityTeamsPerunAdmin.
@Test
public void testGetSecurityTeamsPerunAdmin() throws Exception {
System.out.println(CLASS_NAME + "testGetSecurityTeamsPerunAdmin");
AuthzRoles roles = sess.getPerunPrincipal().getRoles();
try {
List<SecurityTeam> expected = setUpSecurityTeams();
sess.getPerunPrincipal().setRoles(new AuthzRoles(Role.PERUNADMIN));
List<SecurityTeam> actual = securityTeamsManagerEntry.getSecurityTeams(sess);
assertTrue("Security teams should contain all created.", actual.containsAll(expected));
} finally {
sess.getPerunPrincipal().setRoles(roles);
}
}
use of cz.metacentrum.perun.core.api.SecurityTeam in project perun by CESNET.
the class SecurityTeamsManagerEntryIntegrationTest method testAddUserToBlacklistSecurityTeamNotExists.
@Test(expected = SecurityTeamNotExistsException.class)
public void testAddUserToBlacklistSecurityTeamNotExists() throws Exception {
System.out.println(CLASS_NAME + "testAddUserToBlacklistSecurityTeamNotExists");
setUpSecurityTeams();
setUpUsers();
setUpFacilities();
SecurityTeam st = new SecurityTeam(0, "Security0", "Description test 0");
securityTeamsManagerEntry.addUserToBlacklist(sess, st, u0, "reason");
}
use of cz.metacentrum.perun.core.api.SecurityTeam in project perun by CESNET.
the class SecurityTeamsManagerEntryIntegrationTest method setUpSecurityTeams.
private List<SecurityTeam> setUpSecurityTeams() throws PrivilegeException, InternalErrorException, SecurityTeamExistsException {
st0 = new SecurityTeam("Security0", "Description test 0");
st1 = new SecurityTeam("Security1", "");
st2 = new SecurityTeam("Security2", null);
securityTeamsManagerEntry.createSecurityTeam(sess, st0);
securityTeamsManagerEntry.createSecurityTeam(sess, st1);
securityTeamsManagerEntry.createSecurityTeam(sess, st2);
List<SecurityTeam> result = new ArrayList<>();
result.add(st0);
result.add(st1);
result.add(st2);
return result;
}
Aggregations