Search in sources :

Example 36 with ExtSource

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

the class urn_perun_group_resource_attribute_def_def_isUnixGroupIntegrationtest method setUpUserExtSource.

private void setUpUserExtSource() throws Exception {
    ExtSource externalSource = perun.getExtSourcesManager().getExtSourceByName(sess, extSourceName);
    // gets real external source object from database
    userExtSource.setExtSource(externalSource);
    // put real external source into user's external source
    userExtSource.setLogin(extLogin);
    // set users login in his ext source
    assertNotNull(usersManager.addUserExtSource(sess, user, userExtSource));
// create new user ext source in database
}
Also used : UserExtSource(cz.metacentrum.perun.core.api.UserExtSource) ExtSource(cz.metacentrum.perun.core.api.ExtSource)

Example 37 with ExtSource

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

the class VosManagerEntryIntegrationTest method setUp.

@Before
public void setUp() throws Exception {
    vosManagerEntry = perun.getVosManager();
    myVo = new Vo(0, voName, voShortName);
    ExtSource newExtSource = new ExtSource(extSourceName, ExtSourcesManager.EXTSOURCE_INTERNAL);
    es = perun.getExtSourcesManager().createExtSource(sess, newExtSource, null);
}
Also used : Vo(cz.metacentrum.perun.core.api.Vo) UserExtSource(cz.metacentrum.perun.core.api.UserExtSource) ExtSource(cz.metacentrum.perun.core.api.ExtSource) Before(org.junit.Before)

Example 38 with ExtSource

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

the class UsersManagerEntryIntegrationTest method setUpVo.

private Vo setUpVo() throws Exception {
    Vo newVo = new Vo(0, "UserManagerTestVo", "UMTestVo");
    Vo returnedVo = perun.getVosManager().createVo(sess, newVo);
    // create test VO in database
    assertNotNull("unable to create testing Vo", returnedVo);
    assertEquals("both VOs should be the same", newVo, returnedVo);
    ExtSource newExtSource = new ExtSource(extSourceName, ExtSourcesManager.EXTSOURCE_INTERNAL);
    ExtSource es = perun.getExtSourcesManager().createExtSource(sess, newExtSource, null);
    // get and create real external source from DB
    perun.getExtSourcesManager().addExtSource(sess, returnedVo, es);
    return returnedVo;
}
Also used : Vo(cz.metacentrum.perun.core.api.Vo) ExtSource(cz.metacentrum.perun.core.api.ExtSource) UserExtSource(cz.metacentrum.perun.core.api.UserExtSource)

Example 39 with ExtSource

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

the class UsersManagerEntryIntegrationTest method getUserExtSourceByExtLoginWhenExtSourceNotExists.

@Test(expected = ExtSourceNotExistsException.class)
public void getUserExtSourceByExtLoginWhenExtSourceNotExists() throws Exception {
    System.out.println(CLASS_NAME + "getUserExtSourceByExtLoginWhenExtSourceNotExists");
    usersManager.getUserExtSourceByExtLogin(sess, new ExtSource(), "");
}
Also used : ExtSource(cz.metacentrum.perun.core.api.ExtSource) UserExtSource(cz.metacentrum.perun.core.api.UserExtSource) AbstractPerunIntegrationTest(cz.metacentrum.perun.core.AbstractPerunIntegrationTest) Test(org.junit.Test)

Example 40 with ExtSource

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

the class MembersManagerBlImpl method createMember.

/*
	 * This method finally has to call this.createMember(PerunSession sess, Vo vo, UserExtSource userExtSource)
	 * @see cz.metacentrum.perun.core.api.MembersManager#createMember(cz.metacentrum.perun.core.api.PerunSession, cz.metacentrum.perun.core.api.Vo, java.lang.String, java.lang.String, java.lang.String, cz.metacentrum.perun.core.api.Candidate)
	 */
public Member createMember(PerunSession sess, Vo vo, String extSourceName, String extSourceType, String login, Candidate candidate, List<Group> groups) throws InternalErrorException, WrongAttributeValueException, WrongReferenceAttributeValueException, AlreadyMemberException, ExtendMembershipException, GroupOperationsException {
    // Create ExtSource object
    ExtSource extSource = new ExtSource();
    extSource.setName(extSourceName);
    extSource.setType(extSourceType);
    // Create UserExtSource object
    UserExtSource userExtSource = new UserExtSource();
    userExtSource.setLogin(login);
    userExtSource.setExtSource(extSource);
    // Set all above data to the candidate's userExtSource
    candidate.setUserExtSource(userExtSource);
    return this.createMember(sess, vo, candidate, groups);
}
Also used : UserExtSource(cz.metacentrum.perun.core.api.UserExtSource) ExtSource(cz.metacentrum.perun.core.api.ExtSource) UserExtSource(cz.metacentrum.perun.core.api.UserExtSource)

Aggregations

ExtSource (cz.metacentrum.perun.core.api.ExtSource)58 UserExtSource (cz.metacentrum.perun.core.api.UserExtSource)36 AbstractPerunIntegrationTest (cz.metacentrum.perun.core.AbstractPerunIntegrationTest)24 Test (org.junit.Test)24 Vo (cz.metacentrum.perun.core.api.Vo)16 InternalErrorException (cz.metacentrum.perun.core.api.exceptions.InternalErrorException)13 Candidate (cz.metacentrum.perun.core.api.Candidate)12 Group (cz.metacentrum.perun.core.api.Group)11 ExtSourceNotExistsException (cz.metacentrum.perun.core.api.exceptions.ExtSourceNotExistsException)10 Member (cz.metacentrum.perun.core.api.Member)8 ConsistencyErrorException (cz.metacentrum.perun.core.api.exceptions.ConsistencyErrorException)8 ArrayList (java.util.ArrayList)5 Attribute (cz.metacentrum.perun.core.api.Attribute)4 AttributeNotExistsException (cz.metacentrum.perun.core.api.exceptions.AttributeNotExistsException)4 CandidateNotExistsException (cz.metacentrum.perun.core.api.exceptions.CandidateNotExistsException)4 ExtSourceExistsException (cz.metacentrum.perun.core.api.exceptions.ExtSourceExistsException)4 MemberNotExistsException (cz.metacentrum.perun.core.api.exceptions.MemberNotExistsException)4 HashMap (java.util.HashMap)4 User (cz.metacentrum.perun.core.api.User)3 ExtSourceUnsupportedOperationException (cz.metacentrum.perun.core.api.exceptions.ExtSourceUnsupportedOperationException)3