use of org.apache.syncope.common.lib.to.SecurityQuestionTO in project syncope by apache.
the class SecurityQuestionITCase method list.
@Test
public void list() {
List<SecurityQuestionTO> securityQuestionTOs = securityQuestionService.list();
assertNotNull(securityQuestionTOs);
assertFalse(securityQuestionTOs.isEmpty());
for (SecurityQuestionTO instance : securityQuestionTOs) {
assertNotNull(instance);
}
}
use of org.apache.syncope.common.lib.to.SecurityQuestionTO in project syncope by apache.
the class SecurityQuestionITCase method read.
@Test
public void read() {
SecurityQuestionTO securityQuestionTO = securityQuestionService.read("887028ea-66fc-41e7-b397-620d7ea6dfbb");
assertNotNull(securityQuestionTO);
}
use of org.apache.syncope.common.lib.to.SecurityQuestionTO in project syncope by apache.
the class SecurityQuestionITCase method update.
@Test
public void update() {
SecurityQuestionTO securityQuestionTO = securityQuestionService.read("887028ea-66fc-41e7-b397-620d7ea6dfbb");
securityQuestionTO.setContent("What is your favorite color?");
securityQuestionService.update(securityQuestionTO);
SecurityQuestionTO actual = securityQuestionService.read(securityQuestionTO.getKey());
assertNotNull(actual);
assertEquals(actual, securityQuestionTO);
}
use of org.apache.syncope.common.lib.to.SecurityQuestionTO in project syncope by apache.
the class SecurityQuestionServiceImpl method create.
@Override
public Response create(final SecurityQuestionTO securityQuestionTO) {
SecurityQuestionTO created = logic.create(securityQuestionTO);
URI location = uriInfo.getAbsolutePathBuilder().path(created.getKey()).build();
return Response.created(location).header(RESTHeaders.RESOURCE_KEY, created.getKey()).build();
}
use of org.apache.syncope.common.lib.to.SecurityQuestionTO in project syncope by apache.
the class SecurityQuestionLogic method delete.
@PreAuthorize("hasRole('" + StandardEntitlement.SECURITY_QUESTION_DELETE + "')")
public SecurityQuestionTO delete(final String key) {
SecurityQuestion securityQuestion = securityQuestionDAO.find(key);
if (securityQuestion == null) {
LOG.error("Could not find security question '" + key + "'");
throw new NotFoundException(String.valueOf(key));
}
SecurityQuestionTO deleted = binder.getSecurityQuestionTO(securityQuestion);
securityQuestionDAO.delete(key);
return deleted;
}
Aggregations