2

如何使用 java Rally-Rest-API 为用户故事创建缺陷/任务。任何人都可以拥有集会查询属性可用的链接吗?

提前致谢

4

1 回答 1

0

您可以在此处找到对 Java REST API 的介绍:

https://developer.help.rallydev.com/java-toolkit-rally-rest-api

以及关于 Rally 的 Webservices API 的文档:

https://rally1.rallydev.com/slm/doc/webservice

要创建新缺陷并将其与故事相关联,您可以执行以下操作:

// Query for Story to associate with Defect
String storyFormattedID = "US20142";
QueryRequest storyRequest = new QueryRequest("HierarchicalRequirement");
storyRequest.setFetch(new Fetch("FormattedID","Name","Changesets"));
storyRequest.setQueryFilter(new QueryFilter("FormattedID", "=", storyFormattedID));
QueryResponse storyQueryResponse = restApi.query(storyRequest);
JsonObject storyJsonObject = storyQueryResponse.getResults().get(0).getAsJsonObject();
String storyRef = storyJsonObject.get("_ref").toString();

JsonObject newDefect = new JsonObject();
newDefect.addProperty("Name", "Test Defect");
newDefect.addProperty("Priority", "High Attention");
newDefect.addProperty("Severity", "Major Problem");
newDefect.addProperty("Requirement", storyRef);

CreateRequest storyCreateRequest = new CreateRequest("defect", newDefect);
CreateResponse storyCreateResponse = restApi.create(storyCreateRequest);

任务的过程将非常相似:

// Create a new Task and associate to the same Requirement
JsonObject newTask = new JsonObject();
newTask.addProperty("Name", "Test Task");
newTask.addProperty("State", "Defined");
newDefect.addProperty("WorkProduct", storyRef);

CreateRequest taskCreateRequest = new CreateRequest("task", newTask);
CreateResponse taskCreateResponse = restApi.create(taskCreateRequest);
于 2013-04-16T14:24:11.143 回答