Search in sources :

Example 1 with ServicesPackage

use of cz.metacentrum.perun.core.api.ServicesPackage in project perun by CESNET.

the class ServicesManagerEntryIntegrationTest method addServiceToServicesPackageWhenServiceNotExists.

@Test(expected = ServiceNotExistsException.class)
public void addServiceToServicesPackageWhenServiceNotExists() throws Exception {
    System.out.println(CLASS_NAME + "addServiceToServicesPackageWhenServiceNotExists");
    ServicesPackage servicesPackage = new ServicesPackage();
    servicesPackage.setName("ServicesManagerTestSP");
    servicesPackage.setDescription("TestingPackage");
    perun.getServicesManager().createServicesPackage(sess, servicesPackage);
    perun.getServicesManager().addServiceToServicesPackage(sess, servicesPackage, new Service());
// shouldn't find services package
}
Also used : Service(cz.metacentrum.perun.core.api.Service) ServicesPackage(cz.metacentrum.perun.core.api.ServicesPackage) AbstractPerunIntegrationTest(cz.metacentrum.perun.core.AbstractPerunIntegrationTest) Test(org.junit.Test)

Example 2 with ServicesPackage

use of cz.metacentrum.perun.core.api.ServicesPackage in project perun by CESNET.

the class ServicesManagerEntryIntegrationTest method removeServiceFromServicesPackageWhenPackageNotExists.

@Test(expected = ServicesPackageNotExistsException.class)
public void removeServiceFromServicesPackageWhenPackageNotExists() throws Exception {
    System.out.println(CLASS_NAME + "removeServiceFromServicesPackageWhenPackageNotExists");
    service = setUpService();
    assertNotNull("unable to create service in DB", service);
    perun.getServicesManager().removeServiceFromServicesPackage(sess, new ServicesPackage(), service);
// shouldn't find services package
}
Also used : ServicesPackage(cz.metacentrum.perun.core.api.ServicesPackage) AbstractPerunIntegrationTest(cz.metacentrum.perun.core.AbstractPerunIntegrationTest) Test(org.junit.Test)

Example 3 with ServicesPackage

use of cz.metacentrum.perun.core.api.ServicesPackage in project perun by CESNET.

the class ServicesManagerEntryIntegrationTest method setUpServicesPackage.

private ServicesPackage setUpServicesPackage(Service service) throws Exception {
    ServicesPackage servicesPackage = new ServicesPackage();
    servicesPackage.setName("ResourcesManagertTestSP");
    servicesPackage.setDescription("testingServicePackage");
    servicesPackage = perun.getServicesManager().createServicesPackage(sess, servicesPackage);
    perun.getServicesManager().addServiceToServicesPackage(sess, servicesPackage, service);
    return servicesPackage;
}
Also used : ServicesPackage(cz.metacentrum.perun.core.api.ServicesPackage)

Example 4 with ServicesPackage

use of cz.metacentrum.perun.core.api.ServicesPackage in project perun by CESNET.

the class ServicesManagerEntryIntegrationTest method deleteServicesPackageWhenPackageNotExist.

@Test(expected = ServicesPackageNotExistsException.class)
public void deleteServicesPackageWhenPackageNotExist() throws Exception {
    System.out.println(CLASS_NAME + "deleteServicesPackageWhenPackageNotExist");
    perun.getServicesManager().deleteServicesPackage(sess, new ServicesPackage());
// shouldn't find services package in DB
}
Also used : ServicesPackage(cz.metacentrum.perun.core.api.ServicesPackage) AbstractPerunIntegrationTest(cz.metacentrum.perun.core.AbstractPerunIntegrationTest) Test(org.junit.Test)

Example 5 with ServicesPackage

use of cz.metacentrum.perun.core.api.ServicesPackage in project perun by CESNET.

the class ServicesManagerEntryIntegrationTest method addServiceToServicesPackage.

@Test
public void addServiceToServicesPackage() throws Exception {
    System.out.println(CLASS_NAME + "addServiceToServicesPackage");
    service = setUpService();
    assertNotNull("unable to create service in DB", service);
    ServicesPackage servicesPackage = new ServicesPackage();
    servicesPackage.setName("ServicesManagerTestSP");
    servicesPackage.setDescription("TestingPackage");
    perun.getServicesManager().createServicesPackage(sess, servicesPackage);
    perun.getServicesManager().addServiceToServicesPackage(sess, servicesPackage, service);
    List<Service> services = perun.getServicesManager().getServicesFromServicesPackage(sess, servicesPackage);
    assertTrue("there should be at leas 1 service in package", services.size() >= 1);
    assertTrue("our service should be between package services", services.contains(service));
}
Also used : Service(cz.metacentrum.perun.core.api.Service) ServicesPackage(cz.metacentrum.perun.core.api.ServicesPackage) AbstractPerunIntegrationTest(cz.metacentrum.perun.core.AbstractPerunIntegrationTest) Test(org.junit.Test)

Aggregations

ServicesPackage (cz.metacentrum.perun.core.api.ServicesPackage)11 AbstractPerunIntegrationTest (cz.metacentrum.perun.core.AbstractPerunIntegrationTest)9 Test (org.junit.Test)9 Service (cz.metacentrum.perun.core.api.Service)2 ServicesPackageExistsException (cz.metacentrum.perun.core.api.exceptions.ServicesPackageExistsException)1 ServicesPackageNotExistsException (cz.metacentrum.perun.core.api.exceptions.ServicesPackageNotExistsException)1