Skip to main content
summaryrefslogtreecommitdiffstats
blob: 9640c0b2465b7c2977bd590c34761286f40c820e (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
81
82
83
84
85
/*******************************************************************************
 * Copyright (c) 2003, 2007 Mylyn project committers 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
 *******************************************************************************/
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();
	}

	@Override
	protected void tearDown() throws Exception {
		super.tearDown();
	}

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

	private TaskRepository setRepository(String url) {
		repository = new TaskRepository(BugzillaCorePlugin.CONNECTOR_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, null).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, null).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, null).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, null).getProducts();
		assertEquals(1, productList.size());
		assertTrue(productList.contains("TestProduct"));
	}

}

Back to the top