Skip to content

Commit ecb8f5e

Browse files
iapplejohnkhmarbaise
authored andcommitted
Add the crumbFlag as the 2nd parameter of getConsoleOutputText(bufferOffset) method (#386)
1 parent b9fbcd0 commit ecb8f5e

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

jenkins-client/src/main/java/com/offbytwo/jenkins/model/BuildWithDetails.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,7 @@ public String getConsoleOutputHtml() throws IOException {
407407
* @throws IOException in case of an error.
408408
*
409409
*/
410-
public void streamConsoleOutput(final BuildConsoleStreamListener listener, final int poolingInterval, final int poolingTimeout) throws InterruptedException, IOException {
410+
public void streamConsoleOutput(final BuildConsoleStreamListener listener, final int poolingInterval, final int poolingTimeout, boolean crumbFlag) throws InterruptedException, IOException {
411411
// Calculate start and timeout
412412
final long startTime = System.currentTimeMillis();
413413
final long timeoutTime = startTime + (poolingTimeout * 1000);
@@ -417,7 +417,7 @@ public void streamConsoleOutput(final BuildConsoleStreamListener listener, final
417417
Thread.sleep(poolingInterval * 1000);
418418

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

456456
Header moreDataHeader = httpResponse.getFirstHeader(MORE_DATA_HEADER);
457457
Header textSizeHeader = httpResponse.getFirstHeader(TEXT_SIZE_HEADER);

jenkins-client/src/test/java/com/offbytwo/jenkins/model/BuildWithDetailsTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public void getBuildLogWithBuffer() {
5252
given(response.getFirstHeader(BuildWithDetails.MORE_DATA_HEADER)).willReturn(moreDataHeader);
5353
given(response.getFirstHeader(BuildWithDetails.TEXT_SIZE_HEADER)).willReturn(textSizeHeader);
5454
given(client.post_form_with_result(anyString(),anyListOf(NameValuePair.class),anyBoolean())).willReturn(response);
55-
ConsoleLog consoleOutputText = buildWithDetails.getConsoleOutputText(500);
55+
ConsoleLog consoleOutputText = buildWithDetails.getConsoleOutputText(500, false);
5656
assertThat(consoleOutputText.getConsoleLog()).isEqualTo(text);
5757
assertThat(consoleOutputText.getCurrentBufferSize()).isEqualTo(textLength);
5858
assertThat(consoleOutputText.getHasMoreData()).isFalse();
@@ -86,7 +86,7 @@ public void onData(String newLogChunk) {
8686
public void finished() {
8787
assertThat(buffer.toString()).isEqualTo(text);
8888
}
89-
},1,2);
89+
},1,2, false);
9090
} catch (IOException e) {
9191
fail("Should not return exception",e);
9292
}
@@ -114,7 +114,7 @@ public void onData(String newLogChunk) {
114114
public void finished() {
115115
fail("Should timeout");
116116
}
117-
},1,2);
117+
},1,2, false);
118118
} catch (IOException e) {
119119
fail("Should not return exception",e);
120120
}

0 commit comments

Comments
 (0)