use of cz.metacentrum.perun.core.api.Service in project perun by CESNET.
the class AttributesManagerEntryIntegrationTest method getRequiredResourceAttributesFromOneServiceWhenServiceNotExists.
@Test(expected = ServiceNotExistsException.class)
public void getRequiredResourceAttributesFromOneServiceWhenServiceNotExists() throws Exception {
System.out.println(CLASS_NAME + "getRequiredResourceAttributesFromOneServiceWhenServiceNotExists");
vo = setUpVo();
facility = setUpFacility();
resource = setUpResource();
attributesManager.getRequiredAttributes(sess, new Service(), resource);
// shouldn't find service
}
use of cz.metacentrum.perun.core.api.Service in project perun by CESNET.
the class AttributesManagerEntryIntegrationTest method getRequiredMemberAttributesFromOneServiceWhenServiceNotExists.
@Test(expected = ServiceNotExistsException.class)
public void getRequiredMemberAttributesFromOneServiceWhenServiceNotExists() throws Exception {
System.out.println(CLASS_NAME + "getRequiredMemberAttributesFromOneServiceWhenServiceNotExists");
vo = setUpVo();
member = setUpMember();
attributesManager.getRequiredAttributes(sess, new Service(), member);
// shouldn't find service
}
use of cz.metacentrum.perun.core.api.Service in project perun by CESNET.
the class AttributesManagerEntryIntegrationTest method getRequiredGroupAttributesFromOneServiceWhenServiceNotExists.
@Test(expected = ServiceNotExistsException.class)
public void getRequiredGroupAttributesFromOneServiceWhenServiceNotExists() throws Exception {
System.out.println(CLASS_NAME + "getRequiredGroupAttributesFromOneServiceWhenServiceNotExists");
vo = setUpVo();
group = setUpGroup();
attributesManager.getRequiredAttributes(sess, new Service(), group);
// shouldn't find service
}
use of cz.metacentrum.perun.core.api.Service in project perun by CESNET.
the class AttributesManagerImplIntegrationTest method initializeServiceRequiredAttributes.
/* ################## Private methods ################ */
private void initializeServiceRequiredAttributes() throws Exception {
Vo vo = new Vo(-1, "Test vo", "TestVo");
vo = perunBlImpl.getVosManagerBl().createVo(sess, vo);
Facility facility = new Facility(-1, "Test Facility");
facility = perunBlImpl.getFacilitiesManagerBl().createFacility(sess, facility);
resource = new Resource(-1, "Test", "Test", facility.getId());
resource = perunBlImpl.getResourcesManagerBl().createResource(sess, resource, vo, facility);
group = new Group("TestGroup", "Test Group");
group = perunBlImpl.getGroupsManagerBl().createGroup(sess, vo, group);
service1 = new Service(-1, "TestService1");
service1 = perunBlImpl.getServicesManagerBl().createService(sess, service1);
service2 = new Service(-1, "TestService2");
service2 = perunBlImpl.getServicesManagerBl().createService(sess, service2);
AttributeDefinition groupAttribute1 = getGroupAttributeDefinition("Service1attribute");
groupAttribute1 = perunBlImpl.getAttributesManagerBl().createAttribute(sess, groupAttribute1);
AttributeDefinition groupAttribute2 = getGroupAttributeDefinition("Service2attribute");
groupAttribute2 = perunBlImpl.getAttributesManagerBl().createAttribute(sess, groupAttribute2);
AttributeDefinition groupResourceAttribute1 = getGroupResourceAttributeDefinition("Service1attribute");
groupResourceAttribute1 = perunBlImpl.getAttributesManagerBl().createAttribute(sess, groupResourceAttribute1);
AttributeDefinition groupResourceAttribute2 = getGroupResourceAttributeDefinition("Service2attribute");
groupResourceAttribute2 = perunBlImpl.getAttributesManagerBl().createAttribute(sess, groupResourceAttribute2);
perunBlImpl.getServicesManagerBl().addRequiredAttribute(sess, service1, groupAttribute1);
perunBlImpl.getServicesManagerBl().addRequiredAttribute(sess, service1, groupResourceAttribute1);
perunBlImpl.getServicesManagerBl().addRequiredAttribute(sess, service2, groupResourceAttribute2);
perunBlImpl.getServicesManagerBl().addRequiredAttribute(sess, service2, groupAttribute2);
perunBlImpl.getResourcesManagerBl().assignGroupToResource(sess, group, resource, false, false, false);
perunBlImpl.getResourcesManagerBl().assignService(sess, resource, service1);
perunBlImpl.getResourcesManagerBl().assignService(sess, resource, service2);
}
use of cz.metacentrum.perun.core.api.Service in project perun by CESNET.
the class ServicesManagerEntryIntegrationTest method removeAllDestinationsWithFacilityDeletesDestination.
@Test
public void removeAllDestinationsWithFacilityDeletesDestination() throws Exception {
System.out.println(CLASS_NAME + "removeAllDestinationsWithFacilityDeletesDestination");
List<Service> services = setUpServices();
facility = setUpFacility();
destination = setUpDestination();
Destination dest1 = perun.getServicesManager().addDestination(sess, services.get(0), facility, destination);
Destination dest2 = perun.getServicesManager().addDestination(sess, services.get(1), facility, destination);
List<Destination> destinations = perun.getServicesManagerBl().getDestinations(sess, facility);
assertTrue("There need to be dest1", destinations.contains(dest1));
assertTrue("There need to be dest2", destinations.contains(dest2));
// service denials should be deleted too
perun.getServicesManager().blockServiceOnDestination(sess, services.get(0), dest1.getId());
perun.getServicesManagerBl().removeAllDestinations(sess, facility);
destinations = perun.getServicesManagerBl().getDestinations(sess, facility);
assertTrue("All destinations should be removed", destinations.isEmpty());
// destination should be deleted because it is no longer used
assertThatExceptionOfType(DestinationNotExistsException.class).isThrownBy(() -> perun.getServicesManager().getDestinationById(sess, dest1.getId()));
}
Aggregations