diff options
author | spingel | 2009-11-19 03:28:58 +0000 |
---|---|---|
committer | spingel | 2009-11-19 03:28:58 +0000 |
commit | bed92deb293917c1c7f389eb66a6d61c0e14cf00 (patch) | |
tree | ad0257a08c316c1b8fae93c28eac43b799a7ace3 /org.eclipse.mylyn.tasks.tests | |
parent | 449f183c7d5f4f6b7a8c224db89a202520817f9e (diff) | |
download | org.eclipse.mylyn.tasks-bed92deb293917c1c7f389eb66a6d61c0e14cf00.tar.gz org.eclipse.mylyn.tasks-bed92deb293917c1c7f389eb66a6d61c0e14cf00.tar.xz org.eclipse.mylyn.tasks-bed92deb293917c1c7f389eb66a6d61c0e14cf00.zip |
RESOLVED - bug 247595: extend TaskMapper with default schema
https://bugs.eclipse.org/bugs/show_bug.cgi?id=247595
Diffstat (limited to 'org.eclipse.mylyn.tasks.tests')
-rw-r--r-- | org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/TaskMapperTest.java | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/TaskMapperTest.java b/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/TaskMapperTest.java index c8db2601c..c04c18832 100644 --- a/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/TaskMapperTest.java +++ b/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/TaskMapperTest.java @@ -18,8 +18,10 @@ import java.util.Map; import junit.framework.TestCase; import org.eclipse.mylyn.tasks.core.TaskRepository; +import org.eclipse.mylyn.tasks.core.data.TaskAttachmentMapper; import org.eclipse.mylyn.tasks.core.data.TaskAttribute; import org.eclipse.mylyn.tasks.core.data.TaskAttributeMapper; +import org.eclipse.mylyn.tasks.core.data.TaskCommentMapper; import org.eclipse.mylyn.tasks.core.data.TaskData; import org.eclipse.mylyn.tasks.core.data.TaskMapper; import org.eclipse.mylyn.tasks.tests.connector.MockRepositoryConnector; @@ -46,6 +48,42 @@ public class TaskMapperTest extends TestCase { target = new TaskMapper(new TaskData(mapper, "kind", "http://url", "2"), true); } + public void testTaskSchema() { + source.setReporter("reporter"); + + TaskAttribute attribute = source.getTaskData().getRoot().getAttribute(TaskAttribute.USER_REPORTER); + assertNotNull(attribute); + assertEquals("reporter", attribute.getValue()); + assertEquals("Reporter", attribute.getMetaData().getLabel()); + assertEquals(TaskAttribute.TYPE_PERSON, attribute.getMetaData().getType()); + } + + public void testTaskAttachmentMapperSchema() { + TaskAttribute attachmentAttribute = mapper.createTaskAttachment(source.getTaskData()); + TaskAttachmentMapper mapper = new TaskAttachmentMapper(); + mapper.setAuthor(taskRepository.createPerson("reporter")); + mapper.applyTo(attachmentAttribute); + + TaskAttribute attribute = attachmentAttribute.getAttribute(TaskAttribute.ATTACHMENT_AUTHOR); + assertNotNull(attribute); + assertEquals("reporter", attribute.getValue()); + assertEquals("Author", attribute.getMetaData().getLabel()); + assertEquals(TaskAttribute.TYPE_PERSON, attribute.getMetaData().getType()); + } + + public void testTaskCommentMapperSchema() { + TaskAttribute attachmentAttribute = mapper.createTaskAttachment(source.getTaskData()); + TaskCommentMapper mapper = new TaskCommentMapper(); + mapper.setAuthor(taskRepository.createPerson("reporter")); + mapper.applyTo(attachmentAttribute); + + TaskAttribute attribute = attachmentAttribute.getAttribute(TaskAttribute.COMMENT_AUTHOR); + assertNotNull(attribute); + assertEquals("reporter", attribute.getValue()); + assertEquals("Author", attribute.getMetaData().getLabel()); + assertEquals(TaskAttribute.TYPE_PERSON, attribute.getMetaData().getType()); + } + public void testCloneTaskCloneCommonAttributes() { source.setDescription("sourceDescription"); target.setDescription(""); |