diff options
author | Frank Becker | 2015-05-14 19:19:22 +0000 |
---|---|---|
committer | Gerrit Code Review @ Eclipse.org | 2015-06-26 17:01:08 +0000 |
commit | 562ca659e9a96b7fd7cee8255961cbf5bfba1467 (patch) | |
tree | 2d616d72247333028703e874a85b6813b6c45429 | |
parent | 1e8137f8bd8a09df5252f7460cdcf3d1fa03fb84 (diff) | |
download | org.eclipse.mylyn.tasks-562ca659e9a96b7fd7cee8255961cbf5bfba1467.tar.gz org.eclipse.mylyn.tasks-562ca659e9a96b7fd7cee8255961cbf5bfba1467.tar.xz org.eclipse.mylyn.tasks-562ca659e9a96b7fd7cee8255961cbf5bfba1467.zip |
414360: add get Tasks for the new REST API
Change-Id: I8a60b4219a4949bb01f53531f89dcb83dbbd7475
Task-Url: https://bugs.eclipse.org/bugs/show_bug.cgi?id=414360
16 files changed, 553 insertions, 127 deletions
diff --git a/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core.tests/src/org/eclipse/mylyn/internal/bugzilla/rest/core/tests/BugzillaRestClientTest.java b/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core.tests/src/org/eclipse/mylyn/internal/bugzilla/rest/core/tests/BugzillaRestClientTest.java index 3116ca755..2344b658d 100644 --- a/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core.tests/src/org/eclipse/mylyn/internal/bugzilla/rest/core/tests/BugzillaRestClientTest.java +++ b/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core.tests/src/org/eclipse/mylyn/internal/bugzilla/rest/core/tests/BugzillaRestClientTest.java @@ -21,8 +21,10 @@ import java.io.IOException; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; +import java.util.HashSet; import java.util.List; import java.util.Map; +import java.util.Set; import org.apache.commons.io.IOUtils; import org.eclipse.mylyn.commons.repositories.core.RepositoryLocation; @@ -37,6 +39,7 @@ import org.eclipse.mylyn.internal.bugzilla.rest.core.BugzillaRestConnector; import org.eclipse.mylyn.internal.bugzilla.rest.core.BugzillaRestCreateTaskSchema; import org.eclipse.mylyn.internal.bugzilla.rest.core.BugzillaRestException; import org.eclipse.mylyn.internal.bugzilla.rest.core.BugzillaRestVersion; +import org.eclipse.mylyn.internal.bugzilla.rest.core.SingleTaskDataCollector; import org.eclipse.mylyn.internal.bugzilla.rest.core.response.data.Field; import org.eclipse.mylyn.internal.bugzilla.rest.core.response.data.LoginToken; import org.eclipse.mylyn.internal.bugzilla.rest.core.response.data.Parameters; @@ -341,8 +344,8 @@ public class BugzillaRestClientTest { taskData.getRoot() .getAttribute(BugzillaRestCreateTaskSchema.getDefault().TARGET_MILESTONE.getKey()) .setValue("M2"); - RepositoryResponse xx = connector.getClient(actualFixture.repository()).postTaskData(taskData, null); - assertEquals(ResponseKind.TASK_CREATED, xx.getReposonseKind()); + RepositoryResponse reposonse = connector.getClient(actualFixture.repository()).postTaskData(taskData, null); + assertEquals(ResponseKind.TASK_CREATED, reposonse.getReposonseKind()); } @Test @@ -389,7 +392,88 @@ public class BugzillaRestClientTest { TaskMapper mapper1 = new TaskMapper(taskData); connector.getTaskMapping(taskDataSubmit).merge(mapper1); - RepositoryResponse xx = connector.getClient(actualFixture.repository()).postTaskData(taskDataSubmit, null); - assertEquals(ResponseKind.TASK_CREATED, xx.getReposonseKind()); + RepositoryResponse reposonse = connector.getClient(actualFixture.repository()).postTaskData(taskDataSubmit, + null); + assertEquals(ResponseKind.TASK_CREATED, reposonse.getReposonseKind()); } + + @Test + public void testGetTaskData() throws Exception { + final TaskMapping taskMappingInit = new TaskMapping() { + @Override + public String getSummary() { + return "The 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"; + } + }; + AbstractTaskDataHandler taskDataHandler = connector.getTaskDataHandler(); + TaskAttributeMapper mapper = taskDataHandler.getAttributeMapper(actualFixture.repository()); + TaskData taskData = new TaskData(mapper, actualFixture.repository().getConnectorKind(), + actualFixture.repository().getRepositoryUrl(), ""); + taskDataHandler.initializeTaskData(actualFixture.repository(), taskData, taskMappingInit, null); + taskData.getRoot().getAttribute("cf_dropdown").setValue("one"); + taskData.getRoot() + .getAttribute(BugzillaRestCreateTaskSchema.getDefault().TARGET_MILESTONE.getKey()) + .setValue("M2"); + RepositoryResponse reposonse = connector.getClient(actualFixture.repository()).postTaskData(taskData, null); + assertEquals(ResponseKind.TASK_CREATED, reposonse.getReposonseKind()); + String taskId = reposonse.getTaskId(); + Set<String> taskIds = new HashSet<String>(); + taskIds.add(taskId); + SingleTaskDataCollector singleTaskDataCollector = new SingleTaskDataCollector(); + connector.getClient(actualFixture.repository()).getTaskData(taskIds, actualFixture.repository(), + singleTaskDataCollector, null); + TaskData taskDataGet = singleTaskDataCollector.getTaskData(); + assertNotNull(taskDataGet); + assertNotNull(taskDataGet.getRoot()); + + // actual we read no comments and so we also can not get the description + taskData.getRoot().removeAttribute("task.common.description"); + taskDataGet.getRoot().removeAttribute("task.common.description"); + + // attributes we know that they can not be equal + taskData.getRoot().removeAttribute("task.common.status"); + taskDataGet.getRoot().removeAttribute("task.common.status"); + taskData.getRoot().removeAttribute("task.common.user.assigned"); + taskDataGet.getRoot().removeAttribute("task.common.user.assigned"); + taskData.getRoot().removeAttribute("task.common.operation"); + taskDataGet.getRoot().removeAttribute("task.common.operation"); + + // attributes only in new tasks + taskData.getRoot().removeAttribute("description_is_private"); + + // attributes only in old tasks + taskDataGet.getRoot().removeAttribute("bug_id"); + taskDataGet.getRoot().removeAttribute("task.common.comment.new"); + + // attributes for operations + taskDataGet.getRoot().removeAttribute("task.common.operation-CONFIRMED"); + taskDataGet.getRoot().removeAttribute("task.common.operation-IN_PROGRESS"); + taskDataGet.getRoot().removeAttribute("task.common.operation-RESOLVED"); + taskDataGet.getRoot().removeAttribute("resolutionInput"); + taskDataGet.getRoot().removeAttribute("task.common.operation-duplicate"); + taskDataGet.getRoot().removeAttribute("dup_id"); + + assertEquals(taskData.getRoot().toString(), taskDataGet.getRoot().toString()); + } + } diff --git a/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core.tests/testdata/Version1/taskData.txt b/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core.tests/testdata/Version1/taskData.txt index 024c77784..1833e76d0 100644 --- a/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core.tests/testdata/Version1/taskData.txt +++ b/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core.tests/testdata/Version1/taskData.txt @@ -1,5 +1,5 @@ TaskAttribute[id=root,values=[],options=null,metaData=null] - TaskAttribute[id=task.common.product,values=[],options={TestProduct=TestProduct, Product with Spaces=Product with Spaces, ManualTest=ManualTest},metaData={task.meta.label=Product, task.meta.type=singleSelect, task.meta.readOnly=false, task.meta.attributeKind=task.common.kind.default, task.meta.required=true}] + TaskAttribute[id=task.common.product,values=[],options={ManualTest=ManualTest, Product with Spaces=Product with Spaces, TestProduct=TestProduct},metaData={task.meta.label=Product, task.meta.type=singleSelect, task.meta.readOnly=false, task.meta.attributeKind=task.common.kind.default, task.meta.required=true}] TaskAttribute[id=task.common.component,values=[],options={TestComponent=TestComponent, Component 1=Component 1, Component 2=Component 2, ManualC1=ManualC1, ManualC2=ManualC2},metaData={task.meta.label=Component, task.meta.type=singleSelect, task.meta.readOnly=false, task.meta.attributeKind=task.common.kind.default, task.meta.required=true, task.meta.dependson.attribute=task.common.product}] TaskAttribute[id=task.common.summary,values=[],options=null,metaData={task.meta.label=Summary, task.meta.type=shortRichText, task.meta.readOnly=false, task.meta.required=true}] TaskAttribute[id=task.common.version,values=[],options={unspecified=unspecified, a=a, b=b, c=c, R1=R1, R1.1=R1.1, R2.0=R2.0},metaData={task.meta.label=Version, task.meta.type=singleSelect, task.meta.readOnly=false, task.meta.attributeKind=task.common.kind.default, task.meta.required=true, task.meta.dependson.attribute=task.common.product}] @@ -8,16 +8,16 @@ TaskAttribute[id=root,values=[],options=null,metaData=null] TaskAttribute[id=platform,values=[All],options={All=All, PC=PC, Macintosh=Macintosh, Other=Other},metaData={task.meta.label=Platform, task.meta.type=singleSelect, task.meta.readOnly=false, task.meta.attributeKind=task.common.kind.default, task.meta.required=false}] TaskAttribute[id=task.common.priority,values=[---],options={Highest=Highest, High=High, Normal=Normal, Low=Low, Lowest=Lowest, ---=---},metaData={task.meta.label=Priority, task.meta.type=singleSelect, task.meta.readOnly=false, task.meta.attributeKind=task.common.kind.default, task.meta.required=false}] TaskAttribute[id=task.common.severity,values=[enhancement],options={blocker=blocker, critical=critical, major=major, normal=normal, minor=minor, trivial=trivial, enhancement=enhancement},metaData={task.meta.label=Severity, task.meta.type=singleSelect, task.meta.readOnly=false, task.meta.attributeKind=task.common.kind.default, task.meta.required=false}] + TaskAttribute[id=task.common.status,values=[],options={UNCONFIRMED=UNCONFIRMED, CONFIRMED=CONFIRMED, IN_PROGRESS=IN_PROGRESS},metaData={task.meta.label=Status, task.meta.type=shortText, task.meta.readOnly=true, task.meta.required=false}] TaskAttribute[id=alias,values=[],options=null,metaData={task.meta.label=Alias, task.meta.type=shortText, task.meta.readOnly=false, task.meta.attributeKind=task.common.kind.default, task.meta.required=false}] TaskAttribute[id=task.common.user.assigned,values=[],options=null,metaData={task.meta.label=Assigned to, task.meta.type=person, task.meta.readOnly=false, task.meta.attributeKind=task.common.kind.people, task.meta.required=false, task.meta.dependson.attribute=task.common.component}] TaskAttribute[id=task.common.user.cc,values=[],options=null,metaData={task.meta.label=CC, task.meta.type=person, task.meta.readOnly=false, task.meta.attributeKind=task.common.kind.people, task.meta.required=false}] TaskAttribute[id=task.common.addselfcc,values=[],options=null,metaData={task.meta.label=Add Self to CC, task.meta.type=boolean, task.meta.readOnly=false, task.meta.attributeKind=task.common.kind.people, task.meta.required=false}] - TaskAttribute[id=comment_is_private,values=[],options=null,metaData={task.meta.label=Description is private, task.meta.type=boolean, task.meta.readOnly=false, task.meta.attributeKind=task.common.kind.default, task.meta.required=false}] + TaskAttribute[id=description_is_private,values=[],options=null,metaData={task.meta.label=Description is private, task.meta.type=boolean, task.meta.readOnly=false, task.meta.attributeKind=task.common.kind.default, task.meta.required=false}] TaskAttribute[id=qa_contact,values=[],options=null,metaData={task.meta.label=QA Contact, task.meta.type=person, task.meta.readOnly=false, task.meta.attributeKind=task.common.kind.people, task.meta.required=false, task.meta.dependson.attribute=task.common.component}] - TaskAttribute[id=target_milestone,values=[],options={---=---, M1=M1, M1.0=M1.0, M2=M2, M2.0=M2.0, M3=M3, M3.0=M3.0},metaData={task.meta.label=Target milestone, task.meta.type=singleSelect, task.meta.readOnly=false, task.meta.attributeKind=task.common.kind.default, task.meta.required=false, task.meta.dependson.attribute=task.common.product}] + TaskAttribute[id=target_milestone,values=[],options={---=---, M1=M1, M1.0=M1.0, M2=M2, M2.0=M2.0, M3=M3, M3.0=M3.0},metaData={task.meta.label=Target milestone, task.meta.type=singleSelect, task.meta.readOnly=false, task.meta.attributeKind=task.common.kind.default, task.meta.required=true, task.meta.dependson.attribute=task.common.product}] TaskAttribute[id=task.common.resolution,values=[],options={=, FIXED=FIXED, INVALID=INVALID, WONTFIX=WONTFIX, DUPLICATE=DUPLICATE, WORKSFORME=WORKSFORME},metaData={task.meta.label=Resolution, task.meta.type=singleSelect, task.meta.readOnly=true, task.meta.required=false}] TaskAttribute[id=task.common.operation,values=[],options=null,metaData={task.meta.label=Operation, task.meta.type=operation, task.meta.readOnly=false, task.meta.required=false}] - TaskAttribute[id=task.common.status,values=[],options={UNCONFIRMED=UNCONFIRMED, CONFIRMED=CONFIRMED, IN_PROGRESS=IN_PROGRESS},metaData={task.meta.label=Status, task.meta.type=shortText, task.meta.readOnly=true, task.meta.required=false}] TaskAttribute[id=cf_bugid,values=[],options=null,metaData={task.meta.readOnly=false, task.meta.type=integer, task.meta.required=false, task.meta.label=bug id custom field, task.meta.attributeKind=task.common.kind.default}] TaskAttribute[id=cf_datetime,values=[],options=null,metaData={task.meta.readOnly=false, task.meta.type=dateTime, task.meta.required=false, task.meta.label=date time custom field, task.meta.attributeKind=task.common.kind.default}] TaskAttribute[id=cf_dropdown,values=[],options={---=---, one=one, three=three, two=two},metaData={task.meta.readOnly=false, task.meta.type=singleSelect, task.meta.required=true, task.meta.label=drop down custom field, task.meta.attributeKind=task.common.kind.default}] diff --git a/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core.tests/testdata/Version1/taskData1.txt b/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core.tests/testdata/Version1/taskData1.txt index 93fb7ef4f..1d246fbbc 100644 --- a/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core.tests/testdata/Version1/taskData1.txt +++ b/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core.tests/testdata/Version1/taskData1.txt @@ -1,5 +1,5 @@ TaskAttribute[id=root,values=[],options=null,metaData=null] - TaskAttribute[id=task.common.product,values=[],options={TestProduct=TestProduct, Product with Spaces=Product with Spaces, ManualTest=ManualTest},metaData={task.meta.label=Product, task.meta.type=singleSelect, task.meta.readOnly=false, task.meta.attributeKind=task.common.kind.default, task.meta.required=true}] + TaskAttribute[id=task.common.product,values=[],options={ManualTest=ManualTest, Product with Spaces=Product with Spaces, TestProduct=TestProduct},metaData={task.meta.label=Product, task.meta.type=singleSelect, task.meta.readOnly=false, task.meta.attributeKind=task.common.kind.default, task.meta.required=true}] TaskAttribute[id=task.common.component,values=[],options={TestComponent=TestComponent, Component 1=Component 1, Component 2=Component 2, ManualC1=ManualC1, ManualC2=ManualC2},metaData={task.meta.label=Component, task.meta.type=singleSelect, task.meta.readOnly=false, task.meta.attributeKind=task.common.kind.default, task.meta.required=true, task.meta.dependson.attribute=task.common.product}] TaskAttribute[id=task.common.summary,values=[The Summary],options=null,metaData={task.meta.label=Summary, task.meta.type=shortRichText, task.meta.readOnly=false, task.meta.required=true}] TaskAttribute[id=task.common.version,values=[],options={unspecified=unspecified, a=a, b=b, c=c, R1=R1, R1.1=R1.1, R2.0=R2.0},metaData={task.meta.label=Version, task.meta.type=singleSelect, task.meta.readOnly=false, task.meta.attributeKind=task.common.kind.default, task.meta.required=true, task.meta.dependson.attribute=task.common.product}] @@ -8,16 +8,16 @@ TaskAttribute[id=root,values=[],options=null,metaData=null] TaskAttribute[id=platform,values=[All],options={All=All, PC=PC, Macintosh=Macintosh, Other=Other},metaData={task.meta.label=Platform, task.meta.type=singleSelect, task.meta.readOnly=false, task.meta.attributeKind=task.common.kind.default, task.meta.required=false}] TaskAttribute[id=task.common.priority,values=[---],options={Highest=Highest, High=High, Normal=Normal, Low=Low, Lowest=Lowest, ---=---},metaData={task.meta.label=Priority, task.meta.type=singleSelect, task.meta.readOnly=false, task.meta.attributeKind=task.common.kind.default, task.meta.required=false}] TaskAttribute[id=task.common.severity,values=[enhancement],options={blocker=blocker, critical=critical, major=major, normal=normal, minor=minor, trivial=trivial, enhancement=enhancement},metaData={task.meta.label=Severity, task.meta.type=singleSelect, task.meta.readOnly=false, task.meta.attributeKind=task.common.kind.default, task.meta.required=false}] + TaskAttribute[id=task.common.status,values=[],options={UNCONFIRMED=UNCONFIRMED, CONFIRMED=CONFIRMED, IN_PROGRESS=IN_PROGRESS},metaData={task.meta.label=Status, task.meta.type=shortText, task.meta.readOnly=true, task.meta.required=false}] TaskAttribute[id=alias,values=[],options=null,metaData={task.meta.label=Alias, task.meta.type=shortText, task.meta.readOnly=false, task.meta.attributeKind=task.common.kind.default, task.meta.required=false}] TaskAttribute[id=task.common.user.assigned,values=[],options=null,metaData={task.meta.label=Assigned to, task.meta.type=person, task.meta.readOnly=false, task.meta.attributeKind=task.common.kind.people, task.meta.required=false, task.meta.dependson.attribute=task.common.component}] TaskAttribute[id=task.common.user.cc,values=[],options=null,metaData={task.meta.label=CC, task.meta.type=person, task.meta.readOnly=false, task.meta.attributeKind=task.common.kind.people, task.meta.required=false}] TaskAttribute[id=task.common.addselfcc,values=[],options=null,metaData={task.meta.label=Add Self to CC, task.meta.type=boolean, task.meta.readOnly=false, task.meta.attributeKind=task.common.kind.people, task.meta.required=false}] - TaskAttribute[id=comment_is_private,values=[],options=null,metaData={task.meta.label=Description is private, task.meta.type=boolean, task.meta.readOnly=false, task.meta.attributeKind=task.common.kind.default, task.meta.required=false}] + TaskAttribute[id=description_is_private,values=[],options=null,metaData={task.meta.label=Description is private, task.meta.type=boolean, task.meta.readOnly=false, task.meta.attributeKind=task.common.kind.default, task.meta.required=false}] TaskAttribute[id=qa_contact,values=[],options=null,metaData={task.meta.label=QA Contact, task.meta.type=person, task.meta.readOnly=false, task.meta.attributeKind=task.common.kind.people, task.meta.required=false, task.meta.dependson.attribute=task.common.component}] - TaskAttribute[id=target_milestone,values=[],options={---=---, M1=M1, M1.0=M1.0, M2=M2, M2.0=M2.0, M3=M3, M3.0=M3.0},metaData={task.meta.label=Target milestone, task.meta.type=singleSelect, task.meta.readOnly=false, task.meta.attributeKind=task.common.kind.default, task.meta.required=false, task.meta.dependson.attribute=task.common.product}] + TaskAttribute[id=target_milestone,values=[],options={---=---, M1=M1, M1.0=M1.0, M2=M2, M2.0=M2.0, M3=M3, M3.0=M3.0},metaData={task.meta.label=Target milestone, task.meta.type=singleSelect, task.meta.readOnly=false, task.meta.attributeKind=task.common.kind.default, task.meta.required=true, task.meta.dependson.attribute=task.common.product}] TaskAttribute[id=task.common.resolution,values=[],options={=, FIXED=FIXED, INVALID=INVALID, WONTFIX=WONTFIX, DUPLICATE=DUPLICATE, WORKSFORME=WORKSFORME},metaData={task.meta.label=Resolution, task.meta.type=singleSelect, task.meta.readOnly=true, task.meta.required=false}] TaskAttribute[id=task.common.operation,values=[],options=null,metaData={task.meta.label=Operation, task.meta.type=operation, task.meta.readOnly=false, task.meta.required=false}] - TaskAttribute[id=task.common.status,values=[],options={UNCONFIRMED=UNCONFIRMED, CONFIRMED=CONFIRMED, IN_PROGRESS=IN_PROGRESS},metaData={task.meta.label=Status, task.meta.type=shortText, task.meta.readOnly=true, task.meta.required=false}] TaskAttribute[id=cf_bugid,values=[],options=null,metaData={task.meta.readOnly=false, task.meta.type=integer, task.meta.required=false, task.meta.label=bug id custom field, task.meta.attributeKind=task.common.kind.default}] TaskAttribute[id=cf_datetime,values=[],options=null,metaData={task.meta.readOnly=false, task.meta.type=dateTime, task.meta.required=false, task.meta.label=date time custom field, task.meta.attributeKind=task.common.kind.default}] TaskAttribute[id=cf_dropdown,values=[],options={---=---, one=one, three=three, two=two},metaData={task.meta.readOnly=false, task.meta.type=singleSelect, task.meta.required=true, task.meta.label=drop down custom field, task.meta.attributeKind=task.common.kind.default}] diff --git a/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core.tests/testdata/Version1/taskData2.txt b/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core.tests/testdata/Version1/taskData2.txt index 196328e57..2ab2142ca 100644 --- a/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core.tests/testdata/Version1/taskData2.txt +++ b/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core.tests/testdata/Version1/taskData2.txt @@ -1,5 +1,5 @@ TaskAttribute[id=root,values=[],options=null,metaData=null] - TaskAttribute[id=task.common.product,values=[TestProduct],options={TestProduct=TestProduct, Product with Spaces=Product with Spaces, ManualTest=ManualTest},metaData={task.meta.label=Product, task.meta.type=singleSelect, task.meta.readOnly=false, task.meta.attributeKind=task.common.kind.default, task.meta.required=true}] + TaskAttribute[id=task.common.product,values=[TestProduct],options={ManualTest=ManualTest, Product with Spaces=Product with Spaces, TestProduct=TestProduct},metaData={task.meta.label=Product, task.meta.type=singleSelect, task.meta.readOnly=false, task.meta.attributeKind=task.common.kind.default, task.meta.required=true}] TaskAttribute[id=task.common.component,values=[TestComponent],options={TestComponent=TestComponent},metaData={task.meta.label=Component, task.meta.type=singleSelect, task.meta.readOnly=false, task.meta.attributeKind=task.common.kind.default, task.meta.required=true, task.meta.dependson.attribute=task.common.product}] TaskAttribute[id=task.common.summary,values=[],options=null,metaData={task.meta.label=Summary, task.meta.type=shortRichText, task.meta.readOnly=false, task.meta.required=true}] TaskAttribute[id=task.common.version,values=[unspecified],options={unspecified=unspecified},metaData={task.meta.label=Version, task.meta.type=singleSelect, task.meta.readOnly=false, task.meta.attributeKind=task.common.kind.default, task.meta.required=true, task.meta.dependson.attribute=task.common.product}] @@ -8,16 +8,16 @@ TaskAttribute[id=root,values=[],options=null,metaData=null] TaskAttribute[id=platform,values=[All],options={All=All, PC=PC, Macintosh=Macintosh, Other=Other},metaData={task.meta.label=Platform, task.meta.type=singleSelect, task.meta.readOnly=false, task.meta.attributeKind=task.common.kind.default, task.meta.required=false}] TaskAttribute[id=task.common.priority,values=[---],options={Highest=Highest, High=High, Normal=Normal, Low=Low, Lowest=Lowest, ---=---},metaData={task.meta.label=Priority, task.meta.type=singleSelect, task.meta.readOnly=false, task.meta.attributeKind=task.common.kind.default, task.meta.required=false}] TaskAttribute[id=task.common.severity,values=[enhancement],options={blocker=blocker, critical=critical, major=major, normal=normal, minor=minor, trivial=trivial, enhancement=enhancement},metaData={task.meta.label=Severity, task.meta.type=singleSelect, task.meta.readOnly=false, task.meta.attributeKind=task.common.kind.default, task.meta.required=false}] + TaskAttribute[id=task.common.status,values=[],options={UNCONFIRMED=UNCONFIRMED, CONFIRMED=CONFIRMED, IN_PROGRESS=IN_PROGRESS},metaData={task.meta.label=Status, task.meta.type=shortText, task.meta.readOnly=true, task.meta.required=false}] TaskAttribute[id=alias,values=[],options=null,metaData={task.meta.label=Alias, task.meta.type=shortText, task.meta.readOnly=false, task.meta.attributeKind=task.common.kind.default, task.meta.required=false}] TaskAttribute[id=task.common.user.assigned,values=[],options=null,metaData={task.meta.label=Assigned to, task.meta.type=person, task.meta.readOnly=false, task.meta.attributeKind=task.common.kind.people, task.meta.required=false, task.meta.dependson.attribute=task.common.component}] TaskAttribute[id=task.common.user.cc,values=[],options=null,metaData={task.meta.label=CC, task.meta.type=person, task.meta.readOnly=false, task.meta.attributeKind=task.common.kind.people, task.meta.required=false}] TaskAttribute[id=task.common.addselfcc,values=[],options=null,metaData={task.meta.label=Add Self to CC, task.meta.type=boolean, task.meta.readOnly=false, task.meta.attributeKind=task.common.kind.people, task.meta.required=false}] - TaskAttribute[id=comment_is_private,values=[],options=null,metaData={task.meta.label=Description is private, task.meta.type=boolean, task.meta.readOnly=false, task.meta.attributeKind=task.common.kind.default, task.meta.required=false}] + TaskAttribute[id=description_is_private,values=[],options=null,metaData={task.meta.label=Description is private, task.meta.type=boolean, task.meta.readOnly=false, task.meta.attributeKind=task.common.kind.default, task.meta.required=false}] TaskAttribute[id=qa_contact,values=[],options=null,metaData={task.meta.label=QA Contact, task.meta.type=person, task.meta.readOnly=false, task.meta.attributeKind=task.common.kind.people, task.meta.required=false, task.meta.dependson.attribute=task.common.component}] - TaskAttribute[id=target_milestone,values=[---],options={---=---},metaData={task.meta.label=Target milestone, task.meta.type=singleSelect, task.meta.readOnly=false, task.meta.attributeKind=task.common.kind.default, task.meta.required=false, task.meta.dependson.attribute=task.common.product}] + TaskAttribute[id=target_milestone,values=[---],options={---=---},metaData={task.meta.label=Target milestone, task.meta.type=singleSelect, task.meta.readOnly=false, task.meta.attributeKind=task.common.kind.default, task.meta.required=true, task.meta.dependson.attribute=task.common.product}] TaskAttribute[id=task.common.resolution,values=[],options={=, FIXED=FIXED, INVALID=INVALID, WONTFIX=WONTFIX, DUPLICATE=DUPLICATE, WORKSFORME=WORKSFORME},metaData={task.meta.label=Resolution, task.meta.type=singleSelect, task.meta.readOnly=true, task.meta.required=false}] TaskAttribute[id=task.common.operation,values=[],options=null,metaData={task.meta.label=Operation, task.meta.type=operation, task.meta.readOnly=false, task.meta.required=false}] - TaskAttribute[id=task.common.status,values=[],options={UNCONFIRMED=UNCONFIRMED, CONFIRMED=CONFIRMED, IN_PROGRESS=IN_PROGRESS},metaData={task.meta.label=Status, task.meta.type=shortText, task.meta.readOnly=true, task.meta.required=false}] TaskAttribute[id=cf_bugid,values=[],options=null,metaData={task.meta.readOnly=false, task.meta.type=integer, task.meta.required=false, task.meta.label=bug id custom field, task.meta.attributeKind=task.common.kind.default}] TaskAttribute[id=cf_datetime,values=[],options=null,metaData={task.meta.readOnly=false, task.meta.type=dateTime, task.meta.required=false, task.meta.label=date time custom field, task.meta.attributeKind=task.common.kind.default}] TaskAttribute[id=cf_dropdown,values=[],options={---=---, one=one, three=three, two=two},metaData={task.meta.readOnly=false, task.meta.type=singleSelect, task.meta.required=true, task.meta.label=drop down custom field, task.meta.attributeKind=task.common.kind.default}] diff --git a/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core.tests/testdata/Version2/taskData.txt b/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core.tests/testdata/Version2/taskData.txt index 024c77784..1833e76d0 100644 --- a/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core.tests/testdata/Version2/taskData.txt +++ b/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core.tests/testdata/Version2/taskData.txt @@ -1,5 +1,5 @@ TaskAttribute[id=root,values=[],options=null,metaData=null] - TaskAttribute[id=task.common.product,values=[],options={TestProduct=TestProduct, Product with Spaces=Product with Spaces, ManualTest=ManualTest},metaData={task.meta.label=Product, task.meta.type=singleSelect, task.meta.readOnly=false, task.meta.attributeKind=task.common.kind.default, task.meta.required=true}] + TaskAttribute[id=task.common.product,values=[],options={ManualTest=ManualTest, Product with Spaces=Product with Spaces, TestProduct=TestProduct},metaData={task.meta.label=Product, task.meta.type=singleSelect, task.meta.readOnly=false, task.meta.attributeKind=task.common.kind.default, task.meta.required=true}] TaskAttribute[id=task.common.component,values=[],options={TestComponent=TestComponent, Component 1=Component 1, Component 2=Component 2, ManualC1=ManualC1, ManualC2=ManualC2},metaData={task.meta.label=Component, task.meta.type=singleSelect, task.meta.readOnly=false, task.meta.attributeKind=task.common.kind.default, task.meta.required=true, task.meta.dependson.attribute=task.common.product}] TaskAttribute[id=task.common.summary,values=[],options=null,metaData={task.meta.label=Summary, task.meta.type=shortRichText, task.meta.readOnly=false, task.meta.required=true}] TaskAttribute[id=task.common.version,values=[],options={unspecified=unspecified, a=a, b=b, c=c, R1=R1, R1.1=R1.1, R2.0=R2.0},metaData={task.meta.label=Version, task.meta.type=singleSelect, task.meta.readOnly=false, task.meta.attributeKind=task.common.kind.default, task.meta.required=true, task.meta.dependson.attribute=task.common.product}] @@ -8,16 +8,16 @@ TaskAttribute[id=root,values=[],options=null,metaData=null] TaskAttribute[id=platform,values=[All],options={All=All, PC=PC, Macintosh=Macintosh, Other=Other},metaData={task.meta.label=Platform, task.meta.type=singleSelect, task.meta.readOnly=false, task.meta.attributeKind=task.common.kind.default, task.meta.required=false}] TaskAttribute[id=task.common.priority,values=[---],options={Highest=Highest, High=High, Normal=Normal, Low=Low, Lowest=Lowest, ---=---},metaData={task.meta.label=Priority, task.meta.type=singleSelect, task.meta.readOnly=false, task.meta.attributeKind=task.common.kind.default, task.meta.required=false}] TaskAttribute[id=task.common.severity,values=[enhancement],options={blocker=blocker, critical=critical, major=major, normal=normal, minor=minor, trivial=trivial, enhancement=enhancement},metaData={task.meta.label=Severity, task.meta.type=singleSelect, task.meta.readOnly=false, task.meta.attributeKind=task.common.kind.default, task.meta.required=false}] + TaskAttribute[id=task.common.status,values=[],options={UNCONFIRMED=UNCONFIRMED, CONFIRMED=CONFIRMED, IN_PROGRESS=IN_PROGRESS},metaData={task.meta.label=Status, task.meta.type=shortText, task.meta.readOnly=true, task.meta.required=false}] TaskAttribute[id=alias,values=[],options=null,metaData={task.meta.label=Alias, task.meta.type=shortText, task.meta.readOnly=false, task.meta.attributeKind=task.common.kind.default, task.meta.required=false}] TaskAttribute[id=task.common.user.assigned,values=[],options=null,metaData={task.meta.label=Assigned to, task.meta.type=person, task.meta.readOnly=false, task.meta.attributeKind=task.common.kind.people, task.meta.required=false, task.meta.dependson.attribute=task.common.component}] TaskAttribute[id=task.common.user.cc,values=[],options=null,metaData={task.meta.label=CC, task.meta.type=person, task.meta.readOnly=false, task.meta.attributeKind=task.common.kind.people, task.meta.required=false}] TaskAttribute[id=task.common.addselfcc,values=[],options=null,metaData={task.meta.label=Add Self to CC, task.meta.type=boolean, task.meta.readOnly=false, task.meta.attributeKind=task.common.kind.people, task.meta.required=false}] - TaskAttribute[id=comment_is_private,values=[],options=null,metaData={task.meta.label=Description is private, task.meta.type=boolean, task.meta.readOnly=false, task.meta.attributeKind=task.common.kind.default, task.meta.required=false}] + TaskAttribute[id=description_is_private,values=[],options=null,metaData={task.meta.label=Description is private, task.meta.type=boolean, task.meta.readOnly=false, task.meta.attributeKind=task.common.kind.default, task.meta.required=false}] TaskAttribute[id=qa_contact,values=[],options=null,metaData={task.meta.label=QA Contact, task.meta.type=person, task.meta.readOnly=false, task.meta.attributeKind=task.common.kind.people, task.meta.required=false, task.meta.dependson.attribute=task.common.component}] - TaskAttribute[id=target_milestone,values=[],options={---=---, M1=M1, M1.0=M1.0, M2=M2, M2.0=M2.0, M3=M3, M3.0=M3.0},metaData={task.meta.label=Target milestone, task.meta.type=singleSelect, task.meta.readOnly=false, task.meta.attributeKind=task.common.kind.default, task.meta.required=false, task.meta.dependson.attribute=task.common.product}] + TaskAttribute[id=target_milestone,values=[],options={---=---, M1=M1, M1.0=M1.0, M2=M2, M2.0=M2.0, M3=M3, M3.0=M3.0},metaData={task.meta.label=Target milestone, task.meta.type=singleSelect, task.meta.readOnly=false, task.meta.attributeKind=task.common.kind.default, task.meta.required=true, task.meta.dependson.attribute=task.common.product}] TaskAttribute[id=task.common.resolution,values=[],options={=, FIXED=FIXED, INVALID=INVALID, WONTFIX=WONTFIX, DUPLICATE=DUPLICATE, WORKSFORME=WORKSFORME},metaData={task.meta.label=Resolution, task.meta.type=singleSelect, task.meta.readOnly=true, task.meta.required=false}] TaskAttribute[id=task.common.operation,values=[],options=null,metaData={task.meta.label=Operation, task.meta.type=operation, task.meta.readOnly=false, task.meta.required=false}] - TaskAttribute[id=task.common.status,values=[],options={UNCONFIRMED=UNCONFIRMED, CONFIRMED=CONFIRMED, IN_PROGRESS=IN_PROGRESS},metaData={task.meta.label=Status, task.meta.type=shortText, task.meta.readOnly=true, task.meta.required=false}] TaskAttribute[id=cf_bugid,values=[],options=null,metaData={task.meta.readOnly=false, task.meta.type=integer, task.meta.required=false, task.meta.label=bug id custom field, task.meta.attributeKind=task.common.kind.default}] TaskAttribute[id=cf_datetime,values=[],options=null,metaData={task.meta.readOnly=false, task.meta.type=dateTime, task.meta.required=false, task.meta.label=date time custom field, task.meta.attributeKind=task.common.kind.default}] TaskAttribute[id=cf_dropdown,values=[],options={---=---, one=one, three=three, two=two},metaData={task.meta.readOnly=false, task.meta.type=singleSelect, task.meta.required=true, task.meta.label=drop down custom field, task.meta.attributeKind=task.common.kind.default}] diff --git a/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core.tests/testdata/Version2/taskData1.txt b/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core.tests/testdata/Version2/taskData1.txt index 93fb7ef4f..1d246fbbc 100644 --- a/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core.tests/testdata/Version2/taskData1.txt +++ b/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core.tests/testdata/Version2/taskData1.txt @@ -1,5 +1,5 @@ TaskAttribute[id=root,values=[],options=null,metaData=null] - TaskAttribute[id=task.common.product,values=[],options={TestProduct=TestProduct, Product with Spaces=Product with Spaces, ManualTest=ManualTest},metaData={task.meta.label=Product, task.meta.type=singleSelect, task.meta.readOnly=false, task.meta.attributeKind=task.common.kind.default, task.meta.required=true}] + TaskAttribute[id=task.common.product,values=[],options={ManualTest=ManualTest, Product with Spaces=Product with Spaces, TestProduct=TestProduct},metaData={task.meta.label=Product, task.meta.type=singleSelect, task.meta.readOnly=false, task.meta.attributeKind=task.common.kind.default, task.meta.required=true}] TaskAttribute[id=task.common.component,values=[],options={TestComponent=TestComponent, Component 1=Component 1, Component 2=Component 2, ManualC1=ManualC1, ManualC2=ManualC2},metaData={task.meta.label=Component, task.meta.type=singleSelect, task.meta.readOnly=false, task.meta.attributeKind=task.common.kind.default, task.meta.required=true, task.meta.dependson.attribute=task.common.product}] TaskAttribute[id=task.common.summary,values=[The Summary],options=null,metaData={task.meta.label=Summary, task.meta.type=shortRichText, task.meta.readOnly=false, task.meta.required=true}] TaskAttribute[id=task.common.version,values=[],options={unspecified=unspecified, a=a, b=b, c=c, R1=R1, R1.1=R1.1, R2.0=R2.0},metaData={task.meta.label=Version, task.meta.type=singleSelect, task.meta.readOnly=false, task.meta.attributeKind=task.common.kind.default, task.meta.required=true, task.meta.dependson.attribute=task.common.product}] @@ -8,16 +8,16 @@ TaskAttribute[id=root,values=[],options=null,metaData=null] TaskAttribute[id=platform,values=[All],options={All=All, PC=PC, Macintosh=Macintosh, Other=Other},metaData={task.meta.label=Platform, task.meta.type=singleSelect, task.meta.readOnly=false, task.meta.attributeKind=task.common.kind.default, task.meta.required=false}] TaskAttribute[id=task.common.priority,values=[---],options={Highest=Highest, High=High, Normal=Normal, Low=Low, Lowest=Lowest, ---=---},metaData={task.meta.label=Priority, task.meta.type=singleSelect, task.meta.readOnly=false, task.meta.attributeKind=task.common.kind.default, task.meta.required=false}] TaskAttribute[id=task.common.severity,values=[enhancement],options={blocker=blocker, critical=critical, major=major, normal=normal, minor=minor, trivial=trivial, enhancement=enhancement},metaData={task.meta.label=Severity, task.meta.type=singleSelect, task.meta.readOnly=false, task.meta.attributeKind=task.common.kind.default, task.meta.required=false}] + TaskAttribute[id=task.common.status,values=[],options={UNCONFIRMED=UNCONFIRMED, CONFIRMED=CONFIRMED, IN_PROGRESS=IN_PROGRESS},metaData={task.meta.label=Status, task.meta.type=shortText, task.meta.readOnly=true, task.meta.required=false}] TaskAttribute[id=alias,values=[],options=null,metaData={task.meta.label=Alias, task.meta.type=shortText, task.meta.readOnly=false, task.meta.attributeKind=task.common.kind.default, task.meta.required=false}] TaskAttribute[id=task.common.user.assigned,values=[],options=null,metaData={task.meta.label=Assigned to, task.meta.type=person, task.meta.readOnly=false, task.meta.attributeKind=task.common.kind.people, task.meta.required=false, task.meta.dependson.attribute=task.common.component}] TaskAttribute[id=task.common.user.cc,values=[],options=null,metaData={task.meta.label=CC, task.meta.type=person, task.meta.readOnly=false, task.meta.attributeKind=task.common.kind.people, task.meta.required=false}] TaskAttribute[id=task.common.addselfcc,values=[],options=null,metaData={task.meta.label=Add Self to CC, task.meta.type=boolean, task.meta.readOnly=false, task.meta.attributeKind=task.common.kind.people, task.meta.required=false}] - TaskAttribute[id=comment_is_private,values=[],options=null,metaData={task.meta.label=Description is private, task.meta.type=boolean, task.meta.readOnly=false, task.meta.attributeKind=task.common.kind.default, task.meta.required=false}] + TaskAttribute[id=description_is_private,values=[],options=null,metaData={task.meta.label=Description is private, task.meta.type=boolean, task.meta.readOnly=false, task.meta.attributeKind=task.common.kind.default, task.meta.required=false}] TaskAttribute[id=qa_contact,values=[],options=null,metaData={task.meta.label=QA Contact, task.meta.type=person, task.meta.readOnly=false, task.meta.attributeKind=task.common.kind.people, task.meta.required=false, task.meta.dependson.attribute=task.common.component}] - TaskAttribute[id=target_milestone,values=[],options={---=---, M1=M1, M1.0=M1.0, M2=M2, M2.0=M2.0, M3=M3, M3.0=M3.0},metaData={task.meta.label=Target milestone, task.meta.type=singleSelect, task.meta.readOnly=false, task.meta.attributeKind=task.common.kind.default, task.meta.required=false, task.meta.dependson.attribute=task.common.product}] + TaskAttribute[id=target_milestone,values=[],options={---=---, M1=M1, M1.0=M1.0, M2=M2, M2.0=M2.0, M3=M3, M3.0=M3.0},metaData={task.meta.label=Target milestone, task.meta.type=singleSelect, task.meta.readOnly=false, task.meta.attributeKind=task.common.kind.default, task.meta.required=true, task.meta.dependson.attribute=task.common.product}] TaskAttribute[id=task.common.resolution,values=[],options={=, FIXED=FIXED, INVALID=INVALID, WONTFIX=WONTFIX, DUPLICATE=DUPLICATE, WORKSFORME=WORKSFORME},metaData={task.meta.label=Resolution, task.meta.type=singleSelect, task.meta.readOnly=true, task.meta.required=false}] TaskAttribute[id=task.common.operation,values=[],options=null,metaData={task.meta.label=Operation, task.meta.type=operation, task.meta.readOnly=false, task.meta.required=false}] - TaskAttribute[id=task.common.status,values=[],options={UNCONFIRMED=UNCONFIRMED, CONFIRMED=CONFIRMED, IN_PROGRESS=IN_PROGRESS},metaData={task.meta.label=Status, task.meta.type=shortText, task.meta.readOnly=true, task.meta.required=false}] TaskAttribute[id=cf_bugid,values=[],options=null,metaData={task.meta.readOnly=false, task.meta.type=integer, task.meta.required=false, task.meta.label=bug id custom field, task.meta.attributeKind=task.common.kind.default}] TaskAttribute[id=cf_datetime,values=[],options=null,metaData={task.meta.readOnly=false, task.meta.type=dateTime, task.meta.required=false, task.meta.label=date time custom field, task.meta.attributeKind=task.common.kind.default}] TaskAttribute[id=cf_dropdown,values=[],options={---=---, one=one, three=three, two=two},metaData={task.meta.readOnly=false, task.meta.type=singleSelect, task.meta.required=true, task.meta.label=drop down custom field, task.meta.attributeKind=task.common.kind.default}] diff --git a/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core.tests/testdata/Version2/taskData2.txt b/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core.tests/testdata/Version2/taskData2.txt index 196328e57..2ab2142ca 100644 --- a/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core.tests/testdata/Version2/taskData2.txt +++ b/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core.tests/testdata/Version2/taskData2.txt @@ -1,5 +1,5 @@ TaskAttribute[id=root,values=[],options=null,metaData=null] - TaskAttribute[id=task.common.product,values=[TestProduct],options={TestProduct=TestProduct, Product with Spaces=Product with Spaces, ManualTest=ManualTest},metaData={task.meta.label=Product, task.meta.type=singleSelect, task.meta.readOnly=false, task.meta.attributeKind=task.common.kind.default, task.meta.required=true}] + TaskAttribute[id=task.common.product,values=[TestProduct],options={ManualTest=ManualTest, Product with Spaces=Product with Spaces, TestProduct=TestProduct},metaData={task.meta.label=Product, task.meta.type=singleSelect, task.meta.readOnly=false, task.meta.attributeKind=task.common.kind.default, task.meta.required=true}] TaskAttribute[id=task.common.component,values=[TestComponent],options={TestComponent=TestComponent},metaData={task.meta.label=Component, task.meta.type=singleSelect, task.meta.readOnly=false, task.meta.attributeKind=task.common.kind.default, task.meta.required=true, task.meta.dependson.attribute=task.common.product}] TaskAttribute[id=task.common.summary,values=[],options=null,metaData={task.meta.label=Summary, task.meta.type=shortRichText, task.meta.readOnly=false, task.meta.required=true}] TaskAttribute[id=task.common.version,values=[unspecified],options={unspecified=unspecified},metaData={task.meta.label=Version, task.meta.type=singleSelect, task.meta.readOnly=false, task.meta.attributeKind=task.common.kind.default, task.meta.required=true, task.meta.dependson.attribute=task.common.product}] @@ -8,16 +8,16 @@ TaskAttribute[id=root,values=[],options=null,metaData=null] TaskAttribute[id=platform,values=[All],options={All=All, PC=PC, Macintosh=Macintosh, Other=Other},metaData={task.meta.label=Platform, task.meta.type=singleSelect, task.meta.readOnly=false, task.meta.attributeKind=task.common.kind.default, task.meta.required=false}] TaskAttribute[id=task.common.priority,values=[---],options={Highest=Highest, High=High, Normal=Normal, Low=Low, Lowest=Lowest, ---=---},metaData={task.meta.label=Priority, task.meta.type=singleSelect, task.meta.readOnly=false, task.meta.attributeKind=task.common.kind.default, task.meta.required=false}] TaskAttribute[id=task.common.severity,values=[enhancement],options={blocker=blocker, critical=critical, major=major, normal=normal, minor=minor, trivial=trivial, enhancement=enhancement},metaData={task.meta.label=Severity, task.meta.type=singleSelect, task.meta.readOnly=false, task.meta.attributeKind=task.common.kind.default, task.meta.required=false}] + TaskAttribute[id=task.common.status,values=[],options={UNCONFIRMED=UNCONFIRMED, CONFIRMED=CONFIRMED, IN_PROGRESS=IN_PROGRESS},metaData={task.meta.label=Status, task.meta.type=shortText, task.meta.readOnly=true, task.meta.required=false}] TaskAttribute[id=alias,values=[],options=null,metaData={task.meta.label=Alias, task.meta.type=shortText, task.meta.readOnly=false, task.meta.attributeKind=task.common.kind.default, task.meta.required=false}] TaskAttribute[id=task.common.user.assigned,values=[],options=null,metaData={task.meta.label=Assigned to, task.meta.type=person, task.meta.readOnly=false, task.meta.attributeKind=task.common.kind.people, task.meta.required=false, task.meta.dependson.attribute=task.common.component}] TaskAttribute[id=task.common.user.cc,values=[],options=null,metaData={task.meta.label=CC, task.meta.type=person, task.meta.readOnly=false, task.meta.attributeKind=task.common.kind.people, task.meta.required=false}] TaskAttribute[id=task.common.addselfcc,values=[],options=null,metaData={task.meta.label=Add Self to CC, task.meta.type=boolean, task.meta.readOnly=false, task.meta.attributeKind=task.common.kind.people, task.meta.required=false}] - TaskAttribute[id=comment_is_private,values=[],options=null,metaData={task.meta.label=Description is private, task.meta.type=boolean, task.meta.readOnly=false, task.meta.attributeKind=task.common.kind.default, task.meta.required=false}] + TaskAttribute[id=description_is_private,values=[],options=null,metaData={task.meta.label=Description is private, task.meta.type=boolean, task.meta.readOnly=false, task.meta.attributeKind=task.common.kind.default, task.meta.required=false}] TaskAttribute[id=qa_contact,values=[],options=null,metaData={task.meta.label=QA Contact, task.meta.type=person, task.meta.readOnly=false, task.meta.attributeKind=task.common.kind.people, task.meta.required=false, task.meta.dependson.attribute=task.common.component}] - TaskAttribute[id=target_milestone,values=[---],options={---=---},metaData={task.meta.label=Target milestone, task.meta.type=singleSelect, task.meta.readOnly=false, task.meta.attributeKind=task.common.kind.default, task.meta.required=false, task.meta.dependson.attribute=task.common.product}] + TaskAttribute[id=target_milestone,values=[---],options={---=---},metaData={task.meta.label=Target milestone, task.meta.type=singleSelect, task.meta.readOnly=false, task.meta.attributeKind=task.common.kind.default, task.meta.required=true, task.meta.dependson.attribute=task.common.product}] TaskAttribute[id=task.common.resolution,values=[],options={=, FIXED=FIXED, INVALID=INVALID, WONTFIX=WONTFIX, DUPLICATE=DUPLICATE, WORKSFORME=WORKSFORME},metaData={task.meta.label=Resolution, task.meta.type=singleSelect, task.meta.readOnly=true, task.meta.required=false}] TaskAttribute[id=task.common.operation,values=[],options=null,metaData={task.meta.label=Operation, task.meta.type=operation, task.meta.readOnly=false, task.meta.required=false}] - TaskAttribute[id=task.common.status,values=[],options={UNCONFIRMED=UNCONFIRMED, CONFIRMED=CONFIRMED, IN_PROGRESS=IN_PROGRESS},metaData={task.meta.label=Status, task.meta.type=shortText, task.meta.readOnly=true, task.meta.required=false}] TaskAttribute[id=cf_bugid,values=[],options=null,metaData={task.meta.readOnly=false, task.meta.type=integer, task.meta.required=false, task.meta.label=bug id custom field, task.meta.attributeKind=task.common.kind.default}] TaskAttribute[id=cf_datetime,values=[],options=null,metaData={task.meta.readOnly=false, task.meta.type=dateTime, task.meta.required=false, task.meta.label=date time custom field, task.meta.attributeKind=task.common.kind.default}] TaskAttribute[id=cf_dropdown,values=[],options={---=---, one=one, three=three, two=two},metaData={task.meta.readOnly=false, task.meta.type=singleSelect, task.meta.required=true, task.meta.label=drop down custom field, task.meta.attributeKind=task.common.kind.default}] diff --git a/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core/src/org/eclipse/mylyn/internal/bugzilla/rest/core/BugzillaRestClient.java b/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core/src/org/eclipse/mylyn/internal/bugzilla/rest/core/BugzillaRestClient.java index 617a758ca..9593445a6 100644 --- a/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core/src/org/eclipse/mylyn/internal/bugzilla/rest/core/BugzillaRestClient.java +++ b/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core/src/org/eclipse/mylyn/internal/bugzilla/rest/core/BugzillaRestClient.java @@ -11,8 +11,11 @@ package org.eclipse.mylyn.internal.bugzilla.rest.core; +import java.util.List; import java.util.Map; +import java.util.Set; +import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.Status; import org.eclipse.mylyn.commons.core.StatusHandler; @@ -32,8 +35,11 @@ import org.eclipse.mylyn.tasks.core.RepositoryResponse; import org.eclipse.mylyn.tasks.core.RepositoryResponse.ResponseKind; import org.eclipse.mylyn.tasks.core.TaskRepository; import org.eclipse.mylyn.tasks.core.data.TaskData; +import org.eclipse.mylyn.tasks.core.data.TaskDataCollector; import com.google.common.base.Function; +import com.google.common.base.Joiner; +import com.google.common.collect.Iterables; import com.google.common.collect.Lists; import com.google.common.collect.Maps; import com.google.gson.reflect.TypeToken; @@ -119,4 +125,54 @@ public class BugzillaRestClient { } } + private final Function<String, String> function = new Function<String, String>() { + + @Override + public String apply(String input) { + while (input.startsWith("0")) { //$NON-NLS-1$ + input = input.substring(1); + } + return input; + } + }; + + public void getTaskData(Set<String> taskIds, TaskRepository taskRepository, TaskDataCollector collector, + IOperationMonitor monitor) throws BugzillaRestException { + BugzillaRestConfiguration config; + try { + config = connector.getRepositoryConfiguration(taskRepository); + } catch (CoreException e1) { + throw new BugzillaRestException(e1); + } + + Iterable<String> taskIdsTemp = Iterables.transform(taskIds, function); + Iterable<List<String>> partitions = Iterables.partition(taskIdsTemp, MAX_RETRIEVED_PER_QUERY); + for (List<String> list : partitions) { + Joiner joiner = Joiner.on(",id=").skipNulls(); //$NON-NLS-1$ + String urlIDList = "id=" + joiner.join(list); //$NON-NLS-1$ + try { + + List<TaskData> taskDataArray = new BugzillaRestGetTaskData(client, connector, urlIDList, taskRepository) + .run(monitor); + for (TaskData taskData : taskDataArray) { + config.updateProductOptions(taskData); + config.addValidOperations(taskData); + collector.accept(taskData); + } + } catch (BugzillaRestException e) { + throw e; + } catch (RuntimeException e) { + // if the Throwable was warped in a RuntimeException in + // BugzillaRestGetTaskData.JSonTaskDataDeserializer.deserialize() + // we now remove the warper and throw a BugzillaRestException + Throwable cause = e.getCause(); + if (cause instanceof CoreException) { + throw new BugzillaRestException(cause); + } + throw e; + } + } + + } + } diff --git a/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core/src/org/eclipse/mylyn/internal/bugzilla/rest/core/BugzillaRestConfiguration.java b/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core/src/org/eclipse/mylyn/internal/bugzilla/rest/core/BugzillaRestConfiguration.java index 19d4b8225..1572e3818 100644 --- a/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core/src/org/eclipse/mylyn/internal/bugzilla/rest/core/BugzillaRestConfiguration.java +++ b/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core/src/org/eclipse/mylyn/internal/bugzilla/rest/core/BugzillaRestConfiguration.java @@ -12,13 +12,14 @@ package org.eclipse.mylyn.internal.bugzilla.rest.core; import java.io.Serializable; -import java.util.ArrayList; -import java.util.List; import java.util.Map; +import java.util.SortedSet; +import java.util.TreeSet; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.Status; +import org.eclipse.jdt.annotation.NonNull; import org.eclipse.mylyn.commons.core.StatusHandler; import org.eclipse.mylyn.internal.bugzilla.rest.core.response.data.Component; import org.eclipse.mylyn.internal.bugzilla.rest.core.response.data.Field; @@ -38,6 +39,8 @@ import com.google.common.collect.Ordering; public class BugzillaRestConfiguration implements Serializable { + private static final BugzillaRestCreateTaskSchema SCHEMA = BugzillaRestCreateTaskSchema.getDefault(); + private static final long serialVersionUID = 4173223872076958202L; private final String repositoryId; @@ -112,6 +115,8 @@ public class BugzillaRestConfiguration implements Serializable { } public void updateInitialTaskData(TaskData data) throws CoreException { + setProductOptions(data); + updateProductOptions(data); for (String key : data.getRoot().getAttributes().keySet()) { if (key.equals(BugzillaRestTaskSchema.getDefault().ADD_SELF_CC.getKey()) || key.equals(BugzillaRestTaskSchema.getDefault().NEW_COMMENT.getKey()) @@ -119,65 +124,41 @@ public class BugzillaRestConfiguration implements Serializable { continue; } TaskAttribute attribute = data.getRoot().getAttribute(key); - if (key.equals(BugzillaRestCreateTaskSchema.getDefault().PRODUCT.getKey())) { - List<String> products = new ArrayList<String>(); - Field configFieldComponent = getFieldWithName("component"); - FieldValues[] val = configFieldComponent.getValues(); - if (val != null && val.length > 0) { - for (FieldValues fieldValues : val) { - fieldValues.getVisibilityValues(); - for (String visibilityValue : fieldValues.getVisibilityValues()) { - if (!products.contains(visibilityValue)) { - products.add(visibilityValue); - } - } - } - attribute.clearOptions(); - for (String productName : products) { - attribute.putOption(productName, productName); - } - } - } else { + if (!key.equals(SCHEMA.PRODUCT.getKey())) { String configName = mapTaskAttributeKey2ConfigurationFields(key); Field configField = getFieldWithName(configName); if (configField == null) { continue; } - FieldValues[] val = configField.getValues(); - if (val != null && val.length > 0) { - for (FieldValues fieldValues : val) { - if (configName.equals("bug_status")) { - if (fieldValues.getName() == null) { - for (StatusTransition bugzillaRestBugStatusTransition : fieldValues.getCanChangeTo()) { - attribute.putOption(bugzillaRestBugStatusTransition.getName(), - bugzillaRestBugStatusTransition.getName()); - } - } - } else if (configName.equals("component") || configName.equals("version") - || configName.equals("target_milestone")) { - TaskAttribute productAttribute = data.getRoot() - .getAttribute(BugzillaRestCreateTaskSchema.getDefault().PRODUCT.getKey()); - String productValue = productAttribute.getValue(); - for (String visibilityValue : fieldValues.getVisibilityValues()) { - if (visibilityValue.equals(productValue) || productValue.equals("")) { - attribute.putOption(fieldValues.getName(), fieldValues.getName()); + if (configName.equals("component") || configName.equals("version") + || configName.equals("target_milestone")) { + if (attribute.getOptions().size() == 1 && attribute.getValue().isEmpty()) { + attribute.setValue((String) attribute.getOptions().values().toArray()[0]); + } + } else { + FieldValues[] val = configField.getValues(); + if (val != null && val.length > 0) { + for (FieldValues fieldValues : val) { + if (configName.equals("bug_status")) { + if (fieldValues.getName() == null) { + for (StatusTransition bugzillaRestBugStatusTransition : fieldValues + .getCanChangeTo()) { + attribute.putOption(bugzillaRestBugStatusTransition.getName(), + bugzillaRestBugStatusTransition.getName()); + } } + } else { + attribute.putOption(fieldValues.getName(), fieldValues.getName()); } - } else { - attribute.putOption(fieldValues.getName(), fieldValues.getName()); - } - } - if ((configName.equals("component") || configName.equals("version") - || configName.equals("target_milestone")) && attribute.getOptions().size() == 1 - && attribute.getValue().equals("")) { - attribute.setValue((String) attribute.getOptions().values().toArray()[0]); - } - if ("".equals(attribute.getValue())) { - attribute.setValue(getValueFromParameter(key)); + } } } } + if (attribute.getValue().isEmpty()) { + attribute.setValue(getValueFromParameter(key)); + } + } for (Field Field : fields.values()) { if (Field.isCustom() && Field.isOnBugEntry()) { @@ -209,13 +190,13 @@ public class BugzillaRestConfiguration implements Serializable { } else if (attributeId.equals(TaskAttribute.SEVERITY)) { return getParameters().getDefaultseverity(); } else if (attributeId.equals("platform")) { - if (getParameters().getDefaultplatform() == null || getParameters().getDefaultplatform().equals("")) { + if (getParameters().getDefaultplatform() == null || getParameters().getDefaultplatform().isEmpty()) { return "All"; } else { return getParameters().getDefaultplatform(); } } else if (attributeId.equals("os")) { - if (getParameters().getDefaultopsys() == null || getParameters().getDefaultopsys().equals("")) { + if (getParameters().getDefaultopsys() == null || getParameters().getDefaultopsys().isEmpty()) { return "All"; } else { return getParameters().getDefaultopsys(); @@ -266,7 +247,7 @@ public class BugzillaRestConfiguration implements Serializable { resultString = "cc"; } else if (taskAttributeKey.equals(TaskAttribute.DESCRIPTION)) { resultString = "longdesc"; - } else if (taskAttributeKey.equals("comment_is_private")) { + } else if (taskAttributeKey.equals("description_is_private")) { resultString = "longdescs.isprivate"; } else if (taskAttributeKey.equals("os")) { resultString = "op_sys"; @@ -284,11 +265,11 @@ public class BugzillaRestConfiguration implements Serializable { private void setAttributeOptionsForProduct(TaskAttribute taskAttribute, Product actualProduct) { taskAttribute.clearOptions(); - if (taskAttribute.getId().equals(BugzillaRestCreateTaskSchema.getDefault().TARGET_MILESTONE.getKey())) { + if (taskAttribute.getId().equals(SCHEMA.TARGET_MILESTONE.getKey())) { internalSetAttributeOptions(taskAttribute, actualProduct.getMilestones()); - } else if (taskAttribute.getId().equals(BugzillaRestCreateTaskSchema.getDefault().VERSION.getKey())) { + } else if (taskAttribute.getId().equals(SCHEMA.VERSION.getKey())) { internalSetAttributeOptions(taskAttribute, actualProduct.getVersions()); - } else if (taskAttribute.getId().equals(BugzillaRestCreateTaskSchema.getDefault().COMPONENT.getKey())) { + } else if (taskAttribute.getId().equals(SCHEMA.COMPONENT.getKey())) { internalSetAttributeOptions(taskAttribute, actualProduct.getComponents()); } } @@ -311,23 +292,21 @@ public class BugzillaRestConfiguration implements Serializable { public boolean updateAfterComponentChange(TaskAttribute taskAttribute) { if (taskAttribute != null) { - if (taskAttribute.getId().equals(BugzillaRestCreateTaskSchema.getDefault().COMPONENT.getKey())) { + if (taskAttribute.getId().equals(SCHEMA.COMPONENT.getKey())) { TaskAttribute rootAttribute = taskAttribute.getTaskData().getRoot(); TaskAttribute productAttribute = taskAttribute.getTaskData() .getRoot() - .getMappedAttribute(BugzillaRestCreateTaskSchema.getDefault().PRODUCT.getKey()); + .getMappedAttribute(SCHEMA.PRODUCT.getKey()); Product actualProduct = getProductWithName(productAttribute.getValue()); Component actualComponent = getProductComponentWithName(actualProduct, taskAttribute.getValue()); if (actualComponent != null) { taskAttribute.getMetaData().putValue(TaskAttribute.META_DESCRIPTION, actualComponent.getDescription()); - TaskAttribute attributeQaContact = rootAttribute - .getMappedAttribute(BugzillaRestCreateTaskSchema.getDefault().QA_CONTACT.getKey()); + TaskAttribute attributeQaContact = rootAttribute.getMappedAttribute(SCHEMA.QA_CONTACT.getKey()); if (attributeQaContact != null) { attributeQaContact.setValue(actualComponent.getDefaultQaContact()); } - TaskAttribute attributeAssignedTo = rootAttribute - .getMappedAttribute(BugzillaRestCreateTaskSchema.getDefault().ASSIGNED_TO.getKey()); + TaskAttribute attributeAssignedTo = rootAttribute.getMappedAttribute(SCHEMA.ASSIGNED_TO.getKey()); if (attributeAssignedTo != null) { attributeAssignedTo.setValue(actualComponent.getDefaultAssignedTo()); } @@ -338,33 +317,76 @@ public class BugzillaRestConfiguration implements Serializable { return false; } - public boolean updateProductOptions(TaskAttribute taskAttribute) { - if (taskAttribute != null) { - if (taskAttribute.getId().equals(BugzillaRestCreateTaskSchema.getDefault().PRODUCT.getKey())) { - TaskAttribute rootAttribute = taskAttribute.getTaskData().getRoot(); - Product actualProduct = getProductWithName(taskAttribute.getValue()); - - TaskAttribute attributeComponent = rootAttribute - .getMappedAttribute(BugzillaRestCreateTaskSchema.getDefault().COMPONENT.getKey()); - if (attributeComponent != null) { - setAttributeOptionsForProduct(attributeComponent, actualProduct); - } - TaskAttribute attributeVersion = rootAttribute - .getMappedAttribute(BugzillaRestCreateTaskSchema.getDefault().VERSION.getKey()); - if (attributeVersion != null) { - setAttributeOptionsForProduct(attributeVersion, actualProduct); + public boolean setProductOptions(@NonNull TaskData taskData) { + TaskAttribute attributeProduct = taskData.getRoot().getMappedAttribute(SCHEMA.PRODUCT.getKey()); + if (attributeProduct != null) { + SortedSet<String> products = new TreeSet<String>(); + Field configFieldComponent = getFieldWithName("component"); + FieldValues[] val = configFieldComponent.getValues(); + if (val != null && val.length > 0) { + for (FieldValues fieldValues : val) { + for (String visibilityValue : fieldValues.getVisibilityValues()) { + if (!products.contains(visibilityValue)) { + products.add(visibilityValue); + } + } } - TaskAttribute attributeTargetMilestone = rootAttribute - .getMappedAttribute(BugzillaRestCreateTaskSchema.getDefault().TARGET_MILESTONE.getKey()); - if (attributeTargetMilestone != null) { - setAttributeOptionsForProduct(attributeTargetMilestone, actualProduct); + attributeProduct.clearOptions(); + for (String productName : products) { + attributeProduct.putOption(productName, productName); } } + return true; } return false; } + public boolean updateProductOptions(@NonNull TaskData taskData) { + TaskAttribute attributeProduct = taskData.getRoot().getMappedAttribute(SCHEMA.PRODUCT.getKey()); + if (!attributeProduct.getValue().isEmpty()) { + Product actualProduct = getProductWithName(attributeProduct.getValue()); + + TaskAttribute attributeComponent = taskData.getRoot().getMappedAttribute(SCHEMA.COMPONENT.getKey()); + if (attributeComponent != null) { + setAttributeOptionsForProduct(attributeComponent, actualProduct); + } + TaskAttribute attributeVersion = taskData.getRoot().getMappedAttribute(SCHEMA.VERSION.getKey()); + if (attributeVersion != null) { + setAttributeOptionsForProduct(attributeVersion, actualProduct); + } + TaskAttribute attributeTargetMilestone = taskData.getRoot() + .getMappedAttribute(SCHEMA.TARGET_MILESTONE.getKey()); + if (attributeTargetMilestone != null) { + setAttributeOptionsForProduct(attributeTargetMilestone, actualProduct); + } + } else { + TaskAttribute attributeComponent = taskData.getRoot().getMappedAttribute(SCHEMA.COMPONENT.getKey()); + if (attributeComponent != null) { + setAllAttributeOptions(attributeComponent, getFieldWithName("component")); //$NON-NLS-1$ + } + TaskAttribute attributeVersion = taskData.getRoot().getMappedAttribute(SCHEMA.VERSION.getKey()); + if (attributeVersion != null) { + setAllAttributeOptions(attributeVersion, getFieldWithName("version")); //$NON-NLS-1$ + } + TaskAttribute attributeTargetMilestone = taskData.getRoot() + .getMappedAttribute(SCHEMA.TARGET_MILESTONE.getKey()); + if (attributeTargetMilestone != null) { + setAllAttributeOptions(attributeTargetMilestone, getFieldWithName("target_milestone")); //$NON-NLS-1$ + } + } + return true; + } + + private void setAllAttributeOptions(TaskAttribute updateAttribute, Field configField) { + FieldValues[] val = configField.getValues(); + if (val != null && val.length > 0) { + for (FieldValues fieldValues : val) { + updateAttribute.putOption(fieldValues.getName(), fieldValues.getName()); + } + } + } + public void addValidOperations(TaskData bugReport) { TaskAttribute attributeStatus = bugReport.getRoot().getMappedAttribute(TaskAttribute.STATUS); String attributeStatusValue = attributeStatus.getValue(); @@ -379,7 +401,7 @@ public class BugzillaRestConfiguration implements Serializable { TaskOperation.applyTo(operationAttribute, attributeStatusValue, attributeStatusValue); Field status = getFieldWithName("bug_status"); for (FieldValues fieldValues : status.getValues()) { - if (((attributeStatusValue == null || attributeStatusValue.equals("")) && fieldValues.getName() == null) + if (((attributeStatusValue == null || attributeStatusValue.isEmpty()) && fieldValues.getName() == null) || (attributeStatusValue != null && attributeStatusValue.equals(fieldValues.getName()))) { for (StatusTransition statusTransition : fieldValues.getCanChangeTo()) { attribute = bugReport.getRoot() diff --git a/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core/src/org/eclipse/mylyn/internal/bugzilla/rest/core/BugzillaRestConnector.java b/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core/src/org/eclipse/mylyn/internal/bugzilla/rest/core/BugzillaRestConnector.java index 602fb58b6..e6b322abb 100644 --- a/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core/src/org/eclipse/mylyn/internal/bugzilla/rest/core/BugzillaRestConnector.java +++ b/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core/src/org/eclipse/mylyn/internal/bugzilla/rest/core/BugzillaRestConnector.java @@ -31,13 +31,15 @@ import org.eclipse.mylyn.internal.tasks.core.IRepositoryConstants; import org.eclipse.mylyn.tasks.core.AbstractRepositoryConnector; import org.eclipse.mylyn.tasks.core.IRepositoryQuery; import org.eclipse.mylyn.tasks.core.ITask; +import org.eclipse.mylyn.tasks.core.ITaskMapping; import org.eclipse.mylyn.tasks.core.RepositoryInfo; import org.eclipse.mylyn.tasks.core.RepositoryVersion; import org.eclipse.mylyn.tasks.core.TaskRepository; import org.eclipse.mylyn.tasks.core.data.AbstractTaskDataHandler; -import org.eclipse.mylyn.tasks.core.data.TaskAttributeMapper; +import org.eclipse.mylyn.tasks.core.data.TaskAttribute; import org.eclipse.mylyn.tasks.core.data.TaskData; import org.eclipse.mylyn.tasks.core.data.TaskDataCollector; +import org.eclipse.mylyn.tasks.core.data.TaskMapper; import org.eclipse.mylyn.tasks.core.sync.ISynchronizationSession; import com.google.common.base.Optional; @@ -196,11 +198,7 @@ public class BugzillaRestConnector extends AbstractRepositoryConnector { @Override public TaskData getTaskData(TaskRepository repository, String taskIdOrKey, IProgressMonitor monitor) throws CoreException { - // only to not generate NPE in SubmitTaskJob.createTask() - // we replace this with the next review - AbstractTaskDataHandler taskDataHandler = getTaskDataHandler(); - TaskAttributeMapper mapper = taskDataHandler.getAttributeMapper(repository); - return new TaskData(mapper, repository.getConnectorKind(), repository.getRepositoryUrl(), taskIdOrKey); + return ((BugzillaRestTaskDataHandler) getTaskDataHandler()).getTaskData(repository, taskIdOrKey, monitor); } @Override @@ -323,4 +321,30 @@ public class BugzillaRestConnector extends AbstractRepositoryConnector { return false; } + @Override + public ITaskMapping getTaskMapping(final TaskData taskData) { + + return new TaskMapper(taskData) { + @Override + public String getTaskKey() { + TaskAttribute attribute = getTaskData().getRoot() + .getAttribute(BugzillaRestTaskSchema.getDefault().BUG_ID.getKey()); + if (attribute != null) { + return attribute.getValue(); + } + return super.getTaskKey(); + } + + @Override + public String getTaskKind() { + return taskData.getConnectorKind(); + } + + @Override + public String getTaskUrl() { + return taskData.getRepositoryUrl(); + } + }; + } + } diff --git a/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core/src/org/eclipse/mylyn/internal/bugzilla/rest/core/BugzillaRestCreateTaskSchema.java b/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core/src/org/eclipse/mylyn/internal/bugzilla/rest/core/BugzillaRestCreateTaskSchema.java index b12c00e0d..c50c603a8 100644 --- a/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core/src/org/eclipse/mylyn/internal/bugzilla/rest/core/BugzillaRestCreateTaskSchema.java +++ b/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core/src/org/eclipse/mylyn/internal/bugzilla/rest/core/BugzillaRestCreateTaskSchema.java @@ -70,6 +70,8 @@ public class BugzillaRestCreateTaskSchema extends AbstractTaskSchema { public final Field SEVERITY = inheritFrom(parent.SEVERITY).create(); + public final Field STATUS = inheritFrom(parent.STATUS).create(); + public final Field ALIAS = createField("alias", "Alias", TaskAttribute.TYPE_SHORT_TEXT, Flag.ATTRIBUTE); public final Field ASSIGNED_TO = inheritFrom(parent.USER_ASSIGNED).label("Assigned to") @@ -80,18 +82,16 @@ public class BugzillaRestCreateTaskSchema extends AbstractTaskSchema { public final Field ADD_SELF_CC = inheritFrom(parent.ADD_SELF_CC).addFlags(Flag.PEOPLE).create(); - public final Field COMMENT_IS_PRIVATE = createField("comment_is_private", "Description is private", + public final Field DESCRIPTION_IS_PRIVATE = createField("description_is_private", "Description is private", TaskAttribute.TYPE_BOOLEAN, Flag.ATTRIBUTE); public final Field QA_CONTACT = createField("qa_contact", "QA Contact", TaskAttribute.TYPE_PERSON, null, COMPONENT.getKey(), Flag.PEOPLE); public final Field TARGET_MILESTONE = createField("target_milestone", "Target milestone", - TaskAttribute.TYPE_SINGLE_SELECT, null, PRODUCT.getKey(), Flag.ATTRIBUTE); + TaskAttribute.TYPE_SINGLE_SELECT, null, PRODUCT.getKey(), Flag.ATTRIBUTE, Flag.REQUIRED); public final Field RESOLUTION = inheritFrom(parent.RESOLUTION).create(); public final Field OPERATION = createField(TaskAttribute.OPERATION, "Operation", TaskAttribute.TYPE_OPERATION); - - public final Field STATUS = inheritFrom(parent.STATUS).create(); } diff --git a/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core/src/org/eclipse/mylyn/internal/bugzilla/rest/core/BugzillaRestGetTaskData.java b/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core/src/org/eclipse/mylyn/internal/bugzilla/rest/core/BugzillaRestGetTaskData.java new file mode 100644 index 000000000..97b87b255 --- /dev/null +++ b/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core/src/org/eclipse/mylyn/internal/bugzilla/rest/core/BugzillaRestGetTaskData.java @@ -0,0 +1,159 @@ +/******************************************************************************* + * Copyright (c) 2015 Frank Becker and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Frank Becker - initial API and implementation + *******************************************************************************/ + +package org.eclipse.mylyn.internal.bugzilla.rest.core; + +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.List; +import java.util.Map.Entry; + +import org.apache.http.HttpStatus; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.mylyn.commons.core.operations.IOperationMonitor; +import org.eclipse.mylyn.commons.repositories.http.core.CommonHttpResponse; +import org.eclipse.mylyn.commons.repositories.http.core.HttpUtil; +import org.eclipse.mylyn.tasks.core.TaskRepository; +import org.eclipse.mylyn.tasks.core.data.TaskAttribute; +import org.eclipse.mylyn.tasks.core.data.TaskAttributeMapper; +import org.eclipse.mylyn.tasks.core.data.TaskData; +import org.eclipse.osgi.util.NLS; + +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.reflect.TypeToken; + +public class BugzillaRestGetTaskData extends BugzillaRestAuthenticatedGetRequest<List<TaskData>> { + private final String urlSuffix; + + private final TaskRepository taskRepository; + + private final BugzillaRestConnector connector; + + public BugzillaRestGetTaskData(BugzillaRestHttpClient client, BugzillaRestConnector connector, String urlSuffix, + TaskRepository taskRepository) { + super(client, "", null); //$NON-NLS-1$ + this.urlSuffix = urlSuffix; + this.taskRepository = taskRepository; + this.connector = connector; + } + + @Override + protected String getUrlSuffix() { + return "/bug?" + urlSuffix; //$NON-NLS-1$ + } + + @Override + protected List<TaskData> parseFromJson(InputStreamReader in) throws BugzillaRestException { + TypeToken<List<TaskData>> type = new TypeToken<List<TaskData>>() { + }; + return new GsonBuilder().registerTypeAdapter(type.getType(), new JSonTaskDataDeserializer()) + .create() + .fromJson(in, type.getType()); + } + + @Override + protected List<TaskData> doProcess(CommonHttpResponse response, IOperationMonitor monitor) + throws IOException, BugzillaRestException { + InputStream is = response.getResponseEntityAsStream(); + InputStreamReader in = new InputStreamReader(is); + return parseFromJson(in); + } + + @Override + protected void doValidate(CommonHttpResponse response, IOperationMonitor monitor) + throws IOException, BugzillaRestException { + int statusCode = response.getStatusCode(); + if (statusCode != 400 && statusCode != 200) { + if (statusCode == HttpStatus.SC_NOT_FOUND) { + throw new BugzillaRestResourceNotFoundException( + NLS.bind("Requested resource ''{0}'' does not exist", response.getRequestPath())); + } + throw new BugzillaRestException(NLS.bind("Unexpected response from Bugzilla REST server for ''{0}'': {1}", + response.getRequestPath(), HttpUtil.getStatusText(statusCode))); + } + + } + + BugzillaRestTaskSchema taskSchema = BugzillaRestTaskSchema.getDefault(); + + private class JSonTaskDataDeserializer implements JsonDeserializer<ArrayList<TaskData>> { + + @Override + public ArrayList<TaskData> deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) + throws JsonParseException { + ArrayList<TaskData> response = new ArrayList<TaskData>(); + BugzillaRestTaskDataHandler dataHandler = (BugzillaRestTaskDataHandler) connector.getTaskDataHandler(); + TaskAttributeMapper mapper = dataHandler.getAttributeMapper(taskRepository); + for (JsonElement bug : json.getAsJsonObject().get("bugs").getAsJsonArray()) { //$NON-NLS-1$ + JsonObject bugdata = bug.getAsJsonObject(); + TaskData taskData = null; + Integer taskId = bugdata.get("id").getAsInt(); //$NON-NLS-1$ + taskData = new TaskData(mapper, connector.getConnectorKind(), taskRepository.getRepositoryUrl(), + taskId.toString()); + try { + dataHandler.initializeTaskData(taskRepository, taskData, null, null); + } catch (CoreException e) { + com.google.common.base.Throwables.propagate(e); + } + TaskAttribute idAttribute = taskData.getRoot().getAttribute(taskSchema.BUG_ID.getKey()); + idAttribute.setValue(taskId.toString()); + response.add(taskData); + for (Entry<String, JsonElement> entry : bugdata.entrySet()) { + String attributeId = BugzillaRestTaskSchema.getAttributeNameFromFieldName(entry.getKey()); + if (entry.getKey().equals("assigned_to_detail")) { //$NON-NLS-1$ + TaskAttribute attribute = taskData.getRoot().getAttribute(taskSchema.ASSIGNED_TO.getKey()); + JsonElement value = entry.getValue().getAsJsonObject().get("email"); //$NON-NLS-1$//.get("real_name"); + if (attribute != null) { + attribute.setValue(value.getAsString()); + } + continue; + } + TaskAttribute attribute = taskData.getRoot().getAttribute(attributeId); + if (attribute != null) { + JsonElement value = entry.getValue(); + if (!value.isJsonNull()) { + if (value.isJsonArray()) { + JsonArray valueArray = value.getAsJsonArray(); + attribute.clearValues(); + for (JsonElement jsonElement : valueArray) { + attribute.addValue(jsonElement.getAsString()); + } + } else { + attribute.setValue(entry.getValue().getAsString()); + } + } + } + } + BugzillaRestConfiguration config; + try { + config = connector.getRepositoryConfiguration(taskRepository); + if (config != null) { + config.addValidOperations(taskData); + } + } catch (CoreException e) { + com.google.common.base.Throwables.propagate(e); + } + } + return response; + } + + } + +}
\ No newline at end of file diff --git a/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core/src/org/eclipse/mylyn/internal/bugzilla/rest/core/BugzillaRestPostNewTask.java b/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core/src/org/eclipse/mylyn/internal/bugzilla/rest/core/BugzillaRestPostNewTask.java index f8b6766b9..bfa4a0c00 100644 --- a/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core/src/org/eclipse/mylyn/internal/bugzilla/rest/core/BugzillaRestPostNewTask.java +++ b/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core/src/org/eclipse/mylyn/internal/bugzilla/rest/core/BugzillaRestPostNewTask.java @@ -90,8 +90,8 @@ public class BugzillaRestPostNewTask extends BugzillaRestAuthenticatedPostReques } out.name(id).value(value1); if (id.equals("description")) { //$NON-NLS-1$ - TaskAttribute descriptionpri = taskAttribute - .getAttribute(BugzillaRestCreateTaskSchema.getDefault().COMMENT_IS_PRIVATE.getKey()); + TaskAttribute descriptionpri = taskAttribute.getAttribute( + BugzillaRestCreateTaskSchema.getDefault().DESCRIPTION_IS_PRIVATE.getKey()); Boolean descriptionprivalue = (descriptionpri != null) ? (descriptionpri.getValue().equals("1")) //$NON-NLS-1$ : false; diff --git a/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core/src/org/eclipse/mylyn/internal/bugzilla/rest/core/BugzillaRestTaskDataHandler.java b/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core/src/org/eclipse/mylyn/internal/bugzilla/rest/core/BugzillaRestTaskDataHandler.java index 963166342..9454dc7d0 100644 --- a/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core/src/org/eclipse/mylyn/internal/bugzilla/rest/core/BugzillaRestTaskDataHandler.java +++ b/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core/src/org/eclipse/mylyn/internal/bugzilla/rest/core/BugzillaRestTaskDataHandler.java @@ -11,6 +11,7 @@ package org.eclipse.mylyn.internal.bugzilla.rest.core; +import java.util.HashSet; import java.util.Set; import org.eclipse.core.runtime.CoreException; @@ -18,6 +19,7 @@ import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.Status; import org.eclipse.mylyn.commons.core.operations.IOperationMonitor; +import org.eclipse.mylyn.commons.core.operations.IOperationMonitor.OperationFlag; import org.eclipse.mylyn.commons.core.operations.OperationUtil; import org.eclipse.mylyn.commons.net.Policy; import org.eclipse.mylyn.tasks.core.ITaskMapping; @@ -27,6 +29,7 @@ import org.eclipse.mylyn.tasks.core.data.AbstractTaskDataHandler; import org.eclipse.mylyn.tasks.core.data.TaskAttribute; import org.eclipse.mylyn.tasks.core.data.TaskAttributeMapper; import org.eclipse.mylyn.tasks.core.data.TaskData; +import org.eclipse.mylyn.tasks.core.data.TaskDataCollector; public class BugzillaRestTaskDataHandler extends AbstractTaskDataHandler { protected final BugzillaRestConnector connector; @@ -82,4 +85,39 @@ public class BugzillaRestTaskDataHandler extends AbstractTaskDataHandler { return new BugzillaRestTaskAttributeMapper(repository, connector); } + public TaskData getTaskData(TaskRepository repository, String taskId, IProgressMonitor monitor) + throws CoreException { + + Set<String> taskIds = new HashSet<String>(); + taskIds.add(taskId); + SingleTaskDataCollector singleTaskDataCollector = new SingleTaskDataCollector(); + getMultiTaskData(repository, taskIds, singleTaskDataCollector, monitor); + + if (singleTaskDataCollector.getTaskData() == null) { + throw new CoreException(new Status(IStatus.ERROR, BugzillaRestCore.ID_PLUGIN, + "Task data could not be retrieved. Please re-synchronize task")); //$NON-NLS-1$ + } + return singleTaskDataCollector.getTaskData(); + } + + @Override + public void getMultiTaskData(final TaskRepository repository, Set<String> taskIds, + final TaskDataCollector collector, IProgressMonitor monitor) throws CoreException { + monitor = Policy.monitorFor(monitor); + try { + monitor.beginTask("retrive_task", IProgressMonitor.UNKNOWN); + BugzillaRestClient client = connector.getClient(repository); + try { + IOperationMonitor progress = OperationUtil.convert(monitor, "post taskdata", 3); + progress.addFlag(OperationFlag.BACKGROUND); + client.getTaskData(taskIds, repository, collector, progress); + } catch (BugzillaRestException e) { + throw new CoreException(new Status(IStatus.ERROR, BugzillaRestCore.ID_PLUGIN, 2, + "Error get taskdata.\n\n" + e.getMessage(), e)); + } + } finally { + monitor.done(); + } + } + } diff --git a/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core/src/org/eclipse/mylyn/internal/bugzilla/rest/core/BugzillaRestTaskSchema.java b/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core/src/org/eclipse/mylyn/internal/bugzilla/rest/core/BugzillaRestTaskSchema.java index aac11f875..977611289 100644 --- a/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core/src/org/eclipse/mylyn/internal/bugzilla/rest/core/BugzillaRestTaskSchema.java +++ b/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core/src/org/eclipse/mylyn/internal/bugzilla/rest/core/BugzillaRestTaskSchema.java @@ -16,10 +16,35 @@ import org.eclipse.mylyn.tasks.core.data.DefaultTaskSchema; import org.eclipse.mylyn.tasks.core.data.TaskAttribute; import org.eclipse.mylyn.tasks.core.data.TaskData; +import com.google.common.collect.ImmutableMap; + public class BugzillaRestTaskSchema extends AbstractTaskSchema { private static final BugzillaRestTaskSchema instance = new BugzillaRestTaskSchema(); + private static ImmutableMap<String, String> field2AttributeFieldMapper = new ImmutableMap.Builder() + .put("summary", getDefault().SUMMARY.getKey()) + .put("description", getDefault().DESCRIPTION.getKey()) + .put("status", getDefault().STATUS.getKey()) + .put("product", getDefault().PRODUCT.getKey()) + .put("component", getDefault().COMPONENT.getKey()) + .put("CC", getDefault().CC.getKey()) + .put("severity", getDefault().SEVERITY.getKey()) + .put("priority", getDefault().PRIORITY.getKey()) + .put("assigned_to", getDefault().ASSIGNED_TO.getKey()) + .put("op_sys", getDefault().OS.getKey()) + .put("resolution", getDefault().RESOLUTION.getKey()) + .put("version", getDefault().VERSION.getKey()) + .build(); + + public static String getAttributeNameFromFieldName(String fieldName) { + String result = field2AttributeFieldMapper.get(fieldName); + if (result == null) { + result = fieldName; + } + return result; + } + public static BugzillaRestTaskSchema getDefault() { return instance; } @@ -36,7 +61,7 @@ public class BugzillaRestTaskSchema extends AbstractTaskSchema { public final Field SUMMARY = inheritFrom(parent.SUMMARY).addFlags(Flag.REQUIRED).create(); - public final Field VERSION = createField("version", "Version", TaskAttribute.TYPE_SINGLE_SELECT, null, + public final Field VERSION = createField(TaskAttribute.VERSION, "Version", TaskAttribute.TYPE_SINGLE_SELECT, null, PRODUCT.getKey(), Flag.ATTRIBUTE, Flag.REQUIRED); public final Field DESCRIPTION = inheritFrom(parent.DESCRIPTION).addFlags(Flag.REQUIRED, Flag.READ_ONLY).create(); @@ -68,15 +93,15 @@ public class BugzillaRestTaskSchema extends AbstractTaskSchema { public final Field QA_CONTACT = createField("qa_contact", "QA Contact", TaskAttribute.TYPE_PERSON, null, COMPONENT.getKey(), Flag.PEOPLE); - public final Field NEW_COMMENT = inheritFrom(parent.NEW_COMMENT).create(); + public final Field TARGET_MILESTONE = createField("target_milestone", "Target milestone", + TaskAttribute.TYPE_SINGLE_SELECT, null, PRODUCT.getKey(), Flag.ATTRIBUTE, Flag.REQUIRED); public final Field RESOLUTION = inheritFrom(parent.RESOLUTION).create(); - public final Field TARGET_MILESTONE = createField("target_milestone", "Target milestone", - TaskAttribute.TYPE_SINGLE_SELECT, null, PRODUCT.getKey(), Flag.ATTRIBUTE); - public final Field OPERATION = createField(TaskAttribute.OPERATION, "Operation", TaskAttribute.TYPE_OPERATION); + public final Field NEW_COMMENT = inheritFrom(parent.NEW_COMMENT).create(); + @Override public void initialize(TaskData taskData) { for (Field field : getFields()) { diff --git a/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core/src/org/eclipse/mylyn/internal/bugzilla/rest/core/SingleTaskDataCollector.java b/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core/src/org/eclipse/mylyn/internal/bugzilla/rest/core/SingleTaskDataCollector.java new file mode 100644 index 000000000..dd0763d27 --- /dev/null +++ b/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core/src/org/eclipse/mylyn/internal/bugzilla/rest/core/SingleTaskDataCollector.java @@ -0,0 +1,18 @@ +package org.eclipse.mylyn.internal.bugzilla.rest.core; + +import org.eclipse.mylyn.tasks.core.data.TaskData; +import org.eclipse.mylyn.tasks.core.data.TaskDataCollector; + +public class SingleTaskDataCollector extends TaskDataCollector { + final TaskData[] retrievedData = new TaskData[1]; + + @Override + public void accept(TaskData taskData) { + retrievedData[0] = taskData; + } + + public TaskData getTaskData() { + return retrievedData[0]; + } + +}
\ No newline at end of file |