Search in sources :

Example 16 with SecurityTeam

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);
}
Also used : Group(cz.metacentrum.perun.core.api.Group) SecurityTeam(cz.metacentrum.perun.core.api.SecurityTeam) AbstractPerunIntegrationTest(cz.metacentrum.perun.core.AbstractPerunIntegrationTest) Test(org.junit.Test)

Example 17 with SecurityTeam

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"));
}
Also used : SecurityTeam(cz.metacentrum.perun.core.api.SecurityTeam) AbstractPerunIntegrationTest(cz.metacentrum.perun.core.AbstractPerunIntegrationTest) Test(org.junit.Test)

Example 18 with SecurityTeam

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);
    }
}
Also used : AuthzRoles(cz.metacentrum.perun.core.impl.AuthzRoles) SecurityTeam(cz.metacentrum.perun.core.api.SecurityTeam) AbstractPerunIntegrationTest(cz.metacentrum.perun.core.AbstractPerunIntegrationTest) Test(org.junit.Test)

Example 19 with SecurityTeam

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");
}
Also used : SecurityTeam(cz.metacentrum.perun.core.api.SecurityTeam) AbstractPerunIntegrationTest(cz.metacentrum.perun.core.AbstractPerunIntegrationTest) Test(org.junit.Test)

Example 20 with SecurityTeam

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;
}
Also used : SecurityTeam(cz.metacentrum.perun.core.api.SecurityTeam)

Aggregations

SecurityTeam (cz.metacentrum.perun.core.api.SecurityTeam)37 AbstractPerunIntegrationTest (cz.metacentrum.perun.core.AbstractPerunIntegrationTest)30 Test (org.junit.Test)30 ArrayList (java.util.ArrayList)4 BanOnFacility (cz.metacentrum.perun.core.api.BanOnFacility)3 InternalErrorException (cz.metacentrum.perun.core.api.exceptions.InternalErrorException)3 AuthzRoles (cz.metacentrum.perun.core.impl.AuthzRoles)3 Facility (cz.metacentrum.perun.core.api.Facility)2 Group (cz.metacentrum.perun.core.api.Group)2 ContactGroup (cz.metacentrum.perun.core.api.ContactGroup)1 Host (cz.metacentrum.perun.core.api.Host)1 User (cz.metacentrum.perun.core.api.User)1 BanNotExistsException (cz.metacentrum.perun.core.api.exceptions.BanNotExistsException)1 PrivilegeException (cz.metacentrum.perun.core.api.exceptions.PrivilegeException)1 RelationExistsException (cz.metacentrum.perun.core.api.exceptions.RelationExistsException)1 SecurityTeamExistsException (cz.metacentrum.perun.core.api.exceptions.SecurityTeamExistsException)1 SecurityTeamNotExistsException (cz.metacentrum.perun.core.api.exceptions.SecurityTeamNotExistsException)1 WrongAttributeValueException (cz.metacentrum.perun.core.api.exceptions.WrongAttributeValueException)1 WrongReferenceAttributeValueException (cz.metacentrum.perun.core.api.exceptions.WrongReferenceAttributeValueException)1 HashSet (java.util.HashSet)1