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 229655
Collapse All | Expand All

(-)src/org/eclipse/mylyn/bugzilla/tests/DuplicateDetetionTest.java (-10 / +10 lines)
Lines 34-40 Link Here
34
	@Override
34
	@Override
35
	protected void setUp() throws Exception {
35
	protected void setUp() throws Exception {
36
		super.setUp();
36
		super.setUp();
37
		repository = new TaskRepository(BugzillaCorePlugin.REPOSITORY_KIND, IBugzillaConstants.TEST_BUGZILLA_222_URL);
37
		repository = new TaskRepository(BugzillaCorePlugin.CONNECTOR_KIND, IBugzillaConstants.TEST_BUGZILLA_222_URL);
38
38
39
	}
39
	}
40
40
Lines 43-49 Link Here
43
		String stackTrace = "java.lang.NullPointerException\nat jeff.testing.stack.trace.functionality(jeff.java:481)";
43
		String stackTrace = "java.lang.NullPointerException\nat jeff.testing.stack.trace.functionality(jeff.java:481)";
44
44
45
		RepositoryTaskData model = new RepositoryTaskData(new BugzillaAttributeFactory(),
45
		RepositoryTaskData model = new RepositoryTaskData(new BugzillaAttributeFactory(),
46
				BugzillaCorePlugin.REPOSITORY_KIND, repository.getRepositoryUrl(),
46
				BugzillaCorePlugin.CONNECTOR_KIND, repository.getRepositoryUrl(),
47
				TasksUiPlugin.getTaskDataStorageManager().getNewRepositoryTaskId());
47
				TasksUiPlugin.getTaskDataStorageManager().getNewRepositoryTaskId());
48
		model.setDescription(stackTrace);
48
		model.setDescription(stackTrace);
49
		model.setNew(true);
49
		model.setNew(true);
Lines 62-68 Link Here
62
	public void testNoStackTrace() throws Exception {
62
	public void testNoStackTrace() throws Exception {
63
		String fakeStackTrace = "this is not really a stacktrace";
63
		String fakeStackTrace = "this is not really a stacktrace";
64
		RepositoryTaskData model = new RepositoryTaskData(new BugzillaAttributeFactory(),
64
		RepositoryTaskData model = new RepositoryTaskData(new BugzillaAttributeFactory(),
65
				BugzillaCorePlugin.REPOSITORY_KIND, repository.getRepositoryUrl(),
65
				BugzillaCorePlugin.CONNECTOR_KIND, repository.getRepositoryUrl(),
66
				TasksUiPlugin.getTaskDataStorageManager().getNewRepositoryTaskId());
66
				TasksUiPlugin.getTaskDataStorageManager().getNewRepositoryTaskId());
67
		model.setDescription(fakeStackTrace);
67
		model.setDescription(fakeStackTrace);
68
		model.setNew(true);
68
		model.setNew(true);
Lines 84-90 Link Here
84
		String extraText = "\nExtra text that isnt' part of the stack trace java:";
84
		String extraText = "\nExtra text that isnt' part of the stack trace java:";
85
85
86
		RepositoryTaskData model = new RepositoryTaskData(new BugzillaAttributeFactory(),
86
		RepositoryTaskData model = new RepositoryTaskData(new BugzillaAttributeFactory(),
87
				BugzillaCorePlugin.REPOSITORY_KIND, repository.getRepositoryUrl(),
87
				BugzillaCorePlugin.CONNECTOR_KIND, repository.getRepositoryUrl(),
88
				TasksUiPlugin.getTaskDataStorageManager().getNewRepositoryTaskId());
88
				TasksUiPlugin.getTaskDataStorageManager().getNewRepositoryTaskId());
89
89
90
		model.setDescription(extraText + "\n" + stackTrace + "\n");
90
		model.setDescription(extraText + "\n" + stackTrace + "\n");
Lines 113-119 Link Here
113
				+ "at org.eclipse.jdt.internal.core.JavaElement\n.getURLContents(JavaElement.java:734)";
113
				+ "at org.eclipse.jdt.internal.core.JavaElement\n.getURLContents(JavaElement.java:734)";
114
114
115
		RepositoryTaskData model = new RepositoryTaskData(new BugzillaAttributeFactory(),
115
		RepositoryTaskData model = new RepositoryTaskData(new BugzillaAttributeFactory(),
116
				BugzillaCorePlugin.REPOSITORY_KIND, repository.getRepositoryUrl(),
116
				BugzillaCorePlugin.CONNECTOR_KIND, repository.getRepositoryUrl(),
117
				TasksUiPlugin.getTaskDataStorageManager().getNewRepositoryTaskId());
117
				TasksUiPlugin.getTaskDataStorageManager().getNewRepositoryTaskId());
118
118
119
		model.setDescription(stackTrace);
119
		model.setDescription(stackTrace);
Lines 143-149 Link Here
143
				+ "     at org.eclipse.jdt.internal.core.JavaElement.getURLContents(JavaElement.java:734)";
143
				+ "     at org.eclipse.jdt.internal.core.JavaElement.getURLContents(JavaElement.java:734)";
144
144
145
		RepositoryTaskData model = new RepositoryTaskData(new BugzillaAttributeFactory(),
145
		RepositoryTaskData model = new RepositoryTaskData(new BugzillaAttributeFactory(),
146
				BugzillaCorePlugin.REPOSITORY_KIND, repository.getRepositoryUrl(),
146
				BugzillaCorePlugin.CONNECTOR_KIND, repository.getRepositoryUrl(),
147
				TasksUiPlugin.getTaskDataStorageManager().getNewRepositoryTaskId());
147
				TasksUiPlugin.getTaskDataStorageManager().getNewRepositoryTaskId());
148
148
149
		model.setDescription(stackTrace);
149
		model.setDescription(stackTrace);
Lines 169-175 Link Here
169
				+ "	   at gnu.java.lang.MainThread.run() (/usr/lib/libgcj.so.6.0.0)";
169
				+ "	   at gnu.java.lang.MainThread.run() (/usr/lib/libgcj.so.6.0.0)";
170
170
171
		RepositoryTaskData model = new RepositoryTaskData(new BugzillaAttributeFactory(),
171
		RepositoryTaskData model = new RepositoryTaskData(new BugzillaAttributeFactory(),
172
				BugzillaCorePlugin.REPOSITORY_KIND, repository.getRepositoryUrl(),
172
				BugzillaCorePlugin.CONNECTOR_KIND, repository.getRepositoryUrl(),
173
				TasksUiPlugin.getTaskDataStorageManager().getNewRepositoryTaskId());
173
				TasksUiPlugin.getTaskDataStorageManager().getNewRepositoryTaskId());
174
174
175
		model.setDescription(stackTrace);
175
		model.setDescription(stackTrace);
Lines 193-199 Link Here
193
				+ "	at java.lang.reflect.Method.Invoke (Method.java)";
193
				+ "	at java.lang.reflect.Method.Invoke (Method.java)";
194
194
195
		RepositoryTaskData model = new RepositoryTaskData(new BugzillaAttributeFactory(),
195
		RepositoryTaskData model = new RepositoryTaskData(new BugzillaAttributeFactory(),
196
				BugzillaCorePlugin.REPOSITORY_KIND, repository.getRepositoryUrl(),
196
				BugzillaCorePlugin.CONNECTOR_KIND, repository.getRepositoryUrl(),
197
				TasksUiPlugin.getTaskDataStorageManager().getNewRepositoryTaskId());
197
				TasksUiPlugin.getTaskDataStorageManager().getNewRepositoryTaskId());
198
198
199
		model.setDescription(stackTrace);
199
		model.setDescription(stackTrace);
Lines 220-226 Link Here
220
				+ "	at java/util/logging/LogManager.readConfiguration(L:555)";
220
				+ "	at java/util/logging/LogManager.readConfiguration(L:555)";
221
221
222
		RepositoryTaskData model = new RepositoryTaskData(new BugzillaAttributeFactory(),
222
		RepositoryTaskData model = new RepositoryTaskData(new BugzillaAttributeFactory(),
223
				BugzillaCorePlugin.REPOSITORY_KIND, repository.getRepositoryUrl(),
223
				BugzillaCorePlugin.CONNECTOR_KIND, repository.getRepositoryUrl(),
224
				TasksUiPlugin.getTaskDataStorageManager().getNewRepositoryTaskId());
224
				TasksUiPlugin.getTaskDataStorageManager().getNewRepositoryTaskId());
225
225
226
		model.setDescription(stackTrace);
226
		model.setDescription(stackTrace);
Lines 245-251 Link Here
245
				+ "	   at java.lang.VirtualMachine.main (VirtualMachine.java:108)";
245
				+ "	   at java.lang.VirtualMachine.main (VirtualMachine.java:108)";
246
246
247
		RepositoryTaskData model = new RepositoryTaskData(new BugzillaAttributeFactory(),
247
		RepositoryTaskData model = new RepositoryTaskData(new BugzillaAttributeFactory(),
248
				BugzillaCorePlugin.REPOSITORY_KIND, repository.getRepositoryUrl(),
248
				BugzillaCorePlugin.CONNECTOR_KIND, repository.getRepositoryUrl(),
249
				TasksUiPlugin.getTaskDataStorageManager().getNewRepositoryTaskId());
249
				TasksUiPlugin.getTaskDataStorageManager().getNewRepositoryTaskId());
250
250
251
		model.setDescription(stackTrace);
251
		model.setDescription(stackTrace);
(-)src/org/eclipse/mylyn/bugzilla/tests/NewBugWizardTest.java (-17 / +17 lines)
Lines 30-38 Link Here
30
	public void testPlatformOptions() throws Exception {
30
	public void testPlatformOptions() throws Exception {
31
31
32
		RepositoryTaskData newReport = new RepositoryTaskData(new BugzillaAttributeFactory(),
32
		RepositoryTaskData newReport = new RepositoryTaskData(new BugzillaAttributeFactory(),
33
				BugzillaCorePlugin.REPOSITORY_KIND, IBugzillaConstants.TEST_BUGZILLA_220_URL, "1");
33
				BugzillaCorePlugin.CONNECTOR_KIND, IBugzillaConstants.TEST_BUGZILLA_220_URL, "1");
34
34
35
		TaskRepository repository = new TaskRepository(BugzillaCorePlugin.REPOSITORY_KIND,
35
		TaskRepository repository = new TaskRepository(BugzillaCorePlugin.CONNECTOR_KIND,
36
				IBugzillaConstants.TEST_BUGZILLA_220_URL);
36
				IBugzillaConstants.TEST_BUGZILLA_220_URL);
37
		AbstractLegacyRepositoryConnector connector = (AbstractLegacyRepositoryConnector) TasksUiPlugin.getRepositoryManager()
37
		AbstractLegacyRepositoryConnector connector = (AbstractLegacyRepositoryConnector) TasksUiPlugin.getRepositoryManager()
38
				.getRepositoryConnector(repository.getConnectorKind());
38
				.getRepositoryConnector(repository.getConnectorKind());
Lines 44-86 Link Here
44
44
45
		String os = Platform.getOS();
45
		String os = Platform.getOS();
46
		if (os.equals("win32")) {
46
		if (os.equals("win32")) {
47
			assertEquals("Windows", newReport.getAttribute(BugzillaReportElement.OP_SYS.getKeyString()).getValue());
47
			assertEquals("Windows", newReport.getAttribute(BugzillaReportElement.OP_SYS.getKey()).getValue());
48
		} else if (os.equals("solaris")) {
48
		} else if (os.equals("solaris")) {
49
			assertEquals("Solaris", newReport.getAttribute(BugzillaReportElement.OP_SYS.getKeyString()).getValue());
49
			assertEquals("Solaris", newReport.getAttribute(BugzillaReportElement.OP_SYS.getKey()).getValue());
50
		} else if (os.equals("qnx")) {
50
		} else if (os.equals("qnx")) {
51
			assertEquals("QNX-Photon", newReport.getAttribute(BugzillaReportElement.OP_SYS.getKeyString()).getValue());
51
			assertEquals("QNX-Photon", newReport.getAttribute(BugzillaReportElement.OP_SYS.getKey()).getValue());
52
		} else if (os.equals("macosx")) {
52
		} else if (os.equals("macosx")) {
53
			assertEquals("Mac OS", newReport.getAttribute(BugzillaReportElement.OP_SYS.getKeyString()).getValue());
53
			assertEquals("Mac OS", newReport.getAttribute(BugzillaReportElement.OP_SYS.getKey()).getValue());
54
		} else if (os.equals("linux")) {
54
		} else if (os.equals("linux")) {
55
			assertEquals("Linux", newReport.getAttribute(BugzillaReportElement.OP_SYS.getKeyString()).getValue());
55
			assertEquals("Linux", newReport.getAttribute(BugzillaReportElement.OP_SYS.getKey()).getValue());
56
		} else if (os.equals("hpux")) {
56
		} else if (os.equals("hpux")) {
57
			assertEquals("HP-UX", newReport.getAttribute(BugzillaReportElement.OP_SYS.getKeyString()).getValue());
57
			assertEquals("HP-UX", newReport.getAttribute(BugzillaReportElement.OP_SYS.getKey()).getValue());
58
		} else if (os.equals("aix")) {
58
		} else if (os.equals("aix")) {
59
			assertEquals("AIX", newReport.getAttribute(BugzillaReportElement.OP_SYS.getKeyString()).getValue());
59
			assertEquals("AIX", newReport.getAttribute(BugzillaReportElement.OP_SYS.getKey()).getValue());
60
		}
60
		}
61
61
62
		String platform = Platform.getOSArch();
62
		String platform = Platform.getOSArch();
63
		if (platform.equals("x86")) {
63
		if (platform.equals("x86")) {
64
			if (os.equals("macosx")) {
64
			if (os.equals("macosx")) {
65
				assertEquals("Macintosh", newReport.getAttribute(BugzillaReportElement.REP_PLATFORM.getKeyString())
65
				assertEquals("Macintosh", newReport.getAttribute(BugzillaReportElement.REP_PLATFORM.getKey())
66
						.getValue());
66
						.getValue());
67
			} else {
67
			} else {
68
				assertEquals("PC", newReport.getAttribute(BugzillaReportElement.REP_PLATFORM.getKeyString()).getValue());
68
				assertEquals("PC", newReport.getAttribute(BugzillaReportElement.REP_PLATFORM.getKey()).getValue());
69
			}
69
			}
70
		} else if (platform.equals("x86_64")) {
70
		} else if (platform.equals("x86_64")) {
71
			assertEquals("PC", newReport.getAttribute(BugzillaReportElement.REP_PLATFORM.getKeyString()).getValue());
71
			assertEquals("PC", newReport.getAttribute(BugzillaReportElement.REP_PLATFORM.getKey()).getValue());
72
		} else if (platform.equals("ia64")) {
72
		} else if (platform.equals("ia64")) {
73
			assertEquals("PC", newReport.getAttribute(BugzillaReportElement.REP_PLATFORM.getKeyString()).getValue());
73
			assertEquals("PC", newReport.getAttribute(BugzillaReportElement.REP_PLATFORM.getKey()).getValue());
74
		} else if (platform.equals("ia64_32")) {
74
		} else if (platform.equals("ia64_32")) {
75
			assertEquals("PC", newReport.getAttribute(BugzillaReportElement.REP_PLATFORM.getKeyString()).getValue());
75
			assertEquals("PC", newReport.getAttribute(BugzillaReportElement.REP_PLATFORM.getKey()).getValue());
76
		} else if (platform.equals("sparc")) {
76
		} else if (platform.equals("sparc")) {
77
			assertEquals("Sun", newReport.getAttribute(BugzillaReportElement.REP_PLATFORM.getKeyString()).getValue());
77
			assertEquals("Sun", newReport.getAttribute(BugzillaReportElement.REP_PLATFORM.getKey()).getValue());
78
		} else if (platform.equals("ppc")) {
78
		} else if (platform.equals("ppc")) {
79
			if (os.equals("macosx")) {
79
			if (os.equals("macosx")) {
80
				assertEquals("Macintosh", newReport.getAttribute(BugzillaReportElement.REP_PLATFORM.getKeyString())
80
				assertEquals("Macintosh", newReport.getAttribute(BugzillaReportElement.REP_PLATFORM.getKey())
81
						.getValue());
81
						.getValue());
82
			} else {
82
			} else {
83
				assertEquals("Power", newReport.getAttribute(BugzillaReportElement.REP_PLATFORM.getKeyString())
83
				assertEquals("Power", newReport.getAttribute(BugzillaReportElement.REP_PLATFORM.getKey())
84
						.getValue());
84
						.getValue());
85
			}
85
			}
86
		}
86
		}
(-)src/org/eclipse/mylyn/bugzilla/tests/RepositoryEditorWizardTest.java (-4 / +4 lines)
Lines 44-50 Link Here
44
		super.setUp();
44
		super.setUp();
45
		manager = TasksUiPlugin.getRepositoryManager();
45
		manager = TasksUiPlugin.getRepositoryManager();
46
		manager.clearRepositories(TasksUiPlugin.getDefault().getRepositoriesFilePath());
46
		manager.clearRepositories(TasksUiPlugin.getDefault().getRepositoriesFilePath());
47
		repository = new TaskRepository(BugzillaCorePlugin.REPOSITORY_KIND, IBugzillaConstants.TEST_BUGZILLA_222_URL);
47
		repository = new TaskRepository(BugzillaCorePlugin.CONNECTOR_KIND, IBugzillaConstants.TEST_BUGZILLA_222_URL);
48
		Credentials credentials = TestUtil.readCredentials();
48
		Credentials credentials = TestUtil.readCredentials();
49
		repository.setAuthenticationCredentials(credentials.username, credentials.password);
49
		repository.setAuthenticationCredentials(credentials.username, credentials.password);
50
		repository.setAnonymous(false);
50
		repository.setAnonymous(false);
Lines 53-59 Link Here
53
53
54
	private BugzillaClient createClient(String hostUrl, String username, String password, String htAuthUser,
54
	private BugzillaClient createClient(String hostUrl, String username, String password, String htAuthUser,
55
			String htAuthPass, String encoding) throws MalformedURLException {
55
			String htAuthPass, String encoding) throws MalformedURLException {
56
		TaskRepository taskRepository = new TaskRepository(BugzillaCorePlugin.REPOSITORY_KIND, hostUrl);
56
		TaskRepository taskRepository = new TaskRepository(BugzillaCorePlugin.CONNECTOR_KIND, hostUrl);
57
57
58
		AuthenticationCredentials credentials = new AuthenticationCredentials(username, password);
58
		AuthenticationCredentials credentials = new AuthenticationCredentials(username, password);
59
		taskRepository.setCredentials(AuthenticationType.REPOSITORY, credentials, false);
59
		taskRepository.setCredentials(AuthenticationType.REPOSITORY, credentials, false);
Lines 149-155 Link Here
149
		page.setUrl(IBugzillaConstants.TEST_BUGZILLA_218_URL);
149
		page.setUrl(IBugzillaConstants.TEST_BUGZILLA_218_URL);
150
		wizard.performFinish();
150
		wizard.performFinish();
151
		assertEquals(1, manager.getAllRepositories().size());
151
		assertEquals(1, manager.getAllRepositories().size());
152
		TaskRepository repositoryTest = manager.getRepository(BugzillaCorePlugin.REPOSITORY_KIND,
152
		TaskRepository repositoryTest = manager.getRepository(BugzillaCorePlugin.CONNECTOR_KIND,
153
				IBugzillaConstants.TEST_BUGZILLA_218_URL);
153
				IBugzillaConstants.TEST_BUGZILLA_218_URL);
154
		assertNotNull(repositoryTest);
154
		assertNotNull(repositoryTest);
155
		assertEquals(tempUid, repositoryTest.getUserName());
155
		assertEquals(tempUid, repositoryTest.getUserName());
Lines 168-174 Link Here
168
		page.setUserId("bogus");
168
		page.setUserId("bogus");
169
		wizard.performFinish();
169
		wizard.performFinish();
170
		assertEquals(1, manager.getAllRepositories().size());
170
		assertEquals(1, manager.getAllRepositories().size());
171
		TaskRepository repositoryTest = manager.getRepository(BugzillaCorePlugin.REPOSITORY_KIND,
171
		TaskRepository repositoryTest = manager.getRepository(BugzillaCorePlugin.CONNECTOR_KIND,
172
				IBugzillaConstants.TEST_BUGZILLA_222_URL);
172
				IBugzillaConstants.TEST_BUGZILLA_222_URL);
173
		assertNotNull(repositoryTest);
173
		assertNotNull(repositoryTest);
174
		wizard = new EditRepositoryWizard(repositoryTest);
174
		wizard = new EditRepositoryWizard(repositoryTest);
(-)src/org/eclipse/mylyn/bugzilla/tests/BugzillaProductParserTest.java (-1 / +1 lines)
Lines 43-49 Link Here
43
	}
43
	}
44
44
45
	private TaskRepository setRepository(String url) {
45
	private TaskRepository setRepository(String url) {
46
		repository = new TaskRepository(BugzillaCorePlugin.REPOSITORY_KIND, url);
46
		repository = new TaskRepository(BugzillaCorePlugin.CONNECTOR_KIND, url);
47
		Credentials credentials = TestUtil.readCredentials();
47
		Credentials credentials = TestUtil.readCredentials();
48
		repository.setAuthenticationCredentials(credentials.username, credentials.password);
48
		repository.setAuthenticationCredentials(credentials.username, credentials.password);
49
		return repository;
49
		return repository;
(-)src/org/eclipse/mylyn/bugzilla/tests/BugzillaSearchEngineTest.java (-7 / +7 lines)
Lines 43-49 Link Here
43
		super.setUp();
43
		super.setUp();
44
		TasksUiPlugin.getRepositoryManager().clearRepositories(TasksUiPlugin.getDefault().getRepositoriesFilePath());
44
		TasksUiPlugin.getRepositoryManager().clearRepositories(TasksUiPlugin.getDefault().getRepositoriesFilePath());
45
		assertEquals(NUM_REPOSITORIES, TasksUiPlugin.getRepositoryManager().getRepositories(
45
		assertEquals(NUM_REPOSITORIES, TasksUiPlugin.getRepositoryManager().getRepositories(
46
				BugzillaCorePlugin.REPOSITORY_KIND).size());
46
				BugzillaCorePlugin.CONNECTOR_KIND).size());
47
	}
47
	}
48
48
49
	@Override
49
	@Override
Lines 64-70 Link Here
64
// }
64
// }
65
65
66
	public void testSearching218() throws Exception {
66
	public void testSearching218() throws Exception {
67
		TaskRepository repository = new TaskRepository(BugzillaCorePlugin.REPOSITORY_KIND,
67
		TaskRepository repository = new TaskRepository(BugzillaCorePlugin.CONNECTOR_KIND,
68
				IBugzillaConstants.TEST_BUGZILLA_218_URL);
68
				IBugzillaConstants.TEST_BUGZILLA_218_URL);
69
		repository.setVersion(IBugzillaConstants.BugzillaServerVersion.SERVER_218.toString());
69
		repository.setVersion(IBugzillaConstants.BugzillaServerVersion.SERVER_218.toString());
70
		TasksUiPlugin.getRepositoryManager().addRepository(repository);
70
		TasksUiPlugin.getRepositoryManager().addRepository(repository);
Lines 72-78 Link Here
72
	}
72
	}
73
73
74
	public void testSearching220() throws Exception {
74
	public void testSearching220() throws Exception {
75
		TaskRepository repository = new TaskRepository(BugzillaCorePlugin.REPOSITORY_KIND,
75
		TaskRepository repository = new TaskRepository(BugzillaCorePlugin.CONNECTOR_KIND,
76
				IBugzillaConstants.TEST_BUGZILLA_220_URL);
76
				IBugzillaConstants.TEST_BUGZILLA_220_URL);
77
		repository.setVersion(IBugzillaConstants.BugzillaServerVersion.SERVER_220.toString());
77
		repository.setVersion(IBugzillaConstants.BugzillaServerVersion.SERVER_220.toString());
78
		TasksUiPlugin.getRepositoryManager().addRepository(repository);
78
		TasksUiPlugin.getRepositoryManager().addRepository(repository);
Lines 80-86 Link Here
80
	}
80
	}
81
81
82
	public void testSearching2201() throws Exception {
82
	public void testSearching2201() throws Exception {
83
		TaskRepository repository = new TaskRepository(BugzillaCorePlugin.REPOSITORY_KIND,
83
		TaskRepository repository = new TaskRepository(BugzillaCorePlugin.CONNECTOR_KIND,
84
				IBugzillaConstants.TEST_BUGZILLA_2201_URL);
84
				IBugzillaConstants.TEST_BUGZILLA_2201_URL);
85
		repository.setVersion(IBugzillaConstants.BugzillaServerVersion.SERVER_220.toString());
85
		repository.setVersion(IBugzillaConstants.BugzillaServerVersion.SERVER_220.toString());
86
		TasksUiPlugin.getRepositoryManager().addRepository(repository);
86
		TasksUiPlugin.getRepositoryManager().addRepository(repository);
Lines 88-94 Link Here
88
	}
88
	}
89
89
90
	public void testSearching222() throws Exception {
90
	public void testSearching222() throws Exception {
91
		TaskRepository repository = new TaskRepository(BugzillaCorePlugin.REPOSITORY_KIND,
91
		TaskRepository repository = new TaskRepository(BugzillaCorePlugin.CONNECTOR_KIND,
92
				IBugzillaConstants.TEST_BUGZILLA_222_URL);
92
				IBugzillaConstants.TEST_BUGZILLA_222_URL);
93
		repository.setVersion(IBugzillaConstants.BugzillaServerVersion.SERVER_222.toString());
93
		repository.setVersion(IBugzillaConstants.BugzillaServerVersion.SERVER_222.toString());
94
		TasksUiPlugin.getRepositoryManager().addRepository(repository);
94
		TasksUiPlugin.getRepositoryManager().addRepository(repository);
Lines 99-112 Link Here
99
	@SuppressWarnings("deprecation")
99
	@SuppressWarnings("deprecation")
100
	private Set<AbstractTask> runQuery(String repositoryURL, String SearchString) throws Exception {
100
	private Set<AbstractTask> runQuery(String repositoryURL, String SearchString) throws Exception {
101
		TaskRepository repository = TasksUiPlugin.getRepositoryManager().getRepository(
101
		TaskRepository repository = TasksUiPlugin.getRepositoryManager().getRepository(
102
				BugzillaCorePlugin.REPOSITORY_KIND, repositoryURL);
102
				BugzillaCorePlugin.CONNECTOR_KIND, repositoryURL);
103
		assertNotNull(repository);
103
		assertNotNull(repository);
104
104
105
		final BugzillaRepositoryQuery repositoryQuery = new BugzillaRepositoryQuery(repository.getRepositoryUrl(),
105
		final BugzillaRepositoryQuery repositoryQuery = new BugzillaRepositoryQuery(repository.getRepositoryUrl(),
106
				repository.getRepositoryUrl() + BUG_DESC_SUBSTRING_SEARCH + SearchString, QUERY_NAME);
106
				repository.getRepositoryUrl() + BUG_DESC_SUBSTRING_SEARCH + SearchString, QUERY_NAME);
107
107
108
		AbstractRepositoryConnector connector = TasksUiPlugin.getRepositoryManager().getRepositoryConnector(
108
		AbstractRepositoryConnector connector = TasksUiPlugin.getRepositoryManager().getRepositoryConnector(
109
				BugzillaCorePlugin.REPOSITORY_KIND);
109
				BugzillaCorePlugin.CONNECTOR_KIND);
110
//		TaskList taskList = TasksUiPlugin.getTaskList();
110
//		TaskList taskList = TasksUiPlugin.getTaskList();
111
		QueryHitCollector collector = new QueryHitCollector(new TaskFactory(repository));
111
		QueryHitCollector collector = new QueryHitCollector(new TaskFactory(repository));
112
112
(-)src/org/eclipse/mylyn/bugzilla/tests/AbstractBugzillaTest.java (-10 / +13 lines)
Lines 14-29 Link Here
14
14
15
import org.eclipse.core.runtime.CoreException;
15
import org.eclipse.core.runtime.CoreException;
16
import org.eclipse.core.runtime.NullProgressMonitor;
16
import org.eclipse.core.runtime.NullProgressMonitor;
17
import org.eclipse.mylyn.commons.net.AuthenticationCredentials;
18
import org.eclipse.mylyn.commons.net.AuthenticationType;
17
import org.eclipse.mylyn.context.tests.support.TestUtil;
19
import org.eclipse.mylyn.context.tests.support.TestUtil;
18
import org.eclipse.mylyn.context.tests.support.TestUtil.Credentials;
20
import org.eclipse.mylyn.context.tests.support.TestUtil.Credentials;
19
import org.eclipse.mylyn.internal.bugzilla.core.BugzillaCorePlugin;
21
import org.eclipse.mylyn.internal.bugzilla.core.BugzillaCorePlugin;
20
import org.eclipse.mylyn.internal.bugzilla.core.BugzillaRepositoryConnector;
22
import org.eclipse.mylyn.internal.bugzilla.core.BugzillaRepositoryConnector;
21
import org.eclipse.mylyn.internal.bugzilla.core.BugzillaTask;
22
import org.eclipse.mylyn.internal.bugzilla.core.IBugzillaConstants;
23
import org.eclipse.mylyn.internal.bugzilla.core.IBugzillaConstants;
23
import org.eclipse.mylyn.internal.tasks.core.AbstractTask;
24
import org.eclipse.mylyn.internal.tasks.core.AbstractTask;
24
import org.eclipse.mylyn.internal.tasks.core.TaskList;
25
import org.eclipse.mylyn.internal.tasks.core.TaskList;
25
import org.eclipse.mylyn.internal.tasks.core.TaskRepositoryManager;
26
import org.eclipse.mylyn.internal.tasks.core.TaskRepositoryManager;
26
import org.eclipse.mylyn.internal.tasks.core.deprecated.RepositoryTaskData;
27
import org.eclipse.mylyn.internal.tasks.ui.ITasksUiPreferenceConstants;
27
import org.eclipse.mylyn.internal.tasks.ui.ITasksUiPreferenceConstants;
28
import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
28
import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
29
import org.eclipse.mylyn.internal.tasks.ui.util.TasksUiInternal;
29
import org.eclipse.mylyn.internal.tasks.ui.util.TasksUiInternal;
Lines 31-36 Link Here
31
import org.eclipse.mylyn.tasks.core.ITask;
31
import org.eclipse.mylyn.tasks.core.ITask;
32
import org.eclipse.mylyn.tasks.core.TaskRepository;
32
import org.eclipse.mylyn.tasks.core.TaskRepository;
33
import org.eclipse.mylyn.tasks.core.ITask.SynchronizationState;
33
import org.eclipse.mylyn.tasks.core.ITask.SynchronizationState;
34
import org.eclipse.mylyn.tasks.core.data.TaskAttribute;
35
import org.eclipse.mylyn.tasks.core.data.TaskData;
34
36
35
/**
37
/**
36
 * @author Mik Kersten
38
 * @author Mik Kersten
Lines 39-45 Link Here
39
 */
41
 */
40
public abstract class AbstractBugzillaTest extends TestCase {
42
public abstract class AbstractBugzillaTest extends TestCase {
41
43
42
	static final String DEFAULT_KIND = BugzillaCorePlugin.REPOSITORY_KIND;
44
	static final String DEFAULT_KIND = BugzillaCorePlugin.CONNECTOR_KIND;
43
45
44
	protected BugzillaRepositoryConnector connector;
46
	protected BugzillaRepositoryConnector connector;
45
47
Lines 58-64 Link Here
58
		super.setUp();
60
		super.setUp();
59
		TasksUiPlugin.getDefault().getPreferenceStore().setValue(
61
		TasksUiPlugin.getDefault().getPreferenceStore().setValue(
60
				ITasksUiPreferenceConstants.REPOSITORY_SYNCH_SCHEDULE_ENABLED, false);
62
				ITasksUiPreferenceConstants.REPOSITORY_SYNCH_SCHEDULE_ENABLED, false);
61
		TasksUiPlugin.getTaskDataStorageManager().clear();
63
		//TasksUiPlugin.getTaskDataManager().clear();
62
		manager = TasksUiPlugin.getRepositoryManager();
64
		manager = TasksUiPlugin.getRepositoryManager();
63
		TasksUiPlugin.getDefault().reloadDataDirectory();
65
		TasksUiPlugin.getDefault().reloadDataDirectory();
64
		manager.clearRepositories(TasksUiPlugin.getDefault().getRepositoriesFilePath());
66
		manager.clearRepositories(TasksUiPlugin.getDefault().getRepositoriesFilePath());
Lines 99-105 Link Here
99
	protected void init(String url) {
101
	protected void init(String url) {
100
		repository = new TaskRepository(DEFAULT_KIND, url);
102
		repository = new TaskRepository(DEFAULT_KIND, url);
101
		Credentials credentials = TestUtil.readCredentials();
103
		Credentials credentials = TestUtil.readCredentials();
102
		repository.setAuthenticationCredentials(credentials.username, credentials.password);
104
		repository.setCredentials(AuthenticationType.REPOSITORY, new AuthenticationCredentials(credentials.username,
105
				credentials.password), false);
103
106
104
		repository.setTimeZoneId("Canada/Eastern");
107
		repository.setTimeZoneId("Canada/Eastern");
105
		assertNotNull(manager);
108
		assertNotNull(manager);
Lines 114-130 Link Here
114
		connector = (BugzillaRepositoryConnector) abstractRepositoryClient;
117
		connector = (BugzillaRepositoryConnector) abstractRepositoryClient;
115
	}
118
	}
116
119
117
	protected BugzillaTask generateLocalTaskAndDownload(String taskNumber) throws CoreException {
120
	protected ITask generateLocalTaskAndDownload(String taskNumber) throws CoreException {
118
		BugzillaTask task = (BugzillaTask) TasksUiInternal.createTask(repository, taskNumber, new NullProgressMonitor());
121
		ITask task = TasksUiInternal.createTask(repository, taskNumber, new NullProgressMonitor());
119
		TasksUiPlugin.getTaskDataManager().setTaskRead(task, true);
122
		TasksUiPlugin.getTaskDataManager().setTaskRead(task, true);
120
		assertNotNull(task);
123
		assertNotNull(task);
121
		TasksUiPlugin.getTaskList().addTask(task, TasksUiPlugin.getTaskList().getDefaultCategory());
124
		//TasksUiPlugin.getTaskList().addTask(task, TasksUiPlugin.getTaskList().getDefaultCategory());
122
125
123
		return task;
126
		return task;
124
	}
127
	}
125
128
126
	protected void submit(ITask task, RepositoryTaskData taskData) throws CoreException {
129
	protected void submit(ITask task, TaskData taskData, Set<TaskAttribute> changedAttributes) throws CoreException {
127
		connector.getLegacyTaskDataHandler().postTaskData(repository, taskData, new NullProgressMonitor());
130
		connector.getTaskDataHandler().postTaskData(repository, taskData, changedAttributes, new NullProgressMonitor());
128
		((AbstractTask) task).setSubmitting(true);
131
		((AbstractTask) task).setSubmitting(true);
129
	}
132
	}
130
133
(-)src/org/eclipse/mylyn/bugzilla/tests/BugzillaTaskListManagerTest.java (-1 / +1 lines)
Lines 41-47 Link Here
41
		manager.readExistingOrCreateNewList();
41
		manager.readExistingOrCreateNewList();
42
		manager.resetTaskList();
42
		manager.resetTaskList();
43
		manager.saveTaskList();
43
		manager.saveTaskList();
44
		repository = new TaskRepository(BugzillaCorePlugin.REPOSITORY_KIND, IBugzillaConstants.ECLIPSE_BUGZILLA_URL);
44
		repository = new TaskRepository(BugzillaCorePlugin.CONNECTOR_KIND, IBugzillaConstants.ECLIPSE_BUGZILLA_URL);
45
		TasksUiPlugin.getRepositoryManager().addRepository(repository);
45
		TasksUiPlugin.getRepositoryManager().addRepository(repository);
46
		assertEquals(0, manager.getTaskList().getAllTasks().size());
46
		assertEquals(0, manager.getTaskList().getAllTasks().size());
47
	}
47
	}
(-)src/org/eclipse/mylyn/bugzilla/tests/BugzillaSearchDialogTest.java (-1 / +1 lines)
Lines 49-55 Link Here
49
	 * @throws Exception
49
	 * @throws Exception
50
	 */
50
	 */
51
	public void testSearchDialogInit() throws Exception {
51
	public void testSearchDialogInit() throws Exception {
52
		TaskRepository repo = new TaskRepository(BugzillaCorePlugin.REPOSITORY_KIND,
52
		TaskRepository repo = new TaskRepository(BugzillaCorePlugin.CONNECTOR_KIND,
53
				IBugzillaConstants.TEST_BUGZILLA_222_URL);
53
				IBugzillaConstants.TEST_BUGZILLA_222_URL);
54
		repo.setVersion(IBugzillaConstants.BugzillaServerVersion.SERVER_222.toString());
54
		repo.setVersion(IBugzillaConstants.BugzillaServerVersion.SERVER_222.toString());
55
		manager.addRepository(repo);
55
		manager.addRepository(repo);
(-)src/org/eclipse/mylyn/bugzilla/tests/BugzillaTaskDataHandlerTest.java (-48 / +48 lines)
Lines 43-49 Link Here
43
43
44
	private TaskRepository setRepository(String kind, String url) {
44
	private TaskRepository setRepository(String kind, String url) {
45
		connector = (BugzillaRepositoryConnector) TasksUiPlugin.getRepositoryManager().getRepositoryConnector(
45
		connector = (BugzillaRepositoryConnector) TasksUiPlugin.getRepositoryManager().getRepositoryConnector(
46
				BugzillaCorePlugin.REPOSITORY_KIND);
46
				BugzillaCorePlugin.CONNECTOR_KIND);
47
		repository = new TaskRepository(kind, url);
47
		repository = new TaskRepository(kind, url);
48
		Credentials credentials = TestUtil.readCredentials();
48
		Credentials credentials = TestUtil.readCredentials();
49
		repository.setAuthenticationCredentials(credentials.username, credentials.password);
49
		repository.setAuthenticationCredentials(credentials.username, credentials.password);
Lines 51-116 Link Here
51
	}
51
	}
52
52
53
	private void testAttributesFromCloneBug(RepositoryTaskData repositoryTaskData, boolean valueFromBug9) {
53
	private void testAttributesFromCloneBug(RepositoryTaskData repositoryTaskData, boolean valueFromBug9) {
54
		assertEquals("Clone Bug 1", repositoryTaskData.getAttribute(BugzillaReportElement.SHORT_DESC.getKeyString())
54
		assertEquals("Clone Bug 1", repositoryTaskData.getAttribute(BugzillaReportElement.SHORT_DESC.getKey())
55
				.getValue());
55
				.getValue());
56
		assertEquals("Clone Bug 1", repositoryTaskData.getSummary());
56
		assertEquals("Clone Bug 1", repositoryTaskData.getSummary());
57
		assertEquals("This Bug is used to test the cloneTaskData", repositoryTaskData.getDescription());
57
		assertEquals("This Bug is used to test the cloneTaskData", repositoryTaskData.getDescription());
58
		assertEquals("TestProduct", repositoryTaskData.getAttribute(BugzillaReportElement.PRODUCT.getKeyString())
58
		assertEquals("TestProduct", repositoryTaskData.getAttribute(BugzillaReportElement.PRODUCT.getKey())
59
				.getValue());
59
				.getValue());
60
		assertEquals("TestProduct", repositoryTaskData.getProduct());
60
		assertEquals("TestProduct", repositoryTaskData.getProduct());
61
		assertEquals("TestComponent", repositoryTaskData.getAttribute(BugzillaReportElement.COMPONENT.getKeyString())
61
		assertEquals("TestComponent", repositoryTaskData.getAttribute(BugzillaReportElement.COMPONENT.getKey())
62
				.getValue());
62
				.getValue());
63
		assertEquals("PC", repositoryTaskData.getAttribute(BugzillaReportElement.REP_PLATFORM.getKeyString())
63
		assertEquals("PC", repositoryTaskData.getAttribute(BugzillaReportElement.REP_PLATFORM.getKey())
64
				.getValue());
64
				.getValue());
65
		assertEquals("Windows", repositoryTaskData.getAttribute(BugzillaReportElement.OP_SYS.getKeyString()).getValue());
65
		assertEquals("Windows", repositoryTaskData.getAttribute(BugzillaReportElement.OP_SYS.getKey()).getValue());
66
		assertEquals("unspecified", repositoryTaskData.getAttribute(BugzillaReportElement.VERSION.getKeyString())
66
		assertEquals("unspecified", repositoryTaskData.getAttribute(BugzillaReportElement.VERSION.getKey())
67
				.getValue());
67
				.getValue());
68
		assertEquals("P3", repositoryTaskData.getAttribute(BugzillaReportElement.PRIORITY.getKeyString()).getValue());
68
		assertEquals("P3", repositoryTaskData.getAttribute(BugzillaReportElement.PRIORITY.getKey()).getValue());
69
		assertEquals("enhancement", repositoryTaskData.getAttribute(BugzillaReportElement.BUG_SEVERITY.getKeyString())
69
		assertEquals("enhancement", repositoryTaskData.getAttribute(BugzillaReportElement.BUG_SEVERITY.getKey())
70
				.getValue());
70
				.getValue());
71
		assertEquals("---", repositoryTaskData.getAttribute(BugzillaReportElement.TARGET_MILESTONE.getKeyString())
71
		assertEquals("---", repositoryTaskData.getAttribute(BugzillaReportElement.TARGET_MILESTONE.getKey())
72
				.getValue());
72
				.getValue());
73
		assertEquals("Unclassified", repositoryTaskData.getAttribute(
73
		assertEquals("Unclassified", repositoryTaskData.getAttribute(
74
				BugzillaReportElement.CLASSIFICATION.getKeyString()).getValue());
74
				BugzillaReportElement.CLASSIFICATION.getKey()).getValue());
75
		if (valueFromBug9) {
75
		if (valueFromBug9) {
76
			assertEquals("9", repositoryTaskData.getAttribute(BugzillaReportElement.BUG_ID.getKeyString()).getValue());
76
			assertEquals("9", repositoryTaskData.getAttribute(BugzillaReportElement.BUG_ID.getKey()).getValue());
77
			assertEquals("1.00", repositoryTaskData.getAttribute(BugzillaReportElement.REMAINING_TIME.getKeyString())
77
			assertEquals("1.00", repositoryTaskData.getAttribute(BugzillaReportElement.REMAINING_TIME.getKey())
78
					.getValue());
78
					.getValue());
79
			assertEquals("1.00", repositoryTaskData.getAttribute(BugzillaReportElement.ESTIMATED_TIME.getKeyString())
79
			assertEquals("1.00", repositoryTaskData.getAttribute(BugzillaReportElement.ESTIMATED_TIME.getKey())
80
					.getValue());
80
					.getValue());
81
			assertEquals("2007-12-12", repositoryTaskData.getAttribute(BugzillaReportElement.DEADLINE.getKeyString())
81
			assertEquals("2007-12-12", repositoryTaskData.getAttribute(BugzillaReportElement.DEADLINE.getKey())
82
					.getValue());
82
					.getValue());
83
			assertEquals("NEW", repositoryTaskData.getAttribute(BugzillaReportElement.BUG_STATUS.getKeyString())
83
			assertEquals("NEW", repositoryTaskData.getAttribute(BugzillaReportElement.BUG_STATUS.getKey())
84
					.getValue());
84
					.getValue());
85
			assertEquals("2007-11-14 15:12", repositoryTaskData.getAttribute(
85
			assertEquals("2007-11-14 15:12", repositoryTaskData.getAttribute(
86
					BugzillaReportElement.CREATION_TS.getKeyString()).getValue());
86
					BugzillaReportElement.CREATION_TS.getKey()).getValue());
87
			assertEquals("2007-11-14 15:14:46", repositoryTaskData.getAttribute(
87
			assertEquals("2007-11-14 15:14:46", repositoryTaskData.getAttribute(
88
					BugzillaReportElement.DELTA_TS.getKeyString()).getValue());
88
					BugzillaReportElement.DELTA_TS.getKey()).getValue());
89
			assertEquals("tests@mylyn.eclipse.org", repositoryTaskData.getAttribute(
89
			assertEquals("tests@mylyn.eclipse.org", repositoryTaskData.getAttribute(
90
					BugzillaReportElement.REPORTER.getKeyString()).getValue());
90
					BugzillaReportElement.REPORTER.getKey()).getValue());
91
			assertEquals("tests2@mylyn.eclipse.org", repositoryTaskData.getAttribute(
91
			assertEquals("tests2@mylyn.eclipse.org", repositoryTaskData.getAttribute(
92
					BugzillaReportElement.ASSIGNED_TO.getKeyString()).getValue());
92
					BugzillaReportElement.ASSIGNED_TO.getKey()).getValue());
93
		} else {
93
		} else {
94
			assertEquals("2.00", repositoryTaskData.getAttribute(BugzillaReportElement.REMAINING_TIME.getKeyString())
94
			assertEquals("2.00", repositoryTaskData.getAttribute(BugzillaReportElement.REMAINING_TIME.getKey())
95
					.getValue());
95
					.getValue());
96
			assertEquals("2.00", repositoryTaskData.getAttribute(BugzillaReportElement.ESTIMATED_TIME.getKeyString())
96
			assertEquals("2.00", repositoryTaskData.getAttribute(BugzillaReportElement.ESTIMATED_TIME.getKey())
97
					.getValue());
97
					.getValue());
98
			assertEquals("2008-01-01", repositoryTaskData.getAttribute(BugzillaReportElement.DEADLINE.getKeyString())
98
			assertEquals("2008-01-01", repositoryTaskData.getAttribute(BugzillaReportElement.DEADLINE.getKey())
99
					.getValue());
99
					.getValue());
100
			assertEquals("2007-11-14 15:30", repositoryTaskData.getAttribute(
100
			assertEquals("2007-11-14 15:30", repositoryTaskData.getAttribute(
101
					BugzillaReportElement.CREATION_TS.getKeyString()).getValue());
101
					BugzillaReportElement.CREATION_TS.getKey()).getValue());
102
			assertEquals("2007-11-14 15:30:38", repositoryTaskData.getAttribute(
102
			assertEquals("2007-11-14 15:30:38", repositoryTaskData.getAttribute(
103
					BugzillaReportElement.DELTA_TS.getKeyString()).getValue());
103
					BugzillaReportElement.DELTA_TS.getKey()).getValue());
104
			assertEquals("tests2@mylyn.eclipse.org", repositoryTaskData.getAttribute(
104
			assertEquals("tests2@mylyn.eclipse.org", repositoryTaskData.getAttribute(
105
					BugzillaReportElement.REPORTER.getKeyString()).getValue());
105
					BugzillaReportElement.REPORTER.getKey()).getValue());
106
			assertEquals("tests@mylyn.eclipse.org", repositoryTaskData.getAttribute(
106
			assertEquals("tests@mylyn.eclipse.org", repositoryTaskData.getAttribute(
107
					BugzillaReportElement.ASSIGNED_TO.getKeyString()).getValue());
107
					BugzillaReportElement.ASSIGNED_TO.getKey()).getValue());
108
		}
108
		}
109
	}
109
	}
110
110
111
	public void testCloneTaskData() throws Exception {
111
	public void testCloneTaskData() throws Exception {
112
		String bugid = "9";
112
		String bugid = "9";
113
		setRepository(BugzillaCorePlugin.REPOSITORY_KIND, IBugzillaConstants.TEST_BUGZILLA_30_URL);
113
		setRepository(BugzillaCorePlugin.CONNECTOR_KIND, IBugzillaConstants.TEST_BUGZILLA_30_URL);
114
		RepositoryTaskData report1 = init(bugid);
114
		RepositoryTaskData report1 = init(bugid);
115
115
116
		assertNotNull(report1);
116
		assertNotNull(report1);
Lines 118-152 Link Here
118
		testAttributesFromCloneBug(report1, true);
118
		testAttributesFromCloneBug(report1, true);
119
119
120
		bugid = "10";
120
		bugid = "10";
121
		setRepository(BugzillaCorePlugin.REPOSITORY_KIND, IBugzillaConstants.TEST_BUGZILLA_30_URL);
121
		setRepository(BugzillaCorePlugin.CONNECTOR_KIND, IBugzillaConstants.TEST_BUGZILLA_30_URL);
122
		RepositoryTaskData report2 = init(bugid);
122
		RepositoryTaskData report2 = init(bugid);
123
123
124
		assertNotNull(report2);
124
		assertNotNull(report2);
125
		assertEquals("" + bugid, report2.getAttribute(BugzillaReportElement.BUG_ID.getKeyString()).getValue());
125
		assertEquals("" + bugid, report2.getAttribute(BugzillaReportElement.BUG_ID.getKey()).getValue());
126
		assertEquals("2.00", report2.getAttribute(BugzillaReportElement.REMAINING_TIME.getKeyString()).getValue());
126
		assertEquals("2.00", report2.getAttribute(BugzillaReportElement.REMAINING_TIME.getKey()).getValue());
127
		assertEquals("2.00", report2.getAttribute(BugzillaReportElement.ESTIMATED_TIME.getKeyString()).getValue());
127
		assertEquals("2.00", report2.getAttribute(BugzillaReportElement.ESTIMATED_TIME.getKey()).getValue());
128
		assertEquals("2008-01-01", report2.getAttribute(BugzillaReportElement.DEADLINE.getKeyString()).getValue());
128
		assertEquals("2008-01-01", report2.getAttribute(BugzillaReportElement.DEADLINE.getKey()).getValue());
129
129
130
		assertEquals("Clone Bug 2", report2.getAttribute(BugzillaReportElement.SHORT_DESC.getKeyString()).getValue());
130
		assertEquals("Clone Bug 2", report2.getAttribute(BugzillaReportElement.SHORT_DESC.getKey()).getValue());
131
		assertEquals("Clone Bug 2", report2.getSummary());
131
		assertEquals("Clone Bug 2", report2.getSummary());
132
		assertEquals("other Bug for cloneTaskData", report2.getDescription());
132
		assertEquals("other Bug for cloneTaskData", report2.getDescription());
133
		assertEquals("TestProduct", report2.getAttribute(BugzillaReportElement.PRODUCT.getKeyString()).getValue());
133
		assertEquals("TestProduct", report2.getAttribute(BugzillaReportElement.PRODUCT.getKey()).getValue());
134
		assertEquals("TestProduct", report2.getProduct());
134
		assertEquals("TestProduct", report2.getProduct());
135
		assertEquals("TestComponent", report2.getAttribute(BugzillaReportElement.COMPONENT.getKeyString()).getValue());
135
		assertEquals("TestComponent", report2.getAttribute(BugzillaReportElement.COMPONENT.getKey()).getValue());
136
		assertEquals("PC", report2.getAttribute(BugzillaReportElement.REP_PLATFORM.getKeyString()).getValue());
136
		assertEquals("PC", report2.getAttribute(BugzillaReportElement.REP_PLATFORM.getKey()).getValue());
137
		assertEquals("Mac OS", report2.getAttribute(BugzillaReportElement.OP_SYS.getKeyString()).getValue());
137
		assertEquals("Mac OS", report2.getAttribute(BugzillaReportElement.OP_SYS.getKey()).getValue());
138
		assertEquals("unspecified", report2.getAttribute(BugzillaReportElement.VERSION.getKeyString()).getValue());
138
		assertEquals("unspecified", report2.getAttribute(BugzillaReportElement.VERSION.getKey()).getValue());
139
		assertEquals("P2", report2.getAttribute(BugzillaReportElement.PRIORITY.getKeyString()).getValue());
139
		assertEquals("P2", report2.getAttribute(BugzillaReportElement.PRIORITY.getKey()).getValue());
140
		assertEquals("critical", report2.getAttribute(BugzillaReportElement.BUG_SEVERITY.getKeyString()).getValue());
140
		assertEquals("critical", report2.getAttribute(BugzillaReportElement.BUG_SEVERITY.getKey()).getValue());
141
		assertEquals("ASSIGNED", report2.getAttribute(BugzillaReportElement.BUG_STATUS.getKeyString()).getValue());
141
		assertEquals("ASSIGNED", report2.getAttribute(BugzillaReportElement.BUG_STATUS.getKey()).getValue());
142
		assertEquals("2007-11-14 15:30", report2.getAttribute(BugzillaReportElement.CREATION_TS.getKeyString())
142
		assertEquals("2007-11-14 15:30", report2.getAttribute(BugzillaReportElement.CREATION_TS.getKey())
143
				.getValue());
143
				.getValue());
144
		assertEquals("2007-11-14 15:30:38", report2.getAttribute(BugzillaReportElement.DELTA_TS.getKeyString())
144
		assertEquals("2007-11-14 15:30:38", report2.getAttribute(BugzillaReportElement.DELTA_TS.getKey())
145
				.getValue());
145
				.getValue());
146
		assertEquals("---", report2.getAttribute(BugzillaReportElement.TARGET_MILESTONE.getKeyString()).getValue());
146
		assertEquals("---", report2.getAttribute(BugzillaReportElement.TARGET_MILESTONE.getKey()).getValue());
147
		assertEquals("tests2@mylyn.eclipse.org", report2.getAttribute(BugzillaReportElement.REPORTER.getKeyString())
147
		assertEquals("tests2@mylyn.eclipse.org", report2.getAttribute(BugzillaReportElement.REPORTER.getKey())
148
				.getValue());
148
				.getValue());
149
		assertEquals("tests@mylyn.eclipse.org", report2.getAttribute(BugzillaReportElement.ASSIGNED_TO.getKeyString())
149
		assertEquals("tests@mylyn.eclipse.org", report2.getAttribute(BugzillaReportElement.ASSIGNED_TO.getKey())
150
				.getValue());
150
				.getValue());
151
151
152
		AbstractTaskDataHandler handler = connector.getLegacyTaskDataHandler();
152
		AbstractTaskDataHandler handler = connector.getLegacyTaskDataHandler();
Lines 157-163 Link Here
157
157
158
	public void testCharacterEscaping() throws CoreException {
158
	public void testCharacterEscaping() throws CoreException {
159
		String bugid = "17";
159
		String bugid = "17";
160
		setRepository(BugzillaCorePlugin.REPOSITORY_KIND, IBugzillaConstants.TEST_BUGZILLA_30_URL);
160
		setRepository(BugzillaCorePlugin.CONNECTOR_KIND, IBugzillaConstants.TEST_BUGZILLA_30_URL);
161
		RepositoryTaskData report1 = init(bugid);
161
		RepositoryTaskData report1 = init(bugid);
162
		assertEquals("Testing! \"&@ $\" &amp;", report1.getSummary());
162
		assertEquals("Testing! \"&@ $\" &amp;", report1.getSummary());
163
	}
163
	}
(-).refactorings/2008/5/21/refactorings.index (+1 lines)
Added Link Here
1
1211341606664	Change method 'submit'
(-)src/org/eclipse/mylyn/bugzilla/tests/BugzillaRepositoryConnectorTest2.java (+63 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.bugzilla.tests;
10
11
import java.text.ParseException;
12
import java.text.SimpleDateFormat;
13
14
import org.eclipse.core.runtime.CoreException;
15
import org.eclipse.core.runtime.NullProgressMonitor;
16
import org.eclipse.mylyn.internal.bugzilla.core.BugzillaReportElement;
17
import org.eclipse.mylyn.internal.bugzilla.core.IBugzillaConstants;
18
import org.eclipse.mylyn.tasks.core.ITask.PriorityLevel;
19
import org.eclipse.mylyn.tasks.core.data.TaskAttribute;
20
import org.eclipse.mylyn.tasks.core.data.TaskCommentMapper;
21
import org.eclipse.mylyn.tasks.core.data.TaskData;
22
import org.eclipse.mylyn.tasks.core.data.TaskMapper;
23
24
public class BugzillaRepositoryConnectorTest2 extends AbstractBugzillaTest {
25
26
	public void testDataRetrieval() throws CoreException, ParseException {
27
		init(IBugzillaConstants.TEST_BUGZILLA_30_URL);
28
		TaskData data = connector.getTaskData(repository, "2", new NullProgressMonitor());
29
		assertNotNull(data);
30
		TaskMapper mapper = new TaskMapper(data);
31
		assertEquals("2", data.getTaskId());
32
		assertEquals("New bug submit", mapper.getSummary());
33
		assertEquals("Test new bug submission", mapper.getDescription());
34
		assertEquals(PriorityLevel.P2, mapper.getPriority());
35
		assertEquals("TestComponent", mapper.getComponent());
36
		assertEquals("nhapke@cs.ubc.ca", mapper.getOwner());
37
		assertEquals("TestProduct", mapper.getProduct());
38
		assertEquals("PC", mapper.getValue(BugzillaReportElement.REP_PLATFORM.getKey()));
39
		assertEquals("Windows", mapper.getValue(BugzillaReportElement.OP_SYS.getKey()));
40
		assertEquals("ASSIGNED", mapper.getValue(BugzillaReportElement.BUG_STATUS.getKey()));
41
		SimpleDateFormat format1 = new SimpleDateFormat("yyyy-MM-dd HH:mm");
42
		SimpleDateFormat format2 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
43
		assertEquals(format1.parse("2007-03-20 16:37"), mapper.getCreationDate());
44
		assertEquals(format2.parse("2007-12-06 20:50:00"), mapper.getModificationDate());
45
46
		//assertEquals("", mapper.getTaskUrl());
47
		//assertEquals("bugzilla", mapper.getTaskKind());
48
		//assertEquals("", mapper.getTaskKey());
49
50
		// test comments
51
		TaskAttribute comments = data.getMappedAttribute(TaskAttribute.CONTAINER_COMMENTS);
52
		assertEquals(12, comments.getAttributes().size());
53
		TaskCommentMapper commentMap = TaskCommentMapper.createFrom(comments.getAttribute("0"));
54
		assertEquals("Rob Elves", commentMap.getAuthor().getName());
55
		assertEquals("Test new bug submission", commentMap.getText());
56
		commentMap = TaskCommentMapper.createFrom(comments.getAttribute("1"));
57
		assertEquals("Rob Elves", commentMap.getAuthor().getName());
58
		assertEquals("Created an attachment (id=1)\ntest\n\ntest attachments", commentMap.getText());
59
		commentMap = TaskCommentMapper.createFrom(comments.getAttribute("11"));
60
		assertEquals("Tests", commentMap.getAuthor().getName());
61
		assertEquals("test", commentMap.getText());
62
	}
63
}
(-)src/org/eclipse/mylyn/internal/tasks/core/data/TaskDataState.java (-4 / +4 lines)
Lines 24-29 Link Here
24
 */
24
 */
25
public class TaskDataState implements ITaskDataWorkingCopy {
25
public class TaskDataState implements ITaskDataWorkingCopy {
26
26
27
	private final String repositoryUrl;
28
27
	private final String connectorKind;
29
	private final String connectorKind;
28
30
29
	private TaskData editsTaskData;
31
	private TaskData editsTaskData;
Lines 32-47 Link Here
32
34
33
	private TaskData localTaskData;
35
	private TaskData localTaskData;
34
36
35
	private boolean saved;
36
37
	private TaskData repositoryTaskData;
37
	private TaskData repositoryTaskData;
38
38
39
	private final String repositoryUrl;
40
41
	private ITask task;
39
	private ITask task;
42
40
43
	private final String taskId;
41
	private final String taskId;
44
42
43
	private boolean saved;
44
45
	private TaskDataManager taskDataManager;
45
	private TaskDataManager taskDataManager;
46
46
47
	public TaskDataState(String connectorKind, String repositoryUrl, String taskId) {
47
	public TaskDataState(String connectorKind, String repositoryUrl, String taskId) {
(-)src/org/eclipse/mylyn/internal/bugzilla/core/SaxMultiBugReportContentHandler.java (-127 / +142 lines)
Lines 14-25 Link Here
14
import java.util.Locale;
14
import java.util.Locale;
15
import java.util.Map;
15
import java.util.Map;
16
16
17
import org.eclipse.mylyn.internal.tasks.core.deprecated.AbstractAttributeFactory;
17
import org.eclipse.mylyn.tasks.core.data.TaskAttachmentMapper;
18
import org.eclipse.mylyn.internal.tasks.core.deprecated.LegacyTaskDataCollector;
18
import org.eclipse.mylyn.tasks.core.data.TaskAttribute;
19
import org.eclipse.mylyn.internal.tasks.core.deprecated.RepositoryAttachment;
19
import org.eclipse.mylyn.tasks.core.data.TaskAttributeMapper;
20
import org.eclipse.mylyn.internal.tasks.core.deprecated.RepositoryTaskAttribute;
20
import org.eclipse.mylyn.tasks.core.data.TaskData;
21
import org.eclipse.mylyn.internal.tasks.core.deprecated.RepositoryTaskData;
21
import org.eclipse.mylyn.tasks.core.data.TaskDataCollector;
22
import org.eclipse.mylyn.internal.tasks.core.deprecated.TaskComment;
23
import org.xml.sax.Attributes;
22
import org.xml.sax.Attributes;
24
import org.xml.sax.SAXException;
23
import org.xml.sax.SAXException;
25
import org.xml.sax.helpers.DefaultHandler;
24
import org.xml.sax.helpers.DefaultHandler;
Lines 37-69 Link Here
37
36
38
	private StringBuffer characters;
37
	private StringBuffer characters;
39
38
40
	private TaskComment taskComment;
39
	private TaskAttribute taskComment;
41
40
42
	private Map<String, TaskComment> attachIdToComment = new HashMap<String, TaskComment>();
41
	private Map<String, TaskAttribute> attachIdToComment = new HashMap<String, TaskAttribute>();
43
42
44
	private int commentNum = 0;
43
	private int commentNum = 0;
45
44
46
	private RepositoryAttachment attachment;
45
	private int attachmentNum = 0;
47
46
48
	private final Map<String, RepositoryTaskData> taskDataMap;
47
	private TaskAttribute attachment;
49
48
50
	private RepositoryTaskData repositoryTaskData;
49
	private final Map<String, TaskData> taskDataMap;
51
50
52
	private List<TaskComment> longDescs;
51
	private TaskData repositoryTaskData;
52
53
	private List<TaskAttribute> longDescs;
53
54
54
	private String errorMessage = null;
55
	private String errorMessage = null;
55
56
56
	private final AbstractAttributeFactory attributeFactory;
57
	private final TaskAttributeMapper attributeMapper;
57
58
58
	private final List<BugzillaCustomField> customFields;
59
	private final List<BugzillaCustomField> customFields;
59
60
60
	private final LegacyTaskDataCollector collector;
61
	private final TaskDataCollector collector;
62
63
	private TaskAttribute commentContainer;
64
65
	private TaskAttribute attachmentContainer;
66
67
	private boolean isDeprecated = false;
68
69
	private boolean isPatch = false;
61
70
62
	//private int retrieved = 1;
71
	//private int retrieved = 1;
63
72
64
	public SaxMultiBugReportContentHandler(AbstractAttributeFactory factory, LegacyTaskDataCollector collector,
73
	public SaxMultiBugReportContentHandler(TaskAttributeMapper mapper, TaskDataCollector collector,
65
			Map<String, RepositoryTaskData> taskDataMap, List<BugzillaCustomField> customFields) {
74
			Map<String, TaskData> taskDataMap, List<BugzillaCustomField> customFields) {
66
		this.attributeFactory = factory;
75
76
		this.attributeMapper = mapper;
67
		this.taskDataMap = taskDataMap;
77
		this.taskDataMap = taskDataMap;
68
		this.customFields = customFields;
78
		this.customFields = customFields;
69
		this.collector = collector;
79
		this.collector = collector;
Lines 114-133 Link Here
114
			if (attributes != null && (attributes.getValue("error") != null)) {
124
			if (attributes != null && (attributes.getValue("error") != null)) {
115
				errorMessage = attributes.getValue("error");
125
				errorMessage = attributes.getValue("error");
116
			}
126
			}
117
			attachIdToComment = new HashMap<String, TaskComment>();
127
			attachIdToComment = new HashMap<String, TaskAttribute>();
118
			commentNum = 0;
128
			commentNum = 0;
129
			attachmentNum = 0;
119
			taskComment = null;
130
			taskComment = null;
120
			longDescs = new ArrayList<TaskComment>();
131
			longDescs = new ArrayList<TaskAttribute>();
121
			break;
132
			break;
122
		case LONG_DESC:
133
		case LONG_DESC:
123
			taskComment = new TaskComment(attributeFactory, commentNum++);
134
			taskComment = commentContainer.createAttribute("" + commentNum++);
124
			break;
135
			break;
125
		case WHO:
136
		case WHO:
126
			if (taskComment != null) {
137
			if (taskComment != null) {
127
				if (attributes != null && attributes.getLength() > 0) {
138
				if (attributes != null && attributes.getLength() > 0) {
128
					String name = attributes.getValue(ATTRIBUTE_NAME);
139
					String name = attributes.getValue(ATTRIBUTE_NAME);
129
					if (name != null) {
140
					if (name != null) {
130
						taskComment.setAttributeValue(BugzillaReportElement.WHO_NAME.getKeyString(), name);
141
						taskComment.createAttribute(BugzillaReportElement.WHO_NAME.getKey()).setValue(name);
131
					}
142
					}
132
				}
143
				}
133
			}
144
			}
Lines 136-144 Link Here
136
			if (attributes != null && attributes.getLength() > 0) {
147
			if (attributes != null && attributes.getLength() > 0) {
137
				String name = attributes.getValue(ATTRIBUTE_NAME);
148
				String name = attributes.getValue(ATTRIBUTE_NAME);
138
				if (name != null) {
149
				if (name != null) {
139
					RepositoryTaskAttribute attr = attributeFactory.createAttribute(BugzillaReportElement.REPORTER_NAME.getKeyString());
150
					repositoryTaskData.getRoot()
140
					attr.setValue(name);
151
							.createAttribute(BugzillaReportElement.REPORTER_NAME.getKey())
141
					repositoryTaskData.addAttribute(BugzillaReportElement.REPORTER_NAME.getKeyString(), attr);
152
							.setValue(name);
142
				}
153
				}
143
			}
154
			}
144
			break;
155
			break;
Lines 146-168 Link Here
146
			if (attributes != null && attributes.getLength() > 0) {
157
			if (attributes != null && attributes.getLength() > 0) {
147
				String name = attributes.getValue(ATTRIBUTE_NAME);
158
				String name = attributes.getValue(ATTRIBUTE_NAME);
148
				if (name != null) {
159
				if (name != null) {
149
					RepositoryTaskAttribute attr = attributeFactory.createAttribute(BugzillaReportElement.ASSIGNED_TO_NAME.getKeyString());
160
					repositoryTaskData.getRoot()
150
					attr.setValue(name);
161
							.createAttribute(BugzillaReportElement.ASSIGNED_TO_NAME.getKey())
151
					repositoryTaskData.addAttribute(BugzillaReportElement.ASSIGNED_TO_NAME.getKeyString(), attr);
162
							.setValue(name);
152
				}
163
				}
153
			}
164
			}
154
			break;
165
			break;
155
		case ATTACHMENT:
166
		case ATTACHMENT:
156
			attachment = new RepositoryAttachment(attributeFactory);
157
			if (attributes != null) {
167
			if (attributes != null) {
158
				if ("1".equals(attributes.getValue(BugzillaReportElement.IS_OBSOLETE.getKeyString()))) {
168
				isDeprecated = "1".equals(attributes.getValue(BugzillaReportElement.IS_OBSOLETE.getKey()));
159
					attachment.addAttribute(BugzillaReportElement.IS_OBSOLETE.getKeyString(),
169
				isPatch = "1".equals(attributes.getValue(BugzillaReportElement.IS_PATCH.getKey()));
160
							attributeFactory.createAttribute(BugzillaReportElement.IS_OBSOLETE.getKeyString()));
161
					attachment.setObsolete(true);
162
				}
163
				if ("1".equals(attributes.getValue(BugzillaReportElement.IS_PATCH.getKeyString()))) {
164
					attachment.setPatch(true);
165
				}
166
			}
170
			}
167
			break;
171
			break;
168
		}
172
		}
Lines 175-181 Link Here
175
		String parsedText = characters.toString();
179
		String parsedText = characters.toString();
176
180
177
		if (localName.startsWith(BugzillaCustomField.CUSTOM_FIELD_PREFIX)) {
181
		if (localName.startsWith(BugzillaCustomField.CUSTOM_FIELD_PREFIX)) {
178
			RepositoryTaskAttribute attribute = repositoryTaskData.getAttribute(localName);
182
			TaskAttribute attribute = repositoryTaskData.getRoot().getAttribute(localName);
179
			if (attribute == null) {
183
			if (attribute == null) {
180
				String desc = "???";
184
				String desc = "???";
181
				for (BugzillaCustomField bugzillaCustomField : customFields) {
185
				for (BugzillaCustomField bugzillaCustomField : customFields) {
Lines 183-192 Link Here
183
						desc = bugzillaCustomField.getDescription();
187
						desc = bugzillaCustomField.getDescription();
184
					}
188
					}
185
				}
189
				}
186
				RepositoryTaskAttribute newattribute = new RepositoryTaskAttribute(localName, desc, true);
190
				TaskAttribute atr = repositoryTaskData.getRoot().createAttribute(localName);
187
				newattribute.setReadOnly(false);
191
				atr.putMetaDataValue(TaskAttribute.META_READ_ONLY, Boolean.toString(false));
188
				newattribute.setValue(parsedText);
192
				atr.setValue(parsedText);
189
				repositoryTaskData.addAttribute(localName, newattribute);
190
			} else {
193
			} else {
191
				attribute.addValue(parsedText);
194
				attribute.addValue(parsedText);
192
			}
195
			}
Lines 213-247 Link Here
213
				errorMessage = "Bug id from server did not match requested id.";
216
				errorMessage = "Bug id from server did not match requested id.";
214
			}
217
			}
215
218
216
			RepositoryTaskAttribute attr = repositoryTaskData.getAttribute(tag.getKeyString());
219
			TaskAttribute attr = repositoryTaskData.getMappedAttribute(tag.getKey());
217
			if (attr == null) {
220
			if (attr == null) {
218
				attr = attributeFactory.createAttribute(tag.getKeyString());
221
				attr = BugzillaTaskDataHandler.createAttribute(repositoryTaskData, BugzillaReportElement.BUG_ID);
219
				repositoryTaskData.addAttribute(tag.getKeyString(), attr);
220
			}
222
			}
221
			attr.setValue(parsedText);
223
			attr.setValue(parsedText);
224
225
			commentContainer = repositoryTaskData.getRoot().createAttribute(TaskAttribute.CONTAINER_COMMENTS);
226
			attachmentContainer = repositoryTaskData.getRoot().createAttribute(TaskAttribute.CONTAINER_ATTACHMENTS);
227
222
			break;
228
			break;
223
		}
229
		}
224
230
225
			// Comment attributes
231
			// Comment attributes
226
		case WHO:
232
		case WHO:
227
			if (taskComment != null) {
228
				RepositoryTaskAttribute attr = attributeFactory.createAttribute(tag.getKeyString());
229
				attr.setValue(parsedText);
230
				taskComment.addAttribute(tag.getKeyString(), attr);
231
			}
232
			break;
233
		case BUG_WHEN:
233
		case BUG_WHEN:
234
			if (taskComment != null) {
234
			if (taskComment != null) {
235
				RepositoryTaskAttribute attr = attributeFactory.createAttribute(tag.getKeyString());
235
				BugzillaTaskDataHandler.createAttribute(taskComment, tag).setValue(parsedText);
236
				attr.setValue(parsedText);
237
				taskComment.addAttribute(tag.getKeyString(), attr);
238
			}
236
			}
239
			break;
237
			break;
240
		case THETEXT:
238
		case THETEXT:
241
			if (taskComment != null) {
239
			if (taskComment != null) {
242
				RepositoryTaskAttribute attr = attributeFactory.createAttribute(tag.getKeyString());
240
				BugzillaTaskDataHandler.createAttribute(taskComment, tag).setValue(parsedText);
243
				attr.setValue(parsedText);
244
				taskComment.addAttribute(tag.getKeyString(), attr);
245
241
246
				// Check for attachment
242
				// Check for attachment
247
				parseAttachment(taskComment, parsedText);
243
				parseAttachment(taskComment, parsedText);
Lines 255-260 Link Here
255
251
256
		// Attachment attributes
252
		// Attachment attributes
257
		case ATTACHID:
253
		case ATTACHID:
254
			attachment = attachmentContainer.createAttribute(parsedText);
255
			attributeMapper.setBooleanValue(attachment.createAttribute(TaskAttribute.ATTACHMENT_IS_PATCH), isPatch);
256
			attributeMapper.setBooleanValue(attachment.createAttribute(TaskAttribute.ATTACHMENT_IS_DEPRECATED),
257
					isDeprecated);
258
			break;
259
258
		case DATE:
260
		case DATE:
259
		case DESC:
261
		case DESC:
260
		case FILENAME:
262
		case FILENAME:
Lines 262-278 Link Here
262
		case TYPE:
264
		case TYPE:
263
		case SIZE:
265
		case SIZE:
264
			if (attachment != null) {
266
			if (attachment != null) {
265
				RepositoryTaskAttribute attr = attributeFactory.createAttribute(tag.getKeyString());
267
				attachment.createAttribute(tag.getKey()).setValue(parsedText);
266
				attr.setValue(parsedText);
267
				attachment.addAttribute(tag.getKeyString(), attr);
268
			}
268
			}
269
			break;
269
			break;
270
		case DATA:
270
		case DATA:
271
			break;
271
			break;
272
		case ATTACHMENT:
272
		case ATTACHMENT:
273
			if (attachment != null) {
273
			isPatch = false;
274
				repositoryTaskData.addAttachment(attachment);
274
			isDeprecated = false;
275
			}
275
			attachment = null;
276
			break;
276
			break;
277
277
278
		// IGNORED ELEMENTS
278
		// IGNORED ELEMENTS
Lines 297-386 Link Here
297
			// comments
297
			// comments
298
			int longDescsSize = longDescs.size() - 1;
298
			int longDescsSize = longDescs.size() - 1;
299
			if (longDescsSize == 0) {
299
			if (longDescsSize == 0) {
300
				repositoryTaskData.setAttributeValue(RepositoryTaskAttribute.DESCRIPTION, longDescs.get(0).getText());
300
				//Description = comment 0
301
				repositoryTaskData.getRoot().createAttribute(TaskAttribute.DESCRIPTION).setValue(
302
						longDescs.get(0).getMappedAttribute(BugzillaReportElement.THETEXT.getKey()).getValue());
301
			} else if (longDescsSize == 1) {
303
			} else if (longDescsSize == 1) {
302
				if (longDescs.get(0).getCreated().compareTo(longDescs.get(1).getCreated()) <= 0) {
304
				String val0 = longDescs.get(0).getMappedAttribute(BugzillaReportElement.BUG_WHEN.getKey()).getValue();
305
				String val1 = longDescs.get(1).getMappedAttribute(BugzillaReportElement.BUG_WHEN.getKey()).getValue();
306
307
				if (val0.compareTo(val1) <= 0) {
303
					// if created_0 is equal to created_1 we assume that longDescs at index 0 is the description.
308
					// if created_0 is equal to created_1 we assume that longDescs at index 0 is the description.
304
					repositoryTaskData.setAttributeValue(RepositoryTaskAttribute.DESCRIPTION, longDescs.get(0)
309
					repositoryTaskData.getRoot().createAttribute(TaskAttribute.DESCRIPTION).setValue(
305
							.getText());
310
							longDescs.get(0).getMappedAttribute(BugzillaReportElement.THETEXT.getKey()).getValue());
306
					repositoryTaskData.addComment(longDescs.get(1));
307
				} else {
311
				} else {
308
					repositoryTaskData.setAttributeValue(RepositoryTaskAttribute.DESCRIPTION, longDescs.get(1)
312
					repositoryTaskData.getRoot().createAttribute(TaskAttribute.DESCRIPTION).setValue(
309
							.getText());
313
							longDescs.get(1).getMappedAttribute(BugzillaReportElement.THETEXT.getKey()).getValue());
310
					commentNum = 1;
311
					longDescs.get(0).setNumber(commentNum);
312
					repositoryTaskData.addComment(longDescs.get(0));
313
				}
314
				}
314
			} else if (longDescsSize > 1) {
315
			} else if (longDescsSize > 1) {
315
				String created_0 = longDescs.get(0).getCreated();
316
				String val0 = longDescs.get(0).getMappedAttribute(BugzillaReportElement.BUG_WHEN.getKey()).getValue();
316
				String created_1 = longDescs.get(1).getCreated();
317
				String val1 = longDescs.get(1).getMappedAttribute(BugzillaReportElement.BUG_WHEN.getKey()).getValue();
317
				String created_n = longDescs.get(longDescsSize).getCreated();
318
319
				String created_0 = val0;
320
				String created_1 = val1;
321
				String created_n = longDescs.get(longDescsSize).getMappedAttribute(
322
						BugzillaReportElement.BUG_WHEN.getKey()).getValue();
318
				commentNum = 1;
323
				commentNum = 1;
319
				if (created_0.compareTo(created_1) <= 0 && created_0.compareTo(created_n) < 0) {
324
				if (created_0.compareTo(created_1) <= 0 && created_0.compareTo(created_n) < 0) {
320
					// if created_0 is equal to created_1 we assume that longDescs at index 0 is the description.
325
					// if created_0 is equal to created_1 we assume that longDescs at index 0 is the description.
321
					repositoryTaskData.setAttributeValue(RepositoryTaskAttribute.DESCRIPTION, longDescs.get(0)
326
					repositoryTaskData.getRoot().createAttribute(TaskAttribute.DESCRIPTION).setValue(
322
							.getText());
327
							longDescs.get(0).getMappedAttribute(BugzillaReportElement.THETEXT.getKey()).getValue());
323
					if (created_1.compareTo(created_n) < 0) {
328
324
						for (int i = 1; i <= longDescsSize; i++) {
329
// TODO: move into presentation?
325
							longDescs.get(i).setNumber(commentNum++);
330
//					if (created_1.compareTo(created_n) < 0) {
326
							repositoryTaskData.addComment(longDescs.get(i));
331
//						for (int i = 1; i <= longDescsSize; i++) {
327
						}
332
//							longDescs.get(i).setNumber(commentNum++);
328
					} else {
333
//							repositoryTaskData.addComment(longDescs.get(i));
329
						for (int i = longDescsSize; i > 0; i--) {
334
//						}
330
							longDescs.get(i).setNumber(commentNum++);
335
//					} else {
331
							repositoryTaskData.addComment(longDescs.get(i));
336
//						for (int i = longDescsSize; i > 0; i--) {
332
						}
337
//							longDescs.get(i).setNumber(commentNum++);
333
					}
338
//							repositoryTaskData.addComment(longDescs.get(i));
339
//						}
340
//					}
334
				} else {
341
				} else {
335
					repositoryTaskData.setAttributeValue(RepositoryTaskAttribute.DESCRIPTION, longDescs.get(
342
					repositoryTaskData.getRoot().createAttribute(TaskAttribute.DESCRIPTION).setValue(
336
							longDescsSize).getText());
343
							longDescs.get(longDescsSize)
337
					if (created_0.compareTo(created_1) < 0) {
344
									.getMappedAttribute(BugzillaReportElement.THETEXT.getKey())
338
						for (int i = 0; i < longDescsSize; i++) {
345
									.getValue());
339
							longDescs.get(i).setNumber(commentNum++);
346
//					if (created_0.compareTo(created_1) < 0) {
340
							repositoryTaskData.addComment(longDescs.get(i));
347
//						for (int i = 0; i < longDescsSize; i++) {
341
						}
348
//							longDescs.get(i).setNumber(commentNum++);
342
					} else {
349
//							repositoryTaskData.addComment(longDescs.get(i));
343
						for (int i = longDescsSize - 1; i >= 0; i--) {
350
//						}
344
							longDescs.get(i).setNumber(commentNum++);
351
//					} else {
345
							repositoryTaskData.addComment(longDescs.get(i));
352
//						for (int i = longDescsSize - 1; i >= 0; i--) {
346
						}
353
//							longDescs.get(i).setNumber(commentNum++);
347
					}
354
//							repositoryTaskData.addComment(longDescs.get(i));
355
//						}
356
//					}
348
				}
357
				}
349
			}
358
			}
350
359
351
			RepositoryTaskAttribute numCommentsAttribute = repositoryTaskData.getAttribute(BugzillaReportElement.LONGDESCLENGTH.getKeyString());
360
			TaskAttribute container = repositoryTaskData.getMappedAttribute(TaskAttribute.CONTAINER_COMMENTS);
361
			TaskAttribute numCommentsAttribute = repositoryTaskData.getMappedAttribute(BugzillaReportElement.LONGDESCLENGTH.getKey());
352
			if (numCommentsAttribute == null) {
362
			if (numCommentsAttribute == null) {
353
				numCommentsAttribute = attributeFactory.createAttribute(BugzillaReportElement.LONGDESCLENGTH.getKeyString());
363
				numCommentsAttribute = BugzillaTaskDataHandler.createAttribute(repositoryTaskData,
354
				numCommentsAttribute.setValue("" + repositoryTaskData.getComments().size());
364
						BugzillaReportElement.LONGDESCLENGTH);
355
				repositoryTaskData.addAttribute(BugzillaReportElement.LONGDESCLENGTH.getKeyString(),
365
				numCommentsAttribute.setValue("" + container.getAttributes().size());
356
						numCommentsAttribute);
357
			} else {
366
			} else {
358
				numCommentsAttribute.setValue("" + repositoryTaskData.getComments().size());
367
				numCommentsAttribute.setValue(""
368
						+ repositoryTaskData.getMappedAttribute(BugzillaReportElement.LONGDESCLENGTH.getKey())
369
								.getValue());
359
			}
370
			}
360
371
361
			// Set the creator name on all attachments
372
			// Set the creator name on all attachments
362
			for (RepositoryAttachment attachment : repositoryTaskData.getAttachments()) {
373
			for (TaskAttribute attachment : container.getAttributes().values()) {
363
				TaskComment taskComment = attachIdToComment.get(attachment.getId());
374
				TaskAttachmentMapper attachmentMapper = TaskAttachmentMapper.createFrom(attachment);
375
				TaskAttribute taskComment = attachIdToComment.get(attachment.getId());
364
				if (taskComment != null) {
376
				if (taskComment != null) {
365
					attachment.setCreator(taskComment.getAuthor());
377
					String commentAuthor = taskComment.getMappedAttribute(TaskAttribute.COMMENT_AUTHOR).getValue();
366
				}
378
					attachmentMapper.setAuthor(repositoryTaskData.getAttributeMapper()
367
				attachment.setAttributeValue(RepositoryTaskAttribute.ATTACHMENT_URL,
379
							.getTaskRepository()
368
						repositoryTaskData.getRepositoryUrl() + IBugzillaConstants.URL_GET_ATTACHMENT_SUFFIX
380
							.createPerson(commentAuthor));
369
								+ attachment.getId());
381
				}
370
				attachment.setRepositoryKind(repositoryTaskData.getConnectorKind());
382
				attachmentMapper.setUrl(repositoryTaskData.getRepositoryUrl()
371
				attachment.setRepositoryUrl(repositoryTaskData.getRepositoryUrl());
383
						+ IBugzillaConstants.URL_GET_ATTACHMENT_SUFFIX + attachment.getId());
372
				attachment.setTaskId(repositoryTaskData.getTaskId());
384
//				attachment.setRepositoryKind(repositoryTaskData.getConnectorKind());
385
//				attachment.setRepositoryUrl(repositoryTaskData.getRepositoryUrl());
386
//				attachment.setTaskId(repositoryTaskData.getTaskId());
373
			}
387
			}
374
			collector.accept(repositoryTaskData);
388
			collector.accept(repositoryTaskData);
375
			break;
389
			break;
376
390
377
		case BLOCKED:
391
		case BLOCKED:
378
		case DEPENDSON:
392
		case DEPENDSON:
379
			RepositoryTaskAttribute dependancyAttribute = repositoryTaskData.getAttribute(tag.getKeyString());
393
			TaskAttribute dependancyAttribute = repositoryTaskData.getMappedAttribute(tag.getKey());
380
			if (dependancyAttribute == null) {
394
			if (dependancyAttribute == null) {
381
				dependancyAttribute = attributeFactory.createAttribute(tag.getKeyString());
395
				BugzillaTaskDataHandler.createAttribute(repositoryTaskData, BugzillaReportElement.DEPENDSON).setValue(
382
				dependancyAttribute.setValue(parsedText);
396
						parsedText);
383
				repositoryTaskData.addAttribute(tag.getKeyString(), dependancyAttribute);
384
			} else {
397
			} else {
385
				if (dependancyAttribute.getValue().equals("")) {
398
				if (dependancyAttribute.getValue().equals("")) {
386
					dependancyAttribute.setValue(parsedText);
399
					dependancyAttribute.setValue(parsedText);
Lines 391-401 Link Here
391
			break;
404
			break;
392
		// All others added as report attribute
405
		// All others added as report attribute
393
		default:
406
		default:
394
			RepositoryTaskAttribute attribute = repositoryTaskData.getAttribute(tag.getKeyString());
407
			TaskAttribute attribute = repositoryTaskData.getMappedAttribute(tag.getKey());
395
			if (attribute == null) {
408
			if (attribute == null) {
396
				attribute = attributeFactory.createAttribute(tag.getKeyString());
409
				attribute = BugzillaTaskDataHandler.createAttribute(repositoryTaskData, tag);
397
				attribute.setValue(parsedText);
410
				attribute.setValue(parsedText);
398
				repositoryTaskData.addAttribute(tag.getKeyString(), attribute);
399
			} else {
411
			} else {
400
				attribute.addValue(parsedText);
412
				attribute.addValue(parsedText);
401
			}
413
			}
Lines 405-411 Link Here
405
	}
417
	}
406
418
407
	/** determines attachment id from comment */
419
	/** determines attachment id from comment */
408
	private void parseAttachment(TaskComment taskComment, String commentText) {
420
	private void parseAttachment(TaskAttribute taskComment, String commentText) {
409
421
410
		String attachmentID = "";
422
		String attachmentID = "";
411
423
Lines 414-421 Link Here
414
			if (endIndex > 0 && endIndex < commentText.length()) {
426
			if (endIndex > 0 && endIndex < commentText.length()) {
415
				attachmentID = commentText.substring(COMMENT_ATTACHMENT_STRING.length(), endIndex);
427
				attachmentID = commentText.substring(COMMENT_ATTACHMENT_STRING.length(), endIndex);
416
				if (!attachmentID.equals("")) {
428
				if (!attachmentID.equals("")) {
417
					taskComment.setHasAttachment(true);
429
					TaskAttribute attachmentContainer = taskComment.getMappedAttribute(TaskAttribute.CONTAINER_ATTACHMENTS);
418
					taskComment.setAttachmentId(attachmentID);
430
					if (attachmentContainer == null) {
431
						attachmentContainer = taskComment.createAttribute(TaskAttribute.CONTAINER_ATTACHMENTS);
432
					}
433
					attachmentContainer.createAttribute(attachmentID);
419
					attachIdToComment.put(attachmentID, taskComment);
434
					attachIdToComment.put(attachmentID, taskComment);
420
				}
435
				}
421
			}
436
			}
(-)src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaTask.java (-1 / +3 lines)
Lines 15-21 Link Here
15
/**
15
/**
16
 * @author Mik Kersten
16
 * @author Mik Kersten
17
 * @author Rob Elves
17
 * @author Rob Elves
18
 * @deprecated
18
 */
19
 */
20
@Deprecated
19
public class BugzillaTask extends AbstractTask {
21
public class BugzillaTask extends AbstractTask {
20
22
21
	private String severity;
23
	private String severity;
Lines 39-45 Link Here
39
41
40
	@Override
42
	@Override
41
	public String getConnectorKind() {
43
	public String getConnectorKind() {
42
		return BugzillaCorePlugin.REPOSITORY_KIND;
44
		return BugzillaCorePlugin.CONNECTOR_KIND;
43
	}
45
	}
44
46
45
	public String getSeverity() {
47
	public String getSeverity() {
(-)src/org/eclipse/mylyn/internal/bugzilla/core/RepositoryConfiguration.java (-38 / +92 lines)
Lines 12-17 Link Here
12
import java.util.ArrayList;
12
import java.util.ArrayList;
13
import java.util.Collections;
13
import java.util.Collections;
14
import java.util.HashMap;
14
import java.util.HashMap;
15
import java.util.HashSet;
15
import java.util.List;
16
import java.util.List;
16
import java.util.Locale;
17
import java.util.Locale;
17
import java.util.Map;
18
import java.util.Map;
Lines 21-29 Link Here
21
import org.eclipse.mylyn.commons.core.StatusHandler;
22
import org.eclipse.mylyn.commons.core.StatusHandler;
22
import org.eclipse.mylyn.internal.bugzilla.core.IBugzillaConstants.BUGZILLA_OPERATION;
23
import org.eclipse.mylyn.internal.bugzilla.core.IBugzillaConstants.BUGZILLA_OPERATION;
23
import org.eclipse.mylyn.internal.bugzilla.core.IBugzillaConstants.BUGZILLA_REPORT_STATUS;
24
import org.eclipse.mylyn.internal.bugzilla.core.IBugzillaConstants.BUGZILLA_REPORT_STATUS;
24
import org.eclipse.mylyn.internal.tasks.core.deprecated.RepositoryOperation;
25
import org.eclipse.mylyn.tasks.core.data.TaskAttribute;
25
import org.eclipse.mylyn.internal.tasks.core.deprecated.RepositoryTaskAttribute;
26
import org.eclipse.mylyn.tasks.core.data.TaskData;
26
import org.eclipse.mylyn.internal.tasks.core.deprecated.RepositoryTaskData;
27
import org.eclipse.mylyn.tasks.core.data.TaskOperation;
27
28
28
/**
29
/**
29
 * Class describing the configuration of products and components for a given Bugzilla installation.
30
 * Class describing the configuration of products and components for a given Bugzilla installation.
Lines 432-445 Link Here
432
		return customFields;
433
		return customFields;
433
	}
434
	}
434
435
435
	public void configureTaskData(RepositoryTaskData taskData) {
436
	public void configureTaskData(TaskData taskData) {
436
		updateAttributeOptions(taskData);
437
		updateAttributeOptions(taskData);
437
		addValidOperations(taskData);
438
		addValidOperations(taskData);
438
	}
439
	}
439
440
440
	public void updateAttributeOptions(RepositoryTaskData existingReport) {
441
	public void updateAttributeOptions(TaskData existingReport) {
441
		String product = existingReport.getAttributeValue(BugzillaReportElement.PRODUCT.getKeyString());
442
		TaskAttribute attributeProduct = existingReport.getMappedAttribute(BugzillaReportElement.PRODUCT.getKey());
442
		for (RepositoryTaskAttribute attribute : existingReport.getAttributes()) {
443
		if (attributeProduct == null) {
444
			return;
445
		}
446
		String product = attributeProduct.getValue();
447
		for (TaskAttribute attribute : new HashSet<TaskAttribute>(existingReport.getRoot().getAttributes().values())) {
443
			if (attribute.getId().startsWith(BugzillaCustomField.CUSTOM_FIELD_PREFIX)) {
448
			if (attribute.getId().startsWith(BugzillaCustomField.CUSTOM_FIELD_PREFIX)) {
444
				attribute.clearOptions();
449
				attribute.clearOptions();
445
				List<BugzillaCustomField> customFields = getCustomFields();
450
				List<BugzillaCustomField> customFields = getCustomFields();
Lines 448-460 Link Here
448
					if (bugzillaCustomField.getName().equals(attribute.getId())) {
453
					if (bugzillaCustomField.getName().equals(attribute.getId())) {
449
						List<String> optionList = bugzillaCustomField.getOptions();
454
						List<String> optionList = bugzillaCustomField.getOptions();
450
						for (String option : optionList) {
455
						for (String option : optionList) {
451
							attribute.addOption(option, option);
456
							attribute.putOption(option, option);
452
						}
457
						}
453
					}
458
					}
454
				}
459
				}
455
			} else {
460
			} else {
456
				BugzillaReportElement element = BugzillaReportElement.valueOf(attribute.getId().trim().toUpperCase(
461
457
						Locale.ENGLISH));
462
				BugzillaReportElement element;
463
				try {
464
					element = BugzillaReportElement.valueOf(attribute.getId().trim().toUpperCase(Locale.ENGLISH));
465
				} catch (RuntimeException e) {
466
					if (e instanceof IllegalArgumentException) {
467
						// ignore unrecognized tags
468
						continue;
469
					}
470
					throw e;
471
				}
458
				attribute.clearOptions();
472
				attribute.clearOptions();
459
				List<String> optionValues = getOptionValues(element, product);
473
				List<String> optionValues = getOptionValues(element, product);
460
				if (element != BugzillaReportElement.OP_SYS && element != BugzillaReportElement.BUG_SEVERITY
474
				if (element != BugzillaReportElement.OP_SYS && element != BugzillaReportElement.BUG_SEVERITY
Lines 463-474 Link Here
463
				}
477
				}
464
				if (element == BugzillaReportElement.TARGET_MILESTONE && optionValues.isEmpty()) {
478
				if (element == BugzillaReportElement.TARGET_MILESTONE && optionValues.isEmpty()) {
465
479
466
					existingReport.removeAttribute(BugzillaReportElement.TARGET_MILESTONE);
480
					existingReport.getRoot().removeAttribute(BugzillaReportElement.TARGET_MILESTONE.getKey());
467
					continue;
481
					continue;
468
				}
482
				}
469
				attribute.clearOptions();
483
				attribute.clearOptions();
470
				for (String option : optionValues) {
484
				for (String option : optionValues) {
471
					attribute.addOption(option, option);
485
					attribute.putOption(option, option);
472
				}
486
				}
473
487
474
				// TODO: bug#162428, bug#150680 - something along the lines of...
488
				// TODO: bug#162428, bug#150680 - something along the lines of...
Lines 484-496 Link Here
484
498
485
	}
499
	}
486
500
487
	private void addValidOperations(RepositoryTaskData bugReport) {
501
	private void addValidOperations(TaskData bugReport) {
488
		BUGZILLA_REPORT_STATUS status;
502
		TaskAttribute attributeStatus = bugReport.getMappedAttribute(TaskAttribute.STATUS);
503
		BUGZILLA_REPORT_STATUS status = BUGZILLA_REPORT_STATUS.NEW;
489
		try {
504
		try {
490
			status = BUGZILLA_REPORT_STATUS.valueOf(bugReport.getStatus());
505
			if (attributeStatus == null) {
506
				StatusHandler.log(new Status(IStatus.WARNING, BugzillaCorePlugin.PLUGIN_ID,
507
						"Status not found for task.  Synchronize task to correct."));
508
			} else {
509
				status = BUGZILLA_REPORT_STATUS.valueOf(attributeStatus.getValue());
510
			}
491
		} catch (RuntimeException e) {
511
		} catch (RuntimeException e) {
492
			StatusHandler.log(new Status(IStatus.INFO, BugzillaCorePlugin.PLUGIN_ID, "Unrecognized status: "
512
			StatusHandler.log(new Status(IStatus.INFO, BugzillaCorePlugin.PLUGIN_ID, "Unrecognized status: "
493
					+ bugReport.getStatus(), e));
513
					+ attributeStatus.getValue(), e));
494
			status = BUGZILLA_REPORT_STATUS.NEW;
514
			status = BUGZILLA_REPORT_STATUS.NEW;
495
		}
515
		}
496
		switch (status) {
516
		switch (status) {
Lines 535-589 Link Here
535
		}
555
		}
536
	}
556
	}
537
557
538
	private void addOperation(RepositoryTaskData bugReport, BUGZILLA_OPERATION opcode) {
558
	private void addOperation(TaskData bugReport, BUGZILLA_OPERATION opcode) {
539
		RepositoryOperation newOperation = null;
559
		TaskAttribute attribute;
560
		TaskOperation newOperation = null;
561
		TaskAttribute operationAttribute = bugReport.getRoot().createAttribute(TaskAttribute.OPERATION);
562
		TaskAttribute operationContainer = bugReport.getRoot().createAttribute(TaskAttribute.CONTAINER_OPERATIONS);
563
		TaskOperation defaultOperation;
564
540
		switch (opcode) {
565
		switch (opcode) {
541
		case none:
566
		case none:
542
			newOperation = new RepositoryOperation(opcode.toString(), "Leave as " + bugReport.getStatus() + " "
567
			attribute = operationContainer.createAttribute(opcode.toString());
543
					+ bugReport.getResolution());
568
			attribute.setValue(opcode.toString());
544
			newOperation.setChecked(true);
569
			newOperation = TaskOperation.createFrom(attribute);
570
571
			TaskAttribute attributeStatus = bugReport.getMappedAttribute(TaskAttribute.STATUS);
572
			TaskAttribute attributeResolution = bugReport.getMappedAttribute(TaskAttribute.RESOLUTION);
573
574
			newOperation.setLabel("Leave as " + attributeStatus.getValue() + " " + attributeResolution.getValue());
575
			newOperation.applyTo(attribute);
576
577
			// set as default
578
			newOperation.applyTo(operationAttribute);
545
			break;
579
			break;
546
		case accept:
580
		case accept:
547
			newOperation = new RepositoryOperation(opcode.toString(), OPERATION_LABEL_ACCEPT);
581
			attribute = operationContainer.createAttribute(opcode.toString());
582
			attribute.setValue(opcode.toString());
583
			newOperation = TaskOperation.createFrom(attribute);
584
			newOperation.setLabel(OPERATION_LABEL_ACCEPT);
548
			break;
585
			break;
549
		case resolve:
586
		case resolve:
550
			newOperation = new RepositoryOperation(opcode.toString(), OPERATION_LABEL_RESOLVE);
587
			attribute = operationContainer.createAttribute(opcode.toString());
551
			newOperation.setUpOptions(OPERATION_OPTION_RESOLUTION);
588
			attribute.setValue(opcode.toString());
589
			newOperation = TaskOperation.createFrom(attribute);
590
			newOperation.setLabel(OPERATION_LABEL_RESOLVE);
591
592
			//TaskAttribute.META_ASSOCIATED_ATTRIBUTE_ID
552
			for (String resolution : getResolutions()) {
593
			for (String resolution : getResolutions()) {
553
				// DUPLICATE and MOVED have special meanings so do not show as resolution
594
				// DUPLICATE and MOVED have special meanings so do not show as resolution
595
554
				if (resolution.compareTo("DUPLICATE") != 0 && resolution.compareTo("MOVED") != 0) {
596
				if (resolution.compareTo("DUPLICATE") != 0 && resolution.compareTo("MOVED") != 0) {
555
					newOperation.addOption(resolution, resolution);
597
					attribute.putOption(resolution, resolution);
556
				}
598
				}
557
			}
599
			}
558
			break;
600
			break;
559
		case duplicate:
601
		case duplicate:
560
			newOperation = new RepositoryOperation(opcode.toString(), OPERATION_LABEL_DUPLICATE);
602
			attribute = operationContainer.createAttribute(OPERATION_INPUT_DUP_ID);
561
			newOperation.setInputName(OPERATION_INPUT_DUP_ID);
603
			attribute.setValue(opcode.toString());
562
			newOperation.setInputValue("");
604
			newOperation = TaskOperation.createFrom(attribute);
605
			newOperation.setLabel(OPERATION_LABEL_DUPLICATE);
606
			// TODO: Specify short text input
563
			break;
607
			break;
564
		case reassign:
608
		case reassign:
565
			newOperation = new RepositoryOperation(opcode.toString(), OPERATION_LABEL_REASSIGN);
609
			attribute = operationContainer.createAttribute(OPERATION_INPUT_ASSIGNED_TO);
566
			newOperation.setInputName(OPERATION_INPUT_ASSIGNED_TO);
610
			attribute.setValue(OPERATION_INPUT_ASSIGNED_TO);
567
			newOperation.setInputValue("");
611
			newOperation = TaskOperation.createFrom(attribute);
612
			newOperation.setLabel(OPERATION_LABEL_REASSIGN);
568
			break;
613
			break;
569
		case reassignbycomponent:
614
		case reassignbycomponent:
570
			newOperation = new RepositoryOperation(opcode.toString(), OPERATION_LABEL_REASSIGN_DEFAULT);
615
			attribute = operationContainer.createAttribute(opcode.toString());
616
			attribute.setValue(opcode.toString());
617
			newOperation = TaskOperation.createFrom(attribute);
618
			newOperation.setLabel(OPERATION_LABEL_REASSIGN_DEFAULT);
571
			break;
619
			break;
572
		case reopen:
620
		case reopen:
573
			newOperation = new RepositoryOperation(opcode.toString(), OPERATION_LABEL_REOPEN);
621
			attribute = operationContainer.createAttribute(opcode.toString());
622
			attribute.setValue(opcode.toString());
623
			newOperation = TaskOperation.createFrom(attribute);
624
			newOperation.setLabel(OPERATION_LABEL_REOPEN);
574
			break;
625
			break;
575
		case verify:
626
		case verify:
576
			newOperation = new RepositoryOperation(opcode.toString(), OPERATION_LABEL_VERIFY);
627
			attribute = operationContainer.createAttribute(opcode.toString());
628
			attribute.setValue(opcode.toString());
629
			newOperation = TaskOperation.createFrom(attribute);
630
			newOperation.setLabel(OPERATION_LABEL_VERIFY);
577
			break;
631
			break;
578
		case close:
632
		case close:
579
			newOperation = new RepositoryOperation(opcode.toString(), OPERATION_LABEL_CLOSE);
633
			attribute = operationContainer.createAttribute(opcode.toString());
634
			attribute.setValue(opcode.toString());
635
			newOperation = TaskOperation.createFrom(attribute);
636
			newOperation.setLabel(OPERATION_LABEL_CLOSE);
580
			break;
637
			break;
581
		default:
638
		default:
582
			break;
639
			break;
583
		}
640
		}
584
		if (newOperation != null) {
585
			bugReport.addOperation(newOperation);
586
		}
587
	}
641
	}
588
642
589
	/**
643
	/**
(-).refactorings/2008/5/20/refactorings.index (+3 lines)
Line 1 Link Here
1
1210734328587	Rename type 'StackTraceDuplicateDetector'
1
1210734328587	Rename type 'StackTraceDuplicateDetector'
2
1210971188860	Rename field 'REPOSITORY_KIND'
3
1210973071627	Delete element
4
1210976615822	Rename method 'getKeyString'
(-).refactorings/2008/5/20/refactorings.history (-2 / +1 lines)
Lines 1-4 Link Here
1
<?xml version="1.0" encoding="UTF-8"?>
1
<?xml version="1.0" encoding="UTF-8"?>
2
<session version="1.0">
2
<session version="1.0">&#x0A;<refactoring comment="Rename type &apos;org.eclipse.mylyn.internal.bugzilla.core.StackTraceDuplicateDetector&apos; to &apos;BugzillaStackTraceDuplicateDetector&apos;&#x0A;- Original project: &apos;org.eclipse.mylyn.bugzilla.core&apos;&#x0A;- Original element: &apos;org.eclipse.mylyn.internal.bugzilla.core.StackTraceDuplicateDetector&apos;&#x0A;- Renamed element: &apos;org.eclipse.mylyn.internal.bugzilla.core.BugzillaStackTraceDuplicateDetector&apos;&#x0A;- Update references to refactored element&#x0A;- Update fully qualified names in &apos;plugin.xml,MANIFEST.MF&apos; files&#x0A;- Update textual occurrences in comments and strings" description="Rename type &apos;StackTraceDuplicateDetector&apos;" flags="589830" id="org.eclipse.jdt.ui.rename.type" input="/src&lt;org.eclipse.mylyn.internal.bugzilla.core{StackTraceDuplicateDetector.java[StackTraceDuplicateDetector" matchStrategy="1" name="BugzillaStackTraceDuplicateDetector" patterns="plugin.xml,MANIFEST.MF" qualified="true" references="true" similarDeclarations="false" stamp="1210734328587" textual="false" version="1.0"/>&#x0A;<refactoring comment="Rename field &apos;REPOSITORY_KIND&apos; in &apos;org.eclipse.mylyn.internal.bugzilla.core.BugzillaCorePlugin&apos; to &apos;CONNECTOR_KIND&apos;&#x0D;&#x0A;- Original project: &apos;org.eclipse.mylyn.bugzilla.core&apos;&#x0D;&#x0A;- Original element: &apos;org.eclipse.mylyn.internal.bugzilla.core.BugzillaCorePlugin.REPOSITORY_KIND&apos;&#x0D;&#x0A;- Renamed element: &apos;org.eclipse.mylyn.internal.bugzilla.core.BugzillaCorePlugin.CONNECTOR_KIND&apos;&#x0D;&#x0A;- Update references to refactored element&#x0D;&#x0A;- Update textual occurrences in comments and strings" delegate="false" deprecate="false" description="Rename field &apos;REPOSITORY_KIND&apos;" flags="589830" getter="false" id="org.eclipse.jdt.ui.rename.field" input="/src&lt;org.eclipse.mylyn.internal.bugzilla.core{BugzillaCorePlugin.java[BugzillaCorePlugin^REPOSITORY_KIND" name="CONNECTOR_KIND" references="true" setter="false" stamp="1210971188860" textual="false" version="1.0"/>&#x0A;<refactoring accessors="true" comment="Delete 1 element(s) from project &apos;org.eclipse.mylyn.bugzilla.core&apos;&#x0D;&#x0A;- Original project: &apos;org.eclipse.mylyn.bugzilla.core&apos;&#x0D;&#x0A;- Original element: &apos;BugzillaRepositoryConnector.java.rej&apos;" description="Delete element" element1="src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaRepositoryConnector.java.rej" elements="0" flags="589830" id="org.eclipse.jdt.ui.delete" resources="1" stamp="1210973071627" subPackages="false" version="1.0"/>&#x0A;<refactoring comment="Rename method &apos;org.eclipse.mylyn.internal.bugzilla.core.BugzillaReportElement.getKeyString()&apos; to &apos;getKey&apos;&#x0D;&#x0A;- Original project: &apos;org.eclipse.mylyn.bugzilla.core&apos;&#x0D;&#x0A;- Original element: &apos;org.eclipse.mylyn.internal.bugzilla.core.BugzillaReportElement.getKeyString()&apos;&#x0D;&#x0A;- Renamed element: &apos;org.eclipse.mylyn.internal.bugzilla.core.BugzillaReportElement.getKey()&apos;&#x0D;&#x0A;- Update references to refactored element" delegate="false" deprecate="false" description="Rename method &apos;getKeyString&apos;" flags="589830" id="org.eclipse.jdt.ui.rename.method" input="/src&lt;org.eclipse.mylyn.internal.bugzilla.core{BugzillaReportElement.java[BugzillaReportElement~getKeyString" name="getKey" references="true" stamp="1210976615822" version="1.0"/>
3
<refactoring comment="Rename type &apos;org.eclipse.mylyn.internal.bugzilla.core.StackTraceDuplicateDetector&apos; to &apos;BugzillaStackTraceDuplicateDetector&apos;&#x0A;- Original project: &apos;org.eclipse.mylyn.bugzilla.core&apos;&#x0A;- Original element: &apos;org.eclipse.mylyn.internal.bugzilla.core.StackTraceDuplicateDetector&apos;&#x0A;- Renamed element: &apos;org.eclipse.mylyn.internal.bugzilla.core.BugzillaStackTraceDuplicateDetector&apos;&#x0A;- Update references to refactored element&#x0A;- Update fully qualified names in &apos;plugin.xml,MANIFEST.MF&apos; files&#x0A;- Update textual occurrences in comments and strings" description="Rename type &apos;StackTraceDuplicateDetector&apos;" flags="589830" id="org.eclipse.jdt.ui.rename.type" input="/src&lt;org.eclipse.mylyn.internal.bugzilla.core{StackTraceDuplicateDetector.java[StackTraceDuplicateDetector" matchStrategy="1" name="BugzillaStackTraceDuplicateDetector" patterns="plugin.xml,MANIFEST.MF" qualified="true" references="true" similarDeclarations="false" stamp="1210734328587" textual="false" version="1.0"/>
4
</session>
3
</session>
(-)src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaConnectorUi.java (-2 / +2 lines)
Lines 199-205 Link Here
199
199
200
	@Override
200
	@Override
201
	public String getConnectorKind() {
201
	public String getConnectorKind() {
202
		return BugzillaCorePlugin.REPOSITORY_KIND;
202
		return BugzillaCorePlugin.CONNECTOR_KIND;
203
	}
203
	}
204
204
205
	@SuppressWarnings("restriction")
205
	@SuppressWarnings("restriction")
Lines 210-216 Link Here
210
			// we wouldn't have to get the task data this way from here
210
			// we wouldn't have to get the task data this way from here
211
			RepositoryTaskData taskData = TasksUiPlugin.getTaskDataStorageManager().getNewTaskData(
211
			RepositoryTaskData taskData = TasksUiPlugin.getTaskDataStorageManager().getNewTaskData(
212
					task.getRepositoryUrl(), task.getTaskId());
212
					task.getRepositoryUrl(), task.getTaskId());
213
			if (taskData != null && taskData.getAttribute(BugzillaReportElement.ESTIMATED_TIME.getKeyString()) != null) {
213
			if (taskData != null && taskData.getAttribute(BugzillaReportElement.ESTIMATED_TIME.getKey()) != null) {
214
				return true;
214
				return true;
215
			}
215
			}
216
		}
216
		}
(-).refactorings/2008/5/20/refactorings.history (+4 lines)
Added Link Here
1
<?xml version="1.0" encoding="UTF-8"?>
2
<session version="1.0">
3
<refactoring comment="Move 1 elements(s) to &apos;org.eclipse.mylyn.bugzilla.ui/src/org.eclipse.mylyn.internal.bugzilla.ui.tasklist&apos;&#x0D;&#x0A;- Original project: &apos;org.eclipse.mylyn.bugzilla.ui&apos;&#x0D;&#x0A;- Destination element: &apos;org.eclipse.mylyn.bugzilla.ui/src/org.eclipse.mylyn.internal.bugzilla.ui.tasklist&apos;&#x0D;&#x0A;- Original element: &apos;org.eclipse.mylyn.internal.bugzilla.ui.BugzillaTaskListMigrator.java&apos;&#x0D;&#x0A;- Update references to refactored element" description="Move compilation unit" destination="/src&lt;org.eclipse.mylyn.internal.bugzilla.ui.tasklist" element1="/src&lt;org.eclipse.mylyn.internal.bugzilla.ui{BugzillaTaskListMigrator.java" files="0" flags="589830" folders="0" id="org.eclipse.jdt.ui.move" policy="org.eclipse.jdt.ui.moveResources" qualified="false" references="true" stamp="1210972267786" units="1" version="1.0"/>
4
</session>

Return to bug 229655