use of org.apache.syncope.common.rest.api.service.ConnectorService in project syncope by apache.
the class ConnectorITCase method authorizations.
@Test
public void authorizations() {
SyncopeClient puccini = clientFactory.create("puccini", ADMIN_PWD);
ConnectorService pcs = puccini.getService(ConnectorService.class);
// 1. list connectors: get only the ones allowed
List<ConnInstanceTO> connInstances = pcs.list(null);
assertEquals(2, connInstances.size());
assertTrue(connInstances.stream().allMatch(connInstance -> "a6d017fd-a705-4507-bb7c-6ab6a6745997".equals(connInstance.getKey()) || "44c02549-19c3-483c-8025-4919c3283c37".equals(connInstance.getKey())));
// 2. attempt to read a connector with a different admin realm: fail
try {
pcs.read("88a7a819-dab5-46b4-9b90-0b9769eabdb8", null);
fail("This should not happen");
} catch (SyncopeClientException e) {
assertEquals(ClientExceptionType.DelegatedAdministration, e.getType());
}
// 3. read and upate a connector in the realm for which entitlements are owned: succeed
try {
ConnInstanceTO scriptedsql = pcs.read("a6d017fd-a705-4507-bb7c-6ab6a6745997", null);
ConnConfProperty reloadScriptOnExecution = scriptedsql.getConf("reloadScriptOnExecution").get();
assertEquals("true", reloadScriptOnExecution.getValues().get(0).toString());
reloadScriptOnExecution.getValues().set(0, "false");
pcs.update(scriptedsql);
scriptedsql = pcs.read(scriptedsql.getKey(), null);
reloadScriptOnExecution = scriptedsql.getConf("reloadScriptOnExecution").get();
assertEquals("false", reloadScriptOnExecution.getValues().get(0).toString());
} finally {
ConnInstanceTO scriptedsql = connectorService.read("a6d017fd-a705-4507-bb7c-6ab6a6745997", null);
ConnConfProperty reloadScriptOnExecution = scriptedsql.getConf("reloadScriptOnExecution").get();
reloadScriptOnExecution.getValues().set(0, "true");
connectorService.update(scriptedsql);
}
}
use of org.apache.syncope.common.rest.api.service.ConnectorService in project syncope by apache.
the class ConnectorRestClient method getObjectClasses.
public List<String> getObjectClasses(final String connectorKey) {
List<String> result = new ArrayList<>();
ConnectorService service = getService(ConnectorService.class);
ConnInstanceTO connInstance = service.read(connectorKey, SyncopeConsoleSession.get().getLocale().getLanguage());
if (connInstance != null) {
result.addAll(service.buildObjectClassInfo(connInstance, true).stream().map(input -> input.getType()).collect(Collectors.toList()));
}
return result;
}
use of org.apache.syncope.common.rest.api.service.ConnectorService in project syncope by apache.
the class ConnectorRestClient method create.
public ConnInstanceTO create(final ConnInstanceTO connectorTO) {
List<ConnConfProperty> filteredConf = filterProperties(connectorTO.getConf());
connectorTO.getConf().clear();
connectorTO.getConf().addAll(filteredConf);
ConnectorService service = getService(ConnectorService.class);
Response response = service.create(connectorTO);
return getObject(service, response.getLocation(), ConnInstanceTO.class);
}
Aggregations