Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenjamin Muskalla2012-05-08 21:54:00 +0000
committerSteffen Pingel2012-05-18 16:12:42 +0000
commitf93c8eafc2f175a5e558225d1493f80dab413ca2 (patch)
tree34950d70d9953a3cc122e17d423baee7901316c5 /org.eclipse.mylyn.tasks.tests
parent918cbdbcf5d6acd49dca0106a7641cbb48c38bc7 (diff)
downloadorg.eclipse.mylyn.tasks-f93c8eafc2f175a5e558225d1493f80dab413ca2.tar.gz
org.eclipse.mylyn.tasks-f93c8eafc2f175a5e558225d1493f80dab413ca2.tar.xz
org.eclipse.mylyn.tasks-f93c8eafc2f175a5e558225d1493f80dab413ca2.zip
NEW - bug 378855: fix classloading issues with RepositoryClientManager
https://bugs.eclipse.org/bugs/show_bug.cgi?id=378855 Change-Id: I18ba7a241393eb33322b87d97fea41aba1c78d1b
Diffstat (limited to 'org.eclipse.mylyn.tasks.tests')
-rw-r--r--org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/AllTasksTests.java2
-rw-r--r--org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/core/RepositoryClientManagerTest.java77
2 files changed, 79 insertions, 0 deletions
diff --git a/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/AllTasksTests.java b/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/AllTasksTests.java
index 3ff8eb277..4d50c1a2f 100644
--- a/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/AllTasksTests.java
+++ b/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/AllTasksTests.java
@@ -18,6 +18,7 @@ import org.eclipse.mylyn.tasks.tests.bugs.SupportHandlerManagerTest;
import org.eclipse.mylyn.tasks.tests.core.FileTaskAttachmentSourceTest;
import org.eclipse.mylyn.tasks.tests.core.ITasksCoreConstantsTest;
import org.eclipse.mylyn.tasks.tests.core.PriorityLevelTest;
+import org.eclipse.mylyn.tasks.tests.core.RepositoryClientManagerTest;
import org.eclipse.mylyn.tasks.tests.core.TaskListUnmatchedContainerTest;
import org.eclipse.mylyn.tasks.tests.core.TaskRepositoryLocationTest;
import org.eclipse.mylyn.tasks.tests.core.TaskRepositoryTest;
@@ -126,6 +127,7 @@ public class AllTasksTests {
suite.addTestSuite(PriorityLevelTest.class);
suite.addTestSuite(TaskAttributeMapperTest.class);
suite.addTestSuite(SupportHandlerManagerTest.class);
+ suite.addTestSuite(RepositoryClientManagerTest.class);
return suite;
}
diff --git a/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/core/RepositoryClientManagerTest.java b/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/core/RepositoryClientManagerTest.java
new file mode 100644
index 000000000..8e55500ca
--- /dev/null
+++ b/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/core/RepositoryClientManagerTest.java
@@ -0,0 +1,77 @@
+/*******************************************************************************
+ * Copyright (c) 2012 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 java.io.File;
+import java.io.Serializable;
+
+import junit.framework.TestCase;
+
+import org.eclipse.mylyn.internal.provisional.tasks.core.RepositoryClientManager;
+import org.eclipse.mylyn.tasks.core.TaskRepository;
+
+/**
+ * @author Benjamin Muskalla
+ */
+public class RepositoryClientManagerTest extends TestCase {
+
+ private static class MyConfig implements Serializable {
+
+ private static final long serialVersionUID = 5105526708474366441L;
+
+ public String someString = "mylyn";
+
+ public TaskRepository repository = null;
+
+ }
+
+ private class MockRepositoryClientManager extends RepositoryClientManager<Object, MyConfig> {
+
+ private Throwable throwable;
+
+ public MockRepositoryClientManager(File cacheFile) {
+ super(cacheFile);
+ }
+
+ @Override
+ protected MyConfig createRepositoryConfiguration() {
+ return new MyConfig();
+ }
+
+ @Override
+ protected Object createClient(TaskRepository taskRepository, MyConfig data) {
+ return new Object();
+ }
+
+ @Override
+ protected void handleError(String message, Throwable e) {
+ throwable = e;
+ }
+
+ public Throwable getThrowable() {
+ return throwable;
+ }
+
+ }
+
+ public void testClassloadingSerialize() throws Exception {
+ File cacheFile = File.createTempFile("config", "");
+ cacheFile.delete();
+ MockRepositoryClientManager manager = new MockRepositoryClientManager(cacheFile);
+ TaskRepository repository = new TaskRepository("kind", "url");
+ manager.getClient(repository);
+ manager.writeCache();
+ assertNull(manager.getThrowable());
+ manager.readCache();
+ assertNull(manager.getThrowable());
+ }
+}

Back to the top