use of cz.metacentrum.perun.core.bl.FacilitiesManagerBl 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.FacilitiesManagerBl 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);
}
use of cz.metacentrum.perun.core.bl.FacilitiesManagerBl 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);
}
Aggregations