Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorspingel2011-03-05 07:14:09 +0000
committerspingel2011-03-05 07:14:09 +0000
commit0b0c8257804f12431e6499d0c8c634040aa25ef9 (patch)
tree720329c1af83c44c7d479487e26cb7e806b1459c /org.eclipse.mylyn.tasks.tests
parentd97421adca44d14f2264549b6a6ae2903efd0be7 (diff)
downloadorg.eclipse.mylyn.tasks-0b0c8257804f12431e6499d0c8c634040aa25ef9.tar.gz
org.eclipse.mylyn.tasks-0b0c8257804f12431e6499d0c8c634040aa25ef9.tar.xz
org.eclipse.mylyn.tasks-0b0c8257804f12431e6499d0c8c634040aa25ef9.zip
REOPENED - bug 337083: provide an extensible task schema implementation
https://bugs.eclipse.org/bugs/show_bug.cgi?id=337083
Diffstat (limited to 'org.eclipse.mylyn.tasks.tests')
-rw-r--r--org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/core/DefaultTaskSchemaTest.java58
1 files changed, 58 insertions, 0 deletions
diff --git a/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/core/DefaultTaskSchemaTest.java b/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/core/DefaultTaskSchemaTest.java
new file mode 100644
index 000000000..bb6942bbc
--- /dev/null
+++ b/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/core/DefaultTaskSchemaTest.java
@@ -0,0 +1,58 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Tasktop Technologies and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Tasktop Technologies - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.mylyn.tasks.tests.core;
+
+import junit.framework.TestCase;
+
+import org.eclipse.mylyn.tasks.core.data.AbstractTaskSchema;
+import org.eclipse.mylyn.tasks.core.data.DefaultTaskSchema;
+import org.eclipse.mylyn.tasks.core.data.TaskAttribute;
+
+/**
+ * @author Steffen Pingel
+ */
+public class DefaultTaskSchemaTest extends TestCase {
+
+ private class TestSchema extends AbstractTaskSchema {
+
+ private final DefaultTaskSchema parent = DefaultTaskSchema.getInstance();
+
+ public final Field SUMMARY = inheritFrom(parent.SUMMARY).create();
+
+ public final Field SUMMARY_READ_ONLY = inheritFrom(parent.SUMMARY).addFlags(Flag.READ_ONLY).create();
+
+ public final Field REPORTER = inheritFrom(parent.USER_REPORTER).create();
+
+ public final Field REPORTER_MODIFIED = inheritFrom(parent.USER_REPORTER).addFlags(Flag.READ_ONLY)
+ .removeFlags(Flag.READ_ONLY, Flag.PEOPLE)
+ .create();
+
+ }
+
+ public void testInheritFlags() {
+ TestSchema schema = new TestSchema();
+ assertEquals(TaskAttribute.SUMMARY, schema.SUMMARY.getKey());
+ assertEquals(TaskAttribute.SUMMARY, schema.SUMMARY_READ_ONLY.getKey());
+ assertEquals(null, schema.SUMMARY_READ_ONLY.getKind());
+ assertTrue(schema.SUMMARY_READ_ONLY.isReadOnly());
+ }
+
+ public void testInheritFlagsAddRemoveFlag() {
+ TestSchema schema = new TestSchema();
+ assertEquals(TaskAttribute.KIND_PEOPLE, schema.REPORTER.getKind());
+ assertTrue(schema.REPORTER.isReadOnly());
+ assertEquals(TaskAttribute.USER_REPORTER, schema.REPORTER_MODIFIED.getKey());
+ assertEquals(null, schema.REPORTER_MODIFIED.getKind());
+ assertFalse(schema.REPORTER_MODIFIED.isReadOnly());
+ }
+
+}

Back to the top