use of cz.metacentrum.perun.core.api.SecurityTeam in project perun by CESNET.
the class SecurityTeamsManagerEntryIntegrationTest method testGetSecurityTeamsSecurityAdmin1.
@Test
public void testGetSecurityTeamsSecurityAdmin1() throws Exception {
System.out.println(CLASS_NAME + "testGetSecurityTeamsSecurityAdmin1");
AuthzRoles roles = sess.getPerunPrincipal().getRoles();
try {
setUpSecurityTeams();
setUpUsers();
List<SecurityTeam> expected = new ArrayList<>();
expected.add(st0);
expected.add(st1);
sess.getPerunPrincipal().setRoles(new AuthzRoles(Role.SECURITYADMIN, expected));
List<SecurityTeam> actual = securityTeamsManagerEntry.getSecurityTeams(sess);
Collections.sort(expected);
Collections.sort(actual);
assertEquals(expected, actual);
} finally {
sess.getPerunPrincipal().setRoles(roles);
}
}
use of cz.metacentrum.perun.core.api.SecurityTeam in project perun by CESNET.
the class SecurityTeamsManagerEntryIntegrationTest method testGetSecurityTeamById.
@Test
public void testGetSecurityTeamById() throws Exception {
System.out.println(CLASS_NAME + "testGetSecurityTeamById");
SecurityTeam expected = setUpSecurityTeams().get(0);
SecurityTeam actual = securityTeamsManagerEntry.getSecurityTeamById(sess, expected.getId());
assertEquals(expected, actual);
}
use of cz.metacentrum.perun.core.api.SecurityTeam in project perun by CESNET.
the class SecurityTeamsManagerEntryIntegrationTest method testRemoveUserFromBlacklistSecurityTeamNotExists.
@Test(expected = SecurityTeamNotExistsException.class)
public void testRemoveUserFromBlacklistSecurityTeamNotExists() throws Exception {
System.out.println(CLASS_NAME + "testRemoveUserFromBlacklistSecurityTeamNotExists");
setUpSecurityTeams();
setUpUsers();
setUpFacilities();
setUpBlacklists();
SecurityTeam st = new SecurityTeam(0, "Security0", "Description test 0");
securityTeamsManagerEntry.removeUserFromBlacklist(sess, st, u1);
}
use of cz.metacentrum.perun.core.api.SecurityTeam in project perun by CESNET.
the class SecurityTeamsManagerEntryIntegrationTest method testCreateSecurityTeamUniqueName.
@Test(expected = SecurityTeamExistsException.class)
public void testCreateSecurityTeamUniqueName() throws Exception {
System.out.println(CLASS_NAME + "testCreateSecurityTeamUniqueName");
securityTeamsManagerEntry.createSecurityTeam(sess, new SecurityTeam("UniqueName", "Desc 1"));
securityTeamsManagerEntry.createSecurityTeam(sess, new SecurityTeam("UniqueName", "Desc 2"));
}
use of cz.metacentrum.perun.core.api.SecurityTeam in project perun by CESNET.
the class SecurityTeamsManagerEntryIntegrationTest method testUpdateSecurityTeam.
@Test
public void testUpdateSecurityTeam() throws Exception {
System.out.println(CLASS_NAME + "testUpdateSecurityTeam");
List<SecurityTeam> teams = setUpSecurityTeams();
SecurityTeam expected = teams.get(0);
expected.setName("Updated");
SecurityTeam middle = securityTeamsManagerEntry.updateSecurityTeam(sess, expected);
assertNotNull(middle);
assertEquals(expected, middle);
SecurityTeam actual = securityTeamsManagerEntry.getSecurityTeamById(sess, expected.getId());
assertNotNull(actual);
assertEquals(expected, actual);
}
Aggregations