Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorspingel2009-08-31 20:10:16 +0000
committerspingel2009-08-31 20:10:16 +0000
commite8569061b339be8d15c57c51eed8b163acd0c339 (patch)
treeb6bcccd6049fa0ce70f4be92f11257da04194ee7
parent62226af8c1bee0c840c105345c7f79189a821fe0 (diff)
downloadorg.eclipse.mylyn.tasks-e8569061b339be8d15c57c51eed8b163acd0c339.tar.gz
org.eclipse.mylyn.tasks-e8569061b339be8d15c57c51eed8b163acd0c339.tar.xz
org.eclipse.mylyn.tasks-e8569061b339be8d15c57c51eed8b163acd0c339.zip
NEW - bug 288070: fix failing tests in TracClientTest
https://bugs.eclipse.org/bugs/show_bug.cgi?id=288070
-rw-r--r--org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/client/TracWebClient.java6
-rw-r--r--org.eclipse.mylyn.trac.tests/src/org/eclipse/mylyn/trac/tests/support/TracFixture.java5
-rw-r--r--org.eclipse.mylyn.trac.tests/src/org/eclipse/mylyn/trac/tests/support/TracTestUtil.java16
3 files changed, 22 insertions, 5 deletions
diff --git a/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/client/TracWebClient.java b/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/client/TracWebClient.java
index 15ec9f823..6da41cb08 100644
--- a/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/client/TracWebClient.java
+++ b/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/client/TracWebClient.java
@@ -433,8 +433,8 @@ public class TracWebClient extends AbstractTracClient {
} else if (version.startsWith("Trac 0.11")) { //$NON-NLS-1$
return new TracRepositoryInfo(1, 0, 0, version);
} else {
- throw new TracException(NLS.bind(
- Messages.TracWebClient_Trac_version_X_is_unsupported_Error, version));
+ throw new TracException(NLS.bind(Messages.TracWebClient_Trac_version_X_is_unsupported_Error,
+ version));
}
}
@@ -744,6 +744,8 @@ public class TracWebClient extends AbstractTracClient {
sb.append(" "); //$NON-NLS-1$
} else if (token.getType() == Token.COMMENT) {
// ignore
+ } else if (token.getType() == Token.TAG && ((HtmlTag) token.getValue()).getTagType() == Tag.A) {
+ // ignore, Trac 0.11 wraps milestone values in links
} else {
break;
}
diff --git a/org.eclipse.mylyn.trac.tests/src/org/eclipse/mylyn/trac/tests/support/TracFixture.java b/org.eclipse.mylyn.trac.tests/src/org/eclipse/mylyn/trac/tests/support/TracFixture.java
index 917367f86..6d05b5aa6 100644
--- a/org.eclipse.mylyn.trac.tests/src/org/eclipse/mylyn/trac/tests/support/TracFixture.java
+++ b/org.eclipse.mylyn.trac.tests/src/org/eclipse/mylyn/trac/tests/support/TracFixture.java
@@ -64,7 +64,9 @@ public class TracFixture extends TestFixture {
public static TracFixture TRAC_0_11_XML_RPC = new TracFixture(Version.XML_RPC, TracTestConstants.TEST_TRAC_011_URL,
"0.11", "XML-RPC");
- public static TracFixture DEFAULT = TRAC_0_11_XML_RPC;
+ //public static TracFixture DEFAULT = TRAC_0_11_XML_RPC;
+
+ public static TracFixture DEFAULT = TRAC_0_11_WEB;
public static final TracFixture[] ALL = new TracFixture[] { TRAC_0_9_WEB, TRAC_0_10_WEB, TRAC_0_11_WEB,
TRAC_0_10_XML_RPC, TRAC_0_11_XML_RPC, };
@@ -182,6 +184,7 @@ public class TracFixture extends TestFixture {
return version;
}
+ @Override
public TaskRepository singleRepository() {
TracCorePlugin.getDefault().getConnector().getClientManager().writeCache();
TaskRepositoryManager manager = TasksUiPlugin.getRepositoryManager();
diff --git a/org.eclipse.mylyn.trac.tests/src/org/eclipse/mylyn/trac/tests/support/TracTestUtil.java b/org.eclipse.mylyn.trac.tests/src/org/eclipse/mylyn/trac/tests/support/TracTestUtil.java
index 8e2904535..999ac0c48 100644
--- a/org.eclipse.mylyn.trac.tests/src/org/eclipse/mylyn/trac/tests/support/TracTestUtil.java
+++ b/org.eclipse.mylyn.trac.tests/src/org/eclipse/mylyn/trac/tests/support/TracTestUtil.java
@@ -93,8 +93,20 @@ public class TracTestUtil {
Map<?, ?> expectedValues = ticket.getValues();
Map<String, String> values = tracTicket.getValues();
for (String key : values.keySet()) {
- Assert.assertEquals("Values for key '" + key + "' did not match", expectedValues.get(key), values.get(key));
+ Object expected = expectedValues.get(key);
+ String actual = values.get(key);
+ if (key.equals("reporter")) {
+ // Trac 0.11 obfuscates email addresses by replacing the domain with the Ellipses character,
+ // mangle expected value accordingly
+ if (actual != null && actual.endsWith("\u2026") && expected instanceof String) {
+ String expectedString = (String) expected;
+ int i = expectedString.indexOf("@");
+ if (i != -1) {
+ expected = expectedString.substring(0, i + 1) + "\u2026";
+ }
+ }
+ }
+ Assert.assertEquals("Values for key '" + key + "' did not match", expected, actual);
}
}
-
}

Back to the top