use of org.apache.syncope.core.persistence.api.entity.task.PropagationTask in project syncope by apache.
the class TaskTest method addPropagationTaskExecution.
@Test
public void addPropagationTaskExecution() {
PropagationTask task = taskDAO.find("1e697572-b896-484c-ae7f-0c8f63fcbc6c");
assertNotNull(task);
int executionNumber = task.getExecs().size();
TaskExec execution = entityFactory.newEntity(TaskExec.class);
execution.setTask(task);
execution.setStatus(PropagationTaskExecStatus.CREATED.name());
execution.setStart(new Date());
task.add(execution);
taskDAO.save(task);
taskDAO.flush();
task = taskDAO.find("1e697572-b896-484c-ae7f-0c8f63fcbc6c");
assertNotNull(task);
assertEquals(executionNumber + 1, task.getExecs().size());
}
use of org.apache.syncope.core.persistence.api.entity.task.PropagationTask in project syncope by apache.
the class TaskTest method read.
@Test
public void read() {
PropagationTask task = taskDAO.find("1e697572-b896-484c-ae7f-0c8f63fcbc6c");
assertNotNull(task);
assertNotNull(task.getExecs());
assertFalse(task.getExecs().isEmpty());
assertEquals(1, task.getExecs().size());
}
use of org.apache.syncope.core.persistence.api.entity.task.PropagationTask in project syncope by apache.
the class TaskExecTest method findAll.
@Test
public void findAll() {
PropagationTask task = taskDAO.find("1e697572-b896-484c-ae7f-0c8f63fcbc6c");
assertNotNull(task);
Calendar calendar = Calendar.getInstance();
calendar.clear();
calendar.set(2015, 11, 18, 0, 0, 0);
List<TaskExec> execs = taskExecDAO.findAll(task, calendar.getTime(), null, null, null);
assertNotNull(execs);
assertEquals(1, execs.size());
}
use of org.apache.syncope.core.persistence.api.entity.task.PropagationTask in project syncope by apache.
the class TaskExecTest method issueSYNCOPE214.
@Test
public void issueSYNCOPE214() {
PropagationTask task = taskDAO.find("1e697572-b896-484c-ae7f-0c8f63fcbc6c");
assertNotNull(task);
String faultyMessage = "A faulty message";
faultyMessage = faultyMessage.replace('a', '\0');
TaskExec exec = entityFactory.newEntity(TaskExec.class);
exec.setStart(new Date());
exec.setEnd(new Date());
exec.setStatus(PropagationTaskExecStatus.SUCCESS.name());
exec.setMessage(faultyMessage);
task.add(exec);
exec.setTask(task);
exec = taskExecDAO.save(exec);
assertNotNull(exec);
assertEquals(faultyMessage.replace('\0', '\n'), exec.getMessage());
}
use of org.apache.syncope.core.persistence.api.entity.task.PropagationTask in project syncope by apache.
the class TaskTest method savePropagationTask.
@Test
public void savePropagationTask() {
ExternalResource resource = resourceDAO.find("ws-target-resource-1");
assertNotNull(resource);
User user = userDAO.find("74cd8ece-715a-44a4-a736-e17b46c4e7e6");
assertNotNull(user);
PropagationTask task = entityFactory.newEntity(PropagationTask.class);
task.setResource(resource);
task.setAnyTypeKind(AnyTypeKind.USER);
task.setAnyType(AnyTypeKind.USER.name());
task.setOperation(ResourceOperation.CREATE);
task.setConnObjectKey("one@two.com");
Set<Attribute> attributes = new HashSet<>();
attributes.add(AttributeBuilder.build("testAttribute", "testValue1", "testValue2"));
attributes.add(AttributeBuilder.buildPassword("password".toCharArray()));
task.setAttributes(attributes);
task = taskDAO.save(task);
assertNotNull(task);
PropagationTask actual = taskDAO.find(task.getKey());
assertEquals(task, actual);
}
Aggregations