Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 189695
Collapse All | Expand All

(-)src/org/eclipse/mylyn/internal/jira/core/service/web/rss/RssReader.java (-1 / +1 lines)
Lines 25-31 Link Here
25
 * @author Brock Janiczak
25
 * @author Brock Janiczak
26
 * @author Steffen Pingel
26
 * @author Steffen Pingel
27
 */
27
 */
28
class RssReader {
28
public class RssReader {
29
29
30
	private final JiraClient server;
30
	private final JiraClient server;
31
31
(-)src/org/eclipse/mylyn/jira/tests/RssReaderTest.java (+65 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2004, 2007 Mylyn project committers and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *******************************************************************************/
8
9
package org.eclipse.mylyn.jira.tests;
10
11
import java.io.InputStream;
12
13
import junit.framework.TestCase;
14
15
import org.eclipse.mylyn.internal.jira.core.model.Issue;
16
import org.eclipse.mylyn.internal.jira.core.model.ServerInfo;
17
import org.eclipse.mylyn.internal.jira.core.service.JiraClient;
18
import org.eclipse.mylyn.internal.jira.core.service.JiraException;
19
import org.eclipse.mylyn.internal.jira.core.service.web.rss.RssReader;
20
21
/**
22
 * @author Eugene Kuleshov
23
 */
24
public class RssReaderTest extends TestCase {
25
26
	public void testRssReader() throws Exception {
27
		String baseUrl = "http://foo";
28
		
29
		JiraClient client = new MockJiraClient(baseUrl) {
30
			public ServerInfo getServerInfo() throws JiraException {
31
				ServerInfo serverInfo = new ServerInfo();
32
				return serverInfo;
33
			}
34
		};
35
		
36
		MockIssueCollector collector = new MockIssueCollector();
37
		RssReader reader = new RssReader(client, collector);
38
		
39
		InputStream is = getClass().getResourceAsStream("rssWithMarkup.xml");
40
		reader.readRssFeed(is, baseUrl);
41
42
		Issue issue = collector.issues.get(0);
43
		
44
		String description = issue.getDescription();
45
		
46
		// expected description is cut from rss xml with html entities converted
47
		assertEquals("Testing common markup\n" + 
48
				"\n" + 
49
				"<p>New paragraph</p>\n" + 
50
				"\n" + 
51
				"<ul>\n" + 
52
				"	<li>item 1</li>\n" + 
53
				"	<li>item 2</li>\n" + 
54
				"	<li>item 3</li>\n" + 
55
				"</ul>\n" + 
56
				"\n" + 
57
				"\n" + 
58
				"<div class=\"preformatted\"><div class=\"preformattedContent\">\n" + 
59
				"<pre>+- root\n" + 
60
				"  +- child 1\n" + 
61
				"  +- child 2\n" + 
62
				"</pre>\n" + 
63
				"</div></div>", description);
64
	}
65
}
(-)src/org/eclipse/mylyn/jira/tests/rssWithMarkup.xml (+81 lines)
Added Link Here
1
<!--  RSS generated by JIRA (Enterprise Edition, Version: 3.11-#288) at Sat Jan 12 19:15:07 CST 2008 -->
2
<rss version="0.92" >
3
<channel>
4
    <title>jira.codehaus.org</title>
5
    <link>http://jira.codehaus.org</link>
6
    <description>This file is an XML representation of an issue</description>
7
    <language>en-uk</language>
8
<item>
9
<title>[MNGECLIPSE-463] test</title>
10
<link>http://jira.codehaus.org/browse/MNGECLIPSE-463</link>
11
12
                    <description>Testing common markup
13
14
&lt;p&gt;New paragraph&lt;/p&gt;
15
16
&lt;ul&gt;
17
  &lt;li&gt;item 1&lt;/li&gt;
18
  &lt;li&gt;item 2&lt;/li&gt;
19
  &lt;li&gt;item 3&lt;/li&gt;
20
&lt;/ul&gt;
21
22
23
&lt;div class=&quot;preformatted&quot;&gt;&lt;div class=&quot;preformattedContent&quot;&gt;
24
&lt;pre&gt;+- root
25
  +- child 1
26
  +- child 2
27
&lt;/pre&gt;
28
&lt;/div&gt;&lt;/div&gt;</description>
29
                <environment></environment>
30
            <key id="61471">MNGECLIPSE-463</key>
31
        <summary>test</summary>
32
        <type id="3" iconUrl="http://jira.codehaus.org/images/icons/task.gif">Task</type>
33
    
34
            <priority id="3" iconUrl="http://jira.codehaus.org/images/icons/priority_major.gif">Major</priority>    
35
        <status id="1" iconUrl="http://jira.codehaus.org/images/icons/status_open.gif">Open</status>
36
                        <resolution id="-1">Unresolved</resolution>
37
            
38
    
39
                        <assignee username="-1">Unassigned</assignee>
40
            
41
                        <reporter username="eu">Eugene Kuleshov</reporter>
42
            
43
    <created>Sat, 12 Jan 2008 19:14:42 -0600 (CST)</created>
44
    <updated>Sat, 12 Jan 2008 19:14:42 -0600 (CST)</updated>
45
46
                
47
                
48
                
49
            <due></due>
50
    
51
            <votes>0</votes>
52
    
53
                                        
54
55
    
56
    <attachments>
57
        </attachments>
58
59
    <subtasks>
60
        </subtasks>
61
62
            <customfields>
63
                                                                                                <customfield id="customfield_10163" key="com.atlassian.jira.toolkit:dayslastcommented">
64
                    <customfieldname>Days since last comment</customfieldname>
65
                    <customfieldvalues>
66
                                    Less than a minute ago
67
    
68
                    </customfieldvalues>
69
                </customfield>
70
                                                <customfield id="customfield_10161" key="com.atlassian.jira.toolkit:participants">
71
                    <customfieldname>Participants</customfieldname>
72
                    <customfieldvalues>
73
                                    <customfieldvalue>eu</customfieldvalue>
74
    
75
                    </customfieldvalues>
76
                </customfield>
77
                                                                                    </customfields>
78
    
79
</item>
80
</channel>
81
</rss>

Return to bug 189695