Skip to main content
summaryrefslogtreecommitdiffstats
blob: ce96b9c81ca1510d232796ab43168323f36e28dd (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
/*******************************************************************************
 * Copyright (c) 2004 - 2006 Mylar 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.mylar.bugzilla.tests;

import junit.framework.TestCase;

import org.eclipse.mylar.internal.bugzilla.core.BugzillaTask;
import org.eclipse.mylar.internal.bugzilla.core.IBugzillaConstants;
import org.eclipse.mylar.tasks.ui.TaskListManager;
import org.eclipse.mylar.tasks.ui.TasksUiPlugin;

/**
 * @author Mik Kersten
 */
public class RepositoryTaskHandleTest extends TestCase {

	private TaskListManager manager = TasksUiPlugin.getTaskListManager();

	@Override
	protected void setUp() throws Exception {
		super.setUp();
		manager = TasksUiPlugin.getTaskListManager();
		manager.resetTaskList();
	}

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

	// Dash now allowed in task id
	// public void testInvalidHandle() {
	// // MockRepositoryTask task = new MockRepositoryTask()
	// String url = "http://foo";
	// assertEquals(url + "-" + "abc", RepositoryTaskHandleUtil.getHandle(url,
	// "abc"));
	// Exception caught = null;
	// try {
	// RepositoryTaskHandleUtil.getHandle(url, "a-23");
	// } catch (Exception e) {
	// caught = e;
	// }
	// assertNotNull(caught);
	// }

	public void testRepositoryUrlHandles() {

		String repository = IBugzillaConstants.ECLIPSE_BUGZILLA_URL;
		String id = "123";
		BugzillaTask bugTask = new BugzillaTask(repository, id, "label 124");
		assertEquals(repository, bugTask.getRepositoryUrl());

		manager.getTaskList().moveToRoot(bugTask);
		manager.saveTaskList();
		manager.resetTaskList();
		manager.readExistingOrCreateNewList();

		BugzillaTask readReport = (BugzillaTask) manager.getTaskList().getRootTasks().iterator().next();
		assertEquals(readReport.getSummary(), readReport.getSummary());
		assertEquals(readReport.getRepositoryUrl(), readReport.getRepositoryUrl());
	}
}

Back to the top