use of org.apache.syncope.common.rest.api.service.ResourceService in project syncope by apache.
the class ResourceITCase method authorizations.
@Test
public void authorizations() {
SyncopeClient puccini = clientFactory.create("puccini", ADMIN_PWD);
ResourceService prs = puccini.getService(ResourceService.class);
// 1. attempt to read a resource for a connector with a different admin realm: fail
try {
prs.read(RESOURCE_NAME_WS1);
fail("This should not happen");
} catch (SyncopeClientException e) {
assertEquals(ClientExceptionType.DelegatedAdministration, e.getType());
}
// 2. read and upate a resource for a connector in the realm for which entitlements are owned: succeed
try {
ResourceTO scriptedsql = prs.read(RESOURCE_NAME_DBSCRIPTED);
assertEquals(TraceLevel.ALL, scriptedsql.getCreateTraceLevel());
scriptedsql.setCreateTraceLevel(TraceLevel.FAILURES);
prs.update(scriptedsql);
scriptedsql = prs.read(RESOURCE_NAME_DBSCRIPTED);
assertEquals(TraceLevel.FAILURES, scriptedsql.getCreateTraceLevel());
} finally {
ResourceTO scriptedsql = resourceService.read(RESOURCE_NAME_DBSCRIPTED);
scriptedsql.setCreateTraceLevel(TraceLevel.ALL);
resourceService.update(scriptedsql);
}
}
use of org.apache.syncope.common.rest.api.service.ResourceService in project syncope by apache.
the class ResourceRestClient method create.
public ResourceTO create(final ResourceTO resourceTO) {
ResourceService service = getService(ResourceService.class);
Response response = service.create(resourceTO);
return getObject(service, response.getLocation(), ResourceTO.class);
}
Aggregations