use of org.eclipse.mylyn.tasks.core.TaskMapping in project linuxtools by eclipse.
the class TestOSIORestClient method testinitializeTaskData.
@Test
public void testinitializeTaskData() throws Exception {
final TaskMapping taskMappingInit = new TaskMapping() {
@Override
public String getSummary() {
return "The Summary";
}
@Override
public String getDescription() {
return "The Description";
}
};
TestData testData = new TestData();
TestUtils.initSpaces(requestProvider, testData);
OSIORestClient client = connector.getClient(repository, requestProvider);
AbstractTaskDataHandler taskDataHandler = connector.getTaskDataHandler();
TaskAttributeMapper mapper = taskDataHandler.getAttributeMapper(repository);
TaskData taskData = new TaskData(mapper, repository.getConnectorKind(), repository.getRepositoryUrl(), "");
assertTrue(taskDataHandler.initializeTaskData(repository, taskData, null, null));
TaskAttribute attribute = taskData.getRoot().getAttribute(OSIORestTaskSchema.getDefault().SUMMARY.getKey());
assertTrue(attribute != null);
assertEquals(attribute.getValue(), "");
taskData = new TaskData(mapper, repository.getConnectorKind(), repository.getRepositoryUrl(), "");
assertTrue(taskDataHandler.initializeTaskData(repository, taskData, taskMappingInit, null));
attribute = taskData.getRoot().getAttribute(OSIORestTaskSchema.getDefault().SUMMARY.getKey());
assertEquals(attribute.getValue(), "The Summary");
attribute = taskData.getRoot().getAttribute(OSIORestTaskSchema.getDefault().DESCRIPTION.getKey());
assertEquals(attribute.getValue(), "The Description");
}
use of org.eclipse.mylyn.tasks.core.TaskMapping in project linuxtools by eclipse.
the class OSIORestHarness method getTaskIdWithSummary.
private String getTaskIdWithSummary(String summary) throws OSIORestException, CoreException {
String taskID = null;
String queryUrlString = repository().getRepositoryUrl() + "/bug?" + "short_desc=" + summary;
RepositoryQuery query = new RepositoryQuery(repository().getConnectorKind(), "handle-testQueryViaConnector");
query.setUrl(queryUrlString);
final Map<Integer, TaskData> changedTaskData = new HashMap<Integer, TaskData>();
TaskDataCollector collector = new TaskDataCollector() {
@Override
public void accept(TaskData taskData) {
changedTaskData.put(Integer.valueOf(taskData.getTaskId()), taskData);
}
};
connector().performQuery(repository(), query, collector, null, new NullProgressMonitor());
if (changedTaskData.size() > 0) {
Set<Integer> ks = changedTaskData.keySet();
SortedSet<Integer> sks = new TreeSet<Integer>(ks);
taskID = sks.last().toString();
} else {
final TaskMapping taskMappingInit = new TaskMapping() {
@Override
public String getSummary() {
return summary;
}
@Override
public String getDescription() {
return "The Description";
}
@Override
public String getProduct() {
return "ManualTest";
}
@Override
public String getComponent() {
return "ManualC1";
}
@Override
public String getVersion() {
return "R1";
}
};
taskID = getNewTaksIdFromInitMapping(taskMappingInit, taskInitializationData);
}
return taskID;
}
Aggregations