Search in sources :

Example 66 with UserExtSource

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

the class AttributesManagerEntryIntegrationTest method setUserExtSourceAttributesWhenTypeMismatch.

@Test(expected = InternalErrorException.class)
public void setUserExtSourceAttributesWhenTypeMismatch() throws Exception {
    System.out.println(CLASS_NAME + "setUserExtSourceAttributesWhenTypeMismatch");
    UserExtSource ues = setUpUserExtSourceTest();
    attributes = setUpUserExtSourceAttribute();
    attributes.get(0).setValue(1);
    // set wrong value - integer into string
    attributesManager.setAttributes(sess, ues, attributes);
// shouldn't set wrong attribute
}
Also used : UserExtSource(cz.metacentrum.perun.core.api.UserExtSource) AbstractPerunIntegrationTest(cz.metacentrum.perun.core.AbstractPerunIntegrationTest) Test(org.junit.Test)

Example 67 with UserExtSource

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

the class AttributesManagerEntryIntegrationTest method removeUserExtSourceAttributes.

@Test
public void removeUserExtSourceAttributes() throws Exception {
    System.out.println(CLASS_NAME + "removeUserExtSourceAttributes");
    UserExtSource ues = setUpUserExtSourceTest();
    attributes = setUpUserExtSourceAttribute();
    attributesManager.setAttribute(sess, ues, attributes.get(0));
    // create userExtSource and set attribute with value
    attributesManager.removeAttributes(sess, ues, attributes);
    // remove attributes from resource (definition or attribute)
    List<Attribute> retAttr = attributesManager.getAttributes(sess, ues);
    assertFalse("our user external source shouldn't have set our attribute", retAttr.contains(attributes.get(0)));
}
Also used : UserExtSource(cz.metacentrum.perun.core.api.UserExtSource) Attribute(cz.metacentrum.perun.core.api.Attribute) RichAttribute(cz.metacentrum.perun.core.api.RichAttribute) AbstractPerunIntegrationTest(cz.metacentrum.perun.core.AbstractPerunIntegrationTest) Test(org.junit.Test)

Example 68 with UserExtSource

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

the class AttributesManagerEntryIntegrationTest method removeUserExtSourceAttributeWhenAttributeNotExists.

@Test(expected = AttributeNotExistsException.class)
public void removeUserExtSourceAttributeWhenAttributeNotExists() throws Exception {
    System.out.println(CLASS_NAME + "removeUserExtSourceAttributeWhenAttributeNotExists");
    UserExtSource ues = setUpUserExtSourceTest();
    attributes = setUpUserExtSourceAttribute();
    attributes.get(0).setId(0);
    attributesManager.removeAttribute(sess, ues, attributes.get(0));
// shouldn't find attribute
}
Also used : UserExtSource(cz.metacentrum.perun.core.api.UserExtSource) AbstractPerunIntegrationTest(cz.metacentrum.perun.core.AbstractPerunIntegrationTest) Test(org.junit.Test)

Example 69 with UserExtSource

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

the class AttributesManagerEntryIntegrationTest method removeAllUserExtSourceAttributes.

@Test
public void removeAllUserExtSourceAttributes() throws Exception {
    System.out.println(CLASS_NAME + "removeAllUserExtSourceAttributes");
    UserExtSource ues = setUpUserExtSourceTest();
    attributes = setUpUserExtSourceAttribute();
    attributesManager.setAttribute(sess, ues, attributes.get(0));
    // create user external source and set attribute with value
    attributesManager.removeAllAttributes(sess, ues);
    // remove all attributes from user external source (definition or attribute)
    List<Attribute> retAttr = attributesManager.getAttributes(sess, ues);
    assertFalse("our user external source shouldn't have set our attribute", retAttr.contains(attributes.get(0)));
}
Also used : UserExtSource(cz.metacentrum.perun.core.api.UserExtSource) Attribute(cz.metacentrum.perun.core.api.Attribute) RichAttribute(cz.metacentrum.perun.core.api.RichAttribute) AbstractPerunIntegrationTest(cz.metacentrum.perun.core.AbstractPerunIntegrationTest) Test(org.junit.Test)

Example 70 with UserExtSource

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

the class AttributesManagerEntryIntegrationTest method removeUserExtSourceAttributesWhenAttributeNotExists.

@Test(expected = AttributeNotExistsException.class)
public void removeUserExtSourceAttributesWhenAttributeNotExists() throws Exception {
    System.out.println(CLASS_NAME + "removeUserExtSourceAttributesWhenAttributeNotExists");
    UserExtSource ues = setUpUserExtSourceTest();
    attributes = setUpUserExtSourceAttribute();
    attributes.get(0).setId(0);
    attributesManager.removeAttributes(sess, ues, attributes);
// shouldn't find attribute
}
Also used : UserExtSource(cz.metacentrum.perun.core.api.UserExtSource) AbstractPerunIntegrationTest(cz.metacentrum.perun.core.AbstractPerunIntegrationTest) Test(org.junit.Test)

Aggregations

UserExtSource (cz.metacentrum.perun.core.api.UserExtSource)79 AbstractPerunIntegrationTest (cz.metacentrum.perun.core.AbstractPerunIntegrationTest)34 Test (org.junit.Test)34 ExtSource (cz.metacentrum.perun.core.api.ExtSource)28 Attribute (cz.metacentrum.perun.core.api.Attribute)19 Candidate (cz.metacentrum.perun.core.api.Candidate)18 InternalErrorException (cz.metacentrum.perun.core.api.exceptions.InternalErrorException)14 User (cz.metacentrum.perun.core.api.User)12 Member (cz.metacentrum.perun.core.api.Member)11 ArrayList (java.util.ArrayList)11 RichAttribute (cz.metacentrum.perun.core.api.RichAttribute)8 Group (cz.metacentrum.perun.core.api.Group)7 ExtSourceNotExistsException (cz.metacentrum.perun.core.api.exceptions.ExtSourceNotExistsException)6 ConsistencyErrorException (cz.metacentrum.perun.core.api.exceptions.ConsistencyErrorException)5 HashMap (java.util.HashMap)5 RichUser (cz.metacentrum.perun.core.api.RichUser)4 AttributeNotExistsException (cz.metacentrum.perun.core.api.exceptions.AttributeNotExistsException)4 WrongAttributeAssignmentException (cz.metacentrum.perun.core.api.exceptions.WrongAttributeAssignmentException)4 Matcher (java.util.regex.Matcher)4 RichMember (cz.metacentrum.perun.core.api.RichMember)3