Search in sources :

Example 26 with Service

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

the class ServicesManagerEntryIntegrationTest method setUpServices.

private List<Service> setUpServices() throws Exception {
    Service service1 = new Service();
    service1.setName("ServicesManagerTestService01");
    service1 = perun.getServicesManager().createService(sess, service1);
    assertNotNull("unable to create service", service1);
    Service service2 = new Service();
    service2.setName("ServicesManagerTestService02");
    service2 = perun.getServicesManager().createService(sess, service2);
    assertNotNull("unable to create service", service2);
    List<Service> services = new ArrayList<Service>();
    services.add(service1);
    services.add(service2);
    return services;
}
Also used : ArrayList(java.util.ArrayList) Service(cz.metacentrum.perun.core.api.Service)

Example 27 with Service

use of cz.metacentrum.perun.core.api.Service 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 28 with Service

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

the class ServicesManagerEntryIntegrationTest method removeDestinationWhenServiceNotExists.

@Test(expected = ServiceNotExistsException.class)
public void removeDestinationWhenServiceNotExists() throws Exception {
    System.out.println(CLASS_NAME + "removeDestinationWhenServiceNotExists");
    facility = setUpFacility();
    destination = setUpDestination();
    perun.getServicesManager().removeDestination(sess, new Service(), facility, destination);
// shouldn't find service
}
Also used : Service(cz.metacentrum.perun.core.api.Service) AbstractPerunIntegrationTest(cz.metacentrum.perun.core.AbstractPerunIntegrationTest) Test(org.junit.Test)

Example 29 with Service

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

the class ServicesManagerEntryIntegrationTest method getDataWithGroupsWhenServiceNotExists.

@Test(expected = ServiceNotExistsException.class)
public void getDataWithGroupsWhenServiceNotExists() throws Exception {
    System.out.println(CLASS_NAME + "getDataWithGroupsWhenServiceNotExists");
    facility = setUpFacility();
    perun.getServicesManager().getDataWithGroups(sess, new Service(), facility);
// shouldn't find service
}
Also used : Service(cz.metacentrum.perun.core.api.Service) AbstractPerunIntegrationTest(cz.metacentrum.perun.core.AbstractPerunIntegrationTest) Test(org.junit.Test)

Example 30 with Service

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

the class ExecServiceDaoTest method setUp.

@Before
public void setUp() throws InternalErrorException, OwnerNotExistsException, ServiceExistsException, PrivilegeException {
    try {
        perunSession = perun.getPerunSession(new PerunPrincipal("perunTests", ExtSourcesManager.EXTSOURCE_NAME_INTERNAL, ExtSourcesManager.EXTSOURCE_INTERNAL), new PerunClient());
    } catch (InternalErrorException e) {
        log.error(e.toString());
    }
    jdbcTemplate = new JdbcPerunTemplate(dataSource);
    // Test Owner
    int newOwnerId = Utils.getNewId(jdbcTemplate, "owners_id_seq");
    testOwner = new Owner();
    testOwner.setContact("Call me babe");
    testOwner.setName("Tester-" + Long.toHexString(System.currentTimeMillis()));
    testOwner.setType(OwnerType.technical);
    testOwner.setId(newOwnerId);
    jdbcTemplate.update("insert into owners(id, name, contact, type) values (?,?,?,?)", newOwnerId, testOwner.getName(), testOwner.getContact(), testOwner.getType().toString());
    // Test Service #1
    testService1 = new Service();
    testService1.setName("Test_service_1_" + Long.toHexString(System.currentTimeMillis()));
    // Test Service #2
    testService2 = new Service();
    testService2.setName("Test_service_2_" + Long.toHexString(System.currentTimeMillis()));
    testService1.setId(servicesManager.createService(perunSession, testService1).getId());
    testService2.setId(servicesManager.createService(perunSession, testService2).getId());
}
Also used : JdbcPerunTemplate(org.springframework.jdbc.core.JdbcPerunTemplate) Owner(cz.metacentrum.perun.core.api.Owner) PerunClient(cz.metacentrum.perun.core.api.PerunClient) PerunPrincipal(cz.metacentrum.perun.core.api.PerunPrincipal) ExecService(cz.metacentrum.perun.taskslib.model.ExecService) Service(cz.metacentrum.perun.core.api.Service) InternalErrorException(cz.metacentrum.perun.core.api.exceptions.InternalErrorException) Before(org.junit.Before)

Aggregations

Service (cz.metacentrum.perun.core.api.Service)66 AbstractPerunIntegrationTest (cz.metacentrum.perun.core.AbstractPerunIntegrationTest)44 Test (org.junit.Test)44 ArrayList (java.util.ArrayList)11 Facility (cz.metacentrum.perun.core.api.Facility)10 Destination (cz.metacentrum.perun.core.api.Destination)9 Member (cz.metacentrum.perun.core.api.Member)8 ExecService (cz.metacentrum.perun.taskslib.model.ExecService)8 User (cz.metacentrum.perun.core.api.User)6 InternalErrorException (cz.metacentrum.perun.core.api.exceptions.InternalErrorException)6 Attribute (cz.metacentrum.perun.core.api.Attribute)5 BanOnFacility (cz.metacentrum.perun.core.api.BanOnFacility)5 Group (cz.metacentrum.perun.core.api.Group)5 Host (cz.metacentrum.perun.core.api.Host)5 Resource (cz.metacentrum.perun.core.api.Resource)5 RichDestination (cz.metacentrum.perun.core.api.RichDestination)5 RichUser (cz.metacentrum.perun.core.api.RichUser)5 AttributeDefinition (cz.metacentrum.perun.core.api.AttributeDefinition)4 PerunClient (cz.metacentrum.perun.core.api.PerunClient)4 PerunPrincipal (cz.metacentrum.perun.core.api.PerunPrincipal)4