Search in sources :

Example 46 with Facility

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
}
Also used : Facility(cz.metacentrum.perun.core.api.Facility) AbstractPerunIntegrationTest(cz.metacentrum.perun.core.AbstractPerunIntegrationTest) Test(org.junit.Test)

Example 47 with 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;
}
Also used : ArrayList(java.util.ArrayList) Host(cz.metacentrum.perun.core.api.Host) Facility(cz.metacentrum.perun.core.api.Facility)

Example 48 with Facility

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
}
Also used : User(cz.metacentrum.perun.core.api.User) Facility(cz.metacentrum.perun.core.api.Facility) AbstractPerunIntegrationTest(cz.metacentrum.perun.core.AbstractPerunIntegrationTest) Test(org.junit.Test)

Example 49 with 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
}
Also used : User(cz.metacentrum.perun.core.api.User) Facility(cz.metacentrum.perun.core.api.Facility) AbstractPerunIntegrationTest(cz.metacentrum.perun.core.AbstractPerunIntegrationTest) Test(org.junit.Test)

Example 50 with 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));
}
Also used : Attribute(cz.metacentrum.perun.core.api.Attribute) BanOnFacility(cz.metacentrum.perun.core.api.BanOnFacility) Facility(cz.metacentrum.perun.core.api.Facility) AbstractPerunIntegrationTest(cz.metacentrum.perun.core.AbstractPerunIntegrationTest) Test(org.junit.Test)

Aggregations

Facility (cz.metacentrum.perun.core.api.Facility)188 Test (org.junit.Test)95 User (cz.metacentrum.perun.core.api.User)81 Attribute (cz.metacentrum.perun.core.api.Attribute)75 AbstractPerunIntegrationTest (cz.metacentrum.perun.core.AbstractPerunIntegrationTest)61 Resource (cz.metacentrum.perun.core.api.Resource)52 BanOnFacility (cz.metacentrum.perun.core.api.BanOnFacility)51 ArrayList (java.util.ArrayList)48 Group (cz.metacentrum.perun.core.api.Group)24 InternalErrorException (cz.metacentrum.perun.core.api.exceptions.InternalErrorException)23 Member (cz.metacentrum.perun.core.api.Member)22 PerunSession (cz.metacentrum.perun.core.api.PerunSession)20 RichFacility (cz.metacentrum.perun.core.api.RichFacility)20 Host (cz.metacentrum.perun.core.api.Host)19 PrivilegeException (cz.metacentrum.perun.core.api.exceptions.PrivilegeException)18 AttributeNotExistsException (cz.metacentrum.perun.core.api.exceptions.AttributeNotExistsException)17 RichUser (cz.metacentrum.perun.core.api.RichUser)16 WrongAttributeValueException (cz.metacentrum.perun.core.api.exceptions.WrongAttributeValueException)15 WrongAttributeAssignmentException (cz.metacentrum.perun.core.api.exceptions.WrongAttributeAssignmentException)14 Vo (cz.metacentrum.perun.core.api.Vo)13