How to download log file from build result through plain java client library
Lee John (51●3●10)
| asked Mar 13 '15, 5:24 a.m.
closed Mar 13 '15, 5:30 a.m. by Ralph Schoon (63.6k●3●36●46)
As title, when I have a IBuildResult implemented object through querying, how do I download the log file from it?
|
Accepted answer
code in one of my tools
ITeamBuildClient buildClient = (ITeamBuildClient) RepoServer.getClientLibrary(ITeamBuildClient.class); // get build result ... // use build result to get log contribution content object and data IBuildResultContribution[] ibrcl =buildClient.getBuildResultContributions(br, IBuildResultContribution.LOG_EXTENDED_CONTRIBUTION_ID, null); for(IBuildResultContribution ibrc : ibrcl) { String s=getContent(ibrc.getExtendedContributionData(), RepoServer.contentManager()); } // worker routine to get the string from the content object private static String getContent(IContent ic, IContentManager icm) { // make an output stream for the content manager OutputStream os = new ByteArrayOutputStream(); // get the content of the content object. try { if (ic != null) { icm.retrieveContent(ic, os, null); return os.toString(); } } catch (Exception e) { e.printStackTrace(); } return null; } Lee John selected this answer as the correct answer
|
Your answer
Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.