Skip to content

Commit

Permalink
Add the crumbFlag as the 2nd parameter of getConsoleOutputText(buffer…
Browse files Browse the repository at this point in the history
…Offset) method (#386)
  • Loading branch information
iapplejohn authored and khmarbaise committed Jan 24, 2019
1 parent b9fbcd0 commit ecb8f5e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,7 @@ public String getConsoleOutputHtml() throws IOException {
* @throws IOException in case of an error.
*
*/
public void streamConsoleOutput(final BuildConsoleStreamListener listener, final int poolingInterval, final int poolingTimeout) throws InterruptedException, IOException {
public void streamConsoleOutput(final BuildConsoleStreamListener listener, final int poolingInterval, final int poolingTimeout, boolean crumbFlag) throws InterruptedException, IOException {
// Calculate start and timeout
final long startTime = System.currentTimeMillis();
final long timeoutTime = startTime + (poolingTimeout * 1000);
Expand All @@ -417,7 +417,7 @@ public void streamConsoleOutput(final BuildConsoleStreamListener listener, final
Thread.sleep(poolingInterval * 1000);

ConsoleLog consoleLog = null;
consoleLog = getConsoleOutputText(bufferOffset);
consoleLog = getConsoleOutputText(bufferOffset, crumbFlag);
String logString = consoleLog.getConsoleLog();
if (logString != null && !logString.isEmpty()) {
listener.onData(logString);
Expand Down Expand Up @@ -447,11 +447,11 @@ public void streamConsoleOutput(final BuildConsoleStreamListener listener, final
* {@code CR+LF}.
* @throws IOException in case of a failure.
*/
public ConsoleLog getConsoleOutputText(int bufferOffset) throws IOException {
public ConsoleLog getConsoleOutputText(int bufferOffset, boolean crumbFlag) throws IOException {
List<NameValuePair> formData = new ArrayList<>();
formData.add(new BasicNameValuePair("start", Integer.toString(bufferOffset)));
String path = getUrl() + "logText/progressiveText";
HttpResponse httpResponse = client.post_form_with_result(path, formData, false);
HttpResponse httpResponse = client.post_form_with_result(path, formData, crumbFlag);

Header moreDataHeader = httpResponse.getFirstHeader(MORE_DATA_HEADER);
Header textSizeHeader = httpResponse.getFirstHeader(TEXT_SIZE_HEADER);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public void getBuildLogWithBuffer() {
given(response.getFirstHeader(BuildWithDetails.MORE_DATA_HEADER)).willReturn(moreDataHeader);
given(response.getFirstHeader(BuildWithDetails.TEXT_SIZE_HEADER)).willReturn(textSizeHeader);
given(client.post_form_with_result(anyString(),anyListOf(NameValuePair.class),anyBoolean())).willReturn(response);
ConsoleLog consoleOutputText = buildWithDetails.getConsoleOutputText(500);
ConsoleLog consoleOutputText = buildWithDetails.getConsoleOutputText(500, false);
assertThat(consoleOutputText.getConsoleLog()).isEqualTo(text);
assertThat(consoleOutputText.getCurrentBufferSize()).isEqualTo(textLength);
assertThat(consoleOutputText.getHasMoreData()).isFalse();
Expand Down Expand Up @@ -86,7 +86,7 @@ public void onData(String newLogChunk) {
public void finished() {
assertThat(buffer.toString()).isEqualTo(text);
}
},1,2);
},1,2, false);
} catch (IOException e) {
fail("Should not return exception",e);
}
Expand Down Expand Up @@ -114,7 +114,7 @@ public void onData(String newLogChunk) {
public void finished() {
fail("Should timeout");
}
},1,2);
},1,2, false);
} catch (IOException e) {
fail("Should not return exception",e);
}
Expand Down

0 comments on commit ecb8f5e

Please sign in to comment.