/** new task. Embedded state and create time will be initialized. * But this task still will have to be persisted with * TransactionContext * .getCurrent() * .getPersistenceSession() * .insert(task); */ public static TaskEntity create() { TaskEntity task = new TaskEntity(); task.isIdentityLinksInitialized = true; task.setCreateTime(ClockUtil.getCurrentTime()); return task; }
/** new task. Embedded state and create time will be initialized. * But this task still will have to be persisted with * TransactionContext * .getCurrent() * .getPersistenceSession() * .insert(task); */ public static TaskEntity create() { TaskEntity task = new TaskEntity(); task.isIdentityLinksInitialized = true; task.setCreateTime(ClockUtil.getCurrentTime()); return task; }
public void testRemoveChangeWhenSetBackToTheOrgValue() { TaskEntity entity = new TaskEntity(); // set an owner (default is null) entity.setOwner("icke"); // should track this change assertFalse(entity.getPropertyChanges().isEmpty()); // reset the owner entity.setOwner(null); // the change is removed assertTrue(entity.getPropertyChanges().isEmpty()); }
when(filterServiceMock.getFilter(eq(MockProvider.NON_EXISTING_ID))).thenReturn(null); List<Object> mockTasks = Collections.<Object>singletonList(new TaskEntity());
public void testNotTrackChangeToTheSameValue() { TaskEntity entity = new TaskEntity(); // get and set a properties entity.setPriority(entity.getPriority()); entity.setOwner(entity.getOwner()); entity.setFollowUpDate(entity.getFollowUpDate()); // should not track this change assertTrue(entity.getPropertyChanges().isEmpty()); }
public void testBeanPropertyChanges() { TaskEntity entity = new TaskEntity(); // assign and validate changes entity.setAssignee("icke"); Map<String, PropertyChange> changes = entity.getPropertyChanges(); assertEquals(1, changes.size()); assertNull(changes.get(ASSIGNEE).getOrgValue()); assertEquals("icke", changes.get(ASSIGNEE).getNewValue()); // assign it again entity.setAssignee("er"); changes = entity.getPropertyChanges(); assertEquals(1, changes.size()); // original value is still null because the task was not saved assertNull(changes.get(ASSIGNEE).getOrgValue()); assertEquals("er", changes.get(ASSIGNEE).getNewValue()); // set a due date entity.setDueDate(new Date()); changes = entity.getPropertyChanges(); assertEquals(2, changes.size()); }
public void testAllTrackedProperties() { Date yesterday = new Date(new Date().getTime() - 86400000); Date tomorrow = new Date(new Date().getTime() + 86400000); TaskEntity entity = new TaskEntity(); // call all tracked setter methods entity.setAssignee("er"); entity.setDelegationState(DelegationState.PENDING); entity.setDeleted(true); entity.setDescription("a description"); entity.setDueDate(tomorrow); entity.setFollowUpDate(yesterday); entity.setName("to do"); entity.setOwner("icke"); entity.setParentTaskId("parent"); entity.setPriority(73); // and validate the change list Map<String, PropertyChange> changes = entity.getPropertyChanges(); assertEquals("er", changes.get(ASSIGNEE).getNewValue()); assertSame(DelegationState.PENDING, changes.get(DELEGATION).getNewValue()); assertTrue((Boolean) changes.get(DELETE).getNewValue()); assertEquals("a description", changes.get(DESCRIPTION).getNewValue()); assertEquals(tomorrow, changes.get(DUE_DATE).getNewValue()); assertEquals(yesterday, changes.get(FOLLOW_UP_DATE).getNewValue()); assertEquals("to do", changes.get(NAME).getNewValue()); assertEquals("icke", changes.get(OWNER).getNewValue()); assertEquals("parent", changes.get(PARENT_TASK).getNewValue()); assertEquals(73, changes.get(PRIORITY).getNewValue()); }
execution8.setId("108"); task1 = new TaskEntity(); task1.setId("104"); task2 = new TaskEntity(); task2.setId("105"); task3 = new TaskEntity(); task3.setId("106"); task4 = new TaskEntity(); task4.setId("107");
public void testTaskEntitySerialization() throws Exception { TaskEntity task = new TaskEntity(); task.setDelegationState(DelegationState.RESOLVED); task.setExecution(new ExecutionEntity()); task.setProcessInstance(new ExecutionEntity()); task.setTaskDefinition(new TaskDefinition(null)); task.setAssignee("kermit"); task.setCreateTime(new Date()); task.setDescription("Test description"); task.setDueDate(new Date()); task.setName("myTask"); task.setEventName("end"); task.setDeleted(false); task.setDelegationStateString(DelegationState.RESOLVED.name()); byte[] data = writeObject(task); task = (TaskEntity) readObject(data); assertEquals("kermit", task.getAssignee()); assertEquals("myTask", task.getName()); assertEquals("end", task.getEventName()); }
/** new task. Embedded state and create time will be initialized. * But this task still will have to be persisted with * TransactionContext * .getCurrent() * .getPersistenceSession() * .insert(task); */ public static TaskEntity create() { TaskEntity task = new TaskEntity(); task.isIdentityLinksInitialized = true; task.setCreateTime(ClockUtil.getCurrentTime()); return task; }
public void testRemoveChangeWhenSetBackToTheOrgValue() { TaskEntity entity = new TaskEntity(); // set an owner (default is null) entity.setOwner("icke"); // should track this change assertFalse(entity.getPropertyChanges().isEmpty()); // reset the owner entity.setOwner(null); // the change is removed assertTrue(entity.getPropertyChanges().isEmpty()); }
public void testBeanPropertyChanges() { TaskEntity entity = new TaskEntity(); // assign and validate changes entity.setAssignee("icke"); Map<String, PropertyChange> changes = entity.getPropertyChanges(); assertEquals(1, changes.size()); assertNull(changes.get(ASSIGNEE).getOrgValue()); assertEquals("icke", changes.get(ASSIGNEE).getNewValue()); // assign it again entity.setAssignee("er"); changes = entity.getPropertyChanges(); assertEquals(1, changes.size()); // original value is still null because the task was not saved assertNull(changes.get(ASSIGNEE).getOrgValue()); assertEquals("er", changes.get(ASSIGNEE).getNewValue()); // set a due date entity.setDueDate(new Date()); changes = entity.getPropertyChanges(); assertEquals(2, changes.size()); }
public void testNotTrackChangeToTheSameValue() { TaskEntity entity = new TaskEntity(); // get and set a properties entity.setPriority(entity.getPriority()); entity.setOwner(entity.getOwner()); entity.setFollowUpDate(entity.getFollowUpDate()); // should not track this change assertTrue(entity.getPropertyChanges().isEmpty()); }
public void testAllTrackedProperties() { Date yesterday = new Date(new Date().getTime() - 86400000); Date tomorrow = new Date(new Date().getTime() + 86400000); TaskEntity entity = new TaskEntity(); // call all tracked setter methods entity.setAssignee("er"); entity.setDelegationState(DelegationState.PENDING); entity.setDeleted(true); entity.setDescription("a description"); entity.setDueDate(tomorrow); entity.setFollowUpDate(yesterday); entity.setName("to do"); entity.setOwner("icke"); entity.setParentTaskId("parent"); entity.setPriority(73); // and validate the change list Map<String, PropertyChange> changes = entity.getPropertyChanges(); assertEquals("er", changes.get(ASSIGNEE).getNewValue()); assertSame(DelegationState.PENDING, changes.get(DELEGATION).getNewValue()); assertTrue((Boolean) changes.get(DELETE).getNewValue()); assertEquals("a description", changes.get(DESCRIPTION).getNewValue()); assertEquals(tomorrow, changes.get(DUE_DATE).getNewValue()); assertEquals(yesterday, changes.get(FOLLOW_UP_DATE).getNewValue()); assertEquals("to do", changes.get(NAME).getNewValue()); assertEquals("icke", changes.get(OWNER).getNewValue()); assertEquals("parent", changes.get(PARENT_TASK).getNewValue()); assertEquals(73, changes.get(PRIORITY).getNewValue()); }
execution8.setId("108"); task1 = new TaskEntity(); task1.setId("104"); task2 = new TaskEntity(); task2.setId("105"); task3 = new TaskEntity(); task3.setId("106"); task4 = new TaskEntity(); task4.setId("107");
public void testTaskEntitySerialization() throws Exception { TaskEntity task = new TaskEntity(); task.setDelegationState(DelegationState.RESOLVED); task.setExecution(new ExecutionEntity()); task.setProcessInstance(new ExecutionEntity()); task.setTaskDefinition(new TaskDefinition(null)); task.setAssignee("kermit"); task.setCreateTime(new Date()); task.setDescription("Test description"); task.setDueDate(new Date()); task.setName("myTask"); task.setEventName("end"); task.setDeleted(false); task.setDelegationStateString(DelegationState.RESOLVED.name()); byte[] data = writeObject(task); task = (TaskEntity) readObject(data); assertEquals("kermit", task.getAssignee()); assertEquals("myTask", task.getName()); assertEquals("end", task.getEventName()); }