Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduced API for updating Build custom fields values #71

Merged
merged 2 commits into from
Mar 19, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions src/main/java/br/eti/kinoshita/testlinkjavaapi/BuildService.java
Original file line number Diff line number Diff line change
Expand Up @@ -149,4 +149,37 @@ protected Map<String, Object> getExecCountersByBuild(Integer testPlanId) {
return responseMap;
}

/**
*
* @param buildId
* @param testProjectId
* @param customFields
*/
protected Map<String, Object> updateBuildCustomFields(Integer buildId, Integer testProjectId, Integer testPlanId, Map<String, String> customFields) {

Map<String, Object> responseMap =null;

try {
Map<String, Object> executionData = new HashMap<String, Object>();

executionData.put(TestLinkParams.BUILD_ID.toString(), buildId);
executionData.put(TestLinkParams.TEST_PROJECT_ID.toString(), testProjectId);
executionData.put(TestLinkParams.TEST_PLAN_ID.toString(), testPlanId);
executionData.put(TestLinkParams.CUSTOM_FIELDS.toString(), customFields);

Object response = this.executeXmlRpcCall(TestLinkMethods.UPDATE_BUILD_CUSTOM_FIELDS.toString(),
executionData);
if (response instanceof Map<?, ?>) {
responseMap = Util.castToMap(response);
} else if (! (response instanceof String) ) {
responseMap = Util.castToMap(((Object[]) response)[0]);
}
} catch (XmlRpcException xmlrpcex) {
throw new TestLinkAPIException("Error updating Build custom fields. " + xmlrpcex.getMessage(),
xmlrpcex);
}

return responseMap;

}
}
14 changes: 14 additions & 0 deletions src/main/java/br/eti/kinoshita/testlinkjavaapi/TestLinkAPI.java
Original file line number Diff line number Diff line change
Expand Up @@ -603,6 +603,20 @@ public Map<String, Object> addPlatformToTestPlan(Integer testProjectId, Integer
/**
* Creates a Build.
*
* @param buildId Build ID
* @param testProjectId Test Project ID
* @param testPlanId Test Plan ID
* @param customFields Custom Fields name,value pairs
* @return Response XML-RPC Response
* @throws TestLinkAPIException if the service returns as error
*/
public Map<String, Object> updateBuildCustomFields(Integer buildId, Integer testProjectId, Integer testPlanId, Map<String, String> customFields) throws TestLinkAPIException {
return this.buildService.updateBuildCustomFields(buildId, testProjectId, testPlanId, customFields);
}

/**
* Creates a Build.
*
* @param testPlanId test plan ID
* @param buildName build name
* @param buildNotes build notes
Expand Down
Loading