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;
}
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));
}
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
}
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
}
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());
}
Aggregations