Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/BugzillaRepository32Test.java2
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/externalization/ExternalizationManager.java15
-rw-r--r--org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/TaskActivityTimingTest.java8
-rw-r--r--org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/TaskRepositoryManagerTest.java24
-rw-r--r--org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/TaskTestUtil.java6
-rw-r--r--org.eclipse.mylyn.tests.util/src/org/eclipse/mylyn/tests/util/TestFixture.java6
6 files changed, 29 insertions, 32 deletions
diff --git a/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/BugzillaRepository32Test.java b/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/BugzillaRepository32Test.java
index fb85c2a0c..b216c6a7e 100644
--- a/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/BugzillaRepository32Test.java
+++ b/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/BugzillaRepository32Test.java
@@ -22,7 +22,6 @@ import java.util.Set;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.mylyn.bugzilla.tests.support.BugzillaFixture;
-import org.eclipse.mylyn.commons.core.CoreUtil;
import org.eclipse.mylyn.commons.net.AuthenticationCredentials;
import org.eclipse.mylyn.commons.net.AuthenticationType;
import org.eclipse.mylyn.internal.bugzilla.core.BugzillaAttribute;
@@ -72,7 +71,6 @@ public class BugzillaRepository32Test extends AbstractBugzillaTest {
public void testSecondSubmit() throws Exception {
init322();
String taskNumber = "1";
- assertTrue(CoreUtil.TEST_MODE);
RepositoryQuery query = new RepositoryQuery("bugzilla", "blah");
query.setRepositoryUrl(BugzillaTestConstants.TEST_BUGZILLA_322_URL);
query.setUrl("?short_desc_type=allwordssubstr&short_desc=&product=TestProduct&long_desc_type=allwordssubstr&long_desc=&order=Importance&ctype=rdf");
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/externalization/ExternalizationManager.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/externalization/ExternalizationManager.java
index 611db2573..0fbc14784 100644
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/externalization/ExternalizationManager.java
+++ b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/externalization/ExternalizationManager.java
@@ -28,7 +28,6 @@ import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.SubProgressMonitor;
import org.eclipse.core.runtime.jobs.ISchedulingRule;
import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.mylyn.commons.core.CoreUtil;
import org.eclipse.mylyn.commons.core.StatusHandler;
import org.eclipse.mylyn.commons.net.Policy;
import org.eclipse.mylyn.internal.tasks.core.ITasksCoreConstants;
@@ -132,11 +131,7 @@ public class ExternalizationManager {
public void requestSave() {
if (!saveDisabled) {
- if (!CoreUtil.TEST_MODE) {
- saveJob.schedule(SAVE_DELAY);
- } else {
- saveJob.run(new NullProgressMonitor());
- }
+ saveJob.schedule(SAVE_DELAY);
}
}
@@ -145,14 +140,18 @@ public class ExternalizationManager {
saveDisabled = true;
// run save job as early as possible
- saveJob.wakeUp();
- saveJob.join();
+ saveNow();
} catch (InterruptedException e) {
StatusHandler.log(new Status(IStatus.ERROR, ITasksCoreConstants.ID_PLUGIN,
"Task List save on shutdown canceled.", e)); //$NON-NLS-1$
}
}
+ public void saveNow() throws InterruptedException {
+ saveJob.wakeUp();
+ saveJob.join();
+ }
+
/**
* Clients invoking this method must hold all necessary scheduling rules.
*/
diff --git a/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/TaskActivityTimingTest.java b/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/TaskActivityTimingTest.java
index 01d17a45c..1b621bc77 100644
--- a/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/TaskActivityTimingTest.java
+++ b/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/TaskActivityTimingTest.java
@@ -652,7 +652,7 @@ public class TaskActivityTimingTest extends TestCase {
- mockContext.getInteractionHistory().get(0).getDate().getTime());
}
- public void testCollapsedExternalization() {
+ public void testCollapsedExternalization() throws Exception {
Calendar startTime1 = Calendar.getInstance();
Calendar endTime1 = Calendar.getInstance();
@@ -690,7 +690,7 @@ public class TaskActivityTimingTest extends TestCase {
TasksUiPlugin.getTaskActivityManager().deactivateActiveTask();
assertEquals(4, ContextCorePlugin.getContextManager().getActivityMetaContext().getInteractionHistory().size());
- TaskTestUtil.saveTaskList();
+ TaskTestUtil.saveNow();
ContextCorePlugin.getContextManager().saveActivityMetaContext();
ContextCorePlugin.getContextManager().getActivityMetaContext().reset();
assertEquals(0, ContextCorePlugin.getContextManager().getActivityMetaContext().getInteractionHistory().size());
@@ -833,7 +833,7 @@ public class TaskActivityTimingTest extends TestCase {
assertEquals(expectedTotalTime, TasksUiPlugin.getTaskActivityManager().getElapsedTime(task1));
}
- public void testElapsedSameAfterRead() {
+ public void testElapsedSameAfterRead() throws Exception {
// test that granularity of elapsed time map is retained after
// being re-read from disk
@@ -901,7 +901,7 @@ public class TaskActivityTimingTest extends TestCase {
TasksUi.getTaskActivityManager().deactivateActiveTask();
assertEquals(4, ContextCorePlugin.getContextManager().getActivityMetaContext().getInteractionHistory().size());
- TaskTestUtil.saveTaskList();
+ TaskTestUtil.saveNow();
ContextCorePlugin.getContextManager().saveActivityMetaContext();
ContextCorePlugin.getContextManager().getActivityMetaContext().reset();
assertEquals(0, ContextCorePlugin.getContextManager().getActivityMetaContext().getInteractionHistory().size());
diff --git a/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/TaskRepositoryManagerTest.java b/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/TaskRepositoryManagerTest.java
index 0dab9eccc..e612666cb 100644
--- a/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/TaskRepositoryManagerTest.java
+++ b/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/TaskRepositoryManagerTest.java
@@ -222,17 +222,17 @@ public class TaskRepositoryManagerTest extends TestCase {
assertNotNull(manager.getRepositoryConnector(connector.getConnectorKind()));
}
- public void testRepositoryPersistance() throws MalformedURLException {
+ public void testRepositoryPersistance() throws Exception {
TaskRepository repository1 = new TaskRepository("bugzilla", "http://bugzilla");
TaskRepository repository2 = new TaskRepository("jira", "http://jira");
TaskRepository repository3 = new TaskRepository("local", "http://local");
manager.addRepository(repository3);
manager.addRepository(repository1);
manager.addRepository(repository2);
- TasksUiPlugin.getDefault();
+ TaskTestUtil.saveNow();
+
TasksUiPlugin.getExternalizationManager().load();
//manager.readRepositories(TasksUiPlugin.getDefault().getRepositoriesFilePath());
-
if (manager.getRepositoryConnector("bugzilla") != null) {
assertTrue(manager.getAllRepositories().contains(repository2));
}
@@ -242,7 +242,7 @@ public class TaskRepositoryManagerTest extends TestCase {
assertTrue(manager.getAllRepositories().contains(repository3));
}
- public void testRepositoryAttributePersistance() throws MalformedURLException {
+ public void testRepositoryAttributePersistance() throws Exception {
assertEquals("", TasksUiPlugin.getDefault().getPreferenceStore().getString(
TaskRepositoryManager.PREF_REPOSITORIES));
@@ -258,7 +258,8 @@ public class TaskRepositoryManagerTest extends TestCase {
repository1.setTimeZoneId(fakeTimeZone);
repository1.setSynchronizationTimeStamp(dateString);
manager.addRepository(repository1);
- TasksUiPlugin.getDefault();
+ TaskTestUtil.saveNow();
+
TasksUiPlugin.getExternalizationManager().load();
//manager.readRepositories(TasksUiPlugin.getDefault().getRepositoriesFilePath());
TaskRepository temp = manager.getRepository(repository1.getConnectorKind(), repository1.getRepositoryUrl());
@@ -303,33 +304,32 @@ public class TaskRepositoryManagerTest extends TestCase {
// causing this test to fail.
AbstractRepositoryConnector connector = new MockRepositoryConnector();
manager.addRepositoryConnector(connector);
-
TaskRepository repository = new TaskRepository(MockRepositoryConnector.REPOSITORY_KIND,
"http://mylyn.eclipse.org/");
repository.setProperty("owner", "euxx");
manager.addRepository(repository);
- TasksUiPlugin.getDefault();
+ TaskTestUtil.saveNow();
+
TasksUiPlugin.getExternalizationManager().load();
//manager.readRepositories(TasksUiPlugin.getDefault().getRepositoriesFilePath());
-
TaskRepository temp = manager.getRepository(repository.getConnectorKind(), repository.getRepositoryUrl());
assertNotNull(temp);
assertEquals("euxx", temp.getProperty("owner"));
}
- public void testRepositoryPersistanceSameUrl() throws MalformedURLException {
+ public void testRepositoryPersistanceSameUrl() throws Exception {
TaskRepository repository1 = new TaskRepository("local", "http://repository");
TaskRepository repository2 = new TaskRepository("web", "http://repository");
manager.addRepository(repository1);
manager.addRepository(repository2);
assertEquals(2, manager.getAllRepositories().size());
-
List<TaskRepository> repositoryList = new ArrayList<TaskRepository>();
repositoryList.add(repository2);
repositoryList.add(repository1);
- //manager.readRepositories(TasksUiPlugin.getDefault().getRepositoriesFilePath());
- TasksUiPlugin.getDefault();
+ TaskTestUtil.saveNow();
+
TasksUiPlugin.getExternalizationManager().load();
+ //manager.readRepositories(TasksUiPlugin.getDefault().getRepositoriesFilePath());
assertEquals("got: " + manager.getAllRepositories(), 2, manager.getAllRepositories().size());
}
diff --git a/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/TaskTestUtil.java b/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/TaskTestUtil.java
index a5e276593..6f7c1527b 100644
--- a/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/TaskTestUtil.java
+++ b/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/TaskTestUtil.java
@@ -89,13 +89,13 @@ public class TaskTestUtil {
*/
public static void saveAndReadTasklist() throws Exception {
TasksUiPlugin.getTaskList().notifyElementsChanged(null);
- saveTaskList();
+ saveNow();
TaskTestUtil.resetTaskList();
TasksUiPlugin.getDefault().initializeDataSources();
}
- public static void saveTaskList() {
- TasksUiPlugin.getExternalizationManager().requestSave();
+ public static void saveNow() throws InterruptedException {
+ TasksUiPlugin.getExternalizationManager().saveNow();
}
public static TaskRepository createMockRepository() {
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 2ce396aaf..ad136e902 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
@@ -86,13 +86,13 @@ public abstract class TestFixture {
*/
public static void saveAndReadTasklist() throws Exception {
TasksUiPlugin.getTaskList().notifyElementsChanged(null);
- saveTaskList();
+ saveNow();
resetTaskList();
TasksUiPlugin.getDefault().initializeDataSources();
}
- public static void saveTaskList() {
- TasksUiPlugin.getExternalizationManager().requestSave();
+ public static void saveNow() throws Exception {
+ TasksUiPlugin.getExternalizationManager().saveNow();
}
protected AbstractRepositoryConnector connector;

Back to the top