rally - RallyRestAPI Create Build with ChangeSets -
i creating rally build records part of teamcity rally integration havving issues associating build changeset.
i find set of related changesets match particular criteria , have them in array of string. create jsonarray object, add these "_ref" strings jsonprimatives array, add array create json object , add rally.
however, happens build created result has empty changeset array.
i have tried including changesets in createrequest , doing updaterequest in both cases response success, there no errors or warnings reported , changeset array returned null , re-querying shows other data expected changeset array empty.
here code.
jsonobject obj = new jsonobject(); obj.addproperty("workspace", def.getworkspace().getref()); obj.addproperty("duration",1.05); obj.addproperty("message", "master 4683 success"); obj.addproperty("start", isoformat.format(new date())); obj.addproperty("status","success"); obj.addproperty("number","4683"); obj.addproperty("uri", "http://"); obj.addproperty("builddefinition",def.getref()); // changesets arraylist<string> of "_ref" strings of valid changesets references. if (changesets != null && changesets.size() > 0) { jsonarray changesetlist = new jsonarray(); (string id : changesets) { changesetlist.add(new jsonprimitive(id)); } obj.add("changesets", changesetlist); } string ref = connector.create("build",obj); connector.delete(ref, null);
any ideas?
my thought instead of populating jsonarray jsonprimitive's having value of ref, need jsonobject key/value pair of {"_ref", "/changeset/12345678910.js"}. i.e. make change similar following:
// changesets arraylist<string> of "_ref" strings of valid changesets references. if (changesets != null && changesets.size() > 0) { jsonarray changesetlist = new jsonarray(); (string id : changesets) { jsonobject thischangeset = new jsonobject(); thischangeset.addproperty("_ref", id); changesetlist.add(thischangeset); } obj.add("changesets", changesetlist); }
and believe code should work expected.
Comments
Post a Comment