Search in sources :

Example 1 with RichResource

use of cz.metacentrum.perun.core.api.RichResource in project perun by CESNET.

the class FacilitiesManagerEntryIntegrationTest method getAssignedRichResources.

@Test
public void getAssignedRichResources() throws Exception {
    System.out.println(CLASS_NAME + "getAssignedRichResources");
    Vo vo = setUpVo();
    Resource resource = setUpResource(vo);
    RichResource rresource = new RichResource(resource);
    rresource.setVo(perun.getResourcesManager().getVo(sess, resource));
    List<RichResource> assignedResources = perun.getFacilitiesManager().getAssignedRichResources(sess, facility);
    List<Vo> vos = new ArrayList<Vo>();
    for (RichResource rr : assignedResources) {
        assertTrue("RichResource must have VO value filled", rr.getVo() != null);
        vos.add(rr.getVo());
    }
    assertTrue("Our VO must be between RichResources VOs", vos.contains(vo));
    assertTrue("our facility should have 1 assigned Resource", assignedResources.size() == 1);
    assertTrue("our facility should have our Resource assigned", assignedResources.contains(rresource));
}
Also used : RichResource(cz.metacentrum.perun.core.api.RichResource) Resource(cz.metacentrum.perun.core.api.Resource) RichResource(cz.metacentrum.perun.core.api.RichResource) ArrayList(java.util.ArrayList) Vo(cz.metacentrum.perun.core.api.Vo) AbstractPerunIntegrationTest(cz.metacentrum.perun.core.AbstractPerunIntegrationTest) Test(org.junit.Test)

Aggregations

AbstractPerunIntegrationTest (cz.metacentrum.perun.core.AbstractPerunIntegrationTest)1 Resource (cz.metacentrum.perun.core.api.Resource)1 RichResource (cz.metacentrum.perun.core.api.RichResource)1 Vo (cz.metacentrum.perun.core.api.Vo)1 ArrayList (java.util.ArrayList)1 Test (org.junit.Test)1