Search in sources :

Example 16 with BanOnVo

use of cz.metacentrum.perun.core.api.BanOnVo in project perun by CESNET.

the class VosManagerImplIntegrationTest method getBanForMember.

@Test
public void getBanForMember() throws Exception {
    System.out.println(CLASS_NAME + "getBanForMember");
    BanOnVo originBan = new BanOnVo(-1, member.getId(), vo.getId(), new Date(), "noob");
    originBan = vosManagerImpl.setBan(sess, originBan);
    BanOnVo actualBan = vosManagerImpl.getBanById(sess, originBan.getId());
    isValidBan(actualBan, originBan.getId(), originBan.getMemberId(), originBan.getVoId(), originBan.getValidityTo(), originBan.getDescription());
}
Also used : BanOnVo(cz.metacentrum.perun.core.api.BanOnVo) Date(java.util.Date) AbstractPerunIntegrationTest(cz.metacentrum.perun.core.AbstractPerunIntegrationTest) Test(org.junit.Test)

Example 17 with BanOnVo

use of cz.metacentrum.perun.core.api.BanOnVo in project perun by CESNET.

the class MembersManagerBlImpl method suspendMemberTo.

@Override
public void suspendMemberTo(PerunSession sess, Member member, Date suspendedTo) {
    BanOnVo ban = new BanOnVo();
    ban.setMemberId(member.getId());
    ban.setVoId(member.getVoId());
    ban.setValidityTo(suspendedTo);
    try {
        perunBl.getVosManagerBl().setBan(sess, ban);
    } catch (MemberNotExistsException e) {
        // shouldn't happen, we expect that the given member exists
        throw new InternalErrorException(e);
    }
}
Also used : BanOnVo(cz.metacentrum.perun.core.api.BanOnVo) MemberNotExistsException(cz.metacentrum.perun.core.api.exceptions.MemberNotExistsException) InternalErrorException(cz.metacentrum.perun.core.api.exceptions.InternalErrorException)

Example 18 with BanOnVo

use of cz.metacentrum.perun.core.api.BanOnVo in project perun by CESNET.

the class VosManagerEntryIntegrationTest method getBanForMemberReturnsNullIfNoBanExists.

@Test
public void getBanForMemberReturnsNullIfNoBanExists() throws Exception {
    System.out.println(CLASS_NAME + "getBanForMemberReturnsNullIfNoBanExists");
    Vo createdVo = vosManagerEntry.createVo(sess, myVo);
    Member member = createMemberFromExtSource(createdVo);
    BanOnVo foundBan = vosManagerEntry.getBanForMember(sess, member);
    assertThat(foundBan).isNull();
}
Also used : BanOnVo(cz.metacentrum.perun.core.api.BanOnVo) BanOnVo(cz.metacentrum.perun.core.api.BanOnVo) Vo(cz.metacentrum.perun.core.api.Vo) Member(cz.metacentrum.perun.core.api.Member) AbstractPerunIntegrationTest(cz.metacentrum.perun.core.AbstractPerunIntegrationTest) Test(org.junit.Test)

Example 19 with BanOnVo

use of cz.metacentrum.perun.core.api.BanOnVo in project perun by CESNET.

the class VosManagerEntryIntegrationTest method removeBanForMemberCorrectly.

@Test
public void removeBanForMemberCorrectly() throws Exception {
    System.out.println(CLASS_NAME + "removeBanForMemberCorrectly");
    Vo createdVo = vosManagerEntry.createVo(sess, myVo);
    Member member = createMemberFromExtSource(createdVo);
    BanOnVo ban = new BanOnVo();
    ban.setMemberId(member.getId());
    vosManagerEntry.setBan(sess, ban);
    vosManagerEntry.removeBanForMember(sess, member);
    assertThat(vosManagerEntry.getBanForMember(sess, member)).isNull();
}
Also used : BanOnVo(cz.metacentrum.perun.core.api.BanOnVo) BanOnVo(cz.metacentrum.perun.core.api.BanOnVo) Vo(cz.metacentrum.perun.core.api.Vo) Member(cz.metacentrum.perun.core.api.Member) AbstractPerunIntegrationTest(cz.metacentrum.perun.core.AbstractPerunIntegrationTest) Test(org.junit.Test)

Example 20 with BanOnVo

use of cz.metacentrum.perun.core.api.BanOnVo in project perun by CESNET.

the class VosManagerEntryIntegrationTest method getBanForMemberCorrectly.

@Test
public void getBanForMemberCorrectly() throws Exception {
    System.out.println(CLASS_NAME + "getBanForMemberCorrectly");
    Vo createdVo = vosManagerEntry.createVo(sess, myVo);
    Member member = createMemberFromExtSource(createdVo);
    BanOnVo ban = new BanOnVo();
    ban.setMemberId(member.getId());
    ban = vosManagerEntry.setBan(sess, ban);
    BanOnVo foundBan = vosManagerEntry.getBanForMember(sess, member);
    assertThat(foundBan).isEqualToIgnoringNullFields(ban);
}
Also used : BanOnVo(cz.metacentrum.perun.core.api.BanOnVo) BanOnVo(cz.metacentrum.perun.core.api.BanOnVo) Vo(cz.metacentrum.perun.core.api.Vo) Member(cz.metacentrum.perun.core.api.Member) AbstractPerunIntegrationTest(cz.metacentrum.perun.core.AbstractPerunIntegrationTest) Test(org.junit.Test)

Aggregations

BanOnVo (cz.metacentrum.perun.core.api.BanOnVo)22 AbstractPerunIntegrationTest (cz.metacentrum.perun.core.AbstractPerunIntegrationTest)13 Test (org.junit.Test)13 Member (cz.metacentrum.perun.core.api.Member)9 Vo (cz.metacentrum.perun.core.api.Vo)8 Date (java.util.Date)8 MemberNotExistsException (cz.metacentrum.perun.core.api.exceptions.MemberNotExistsException)3 PrivilegeException (cz.metacentrum.perun.core.api.exceptions.PrivilegeException)3 BanOnResource (cz.metacentrum.perun.core.api.BanOnResource)2 BanNotExistsException (cz.metacentrum.perun.core.api.exceptions.BanNotExistsException)2 InternalErrorException (cz.metacentrum.perun.core.api.exceptions.InternalErrorException)2 LocalDate (java.time.LocalDate)2 MemberUnsuspended (cz.metacentrum.perun.audit.events.MembersManagerEvents.MemberUnsuspended)1 Attribute (cz.metacentrum.perun.core.api.Attribute)1 Facility (cz.metacentrum.perun.core.api.Facility)1 Resource (cz.metacentrum.perun.core.api.Resource)1 RichMember (cz.metacentrum.perun.core.api.RichMember)1 User (cz.metacentrum.perun.core.api.User)1 BanAlreadyExistsException (cz.metacentrum.perun.core.api.exceptions.BanAlreadyExistsException)1 ConsistencyErrorException (cz.metacentrum.perun.core.api.exceptions.ConsistencyErrorException)1