Search in sources :

Example 1 with VosManager

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

the class ExtSourcesManagerEntryIntegrationTest method removeExtSourceWhenExtSourceNotAssigned.

@Test(expected = ExtSourceNotAssignedException.class)
public void removeExtSourceWhenExtSourceNotAssigned() throws Exception {
    System.out.println(CLASS_NAME + "removeExtSourceWhenExtSourceNotAssigned");
    VosManager vosManager = perun.getVosManager();
    Vo createdVo = vosManager.createVo(sess, new Vo(0, "sjk", "kljlk"));
    extSourcesManagerEntry.removeExtSource(sess, createdVo, extSource);
// shouldn't find not assigned ext source
}
Also used : VosManager(cz.metacentrum.perun.core.api.VosManager) Vo(cz.metacentrum.perun.core.api.Vo) AbstractPerunIntegrationTest(cz.metacentrum.perun.core.AbstractPerunIntegrationTest) Test(org.junit.Test)

Example 2 with VosManager

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

the class ExtSourcesManagerEntryIntegrationTest method removeExtSourceWhenExtSourceNotExist.

@Test(expected = ExtSourceNotExistsException.class)
public void removeExtSourceWhenExtSourceNotExist() throws Exception {
    System.out.println(CLASS_NAME + "removeExtSourceWhenExtSourceNotExist");
    VosManager vosManager = perun.getVosManager();
    Vo createdVo = vosManager.createVo(sess, new Vo(0, "sjk", "kljlk"));
    ExtSource source = new ExtSource(0, "Fake", ExtSourcesManager.EXTSOURCE_INTERNAL);
    extSourcesManagerEntry.removeExtSource(sess, createdVo, source);
// shouldn't find invalid ext source
}
Also used : VosManager(cz.metacentrum.perun.core.api.VosManager) Vo(cz.metacentrum.perun.core.api.Vo) ExtSource(cz.metacentrum.perun.core.api.ExtSource) AbstractPerunIntegrationTest(cz.metacentrum.perun.core.AbstractPerunIntegrationTest) Test(org.junit.Test)

Example 3 with VosManager

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

the class MembersManagerEntryIntegrationTest method setUp.

@Before
public void setUp() throws Exception {
    extSource = perun.getExtSourcesManager().createExtSource(sess, extSource, null);
    usersManagerEntry = perun.getUsersManager();
    attributesManagerEntry = perun.getAttributesManager();
    membersManagerEntry = perun.getMembersManager();
    final Vo vo = new Vo(0, "m3mb3r r00m", "m3mber-room");
    VosManager vosManagerEntry = perun.getVosManager();
    createdVo = vosManagerEntry.createVo(sess, vo);
    assertNotNull(createdVo);
    groupsManagerEntry = perun.getGroupsManager();
    final Group group = new Group("Test_Group_123456", "TestGroupDescr");
    createdGroup = groupsManagerEntry.createGroup(sess, createdVo, group);
    String userFirstName = Long.toHexString(Double.doubleToLongBits(Math.random()));
    String userLastName = Long.toHexString(Double.doubleToLongBits(Math.random()));
    // his login in external source
    String extLogin = Long.toHexString(Double.doubleToLongBits(Math.random()));
    // Mockito.mock(Candidate.class);
    candidate = new Candidate();
    candidate.setFirstName(userFirstName);
    candidate.setId(0);
    candidate.setMiddleName("");
    candidate.setLastName(userLastName);
    candidate.setTitleBefore("");
    candidate.setTitleAfter("");
    ues = new UserExtSource(extSource, extLogin);
    candidate.setUserExtSource(ues);
    candidate.setAttributes(new HashMap<>());
    createdMember = perun.getMembersManagerBl().createMemberSync(sess, createdVo, candidate);
    assertNotNull("No member created", createdMember);
    usersForDeletion.add(perun.getUsersManager().getUserByMember(sess, createdMember));
    // save user for deletion after test
    // need for testing creating members
    g1 = perun.getGroupsManagerBl().createGroup(sess, createdVo, new Group("TESTINGGROUP1", "TESTINGGROUP1"));
    g2 = perun.getGroupsManagerBl().createGroup(sess, createdVo, new Group("TESTINGGROUP2", "TESTINGGROUP2"));
    g3ing1 = perun.getGroupsManagerBl().createGroup(sess, g1, new Group("TESTINGGROUP3", "TESTINGGROUP3"));
}
Also used : Candidate(cz.metacentrum.perun.core.api.Candidate) Group(cz.metacentrum.perun.core.api.Group) VosManager(cz.metacentrum.perun.core.api.VosManager) UserExtSource(cz.metacentrum.perun.core.api.UserExtSource) Vo(cz.metacentrum.perun.core.api.Vo) BanOnVo(cz.metacentrum.perun.core.api.BanOnVo) Before(org.junit.Before)

Example 4 with VosManager

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

the class ExtSourcesManagerEntryIntegrationTest method addExtSourceWhenExtSourceAlreadyAssigned.

@Test(expected = ExtSourceAlreadyAssignedException.class)
public void addExtSourceWhenExtSourceAlreadyAssigned() throws Exception {
    System.out.println(CLASS_NAME + "addExtSourceWhenExtSourceAlreadyAssigned");
    VosManager vosManager = perun.getVosManager();
    Vo createdVo = vosManager.createVo(sess, new Vo(0, "sjk", "kljlk"));
    extSourcesManagerEntry.addExtSource(sess, createdVo, extSource);
    extSourcesManagerEntry.addExtSource(sess, createdVo, extSource);
// shouldn't add same ext source twice
}
Also used : VosManager(cz.metacentrum.perun.core.api.VosManager) Vo(cz.metacentrum.perun.core.api.Vo) AbstractPerunIntegrationTest(cz.metacentrum.perun.core.AbstractPerunIntegrationTest) Test(org.junit.Test)

Aggregations

Vo (cz.metacentrum.perun.core.api.Vo)4 VosManager (cz.metacentrum.perun.core.api.VosManager)4 AbstractPerunIntegrationTest (cz.metacentrum.perun.core.AbstractPerunIntegrationTest)3 Test (org.junit.Test)3 BanOnVo (cz.metacentrum.perun.core.api.BanOnVo)1 Candidate (cz.metacentrum.perun.core.api.Candidate)1 ExtSource (cz.metacentrum.perun.core.api.ExtSource)1 Group (cz.metacentrum.perun.core.api.Group)1 UserExtSource (cz.metacentrum.perun.core.api.UserExtSource)1 Before (org.junit.Before)1