use of org.apache.syncope.common.lib.to.NotificationTO in project syncope by apache.
the class PushTaskITCase method issueSYNCOPE648.
@Test
public void issueSYNCOPE648() {
// 1. Create Push Task
PushTaskTO task = new PushTaskTO();
task.setName("Test create Push");
task.setActive(true);
task.setResource(RESOURCE_NAME_LDAP);
task.setSourceRealm(SyncopeConstants.ROOT_REALM);
task.getFilters().put(AnyTypeKind.USER.name(), SyncopeClient.getUserSearchConditionBuilder().is("username").equalTo("_NO_ONE_").query());
task.getFilters().put(AnyTypeKind.GROUP.name(), SyncopeClient.getGroupSearchConditionBuilder().is("name").equalTo("citizen").query());
task.setMatchingRule(MatchingRule.IGNORE);
task.setUnmatchingRule(UnmatchingRule.IGNORE);
Response response = taskService.create(TaskType.PUSH, task);
PushTaskTO actual = getObject(response.getLocation(), TaskService.class, PushTaskTO.class);
assertNotNull(actual);
// 2. Create notification
NotificationTO notification = new NotificationTO();
notification.setTraceLevel(TraceLevel.FAILURES);
notification.getEvents().add("[PushTask]:[group]:[resource-ldap]:[matchingrule_ignore]:[SUCCESS]");
notification.getEvents().add("[PushTask]:[group]:[resource-ldap]:[unmatchingrule_ignore]:[SUCCESS]");
notification.getStaticRecipients().add("issueyncope648@syncope.apache.org");
notification.setSelfAsRecipient(false);
notification.setRecipientAttrName("email");
notification.setSender("syncope648@syncope.apache.org");
String subject = "Test notification";
notification.setSubject(subject);
notification.setTemplate("optin");
notification.setActive(true);
Response responseNotification = notificationService.create(notification);
notification = getObject(responseNotification.getLocation(), NotificationService.class, NotificationTO.class);
assertNotNull(notification);
execProvisioningTask(taskService, TaskType.PUSH, actual.getKey(), 50, false);
NotificationTaskTO taskTO = findNotificationTask(notification.getKey(), 50);
assertNotNull(taskTO);
}
use of org.apache.syncope.common.lib.to.NotificationTO in project syncope by apache.
the class NotificationServiceImpl method create.
@Override
public Response create(final NotificationTO notificationTO) {
NotificationTO created = logic.create(notificationTO);
URI location = uriInfo.getAbsolutePathBuilder().path(created.getKey()).build();
return Response.created(location).header(RESTHeaders.RESOURCE_KEY, created.getKey()).build();
}
Aggregations