Search in sources :

Example 6 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)

Example 7 with ServicesPackage

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

the class ServicesManagerEntryIntegrationTest method getServicesPackageByName.

@Test
public void getServicesPackageByName() throws Exception {
    System.out.println(CLASS_NAME + "getServicesPackageByName");
    service = setUpService();
    servicesPackage = setUpServicesPackage(service);
    ServicesPackage retServPack = perun.getServicesManager().getServicesPackageByName(sess, servicesPackage.getName());
    assertNotNull("unable to get services package by name", retServPack);
    assertEquals("returned services package is not same as stored", servicesPackage, retServPack);
}
Also used : ServicesPackage(cz.metacentrum.perun.core.api.ServicesPackage) AbstractPerunIntegrationTest(cz.metacentrum.perun.core.AbstractPerunIntegrationTest) Test(org.junit.Test)

Example 8 with ServicesPackage

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

the class ServicesManagerEntryIntegrationTest method addServiceToServicesPackageWhenPackageNotExists.

@Test(expected = ServicesPackageNotExistsException.class)
public void addServiceToServicesPackageWhenPackageNotExists() throws Exception {
    System.out.println(CLASS_NAME + "addServiceToServicesPackageWhenPackageNotExists");
    service = setUpService();
    assertNotNull("unable to create service in DB", service);
    perun.getServicesManager().addServiceToServicesPackage(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 9 with ServicesPackage

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

the class ServicesManagerEntryIntegrationTest method createServicesPackageWhenServicePackageExists.

@Test(expected = ServicesPackageExistsException.class)
public void createServicesPackageWhenServicePackageExists() throws Exception {
    System.out.println(CLASS_NAME + "createServicesPackageWhenServicePackageExists");
    service = setUpService();
    servicesPackage = setUpServicesPackage(service);
    assertNotNull("unable to create services package", servicesPackage);
    ServicesPackage returnedPackage = perun.getServicesManager().getServicesPackageById(sess, servicesPackage.getId());
    perun.getServicesManager().createServicesPackage(sess, returnedPackage);
// shouldn't add service package twice
}
Also used : ServicesPackage(cz.metacentrum.perun.core.api.ServicesPackage) AbstractPerunIntegrationTest(cz.metacentrum.perun.core.AbstractPerunIntegrationTest) Test(org.junit.Test)

Example 10 with ServicesPackage

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

the class ServicesManagerEntryIntegrationTest method createServicesPackage.

@Test
public void createServicesPackage() throws Exception {
    System.out.println(CLASS_NAME + "createServicesPackage");
    service = setUpService();
    servicesPackage = setUpServicesPackage(service);
    assertNotNull("unable to create services package", servicesPackage);
    ServicesPackage returnedPackage = perun.getServicesManager().getServicesPackageById(sess, servicesPackage.getId());
    assertEquals("returned services package should be the same we added", returnedPackage, servicesPackage);
}
Also used : 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