use of cz.metacentrum.perun.core.api.Facility in project perun by CESNET.
the class FacilitiesManagerEntryIntegrationTest method removeSecurityTeamFacilityNotExists.
@Test(expected = FacilityNotExistsException.class)
public void removeSecurityTeamFacilityNotExists() throws Exception {
System.out.println(CLASS_NAME + "removeSecurityTeamFacilityNotExists");
SecurityTeam st0 = setUpSecurityTeam0();
setUpSecurityTeam1();
// should throw an exception
facilitiesManagerEntry.removeSecurityTeam(sess, new Facility(0, "Name"), st0);
}
use of cz.metacentrum.perun.core.api.Facility in project perun by CESNET.
the class ServicesManagerEntryIntegrationTest method addDestinationSameDestinationDifferentAdmin.
@Test(expected = PrivilegeException.class)
public void addDestinationSameDestinationDifferentAdmin() throws Exception {
System.out.println(CLASS_NAME + "addDestinationSameDestinationDifferentAdmin");
vo = setUpVo();
facility = setUpFacility();
resource = setUpResource();
service = setUpService();
Destination testDestination = new Destination(0, "TestDestination", Destination.DESTINATIONHOSTTYPE);
member = setUpMember();
Member memberTwo = setUpMember();
// Creates second facility
Facility secondFacility = new Facility(0, "TestSecondFacility", "TestDescriptionText");
assertNotNull(perun.getFacilitiesManager().createFacility(sess, secondFacility));
// Set users as admins of different facilities
User userOne = perun.getUsersManagerBl().getUserByMember(sess, member);
perun.getFacilitiesManager().addAdmin(sess, facility, userOne);
User userTwo = perun.getUsersManagerBl().getUserByMember(sess, memberTwo);
perun.getFacilitiesManager().addAdmin(sess, secondFacility, userTwo);
// Sets userOne as actor in this test with role facility admin for facility
AuthzRoles authzRoles = new AuthzRoles(Role.FACILITYADMIN, facility);
sess.getPerunPrincipal().setRoles(authzRoles);
sess.getPerunPrincipal().setUser(userOne);
// Adds destination to facility
perun.getServicesManager().addDestination(sess, service, facility, testDestination);
assertTrue(perun.getServicesManager().getDestinations(sess, service, facility).size() == 1);
// Change actor in this test to userTwo
authzRoles = new AuthzRoles(Role.FACILITYADMIN, secondFacility);
sess.getPerunPrincipal().setRoles(authzRoles);
sess.getPerunPrincipal().setUser(userTwo);
// Adds same destination to secondFacility -> should throw exception
perun.getServicesManager().addDestination(sess, service, secondFacility, testDestination);
}
use of cz.metacentrum.perun.core.api.Facility in project perun by CESNET.
the class ServicesManagerEntryIntegrationTest method setUpNonClusterFacilityWithTwoHosts.
private Facility setUpNonClusterFacilityWithTwoHosts() throws Exception {
Facility facility = new Facility();
facility.setName("ServicesManagerTestNonClusterFacility");
facility = perun.getFacilitiesManager().createFacility(sess, facility);
// add first host
Host host1 = new Host();
host1.setHostname("testing_host_1");
// add second host
Host host2 = new Host();
host2.setHostname("testing_host_2");
List<Host> hosts = new ArrayList<Host>();
hosts.add(host1);
hosts.add(host2);
perun.getFacilitiesManager().addHosts(sess, hosts, facility);
return facility;
}
use of cz.metacentrum.perun.core.api.Facility in project perun by CESNET.
the class ServicesManagerEntryIntegrationTest method setUpClusterFacility.
private Facility setUpClusterFacility() throws Exception {
Facility facility = new Facility();
facility.setName("ServicesManagerTestClusterFacility");
facility = perun.getFacilitiesManager().createFacility(sess, facility);
// add one host
Host host = new Host();
host.setHostname("test.test");
List<Host> hosts = new ArrayList<Host>();
hosts.add(host);
perun.getFacilitiesManager().addHosts(sess, hosts, facility);
return facility;
}
use of cz.metacentrum.perun.core.api.Facility in project perun by CESNET.
the class urn_perun_facility_attribute_def_def_homeMountPointsTest method testCheckAttributeValue.
/**
* Test of checkAttributeValue method, of class urn_perun_facility_attribute_def_def_homeMountPoints.
* with all properly set
*/
@Test
public void testCheckAttributeValue() throws Exception {
System.out.println("testCheckAttributeValue()");
ArrayList<String> homeMountPts = new ArrayList<String>();
homeMountPts.add("/mnt/mymountpoint1");
homeMountPts.add("/mnt/mymountpoint2");
attribute.setValue(homeMountPts);
classInstance.checkAttributeValue(session, new Facility(), attribute);
}
Aggregations