use of cz.metacentrum.perun.core.api.Facility in project perun by CESNET.
the class AttributesManagerEntryIntegrationTest method getRequiredFacilityAttributesForItsServicesWhenFacilityNotExists.
@Test(expected = FacilityNotExistsException.class)
public void getRequiredFacilityAttributesForItsServicesWhenFacilityNotExists() throws Exception {
System.out.println(CLASS_NAME + "getRequiredFacilityAttributesForItsServicesWhenFacilityNotExists");
attributesManager.getRequiredAttributes(sess, new Facility());
// shouldn't find facility
}
use of cz.metacentrum.perun.core.api.Facility in project perun by CESNET.
the class AttributesManagerEntryIntegrationTest method setUpHost.
private List<Host> setUpHost() throws Exception {
Host host = new Host();
host.setHostname("AttrTestHost");
List<Host> hosts = new ArrayList<Host>();
hosts.add(host);
// create cluster type facility
facility = new Facility();
facility.setName("AttrTestFacility");
facility = perun.getFacilitiesManager().createFacility(sess, facility);
hosts = perun.getFacilitiesManager().addHosts(sess, hosts, facility);
// save hosts for deletion after test
hostsForDeletion.add(hosts.get(0));
return hosts;
}
use of cz.metacentrum.perun.core.api.Facility in project perun by CESNET.
the class AttributesManagerEntryIntegrationTest method setFacilityUserAttributeWhenFacilityNotExists.
@Test(expected = FacilityNotExistsException.class)
public void setFacilityUserAttributeWhenFacilityNotExists() throws Exception {
System.out.println(CLASS_NAME + "setFacilityUserAttributeWhenFacilityNotExists");
vo = setUpVo();
member = setUpMember();
User user = perun.getUsersManager().getUserByMember(sess, member);
attributes = setUpFacilityUserAttribute();
attributesManager.setAttribute(sess, new Facility(), user, attributes.get(0));
// shouldn't find facility
}
use of cz.metacentrum.perun.core.api.Facility in project perun by CESNET.
the class AttributesManagerEntryIntegrationTest method getResourceRequiredFacilityUserAttributesWhenFacilityNotExists.
@Test(expected = FacilityNotExistsException.class)
public void getResourceRequiredFacilityUserAttributesWhenFacilityNotExists() throws Exception {
System.out.println(CLASS_NAME + "getResourceRequiredFacilityUserAttributesWhenFacilityNotExists");
vo = setUpVo();
member = setUpMember();
facility = setUpFacility();
resource = setUpResource();
User user = perun.getUsersManager().getUserByMember(sess, member);
attributesManager.getResourceRequiredAttributes(sess, resource, new Facility(), user);
// shouldn't find Facility
}
use of cz.metacentrum.perun.core.api.Facility in project perun by CESNET.
the class FacilitiesManagerEntryIntegrationTest method copyAttributes.
@Test
public void copyAttributes() throws Exception {
System.out.println(CLASS_NAME + "copyAttributes");
// set up second facility
Facility newFacility = new Facility();
newFacility.setName("FacilitiesManagerTestSecondFacility");
newFacility.setDescription("TestSecondFacilityDescriptionText");
Facility secondFacility = perun.getFacilitiesManager().createFacility(sess, newFacility);
// add first attribute to source
Attribute firstAttribute = setUpAttribute1();
perun.getAttributesManager().setAttribute(sess, facility, firstAttribute);
// add second attribute to both
Attribute secondAttribute = setUpAttribute2();
perun.getAttributesManager().setAttribute(sess, facility, secondAttribute);
perun.getAttributesManager().setAttribute(sess, secondFacility, secondAttribute);
// add third attribute to destination
Attribute thirdAttribute = setUpAttribute3();
perun.getAttributesManager().setAttribute(sess, secondFacility, thirdAttribute);
// copy
facilitiesManagerEntry.copyAttributes(sess, facility, secondFacility);
// tests
List<Attribute> destinationAttributes = perun.getAttributesManager().getAttributes(sess, secondFacility);
assertNotNull(destinationAttributes);
assertTrue((destinationAttributes.size() - perun.getAttributesManager().getAttributes(sess, facility).size()) == 1);
assertTrue(destinationAttributes.contains(firstAttribute));
assertTrue(destinationAttributes.contains(secondAttribute));
assertTrue(destinationAttributes.contains(thirdAttribute));
}
Aggregations