use of org.apache.syncope.common.lib.to.AttrTO in project syncope by apache.
the class ConfigurationITCase method read.
@Test
public void read() {
AttrTO conf = configurationService.get("token.expireTime");
assertNotNull(conf);
}
use of org.apache.syncope.common.lib.to.AttrTO in project syncope by apache.
the class SCIMConfManager method get.
@PreAuthorize("hasRole('" + SCIMEntitlement.SCIM_CONF_GET + "')")
public SCIMConf get() {
AttrTO confTO = null;
try {
confTO = configurationLogic.get(SCIMConf.KEY);
} catch (Exception e) {
LOG.error("{} not found, reverting to default", SCIMConf.KEY);
}
SCIMConf conf = null;
if (confTO != null) {
try {
conf = POJOHelper.deserialize(new String(Base64.decode(confTO.getValues().get(0))), SCIMConf.class);
} catch (Exception e) {
LOG.error("Could not deserialize, reverting to default", e);
}
}
if (conf == null) {
conf = new SCIMConf();
set(conf);
}
return conf;
}
use of org.apache.syncope.common.lib.to.AttrTO in project syncope by apache.
the class TestPullActions method beforeProvision.
@Override
public void beforeProvision(final ProvisioningProfile<?, ?> profile, final SyncDelta delta, final EntityTO entity) throws JobExecutionException {
if (entity instanceof AnyTO) {
AnyTO any = (AnyTO) entity;
Optional<AttrTO> attrTO = any.getPlainAttr("fullname");
if (!attrTO.isPresent()) {
attrTO = Optional.of(new AttrTO());
attrTO.get().setSchema("fullname");
any.getPlainAttrs().add(attrTO.get());
}
attrTO.get().getValues().clear();
attrTO.get().getValues().add(String.valueOf(counter++));
}
}
use of org.apache.syncope.common.lib.to.AttrTO in project syncope by apache.
the class TestPullActions method beforeUpdate.
@Override
public <M extends AnyPatch> void beforeUpdate(final ProvisioningProfile<?, ?> profile, final SyncDelta delta, final EntityTO entityTO, final M anyPatch) throws JobExecutionException {
AttrPatch fullnamePatch = null;
for (AttrPatch attrPatch : anyPatch.getPlainAttrs()) {
if ("fullname".equals(attrPatch.getAttrTO().getSchema())) {
fullnamePatch = attrPatch;
}
}
if (fullnamePatch == null) {
fullnamePatch = new AttrPatch.Builder().operation(PatchOperation.ADD_REPLACE).attrTO(new AttrTO.Builder().schema("fullname").build()).build();
}
fullnamePatch.getAttrTO().getValues().clear();
fullnamePatch.getAttrTO().getValues().add(String.valueOf(counter++));
}
use of org.apache.syncope.common.lib.to.AttrTO in project syncope by apache.
the class NotificationTaskITCase method notifyByMailWithRetry.
@Test
public void notifyByMailWithRetry() throws Exception {
// 1. Set higher number of retries
AttrTO origMaxRetries = configurationService.get("notification.maxRetries");
configurationService.set(attrTO(origMaxRetries.getSchema(), "10"));
// 2. Stop mail server to force errors while sending out e-mails
stopGreenMail();
try {
// 3. create notification and user
String sender = "syncopetest-" + getUUIDString() + "@syncope.apache.org";
String subject = "Test notification " + getUUIDString();
Pair<String, String> created = createNotificationTask(true, true, TraceLevel.ALL, sender, subject);
NotificationTaskTO taskTO = findNotificationTask(created.getLeft(), 50);
assertNotNull(taskTO);
assertNotNull(taskTO.getNotification());
int preExecs = taskTO.getExecutions().size();
// 4. verify notification could not be delivered
execTask(taskService, TaskType.NOTIFICATION, taskTO.getKey(), NotificationJob.Status.NOT_SENT.name(), 5, false);
taskTO = taskService.read(TaskType.NOTIFICATION, taskTO.getKey(), true);
assertNotNull(taskTO);
assertFalse(taskTO.isExecuted());
assertTrue(preExecs <= taskTO.getExecutions().size());
for (ExecTO exec : taskTO.getExecutions()) {
assertEquals(NotificationJob.Status.NOT_SENT.name(), exec.getStatus());
}
} finally {
// start mail server again
startGreenMail();
// reset number of retries
configurationService.set(origMaxRetries);
}
}
Aggregations