Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteffen Pingel2013-04-15 09:57:55 -0400
committerSteffen Pingel2013-04-15 20:06:09 -0400
commita0fad711183c44b82edcb5df816856beaddf5079 (patch)
treeefab01ddbfb5a3e9a7a730ef6c73578b87c5f51e /org.eclipse.mylyn.trac.core.tests/src/org/eclipse/mylyn/internal/trac
parentdab45ebad385f4ee7320c58a7462995eafe6af35 (diff)
downloadorg.eclipse.mylyn.tasks-a0fad711183c44b82edcb5df816856beaddf5079.tar.gz
org.eclipse.mylyn.tasks-a0fad711183c44b82edcb5df816856beaddf5079.tar.xz
org.eclipse.mylyn.tasks-a0fad711183c44b82edcb5df816856beaddf5079.zip
400396: fix additional Trac fixture test failures
* Handle empty value when parsing tickets on 1.0 in web mode. * Ensure correct token is submitted for form based authentication. * Exclude tests that don't apply in specialized fixtures. Change-Id: Idc7ae6934a3a6a590fd867f995a69d537690bb28 Task-Url: https://bugs.eclipse.org/bugs/show_bug.cgi?id=400396
Diffstat (limited to 'org.eclipse.mylyn.trac.core.tests/src/org/eclipse/mylyn/internal/trac')
-rw-r--r--org.eclipse.mylyn.trac.core.tests/src/org/eclipse/mylyn/internal/trac/core/client/WebSearchResultParserTest.java61
1 files changed, 61 insertions, 0 deletions
diff --git a/org.eclipse.mylyn.trac.core.tests/src/org/eclipse/mylyn/internal/trac/core/client/WebSearchResultParserTest.java b/org.eclipse.mylyn.trac.core.tests/src/org/eclipse/mylyn/internal/trac/core/client/WebSearchResultParserTest.java
new file mode 100644
index 000000000..ce5a025d1
--- /dev/null
+++ b/org.eclipse.mylyn.trac.core.tests/src/org/eclipse/mylyn/internal/trac/core/client/WebSearchResultParserTest.java
@@ -0,0 +1,61 @@
+/*******************************************************************************
+ * Copyright (c) 2013 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.internal.trac.core.client;
+
+import static org.junit.Assert.assertEquals;
+
+import java.io.BufferedReader;
+import java.io.StringReader;
+
+import org.eclipse.mylyn.internal.trac.core.model.TracTicket;
+import org.eclipse.mylyn.internal.trac.core.model.TracTicket.Key;
+import org.junit.Test;
+
+/**
+ * @author Steffen Pingel
+ */
+public class WebSearchResultParserTest {
+
+ private final WebSearchResultParser parser = new WebSearchResultParser();
+
+ @Test
+ public void testParseEmptyValue() throws Exception {
+ String input = "id\tsummary\tmilestone\towner\ttype\tstatus\tpriority\n";
+ input += "32\tsearchMilestone2 Ls9JM2\tmilestone1\t\tdefect\tnew\tmajor\n";
+ parser.parse(new BufferedReader(new StringReader(input)));
+ assertEquals(1, parser.getTickets().size());
+ TracTicket ticket = parser.getTickets().get(0);
+ assertEquals(32, ticket.getId());
+ assertEquals("searchMilestone2 Ls9JM2", ticket.getValue(Key.SUMMARY));
+ assertEquals("milestone1", ticket.getValue(Key.MILESTONE));
+ assertEquals("", ticket.getValue(Key.OWNER));
+ assertEquals("new", ticket.getValue(Key.STATUS));
+ assertEquals("major", ticket.getValue(Key.PRIORITY));
+ }
+
+ @Test
+ public void testParseEmptyValue_Trac0_11() throws Exception {
+ String input = "id\towner\ttype\tstatus\tpriority\tcomponent\tversion\n";
+ input += "58\t< default >\tdefect\tnew\tmajor\t--\t--\n";
+ parser.parse(new BufferedReader(new StringReader(input)));
+ assertEquals(1, parser.getTickets().size());
+ TracTicket ticket = parser.getTickets().get(0);
+ assertEquals(58, ticket.getId());
+ assertEquals("< default >", ticket.getValue(Key.OWNER));
+ assertEquals("defect", ticket.getValue(Key.TYPE));
+ assertEquals("new", ticket.getValue(Key.STATUS));
+ assertEquals("major", ticket.getValue(Key.PRIORITY));
+ assertEquals(null, ticket.getValue(Key.COMPONENT));
+ assertEquals(null, ticket.getValue(Key.VERSION));
+ }
+
+}

Back to the top