Search in sources :

Example 91 with Service

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

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

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

Example 94 with 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);
}
Also used : Group(cz.metacentrum.perun.core.api.Group) Resource(cz.metacentrum.perun.core.api.Resource) Vo(cz.metacentrum.perun.core.api.Vo) Service(cz.metacentrum.perun.core.api.Service) AttributeDefinition(cz.metacentrum.perun.core.api.AttributeDefinition) Facility(cz.metacentrum.perun.core.api.Facility)

Example 95 with Service

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()));
}
Also used : RichDestination(cz.metacentrum.perun.core.api.RichDestination) Destination(cz.metacentrum.perun.core.api.Destination) DestinationNotExistsException(cz.metacentrum.perun.core.api.exceptions.DestinationNotExistsException) Service(cz.metacentrum.perun.core.api.Service) AbstractPerunIntegrationTest(cz.metacentrum.perun.core.AbstractPerunIntegrationTest) Test(org.junit.Test)

Aggregations

Service (cz.metacentrum.perun.core.api.Service)115 Test (org.junit.Test)64 AbstractPerunIntegrationTest (cz.metacentrum.perun.core.AbstractPerunIntegrationTest)55 Facility (cz.metacentrum.perun.core.api.Facility)31 ArrayList (java.util.ArrayList)26 Resource (cz.metacentrum.perun.core.api.Resource)22 Destination (cz.metacentrum.perun.core.api.Destination)20 Member (cz.metacentrum.perun.core.api.Member)17 User (cz.metacentrum.perun.core.api.User)17 Group (cz.metacentrum.perun.core.api.Group)15 Vo (cz.metacentrum.perun.core.api.Vo)13 InternalErrorException (cz.metacentrum.perun.core.api.exceptions.InternalErrorException)13 Attribute (cz.metacentrum.perun.core.api.Attribute)11 RichUser (cz.metacentrum.perun.core.api.RichUser)11 PrivilegeException (cz.metacentrum.perun.core.api.exceptions.PrivilegeException)11 Task (cz.metacentrum.perun.taskslib.model.Task)10 AttributeDefinition (cz.metacentrum.perun.core.api.AttributeDefinition)8 PerunClient (cz.metacentrum.perun.core.api.PerunClient)8 PerunPrincipal (cz.metacentrum.perun.core.api.PerunPrincipal)8 ExecService (cz.metacentrum.perun.taskslib.model.ExecService)8