diff options
author | relves | 2007-02-21 01:09:00 +0000 |
---|---|---|
committer | relves | 2007-02-21 01:09:00 +0000 |
commit | 6ff0f9768fcd11a9463eadfabd34252b738cafe4 (patch) | |
tree | 46e4f903f88e8dab7df27a6259e36d4db92efbe4 /org.eclipse.mylyn.bugzilla.tests | |
parent | 288b4c2c75ff9049a88813a87ff61b44f754c76e (diff) | |
download | org.eclipse.mylyn.tasks-6ff0f9768fcd11a9463eadfabd34252b738cafe4.tar.gz org.eclipse.mylyn.tasks-6ff0f9768fcd11a9463eadfabd34252b738cafe4.tar.xz org.eclipse.mylyn.tasks-6ff0f9768fcd11a9463eadfabd34252b738cafe4.zip |
ASSIGNED - bug 174358: [api] need to support dynamic attribute factory construction
https://bugs.eclipse.org/bugs/show_bug.cgi?id=174358
Diffstat (limited to 'org.eclipse.mylyn.bugzilla.tests')
5 files changed, 24 insertions, 21 deletions
diff --git a/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/BugzillaTaskTest.java b/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/BugzillaTaskTest.java index db2bcda89..94f9d2334 100644 --- a/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/BugzillaTaskTest.java +++ b/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/BugzillaTaskTest.java @@ -25,6 +25,7 @@ import org.eclipse.mylar.internal.bugzilla.core.BugzillaTaskDataHandler; import org.eclipse.mylar.internal.bugzilla.core.IBugzillaConstants; import org.eclipse.mylar.tasks.core.RepositoryTaskAttribute; import org.eclipse.mylar.tasks.core.RepositoryTaskData; +import org.eclipse.mylar.tasks.core.Task; import org.eclipse.mylar.tasks.core.TaskComment; import org.eclipse.mylar.tasks.ui.TasksUiPlugin; @@ -35,12 +36,11 @@ public class BugzillaTaskTest extends TestCase { private BugzillaAttributeFactory attributeFactory = new BugzillaAttributeFactory(); - private BugzillaTaskDataHandler offlineHandler; @Override protected void setUp() throws Exception { super.setUp(); - offlineHandler = new BugzillaTaskDataHandler((BugzillaRepositoryConnector)TasksUiPlugin.getRepositoryManager().getRepositoryConnector(BugzillaCorePlugin.REPOSITORY_KIND)); + new BugzillaTaskDataHandler((BugzillaRepositoryConnector)TasksUiPlugin.getRepositoryManager().getRepositoryConnector(BugzillaCorePlugin.REPOSITORY_KIND)); } @Override @@ -51,12 +51,12 @@ public class BugzillaTaskTest extends TestCase { public void testCompletionDate() throws Exception { BugzillaTask task = new BugzillaTask("repo", "1", "summary", true); RepositoryTaskData report = new RepositoryTaskData(new BugzillaAttributeFactory(), - BugzillaCorePlugin.REPOSITORY_KIND, IBugzillaConstants.ECLIPSE_BUGZILLA_URL, "1"); + BugzillaCorePlugin.REPOSITORY_KIND, IBugzillaConstants.ECLIPSE_BUGZILLA_URL, "1", Task.DEFAULT_TASK_KIND); task.setTaskData(report); assertNull(task.getCompletionDate()); Date now = new Date(); - String nowTimeStamp = new SimpleDateFormat(BugzillaTaskDataHandler.comment_creation_ts_format).format(now); + String nowTimeStamp = new SimpleDateFormat(BugzillaAttributeFactory.comment_creation_ts_format).format(now); TaskComment taskComment = new TaskComment(new BugzillaAttributeFactory(), 1); RepositoryTaskAttribute attribute = attributeFactory.createAttribute(BugzillaReportElement.BUG_WHEN @@ -71,7 +71,7 @@ public class BugzillaTaskTest extends TestCase { resolvedAttribute.setValue(IBugzillaConstants.VALUE_STATUS_RESOLVED); report.addAttribute(BugzillaReportElement.BUG_STATUS.getKeyString(), resolvedAttribute); assertNotNull(task.getCompletionDate()); - assertEquals(offlineHandler + assertEquals(report.getAttributeFactory() .getDateForAttributeType(BugzillaReportElement.BUG_WHEN.getKeyString(), nowTimeStamp), task .getCompletionDate()); diff --git a/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/BugzillaTestUtil.java b/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/BugzillaTestUtil.java index d7ffcc6ba..c6699ff60 100644 --- a/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/BugzillaTestUtil.java +++ b/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/BugzillaTestUtil.java @@ -25,12 +25,12 @@ import org.eclipse.core.runtime.FileLocator; import org.eclipse.mylar.internal.bugzilla.core.BugzillaAttributeFactory; import org.eclipse.mylar.internal.bugzilla.core.BugzillaCorePlugin; import org.eclipse.mylar.internal.bugzilla.core.BugzillaReportElement; -import org.eclipse.mylar.internal.bugzilla.core.BugzillaTaskDataHandler; import org.eclipse.mylar.internal.bugzilla.core.BugzillaTask; import org.eclipse.mylar.internal.bugzilla.core.IBugzillaConstants; -import org.eclipse.mylar.tasks.core.TaskComment; import org.eclipse.mylar.tasks.core.RepositoryTaskAttribute; import org.eclipse.mylar.tasks.core.RepositoryTaskData; +import org.eclipse.mylar.tasks.core.Task; +import org.eclipse.mylar.tasks.core.TaskComment; import org.eclipse.mylar.tasks.tests.MylarTasksTestsPlugin; /** @@ -67,7 +67,7 @@ public class BugzillaTestUtil { public static void setBugTaskCompleted(BugzillaTask bugzillaTask, boolean completed) { RepositoryTaskData report = new RepositoryTaskData(new BugzillaAttributeFactory(), - BugzillaCorePlugin.REPOSITORY_KIND, IBugzillaConstants.ECLIPSE_BUGZILLA_URL, "1"); + BugzillaCorePlugin.REPOSITORY_KIND, IBugzillaConstants.ECLIPSE_BUGZILLA_URL, "1", Task.DEFAULT_TASK_KIND); bugzillaTask.setTaskData(report); RepositoryTaskAttribute resolvedAttribute = attributeFactory.createAttribute(BugzillaReportElement.BUG_STATUS .getKeyString()); @@ -76,11 +76,11 @@ public class BugzillaTestUtil { TaskComment taskComment = new TaskComment(new BugzillaAttributeFactory(), 1); RepositoryTaskAttribute attribute = attributeFactory.createAttribute(BugzillaReportElement.BUG_WHEN .getKeyString()); - attribute.setValue(new SimpleDateFormat(BugzillaTaskDataHandler.comment_creation_ts_format).format(new Date())); + attribute.setValue(new SimpleDateFormat(BugzillaAttributeFactory.comment_creation_ts_format).format(new Date())); taskComment.addAttribute(BugzillaReportElement.BUG_WHEN.getKeyString(), attribute); report.addComment(taskComment); } else { - resolvedAttribute.setValue(RepositoryTaskData.VAL_STATUS_NEW); + resolvedAttribute.setValue("NEW"); } report.addAttribute(BugzillaReportElement.BUG_STATUS.getKeyString(), resolvedAttribute); diff --git a/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/DuplicateDetetionTest.java b/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/DuplicateDetetionTest.java index 2b61a8080..2e18269e2 100644 --- a/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/DuplicateDetetionTest.java +++ b/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/DuplicateDetetionTest.java @@ -19,6 +19,7 @@ import org.eclipse.mylar.internal.bugzilla.core.IBugzillaConstants; import org.eclipse.mylar.internal.bugzilla.ui.editor.NewBugzillaTaskEditor; import org.eclipse.mylar.internal.tasks.ui.TaskListPreferenceConstants; import org.eclipse.mylar.tasks.core.RepositoryTaskData; +import org.eclipse.mylar.tasks.core.Task; import org.eclipse.mylar.tasks.core.TaskRepository; import org.eclipse.mylar.tasks.ui.TasksUiPlugin; import org.eclipse.mylar.tasks.ui.TasksUiUtil; @@ -46,7 +47,7 @@ public class DuplicateDetetionTest extends TestCase { String stackTrace = "java.lang.NullPointerException\nat jeff.testing.stack.trace.functionality(jeff.java:481)"; RepositoryTaskData model = new RepositoryTaskData(new BugzillaAttributeFactory(), BugzillaCorePlugin.REPOSITORY_KIND, repository.getUrl(), TasksUiPlugin.getDefault() - .getTaskDataManager().getNewRepositoryTaskId()); + .getTaskDataManager().getNewRepositoryTaskId(), Task.DEFAULT_TASK_KIND); model.setDescription(stackTrace); model.setHasLocalChanges(true); model.setNew(true); @@ -65,7 +66,7 @@ public class DuplicateDetetionTest extends TestCase { public void testNoStackTrace() throws Exception { String fakeStackTrace = "this is not really a stacktrace"; RepositoryTaskData model = new RepositoryTaskData(new BugzillaAttributeFactory(), BugzillaCorePlugin.REPOSITORY_KIND, repository.getUrl(), TasksUiPlugin.getDefault() - .getTaskDataManager().getNewRepositoryTaskId()); + .getTaskDataManager().getNewRepositoryTaskId(), Task.DEFAULT_TASK_KIND); model.setDescription(fakeStackTrace); model.setHasLocalChanges(true); model.setNew(true); @@ -87,7 +88,7 @@ public class DuplicateDetetionTest extends TestCase { String extraText = "\nExtra text that isnt' part of the stack trace java:"; RepositoryTaskData model = new RepositoryTaskData(new BugzillaAttributeFactory(), BugzillaCorePlugin.REPOSITORY_KIND, repository.getUrl(), TasksUiPlugin.getDefault() - .getTaskDataManager().getNewRepositoryTaskId()); + .getTaskDataManager().getNewRepositoryTaskId(), Task.DEFAULT_TASK_KIND); model.setDescription(extraText + "\n" + stackTrace + "\n"); model.setHasLocalChanges(true); @@ -118,7 +119,7 @@ public class DuplicateDetetionTest extends TestCase { "at org.eclipse.jdt.internal.core.JavaElement\n.getURLContents(JavaElement.java:734)"; RepositoryTaskData model = new RepositoryTaskData(new BugzillaAttributeFactory(), BugzillaCorePlugin.REPOSITORY_KIND, repository.getUrl(), TasksUiPlugin.getDefault() - .getTaskDataManager().getNewRepositoryTaskId()); + .getTaskDataManager().getNewRepositoryTaskId(), Task.DEFAULT_TASK_KIND); model.setDescription(stackTrace); model.setHasLocalChanges(true); @@ -148,7 +149,7 @@ public class DuplicateDetetionTest extends TestCase { " at org.eclipse.jdt.internal.core.JavaElement.getURLContents(JavaElement.java:734)"; RepositoryTaskData model = new RepositoryTaskData(new BugzillaAttributeFactory(), BugzillaCorePlugin.REPOSITORY_KIND, repository.getUrl(), TasksUiPlugin.getDefault() - .getTaskDataManager().getNewRepositoryTaskId()); + .getTaskDataManager().getNewRepositoryTaskId(), Task.DEFAULT_TASK_KIND); model.setDescription(stackTrace); model.setHasLocalChanges(true); @@ -174,7 +175,7 @@ public class DuplicateDetetionTest extends TestCase { " at gnu.java.lang.MainThread.run() (/usr/lib/libgcj.so.6.0.0)"; RepositoryTaskData model = new RepositoryTaskData(new BugzillaAttributeFactory(), BugzillaCorePlugin.REPOSITORY_KIND, repository.getUrl(), TasksUiPlugin.getDefault() - .getTaskDataManager().getNewRepositoryTaskId()); + .getTaskDataManager().getNewRepositoryTaskId(), Task.DEFAULT_TASK_KIND); model.setDescription(stackTrace); model.setHasLocalChanges(true); @@ -199,7 +200,7 @@ public class DuplicateDetetionTest extends TestCase { " at java.lang.reflect.Method.Invoke (Method.java)"; RepositoryTaskData model = new RepositoryTaskData(new BugzillaAttributeFactory(), BugzillaCorePlugin.REPOSITORY_KIND, repository.getUrl(), TasksUiPlugin.getDefault() - .getTaskDataManager().getNewRepositoryTaskId()); + .getTaskDataManager().getNewRepositoryTaskId(), Task.DEFAULT_TASK_KIND); model.setDescription(stackTrace); model.setHasLocalChanges(true); @@ -226,7 +227,7 @@ public class DuplicateDetetionTest extends TestCase { " at java/util/logging/LogManager.readConfiguration(L:555)"; RepositoryTaskData model = new RepositoryTaskData(new BugzillaAttributeFactory(), BugzillaCorePlugin.REPOSITORY_KIND, repository.getUrl(), TasksUiPlugin.getDefault() - .getTaskDataManager().getNewRepositoryTaskId()); + .getTaskDataManager().getNewRepositoryTaskId(), Task.DEFAULT_TASK_KIND); model.setDescription(stackTrace); model.setHasLocalChanges(true); @@ -252,7 +253,7 @@ public class DuplicateDetetionTest extends TestCase { " at java.lang.VirtualMachine.main (VirtualMachine.java:108)"; RepositoryTaskData model = new RepositoryTaskData(new BugzillaAttributeFactory(), BugzillaCorePlugin.REPOSITORY_KIND, repository.getUrl(), TasksUiPlugin.getDefault() - .getTaskDataManager().getNewRepositoryTaskId()); + .getTaskDataManager().getNewRepositoryTaskId(), Task.DEFAULT_TASK_KIND); model.setDescription(stackTrace); model.setHasLocalChanges(true); diff --git a/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/NewBugWizardTest.java b/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/NewBugWizardTest.java index 68ddf0861..2686803df 100644 --- a/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/NewBugWizardTest.java +++ b/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/NewBugWizardTest.java @@ -21,6 +21,7 @@ import org.eclipse.mylar.internal.bugzilla.core.BugzillaRepositoryConnector; import org.eclipse.mylar.internal.bugzilla.core.IBugzillaConstants; import org.eclipse.mylar.internal.bugzilla.ui.wizard.BugzillaProductPage; import org.eclipse.mylar.tasks.core.RepositoryTaskData; +import org.eclipse.mylar.tasks.core.Task; import org.eclipse.mylar.tasks.core.TaskRepository; import org.eclipse.ui.PlatformUI; @@ -33,7 +34,7 @@ public class NewBugWizardTest extends TestCase { public void testPlatformOptions() throws Exception { - RepositoryTaskData newReport = new RepositoryTaskData(new BugzillaAttributeFactory(), BugzillaCorePlugin.REPOSITORY_KIND, IBugzillaConstants.TEST_BUGZILLA_220_URL, "1"); + RepositoryTaskData newReport = new RepositoryTaskData(new BugzillaAttributeFactory(), BugzillaCorePlugin.REPOSITORY_KIND, IBugzillaConstants.TEST_BUGZILLA_220_URL, "1", Task.DEFAULT_TASK_KIND); TaskRepository repository = new TaskRepository(BugzillaCorePlugin.REPOSITORY_KIND, IBugzillaConstants.TEST_BUGZILLA_220_URL); diff --git a/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/TaskEditorTest.java b/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/TaskEditorTest.java index e0444f871..267a0d21d 100644 --- a/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/TaskEditorTest.java +++ b/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/TaskEditorTest.java @@ -17,6 +17,7 @@ import org.eclipse.mylar.internal.bugzilla.core.BugzillaRepositoryConnector; import org.eclipse.mylar.internal.bugzilla.core.IBugzillaConstants; import org.eclipse.mylar.internal.tasks.ui.TaskListPreferenceConstants; import org.eclipse.mylar.tasks.core.RepositoryTaskData; +import org.eclipse.mylar.tasks.core.Task; import org.eclipse.mylar.tasks.core.TaskRepository; import org.eclipse.mylar.tasks.ui.TasksUiPlugin; import org.eclipse.mylar.tasks.ui.TasksUiUtil; @@ -59,7 +60,7 @@ public class TaskEditorTest extends TestCase { IBugzillaConstants.TEST_BUGZILLA_222_URL); RepositoryTaskData model = new RepositoryTaskData(new BugzillaAttributeFactory(), BugzillaCorePlugin.REPOSITORY_KIND, repository.getUrl(), TasksUiPlugin.getDefault() - .getTaskDataManager().getNewRepositoryTaskId()); + .getTaskDataManager().getNewRepositoryTaskId(), Task.DEFAULT_TASK_KIND); model.setNew(true); BugzillaRepositoryConnector.setupNewBugAttributes(repository, model); NewTaskEditorInput editorInput = new NewTaskEditorInput(repository, model); |