use of cz.metacentrum.perun.core.bl.AttributesManagerBl in project perun by CESNET.
the class urn_perun_entityless_attribute_def_def_namespace_minUIDTest method setUp.
@Before
public void setUp() throws Exception {
classInstance = new urn_perun_entityless_attribute_def_def_namespace_minUID();
session = mock(PerunSessionImpl.class);
attributeToCheck = new Attribute(classInstance.getAttributeDefinition());
reqAttribute = new Attribute(classInstance.getAttributeDefinition());
PerunBl perunBl = mock(PerunBl.class);
when(session.getPerunBl()).thenReturn(perunBl);
AttributesManagerBl attributesManagerBl = mock(AttributesManagerBl.class);
when(perunBl.getAttributesManagerBl()).thenReturn(attributesManagerBl);
when(session.getPerunBl().getAttributesManagerBl().getAttribute(session, key, AttributesManager.NS_ENTITYLESS_ATTR_DEF + ":namespace-maxUID")).thenReturn(reqAttribute);
}
use of cz.metacentrum.perun.core.bl.AttributesManagerBl in project perun by CESNET.
the class urn_perun_facility_attribute_def_def_unixGID_namespaceTest method setUp.
@Before
public void setUp() throws Exception {
classInstance = new urn_perun_facility_attribute_def_def_unixGID_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);
}
use of cz.metacentrum.perun.core.bl.AttributesManagerBl in project perun by CESNET.
the class urn_perun_facility_attribute_def_virt_maxUIDTest method setUp.
@Before
public void setUp() throws Exception {
classInstance = new urn_perun_facility_attribute_def_virt_maxUID();
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);
}
use of cz.metacentrum.perun.core.bl.AttributesManagerBl in project perun by CESNET.
the class urn_perun_facility_attribute_def_def_login_namespaceTest method setUp.
@Before
public void setUp() throws Exception {
classInstance = new urn_perun_facility_attribute_def_def_login_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);
}
use of cz.metacentrum.perun.core.bl.AttributesManagerBl in project perun by CESNET.
the class urn_perun_group_attribute_def_virt_adGroupName method fetchAdGroupNamesFromGroupAndItsParentGroups.
/**
* Recursively fetch adGroupName value from group and its parent groups
* Result names are sorted from root group name to the leaf group name.
*
* @param sess Perun Session
* @param group for which we will be fetching values
* @return List of adGroupName values from group and its parent groups
* @throws WrongAttributeAssignmentException
* @throws AttributeNotExistsException
*/
private List<String> fetchAdGroupNamesFromGroupAndItsParentGroups(PerunSessionImpl sess, Group group) throws WrongAttributeAssignmentException, AttributeNotExistsException {
List<String> resultList = new ArrayList<>();
AttributesManagerBl am = sess.getPerunBl().getAttributesManagerBl();
Attribute adGroupName = am.getAttribute(sess, group, SOURCE_ATTR_NAME);
String value = adGroupName.valueAsString();
if (group.getParentGroupId() != null) {
try {
Group parentGroup = sess.getPerunBl().getGroupsManagerBl().getParentGroup(sess, group);
resultList.addAll(fetchAdGroupNamesFromGroupAndItsParentGroups(sess, parentGroup));
} catch (ParentGroupNotExistsException e) {
throw new ConsistencyErrorException(e);
}
}
resultList.add(value);
return resultList;
}
Aggregations