Search in sources :

Example 6 with BanOnVo

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

the class VosManagerEntryIntegrationTest method getBansForVo.

@Test
public void getBansForVo() throws Exception {
    System.out.println(CLASS_NAME + "getBansForVo");
    Vo createdVo = vosManagerEntry.createVo(sess, myVo);
    Member member = createMemberFromExtSource(createdVo);
    BanOnVo ban = new BanOnVo();
    ban.setMemberId(member.getId());
    vosManagerEntry.setBan(sess, ban);
    List<BanOnVo> voBans = vosManagerEntry.getBansForVo(sess, createdVo.getId());
    assertThat(voBans).containsOnly(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)

Example 7 with BanOnVo

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

the class VosManagerEntryIntegrationTest method getBanByIdCorrectly.

@Test
public void getBanByIdCorrectly() throws Exception {
    System.out.println(CLASS_NAME + "getBanByIdCorrectly");
    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.getBanById(sess, ban.getId());
    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)

Example 8 with BanOnVo

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

the class VosManagerImplIntegrationTest method getBansForVo.

@Test
public void getBansForVo() {
    System.out.println(CLASS_NAME + "getBansForVo");
    BanOnVo originBan = new BanOnVo(-1, member.getId(), vo.getId(), new Date(), "noob");
    originBan = vosManagerImpl.setBan(sess, originBan);
    BanOnVo otherBan = new BanOnVo(-1, otherMember.getId(), otherVo.getId(), new Date(), "noob");
    vosManagerImpl.setBan(sess, otherBan);
    List<BanOnVo> voBans = vosManagerImpl.getBansForVo(sess, vo.getId());
    assertThat(voBans).containsOnly(originBan);
}
Also used : BanOnVo(cz.metacentrum.perun.core.api.BanOnVo) Date(java.util.Date) AbstractPerunIntegrationTest(cz.metacentrum.perun.core.AbstractPerunIntegrationTest) Test(org.junit.Test)

Example 9 with BanOnVo

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

the class VosManagerImplIntegrationTest method getBanById.

@Test
public void getBanById() throws Exception {
    System.out.println(CLASS_NAME + "getBanById");
    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 10 with BanOnVo

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

the class VosManagerEntryIntegrationTest method setBanCorrectly.

@Test
public void setBanCorrectly() throws Exception {
    System.out.println(CLASS_NAME + "setBanCorrectly");
    Vo createdVo = vosManagerEntry.createVo(sess, myVo);
    Member member = createMemberFromExtSource(createdVo);
    BanOnVo ban = new BanOnVo();
    ban.setMemberId(member.getId());
    ban = vosManagerEntry.setBan(sess, ban);
    assertThat(ban.getId()).isNotNull();
    assertThat(ban.getVoId()).isNotNull();
    BanOnVo foundBan = vosManagerEntry.getBanById(sess, ban.getId());
    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