Search in sources :

Example 1 with FacilitiesManagerBl

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<>());
}
Also used : ResourcesManagerBl(cz.metacentrum.perun.core.bl.ResourcesManagerBl) FacilitiesManagerBl(cz.metacentrum.perun.core.bl.FacilitiesManagerBl) GroupsManagerBl(cz.metacentrum.perun.core.bl.GroupsManagerBl) Attribute(cz.metacentrum.perun.core.api.Attribute) PerunBl(cz.metacentrum.perun.core.bl.PerunBl) PerunSessionImpl(cz.metacentrum.perun.core.impl.PerunSessionImpl) UsersManagerBl(cz.metacentrum.perun.core.bl.UsersManagerBl) AttributesManagerBl(cz.metacentrum.perun.core.bl.AttributesManagerBl) Before(org.junit.Before)

Example 2 with FacilitiesManagerBl

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);
}
Also used : ResourcesManagerBl(cz.metacentrum.perun.core.bl.ResourcesManagerBl) FacilitiesManagerBl(cz.metacentrum.perun.core.bl.FacilitiesManagerBl) Attribute(cz.metacentrum.perun.core.api.Attribute) Resource(cz.metacentrum.perun.core.api.Resource) ArrayList(java.util.ArrayList) 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 3 with FacilitiesManagerBl

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);
}
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)

Aggregations

Attribute (cz.metacentrum.perun.core.api.Attribute)3 AttributesManagerBl (cz.metacentrum.perun.core.bl.AttributesManagerBl)3 FacilitiesManagerBl (cz.metacentrum.perun.core.bl.FacilitiesManagerBl)3 PerunBl (cz.metacentrum.perun.core.bl.PerunBl)3 PerunSessionImpl (cz.metacentrum.perun.core.impl.PerunSessionImpl)3 Before (org.junit.Before)3 Facility (cz.metacentrum.perun.core.api.Facility)2 ResourcesManagerBl (cz.metacentrum.perun.core.bl.ResourcesManagerBl)2 Resource (cz.metacentrum.perun.core.api.Resource)1 GroupsManagerBl (cz.metacentrum.perun.core.bl.GroupsManagerBl)1 UsersManagerBl (cz.metacentrum.perun.core.bl.UsersManagerBl)1 ArrayList (java.util.ArrayList)1