/// <summary> /// Gets the log. /// </summary> /// <param name="buildSpecifier">The build specifier.</param> /// <param name="sessionToken">The session token.</param> /// <returns>The log data.</returns> public string GetLog(IBuildSpecifier buildSpecifier, string sessionToken) { // Validate the arguments if (buildSpecifier == null) { throw new ArgumentNullException("buildSpecifier", "buildSpecifier is null."); } // Retrieve the server configuration - this is needed to check for compression var serverConfig = this.GetServerUrl(buildSpecifier.ProjectSpecifier.ServerSpecifier); var useCompression = serverConfig.TransferLogsCompressed; // Retrieve the actual log var response = GetCruiseManager(buildSpecifier, sessionToken) .GetLog(buildSpecifier.ProjectSpecifier.ProjectName, buildSpecifier.BuildName, useCompression); if (useCompression) { // Uncompress the log var compressionService = new ZipCompressionService(); response = compressionService.ExpandString(response); } return response; }
public void ExpandStringExpandsAString() { var service = new ZipCompressionService(); var inputString = "eJxNxEEKwCAMBMCvrPf6m34gtGICRsWs9PvtsTDMqRb4CILLegUHruFzlQhkPEaF70abreAWyvE7vbhUFbg="; var expected = "This is a string to compress - with multiple data, data, data!"; var actual = service.ExpandString(inputString); Assert.AreEqual(expected, actual); }
public void ExpandStringValidatesInput() { var service = new ZipCompressionService(); var error = Assert.Throws<ArgumentNullException>(() => { service.ExpandString(null); }); Assert.AreEqual("value", error.ParamName); }