use of cz.metacentrum.perun.core.bl.ResourcesManagerBl 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.ResourcesManagerBl in project perun by CESNET.
the class urn_perun_group_attribute_def_def_unixGID_namespaceTest method setUp.
@Before
public void setUp() throws Exception {
classInstance = new urn_perun_group_attribute_def_def_unixGID_namespace();
attributeToCheck = new Attribute();
attributeToCheck.setFriendlyName("friendly name");
reqAttribute = new Attribute();
reqAttribute.setFriendlyName("friendly name");
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, AttributesManager.NS_GROUP_ATTR_DEF + ":unixGroupName-namespace" + ":" + attributeToCheck.getNamespace())).thenReturn(reqAttribute);
when(sess.getPerunBl().getAttributesManagerBl().getAttribute(sess, "", AttributesManager.NS_ENTITYLESS_ATTR_DEF + ":usedGids")).thenReturn(reqAttribute);
when(sess.getPerunBl().getAttributesManagerBl().getAttributeDefinition(sess, AttributesManager.NS_RESOURCE_ATTR_DEF + ":unixGID-namespace:")).thenReturn(reqAttribute);
when(sess.getPerunBl().getAttributesManagerBl().getAttributeDefinition(sess, AttributesManager.NS_RESOURCE_ATTR_DEF + ":unixGroupName-namespace:")).thenReturn(reqAttribute);
ModulesUtilsBl modulesUtilsBl = mock(ModulesUtilsBl.class);
when(sess.getPerunBl().getModulesUtilsBl()).thenReturn(modulesUtilsBl);
ResourcesManagerBl resourcesManagerBl = mock(ResourcesManagerBl.class);
when(sess.getPerunBl().getResourcesManagerBl()).thenReturn(resourcesManagerBl);
}
use of cz.metacentrum.perun.core.bl.ResourcesManagerBl in project perun by CESNET.
the class urn_perun_resource_attribute_def_def_unixGID_namespaceTest method setUp.
@Before
public void setUp() throws Exception {
classInstance = new urn_perun_resource_attribute_def_def_unixGID_namespace();
attributeToCheck = new Attribute();
attributeToCheck.setFriendlyName("friendly name");
reqAttribute = new Attribute();
reqAttribute.setFriendlyName("friendly name");
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);
AttributesManagerBl attributesManagerBl = mock(AttributesManagerBl.class);
when(perunBl.getAttributesManagerBl()).thenReturn(attributesManagerBl);
when(sess.getPerunBl().getAttributesManagerBl().getAttribute(sess, resource, AttributesManager.NS_GROUP_ATTR_DEF + ":unixGroupName-namespace" + ":" + attributeToCheck.getNamespace())).thenReturn(reqAttribute);
when(sess.getPerunBl().getAttributesManagerBl().getAttribute(sess, attributeToCheck.getFriendlyNameParameter(), AttributesManager.NS_ENTITYLESS_ATTR_DEF + ":usedGids")).thenReturn(reqAttribute);
when(sess.getPerunBl().getAttributesManagerBl().getAttributeDefinition(sess, AttributesManager.NS_GROUP_ATTR_DEF + ":unixGID-namespace:")).thenReturn(reqAttribute);
when(sess.getPerunBl().getAttributesManagerBl().getAttributeDefinition(sess, AttributesManager.NS_GROUP_ATTR_DEF + ":unixGroupName-namespace:")).thenReturn(reqAttribute);
ModulesUtilsBl modulesUtilsBl = mock(ModulesUtilsBl.class);
when(sess.getPerunBl().getModulesUtilsBl()).thenReturn(modulesUtilsBl);
ResourcesManagerBl resourcesManagerBl = mock(ResourcesManagerBl.class);
when(sess.getPerunBl().getResourcesManagerBl()).thenReturn(resourcesManagerBl);
}
use of cz.metacentrum.perun.core.bl.ResourcesManagerBl in project perun by CESNET.
the class urn_perun_group_attribute_def_def_unixGroupName_namespaceTest method setUp.
@Before
public void setUp() throws Exception {
classInstance = new urn_perun_group_attribute_def_def_unixGroupName_namespace();
attributeToCheck = new Attribute();
attributeToCheck.setFriendlyName("unixGID-namespace");
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().getAttributeDefinition(sess, AttributesManager.NS_RESOURCE_ATTR_DEF + ":unixGroupName-namespace:")).thenReturn(attributeToCheck);
GroupsManagerBl groupsManagerBl = mock(GroupsManagerBl.class);
when(sess.getPerunBl().getGroupsManagerBl()).thenReturn(groupsManagerBl);
when(sess.getPerunBl().getGroupsManagerBl().isGroupSynchronizedFromExternallSource(sess, group)).thenReturn(false);
ModulesUtilsBl modulesUtilsBl = mock(ModulesUtilsBl.class);
when(sess.getPerunBl().getModulesUtilsBl()).thenReturn(modulesUtilsBl);
ResourcesManagerBl resourcesManagerBl = mock(ResourcesManagerBl.class);
when(sess.getPerunBl().getResourcesManagerBl()).thenReturn(resourcesManagerBl);
}
use of cz.metacentrum.perun.core.bl.ResourcesManagerBl in project perun by CESNET.
the class urn_perun_resource_attribute_def_def_fairshareGroupNameTest method setUp.
@Before
public void setUp() throws Exception {
classInstance = new urn_perun_resource_attribute_def_def_fairshareGroupName();
attributeToCheck = new Attribute();
reqAttribute = new Attribute();
sess = mock(PerunSessionImpl.class);
Facility facility = new Facility();
List<Resource> resources = new ArrayList<>();
Resource resource2 = new Resource();
resources.add(resource2);
resources.add(resource);
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, resource2, attributeToCheck.getName())).thenReturn(reqAttribute);
ResourcesManagerBl resourcesManagerBl = mock(ResourcesManagerBl.class);
when(perunBl.getResourcesManagerBl()).thenReturn(resourcesManagerBl);
when(resourcesManagerBl.getFacility(sess, resource)).thenReturn(facility);
FacilitiesManagerBl facilitiesManagerBl = mock(FacilitiesManagerBl.class);
when(perunBl.getFacilitiesManagerBl()).thenReturn(facilitiesManagerBl);
when(facilitiesManagerBl.getAssignedResources(sess, facility)).thenReturn(resources);
}
Aggregations