How to use Mylyn connectors the right way? [message #639689] |
Wed, 17 November 2010 13:40 |
Stephan Mann Messages: 22 Registered: August 2010 |
Junior Member |
|
|
Hi,
I want to access multiple bug trackers for a project of mine and so I'm
trying to use the Mylyn connectors. The goal is to use only the code
required for communication with the bug tracker but no part of Mylyn's
GUI. After much trial and error I got access to a Bugzilla repository [1].
Although this is working, I wonder if there is a better way to do this.
Most of the classes I used in this test are internal, so what is the
right way to use the Bugzilla connector? Since I need to access a Mantis
bug tracker as well, I also wonder whether there is some generic
approach that I've missed so far.
I also didn't yet get the concept of TaskData/TaskAttribute. Is there a
more convenient way to access the task properties?
thanks in advance,
stephan
[1]
public class MylynBugzillaTest extends TestCase {
public void testConnect() {
final BugzillaRepositoryConnector connector = new
BugzillaRepositoryConnector();
final TaskRepository repository = new TaskRepository(
BugzillaCorePlugin.CONNECTOR_KIND,
"https://bugs.eclipse.org/bugs");
repository.setAuthenticationCredentials(
"stephan.mann@compeople.de", "password");
final TaskRepositoryManager repositoryManager =
new TaskRepositoryManager();
final TaskList taskList = new TaskList();
final RepositoryModel repositoryModel =
new RepositoryModel(taskList, repositoryManager);
final IRepositoryQuery repositoryQuery =
repositoryModel.createRepositoryQuery(repository);
repositoryQuery.setUrl(repository.getUrl()
+ "/buglist.cgi?product=Riena&bug_status=NEW"
+ "&bug_status=ASSIGNED&bug_status=REOPENED");
final TaskDataCollector collector = new TaskDataCollector() {
@Override
public void accept(final TaskData taskData) {
final String title =
taskData.getRoot().
getAttribute("bug").getValue();
System.out.println(title.trim());
}
};
final IStatus status = connector.performQuery(
repository, repositoryQuery, collector, null,
new NullProgressMonitor());
assertEquals(IStatus.OK, status.getCode());
}
}
|
|
|
Powered by
FUDForum. Page generated in 0.02929 seconds