Search in sources :

Example 86 with PerunBl

use of cz.metacentrum.perun.core.bl.PerunBl in project perun by CESNET.

the class urn_perun_group_attribute_def_virt_adDisplayName_o365muTest method setUp.

@Before
public void setUp() throws Exception {
    // prepare mocks
    sess = mock(PerunSessionImpl.class);
    PerunBl perunBl = mock(PerunBl.class);
    AttributesManagerBl am = mock(AttributesManagerBl.class);
    GroupsManagerBl gm = mock(GroupsManagerBl.class);
    when(sess.getPerunBl()).thenReturn(perunBl);
    when(perunBl.getAttributesManagerBl()).thenReturn(am);
    when(perunBl.getGroupsManagerBl()).thenReturn(gm);
    when(sess.getPerunBl().getGroupsManagerBl().getParentGroup(sess, groupB)).thenReturn(groupA);
    when(sess.getPerunBl().getGroupsManagerBl().getParentGroup(sess, groupC)).thenReturn(groupB);
    when(sess.getPerunBl().getGroupsManagerBl().getParentGroup(sess, groupD)).thenReturn(groupC);
    when(sess.getPerunBl().getGroupsManagerBl().getParentGroup(sess, groupE)).thenReturn(groupD);
    when(sess.getPerunBl().getGroupsManagerBl().getParentGroup(sess, groupF)).thenReturn(groupA);
    // group A is the main group with cispr 000000, it has no default display name
    setWhenClauseByParametersForGroup(sess, groupA, null, "000000", groupA.getName(), groupA.getDescription(), typeOfWorkplacesA);
    // group B is special group which should return null on display name
    setWhenClauseByParametersForGroup(sess, groupB, null, "000001", groupB.getName(), groupB.getDescription(), typeOfWorkplacesA);
    // group C is other part of university, it has no default display name
    setWhenClauseByParametersForGroup(sess, groupC, null, "110000", groupC.getName(), groupC.getDescription(), typeOfWorkplacesB);
    // group D is special group with predefined display name
    setWhenClauseByParametersForGroup(sess, groupD, predefinedDisplayName, null, null, null, null);
    // group E is other type of group, it has no default display name
    setWhenClauseByParametersForGroup(sess, groupE, null, "123456", groupE.getName(), groupE.getDescription(), typeOfWorkplacesC);
    // group E is other type of group, it has no default display name, but displayName is missing
    setWhenClauseByParametersForGroup(sess, groupF, null, "654321", groupF.getName(), groupF.getDescription(), typeOfWorkplacesB);
    when(sess.getPerunBl().getAttributesManagerBl().getAttribute(sess, groupWithoutAttributes, defaultAdDisplayNameAttrDef.getName())).thenThrow(AttributeNotExistsException.class);
    when(sess.getPerunBl().getAttributesManagerBl().getAttribute(sess, groupWithoutAttributes, inetCisprAttrDef.getName())).thenThrow(AttributeNotExistsException.class);
    when(sess.getPerunBl().getAttributesManagerBl().getAttribute(sess, groupWithoutAttributes, inetWorkplacesTypeCSAttrDef.getName())).thenThrow(AttributeNotExistsException.class);
}
Also used : GroupsManagerBl(cz.metacentrum.perun.core.bl.GroupsManagerBl) PerunBl(cz.metacentrum.perun.core.bl.PerunBl) PerunSessionImpl(cz.metacentrum.perun.core.impl.PerunSessionImpl) AttributesManagerBl(cz.metacentrum.perun.core.bl.AttributesManagerBl) Before(org.junit.Before)

Example 87 with PerunBl

use of cz.metacentrum.perun.core.bl.PerunBl in project perun by CESNET.

the class urn_perun_facility_attribute_def_virt_GIDRangesTest method setUp.

@Before
public void setUp() throws Exception {
    classInstance = new urn_perun_facility_attribute_def_virt_GIDRanges();
    session = mock(PerunSessionImpl.class);
    facility = new Facility();
    attributeToCheck = new Attribute();
    attributeToCheck.setFriendlyName("friendly_name");
    reqAttribute = new Attribute();
    PerunBl perunBl = mock(PerunBl.class);
    when(session.getPerunBl()).thenReturn(perunBl);
    AttributesManagerBl attributesManagerBl = mock(AttributesManagerBl.class);
    when(perunBl.getAttributesManagerBl()).thenReturn(attributesManagerBl);
}
Also used : Attribute(cz.metacentrum.perun.core.api.Attribute) PerunBl(cz.metacentrum.perun.core.bl.PerunBl) Facility(cz.metacentrum.perun.core.api.Facility) PerunSessionImpl(cz.metacentrum.perun.core.impl.PerunSessionImpl) AttributesManagerBl(cz.metacentrum.perun.core.bl.AttributesManagerBl) Before(org.junit.Before)

Example 88 with PerunBl

use of cz.metacentrum.perun.core.bl.PerunBl in project perun by CESNET.

the class urn_perun_facility_attribute_def_def_pbsServerTest method setUp.

@Before
public void setUp() throws Exception {
    classInstance = new urn_perun_facility_attribute_def_def_pbsServer();
    session = mock(PerunSessionImpl.class);
    facility = new Facility();
    attributeToCheck = new Attribute();
    Attribute name = new Attribute();
    PerunBl perunBl = mock(PerunBl.class);
    when(session.getPerunBl()).thenReturn(perunBl);
    FacilitiesManagerBl facilitiesManagerBl = mock(FacilitiesManagerBl.class);
    when(perunBl.getFacilitiesManagerBl()).thenReturn(facilitiesManagerBl);
    AttributesManagerBl attributesManagerBl = mock(AttributesManagerBl.class);
    when(perunBl.getAttributesManagerBl()).thenReturn(attributesManagerBl);
    when(attributesManagerBl.getAttributeDefinition(session, AttributesManager.NS_FACILITY_ATTR_CORE + ":name")).thenReturn(name);
}
Also used : FacilitiesManagerBl(cz.metacentrum.perun.core.bl.FacilitiesManagerBl) Attribute(cz.metacentrum.perun.core.api.Attribute) PerunBl(cz.metacentrum.perun.core.bl.PerunBl) Facility(cz.metacentrum.perun.core.api.Facility) PerunSessionImpl(cz.metacentrum.perun.core.impl.PerunSessionImpl) AttributesManagerBl(cz.metacentrum.perun.core.bl.AttributesManagerBl) Before(org.junit.Before)

Example 89 with PerunBl

use of cz.metacentrum.perun.core.bl.PerunBl in project perun by CESNET.

the class urn_perun_facility_attribute_def_def_reqAupsTest method setUp.

@Before
public void setUp() throws Exception {
    classInstance = new urn_perun_facility_attribute_def_def_reqAups();
    session = mock(PerunSessionImpl.class);
    facility = new Facility();
    attributeToCheck = new Attribute();
    reqAttribute = new Attribute();
    PerunBl perunBl = mock(PerunBl.class);
    when(session.getPerunBl()).thenReturn(perunBl);
    AttributesManagerBl attributesManagerBl = mock(AttributesManagerBl.class);
    when(perunBl.getAttributesManagerBl()).thenReturn(attributesManagerBl);
    when(session.getPerunBl().getAttributesManagerBl().getEntitylessAttributes(session, AttributesManager.NS_ENTITYLESS_ATTR_DEF + ":orgAups")).thenReturn(Collections.singletonList(reqAttribute));
}
Also used : Attribute(cz.metacentrum.perun.core.api.Attribute) PerunBl(cz.metacentrum.perun.core.bl.PerunBl) Facility(cz.metacentrum.perun.core.api.Facility) PerunSessionImpl(cz.metacentrum.perun.core.impl.PerunSessionImpl) AttributesManagerBl(cz.metacentrum.perun.core.bl.AttributesManagerBl) Before(org.junit.Before)

Example 90 with PerunBl

use of cz.metacentrum.perun.core.bl.PerunBl in project perun by CESNET.

the class urn_perun_facility_attribute_def_def_uid_namespaceTest method setUp.

@Before
public void setUp() throws Exception {
    classInstance = new urn_perun_facility_attribute_def_def_uid_namespace();
    session = mock(PerunSessionImpl.class);
    facility = new Facility();
    attributeToCheck = new Attribute();
    attributeToCheck.setFriendlyName("friendly_name");
    reqAttribute = new Attribute();
    PerunBl perunBl = mock(PerunBl.class);
    when(session.getPerunBl()).thenReturn(perunBl);
    AttributesManagerBl attributesManagerBl = mock(AttributesManagerBl.class);
    when(perunBl.getAttributesManagerBl()).thenReturn(attributesManagerBl);
}
Also used : Attribute(cz.metacentrum.perun.core.api.Attribute) PerunBl(cz.metacentrum.perun.core.bl.PerunBl) Facility(cz.metacentrum.perun.core.api.Facility) PerunSessionImpl(cz.metacentrum.perun.core.impl.PerunSessionImpl) AttributesManagerBl(cz.metacentrum.perun.core.bl.AttributesManagerBl) Before(org.junit.Before)

Aggregations

PerunBl (cz.metacentrum.perun.core.bl.PerunBl)130 Attribute (cz.metacentrum.perun.core.api.Attribute)93 Before (org.junit.Before)65 PerunSessionImpl (cz.metacentrum.perun.core.impl.PerunSessionImpl)64 AttributesManagerBl (cz.metacentrum.perun.core.bl.AttributesManagerBl)48 User (cz.metacentrum.perun.core.api.User)41 InternalErrorException (cz.metacentrum.perun.core.api.exceptions.InternalErrorException)37 ArrayList (java.util.ArrayList)22 Vo (cz.metacentrum.perun.core.api.Vo)21 Facility (cz.metacentrum.perun.core.api.Facility)19 UserExtSource (cz.metacentrum.perun.core.api.UserExtSource)19 ModulesUtilsBl (cz.metacentrum.perun.core.bl.ModulesUtilsBl)19 ExtSource (cz.metacentrum.perun.core.api.ExtSource)16 Member (cz.metacentrum.perun.core.api.Member)16 AttributeNotExistsException (cz.metacentrum.perun.core.api.exceptions.AttributeNotExistsException)16 UserExtSourceExistsException (cz.metacentrum.perun.core.api.exceptions.UserExtSourceExistsException)16 UsersManagerBl (cz.metacentrum.perun.core.bl.UsersManagerBl)15 WrongAttributeAssignmentException (cz.metacentrum.perun.core.api.exceptions.WrongAttributeAssignmentException)14 GroupsManagerBl (cz.metacentrum.perun.core.bl.GroupsManagerBl)13 Group (cz.metacentrum.perun.core.api.Group)12