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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
|
/*******************************************************************************
* Copyright (c) 2003 - 2006 University Of British Columbia 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:
* University Of British Columbia - initial API and implementation
*******************************************************************************/
package org.eclipse.mylyn.bugzilla.tests;
import java.util.Iterator;
import java.util.List;
import junit.framework.TestCase;
import org.eclipse.mylyn.context.tests.support.TestUtil;
import org.eclipse.mylyn.context.tests.support.TestUtil.Credentials;
import org.eclipse.mylyn.internal.bugzilla.core.BugzillaCorePlugin;
import org.eclipse.mylyn.internal.bugzilla.core.IBugzillaConstants;
import org.eclipse.mylyn.tasks.core.TaskRepository;
/**
* Tests for parsing Product Page for new Bugzilla reports
*
* @author Mik Kersten
* @author Rob Elves
*/
public class BugzillaProductParserTest extends TestCase {
private TaskRepository repository;
@Override
protected void setUp() throws Exception {
super.setUp();
// repository = new TaskRepository(BugzillaPlugin.REPOSITORY_KIND,
// new URL(IBugzillaConstants.ECLIPSE_BUGZILLA_URL));
// MylarTaskListPlugin.getRepositoryManager().addRepository(repository);
}
@Override
protected void tearDown() throws Exception {
super.tearDown();
// MylarTaskListPlugin.getRepositoryManager().removeRepository(repository);
}
public BugzillaProductParserTest(String arg0) {
super(arg0);
}
private TaskRepository setRepository(String url) {
repository = new TaskRepository(BugzillaCorePlugin.REPOSITORY_KIND, url);
Credentials credentials = TestUtil.readCredentials();
repository.setAuthenticationCredentials(credentials.username, credentials.password);
return repository;
}
public void test222Products() throws Exception {
setRepository(IBugzillaConstants.TEST_BUGZILLA_222_URL);
List<String> productList = BugzillaCorePlugin.getRepositoryConfiguration(repository, false).getProducts();
Iterator<String> itr = productList.iterator();
assertTrue(itr.hasNext());
assertEquals("Read Only Test Cases", itr.next());
}
public void test2201Products() throws Exception {
setRepository(IBugzillaConstants.TEST_BUGZILLA_2201_URL);
List<String> productList = BugzillaCorePlugin.getRepositoryConfiguration(repository, false).getProducts();
Iterator<String> itr = productList.iterator();
assertTrue(itr.hasNext());
assertEquals("TestProduct", "TestProduct", itr.next());
}
public void test220Products() throws Exception {
setRepository(IBugzillaConstants.TEST_BUGZILLA_220_URL);
List<String> productList = BugzillaCorePlugin.getRepositoryConfiguration(repository, false).getProducts();
assertEquals(2, productList.size());
assertTrue(productList.contains("TestProduct"));
assertTrue(productList.contains("Widget"));
}
public void test218Products() throws Exception {
setRepository(IBugzillaConstants.TEST_BUGZILLA_218_URL);
List<String> productList = BugzillaCorePlugin.getRepositoryConfiguration(repository, false).getProducts();
assertEquals(1, productList.size());
assertTrue(productList.contains("TestProduct"));
}
// No longer supporting 216
// public void test216Products() throws Exception {
//
// repository = new TaskRepository(BugzillaPlugin.REPOSITORY_KIND, IBugzillaConstants.TEST_BUGZILLA_216_URL,
// IBugzillaConstants.BugzillaServerVersion.SERVER_216.toString());
//
// List<String> productList = BugzillaRepositoryUtil.getProductList(repository);
// Iterator<String> itr = productList.iterator();
// assertTrue(itr.hasNext());
// assertEquals("TestProduct", "TestProduct", itr.next());
// }
}
|