Skip to main content
summaryrefslogtreecommitdiffstats
blob: f6ec721574763a8dd26693557e23fcdaa7fcd966 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
/*******************************************************************************
 * Copyright (c) 2003 University Of British Columbia and others.
 * All rights reserved. This program and the accompanying materials 
 * are made available under the terms of the Common Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/cpl-v10.html
 * 
 * Contributors:
 *     University Of British Columbia - initial API and implementation
 *******************************************************************************/
package org.eclipse.mylar.bugzilla.test;

import java.io.File;
import java.io.FileReader;
import java.io.Reader;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

import junit.framework.TestCase;

import org.eclipse.core.runtime.Path;
import org.eclipse.mylar.bugzilla.core.internal.ProductParser;


/**
 * Tests for parsing Product Page for new Bugzilla reports
 */
public class BugzillaProductParserTest extends TestCase {

	public BugzillaProductParserTest() {
		super();
	}

	public BugzillaProductParserTest(String arg0) {
		super(arg0);
	}

	public void testFullReportBugNoBug() throws Exception {

		File f = FileTool.getFileInPlugin(BugzillaTestPlugin.getDefault(), new Path("TestPages/product-page.html"));
		
		Reader in = new FileReader(f);

		List<String> productList = new ArrayList<String>();
		productList = new ProductParser(in).getProducts();
//		printList(productList);

		Iterator<String> itr = productList.iterator();

		while (itr.hasNext()) {
			assertEquals("AJDT", "AJDT", itr.next());
			assertEquals("AspectJ", "AspectJ", itr.next());
			assertEquals("CDT", "CDT", itr.next());
			assertEquals("CME", "CME", itr.next());
			assertEquals("ECESIS", "ECESIS", itr.next());
			assertEquals("EMF", "EMF", itr.next());
			assertEquals("Equinox", "Equinox", itr.next());
			assertEquals("GEF", "GEF", itr.next());
			assertEquals("GMT", "GMT", itr.next());
			assertEquals("Hyades", "Hyades", itr.next());
			assertEquals("JDT", "JDT", itr.next());
			assertEquals("PDE", "PDE", itr.next());
			assertEquals("Platform", "Platform", itr.next());
			assertEquals("Stellation", "Stellation", itr.next());
			assertEquals("UML2", "UML2", itr.next());
			assertEquals("VE", "VE", itr.next());
			assertEquals("WSVT", "WSVT", itr.next());
			assertEquals("XSD", "XSD", itr.next());
		}
	}

//	private void printList(List<String> productList) {
//
//		Iterator<String> itr = productList.iterator();
//		System.out.println("Product List:");
//		while (itr.hasNext())
//			System.out.println(itr.next());
//	}
}

Back to the top