Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorspingel2009-09-23 02:00:37 +0000
committerspingel2009-09-23 02:00:37 +0000
commit85ad3ca28b0c9a32387b60da9fa50007ecdca36a (patch)
tree11dc113d873e73affc9564d56b0e3c4a4a94c98d /org.eclipse.mylyn.tests.util/src/org/eclipse/mylyn
parent40a9876b3a54f1d5fdc393720f0407f96a0c991b (diff)
downloadorg.eclipse.mylyn.tasks-85ad3ca28b0c9a32387b60da9fa50007ecdca36a.tar.gz
org.eclipse.mylyn.tasks-85ad3ca28b0c9a32387b60da9fa50007ecdca36a.tar.xz
org.eclipse.mylyn.tasks-85ad3ca28b0c9a32387b60da9fa50007ecdca36a.zip
NEW - bug 277254: use a single JiraClient instance per repository
https://bugs.eclipse.org/bugs/show_bug.cgi?id=277254
Diffstat (limited to 'org.eclipse.mylyn.tests.util/src/org/eclipse/mylyn')
-rw-r--r--org.eclipse.mylyn.tests.util/src/org/eclipse/mylyn/tests/util/TestFixture.java70
-rw-r--r--org.eclipse.mylyn.tests.util/src/org/eclipse/mylyn/tests/util/TestUtil.java10
2 files changed, 48 insertions, 32 deletions
diff --git a/org.eclipse.mylyn.tests.util/src/org/eclipse/mylyn/tests/util/TestFixture.java b/org.eclipse.mylyn.tests.util/src/org/eclipse/mylyn/tests/util/TestFixture.java
index c99090b7e..f46bc10eb 100644
--- a/org.eclipse.mylyn.tests.util/src/org/eclipse/mylyn/tests/util/TestFixture.java
+++ b/org.eclipse.mylyn.tests.util/src/org/eclipse/mylyn/tests/util/TestFixture.java
@@ -36,14 +36,50 @@ import org.eclipse.mylyn.tests.util.TestUtil.PrivilegeLevel;
*/
public abstract class TestFixture {
+ /**
+ * Clears all tasks.
+ */
+ public static void resetTaskList() throws Exception {
+ TasksUi.getTaskActivityManager().deactivateActiveTask();
+ TasksUiPlugin.getTaskListExternalizationParticipant().resetTaskList();
+ TaskListView view = TaskListView.getFromActivePerspective();
+ if (view != null) {
+ view.refresh();
+ }
+ }
+
+ /**
+ * Clears tasks and repositories. When this method returns only the local task repository will exist and the task
+ * list will only have default categories but no tasks.
+ */
+ public static void resetTaskListAndRepositories() throws Exception {
+ TasksUiPlugin.getRepositoryManager().clearRepositories();
+ TasksUiPlugin.getDefault().getLocalTaskRepository();
+ resetTaskList();
+ }
+
+ /**
+ * @see #resetTaskList()
+ */
+ public static void saveAndReadTasklist() throws Exception {
+ TasksUiPlugin.getTaskList().notifyElementsChanged(null);
+ saveTaskList();
+ resetTaskList();
+ TasksUiPlugin.getDefault().initializeDataSources();
+ }
+
+ public static void saveTaskList() {
+ TasksUiPlugin.getExternalizationManager().requestSave();
+ }
+
+ protected AbstractRepositoryConnector connector;
+
private final String connectorKind;
private String info;
protected final String repositoryUrl;
- protected AbstractRepositoryConnector connector;
-
public TestFixture(String connectorKind, String repositoryUrl) {
this.connectorKind = connectorKind;
this.repositoryUrl = repositoryUrl;
@@ -59,6 +95,10 @@ public abstract class TestFixture {
}
}
+ public AbstractRepositoryConnector connector() {
+ return connector;
+ }
+
public TestSuite createSuite() {
TestSuite suite = new TestSuite("Testing on " + getInfo());
suite.addTest(new TestCase("activiating " + getRepositoryUrl()) {
@@ -131,30 +171,4 @@ public abstract class TestFixture {
return repository;
}
- public AbstractRepositoryConnector connector() {
- return connector;
- }
-
- /**
- * Clears tasks and repositories. When this method returns only the local task repository will exist and the task
- * list will only have default categories but no tasks.
- */
- public static void resetTaskListAndRepositories() throws Exception {
- TasksUiPlugin.getRepositoryManager().clearRepositories();
- TasksUiPlugin.getDefault().getLocalTaskRepository();
- resetTaskList();
- }
-
- /**
- * Clears all tasks.
- */
- public static void resetTaskList() throws Exception {
- TasksUi.getTaskActivityManager().deactivateActiveTask();
- TasksUiPlugin.getTaskListExternalizationParticipant().resetTaskList();
- TaskListView view = TaskListView.getFromActivePerspective();
- if (view != null) {
- view.refresh();
- }
- }
-
}
diff --git a/org.eclipse.mylyn.tests.util/src/org/eclipse/mylyn/tests/util/TestUtil.java b/org.eclipse.mylyn.tests.util/src/org/eclipse/mylyn/tests/util/TestUtil.java
index b0eb3d490..2b7346e08 100644
--- a/org.eclipse.mylyn.tests.util/src/org/eclipse/mylyn/tests/util/TestUtil.java
+++ b/org.eclipse.mylyn.tests.util/src/org/eclipse/mylyn/tests/util/TestUtil.java
@@ -62,11 +62,13 @@ public class TestUtil {
File file;
String filename = System.getProperty(KEY_CREDENTIALS_FILE);
if (filename == null) {
- file = getFile(TestUtil.class, "credentials.properties");
- if (!file.exists()) {
+ try {
+ file = getFile(TestUtil.class, "credentials.properties");
+ } catch (AssertionFailedError e) {
+ file = getFile(TestUtil.class, "../org.eclipse.mylyn.context.tests/credentials.properties");
// lookup may have reverted to this plug-in, try to lookup file in org.eclipse.context.tests plug-in
- File path = new File(file.getParentFile().getParentFile(), "org.eclipse.mylyn.context.tests");
- file = new File(path, file.getName());
+ //File path = new File(file.getParentFile().getParentFile(), "org.eclipse.mylyn.context.tests");
+ //file = new File(path, file.getName());
}
} else {
file = new File(filename);

Back to the top