use of cz.metacentrum.perun.core.api.Resource in project perun by CESNET.
the class AttributesManagerEntryIntegrationTest method getResourceRequiredMemberAttributesWhenFakeResource.
@Test
public void getResourceRequiredMemberAttributesWhenFakeResource() throws Exception {
System.out.println(CLASS_NAME + "getResourceRequiredMemberAttributesWhenFakeResource");
vo = setUpVo();
member = setUpMember();
facility = setUpFacility();
// without service
Resource fakeResource = setUpResource();
List<Attribute> reqAttr = attributesManager.getResourceRequiredAttributes(sess, fakeResource, member);
assertNotNull("unable to get required member attributes for its services", reqAttr);
assertTrue("Shouldn't return attribute, when there is no service on resource", reqAttr.size() == 0);
}
use of cz.metacentrum.perun.core.api.Resource in project perun by CESNET.
the class AttributesManagerEntryIntegrationTest method getResourceRequiredGroupResourceAttributesWhenFakeResource.
@Test
public void getResourceRequiredGroupResourceAttributesWhenFakeResource() throws Exception {
System.out.println(CLASS_NAME + "getResourceRequiredGroupResourceAttributesWhenFakeResource");
vo = setUpVo();
group = setUpGroup();
facility = setUpFacility();
resource = setUpResource();
service = setUpService();
attributes = setUpRequiredAttributes();
perun.getResourcesManager().assignService(sess, resource, service);
Resource fakeResource = new Resource();
fakeResource.setName("AttrManTestResource2");
fakeResource.setDescription("fake resource");
perun.getResourcesManager().createResource(sess, fakeResource, vo, facility);
List<Attribute> reqAttr = attributesManager.getResourceRequiredAttributes(sess, fakeResource, resource, group);
assertNotNull("unable to get required group resource attributes for its services", reqAttr);
assertTrue("Shouldn't return attribute, when there is no service on resource", reqAttr.size() == 0);
reqAttr = attributesManager.getResourceRequiredAttributes(sess, fakeResource, fakeResource, group);
assertNotNull("unable to get required group resource attributes for its services", reqAttr);
assertTrue("Shouldn't return attribute, when there is no service on resource and no value set", reqAttr.size() == 0);
reqAttr = attributesManager.getResourceRequiredAttributes(sess, resource, fakeResource, group);
assertNotNull("unable to get required group resource attributes for its services", reqAttr);
assertTrue("Should return 1 attribute (but with no value)", reqAttr.size() == 1);
}
use of cz.metacentrum.perun.core.api.Resource in project perun by CESNET.
the class AttributesManagerEntryIntegrationTest method setResourceAttributeWhenResourceNotExists.
@Test(expected = ResourceNotExistsException.class)
public void setResourceAttributeWhenResourceNotExists() throws Exception {
System.out.println(CLASS_NAME + "setResourceAttributeWhenResourceNotExists");
attributes = setUpResourceAttribute();
attributesManager.setAttribute(sess, new Resource(), attributes.get(0));
// shouldn't find resource
}
use of cz.metacentrum.perun.core.api.Resource in project perun by CESNET.
the class AttributesManagerEntryIntegrationTest method getResourceRequiredFacilityUserAttributesWhenFakeResource.
@Test
public void getResourceRequiredFacilityUserAttributesWhenFakeResource() throws Exception {
System.out.println(CLASS_NAME + "getResourceRequiredFacilityUserAttributesWhenFakeResource");
vo = setUpVo();
member = setUpMember();
facility = setUpFacility();
resource = setUpResource();
service = setUpService();
attributes = setUpRequiredAttributes();
perun.getResourcesManager().assignService(sess, resource, service);
Resource fakeResource = new Resource();
fakeResource.setName("AttrManTestResource2");
fakeResource.setDescription("fake resource");
perun.getResourcesManager().createResource(sess, fakeResource, vo, facility);
User user = perun.getUsersManager().getUserByMember(sess, member);
List<Attribute> reqAttr = attributesManager.getResourceRequiredAttributes(sess, fakeResource, facility, user);
assertNotNull("unable to get required facility user attributes for its services", reqAttr);
assertTrue("Shouldn't return attribute, when there is no service on resource", reqAttr.size() == 0);
}
use of cz.metacentrum.perun.core.api.Resource in project perun by CESNET.
the class AttributesManagerEntryIntegrationTest method getGroupResourceAttributeWhenResourceNotExists.
@Test(expected = ResourceNotExistsException.class)
public void getGroupResourceAttributeWhenResourceNotExists() throws Exception {
System.out.println(CLASS_NAME + "getGroupResourceAttributeWhenResourceNotExists");
vo = setUpVo();
group = setUpGroup();
facility = setUpFacility();
resource = setUpResource();
attributes = setUpGroupResourceAttribute();
attributesManager.setAttributes(sess, resource, group, attributes);
attributesManager.getAttribute(sess, new Resource(), group, "urn:perun:group_resource:attribute-def:opt:group-resource-test-attribute");
// shouldn't find resource
}
Aggregations