use of cz.metacentrum.perun.core.bl.AttributesManagerBl in project perun by CESNET.
the class ResourcesManagerBlImpl method checkSemanticsOfFacilityAndResourceRequiredAttributes.
/**
* Checks semantics of all required attributes of given resource and its facility.
*
* @param sess session
* @param resource resource used to get facility and attributes
* @throws WrongReferenceAttributeValueException WrongReferenceAttributeValueException
* @throws WrongAttributeAssignmentException WrongAttributeAssignmentException
*/
public void checkSemanticsOfFacilityAndResourceRequiredAttributes(PerunSession sess, Resource resource) throws WrongReferenceAttributeValueException, WrongAttributeAssignmentException {
AttributesManagerBl attributesManagerBl = getPerunBl().getAttributesManagerBl();
Facility facility = getFacility(sess, resource);
List<Attribute> facilityRequiredAttributes = attributesManagerBl.getRequiredAttributes(sess, facility);
List<Attribute> resourceRequiredAttributes = attributesManagerBl.getRequiredAttributes(sess, resource);
attributesManagerBl.checkAttributesSemantics(sess, facility, facilityRequiredAttributes);
attributesManagerBl.checkAttributesSemantics(sess, resource, resourceRequiredAttributes);
}
use of cz.metacentrum.perun.core.bl.AttributesManagerBl in project perun by CESNET.
the class urn_perun_user_facility_attribute_def_def_defaultUnixGIDTest method setUp.
@Before
public void setUp() throws Exception {
classInstance = new urn_perun_user_facility_attribute_def_def_defaultUnixGID();
attributeToCheck = new Attribute();
attributeToCheck.setValue(5);
namespace = new Attribute();
namespace.setValue("namespace");
unixGroupNamespace = new Attribute();
unixGroupNamespace.setValue("unixGroupNamespace");
resourceGidAttribute = new Attribute();
resourceGidAttribute.setValue("resourceGidAttribute");
groupGidAttribute = new Attribute();
groupGidAttribute.setValue("groupGidAttribute");
sess = mock(PerunSessionImpl.class);
PerunBl perunBl = mock(PerunBl.class);
when(sess.getPerunBl()).thenReturn(perunBl);
AttributesManagerBl attributesManagerBl = mock(AttributesManagerBl.class);
when(perunBl.getAttributesManagerBl()).thenReturn(attributesManagerBl);
when(sess.getPerunBl().getAttributesManagerBl().getAttribute(sess, facility, AttributesManager.NS_FACILITY_ATTR_DEF + ":unixGID-namespace")).thenReturn(namespace);
when(sess.getPerunBl().getAttributesManagerBl().getAttribute(sess, facility, AttributesManager.NS_FACILITY_ATTR_DEF + ":unixGroupName-namespace")).thenReturn(unixGroupNamespace);
when(sess.getPerunBl().getAttributesManagerBl().getAttributeDefinition(sess, AttributesManager.NS_RESOURCE_ATTR_DEF + ":unixGID-namespace:" + namespace.valueAsString())).thenReturn(resourceGidAttribute);
when(sess.getPerunBl().getAttributesManagerBl().getAttributeDefinition(sess, AttributesManager.NS_GROUP_ATTR_DEF + ":unixGID-namespace:" + namespace.valueAsString())).thenReturn(groupGidAttribute);
ResourcesManagerBl resourcesManagerBl = mock(ResourcesManagerBl.class);
when(sess.getPerunBl().getResourcesManagerBl()).thenReturn(resourcesManagerBl);
UsersManagerBl usersManagerBl = mock(UsersManagerBl.class);
when(sess.getPerunBl().getUsersManagerBl()).thenReturn(usersManagerBl);
GroupsManagerBl groupsManagerBl = mock(GroupsManagerBl.class);
when(sess.getPerunBl().getGroupsManagerBl()).thenReturn(groupsManagerBl);
when(sess.getPerunBl().getGroupsManagerBl().getGroupsByAttribute(sess, groupGidAttribute)).thenReturn(new ArrayList<>());
FacilitiesManagerBl facilitiesManagerBl = mock(FacilitiesManagerBl.class);
when(sess.getPerunBl().getFacilitiesManagerBl()).thenReturn(facilitiesManagerBl);
when(sess.getPerunBl().getFacilitiesManagerBl().getAllowedGroups(sess, facility, null, null)).thenReturn(new ArrayList<>());
}
use of cz.metacentrum.perun.core.bl.AttributesManagerBl in project perun by CESNET.
the class urn_perun_user_facility_attribute_def_virt_loginTest method setUp.
@Before
public void setUp() throws Exception {
classInstance = new urn_perun_user_facility_attribute_def_virt_login();
attributeToCheck = new Attribute();
userLoginNamespace = new Attribute();
userLoginNamespace.setValue("user_login_namespace");
facilityLoginNamespace = new Attribute();
facilityLoginNamespace.setValue("facility_login_namespace");
sess = mock(PerunSessionImpl.class);
PerunBl perunBl = mock(PerunBl.class);
when(sess.getPerunBl()).thenReturn(perunBl);
AttributesManagerBl attributesManagerBl = mock(AttributesManagerBl.class);
when(sess.getPerunBl().getAttributesManagerBl()).thenReturn(attributesManagerBl);
when(attributesManagerBl.getAttribute(sess, facility, AttributesManager.NS_FACILITY_ATTR_DEF + ":login-namespace")).thenReturn(facilityLoginNamespace);
when(attributesManagerBl.getAttribute(sess, user, AttributesManager.NS_USER_ATTR_DEF + ":login-namespace:" + facilityLoginNamespace.getValue())).thenReturn(userLoginNamespace);
}
use of cz.metacentrum.perun.core.bl.AttributesManagerBl in project perun by CESNET.
the class urn_perun_group_attribute_def_def_groupStructureSynchronizationEnabledTest method setUp.
@Before
public void setUp() throws Exception {
classInstance = new urn_perun_group_attribute_def_def_groupStructureSynchronizationEnabled();
reqAttribute = new Attribute(classInstance.getAttributeDefinition());
attributeToCheck = new Attribute(classInstance.getAttributeDefinition());
sess = mock(PerunSessionImpl.class);
PerunBl perunBl = mock(PerunBl.class);
when(sess.getPerunBl()).thenReturn(perunBl);
GroupsManagerBl groupsManagerBl = mock(GroupsManagerBl.class);
when(sess.getPerunBl().getGroupsManagerBl()).thenReturn(groupsManagerBl);
when(sess.getPerunBl().getGroupsManagerBl().isGroupSynchronizedFromExternallSource(sess, group)).thenReturn(false);
AttributesManagerBl attributesManagerBl = mock(AttributesManagerBl.class);
when(perunBl.getAttributesManagerBl()).thenReturn(attributesManagerBl);
when(sess.getPerunBl().getAttributesManagerBl().getAttribute(sess, group, GroupsManager.GROUPSYNCHROENABLED_ATTRNAME)).thenReturn(reqAttribute);
when(sess.getPerunBl().getAttributesManagerBl().getAttribute(sess, group, GroupsManager.GROUPSQUERY_ATTRNAME)).thenReturn(reqAttribute);
when(sess.getPerunBl().getAttributesManagerBl().getAttribute(sess, group, GroupsManager.GROUPMEMBERSQUERY_ATTRNAME)).thenReturn(reqAttribute);
when(sess.getPerunBl().getAttributesManagerBl().getAttribute(sess, group, GroupsManager.GROUPEXTSOURCE_ATTRNAME)).thenReturn(reqAttribute);
}
use of cz.metacentrum.perun.core.bl.AttributesManagerBl in project perun by CESNET.
the class urn_perun_group_attribute_def_def_groupSynchronizationTimesTest method setUp.
@Before
public void setUp() throws Exception {
classInstance = new urn_perun_group_attribute_def_def_groupSynchronizationTimes();
syncInterval = new Attribute(classInstance.getAttributeDefinition());
attributeToCheck = new Attribute(classInstance.getAttributeDefinition());
sess = mock(PerunSessionImpl.class);
PerunBl perunBl = mock(PerunBl.class);
when(sess.getPerunBl()).thenReturn(perunBl);
GroupsManagerBl groupsManagerBl = mock(GroupsManagerBl.class);
when(sess.getPerunBl().getGroupsManagerBl()).thenReturn(groupsManagerBl);
when(sess.getPerunBl().getGroupsManagerBl().isGroupSynchronizedFromExternallSource(sess, group)).thenReturn(false);
AttributesManagerBl attributesManagerBl;
attributesManagerBl = mock(AttributesManagerBl.class);
when(perunBl.getAttributesManagerBl()).thenReturn(attributesManagerBl);
when(sess.getPerunBl().getAttributesManagerBl().getAttribute(sess, group, GroupsManager.GROUPSYNCHROINTERVAL_ATTRNAME)).thenReturn(syncInterval);
}
Aggregations