Skip to content

Commit ef871b3

Browse files
committed
review comment refactor.
1 parent b15468f commit ef871b3

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

hadoop-tools/hadoop-azure/src/main/java/org/apache/hadoop/fs/azurebfs/services/AbfsHttpOperation.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -347,9 +347,7 @@ public void sendRequest(byte[] buffer, int offset, int length) throws IOExceptio
347347
if (expectHeader != null && expectHeader.equals(HUNDRED_CONTINUE)
348348
&& e instanceof ProtocolException
349349
&& EXPECT_100_JDK_ERROR.equals(e.getMessage())) {
350-
LOG.debug(
351-
"Getting output stream failed with expect header enabled, returning back ",
352-
e);
350+
LOG.debug("Getting output stream failed with expect header enabled, returning back ", e);
353351
expect100failureReceived = true;
354352
return;
355353
} else {

hadoop-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azurebfs/services/ITestAbfsOutputStream.java

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -165,27 +165,30 @@ public void testExpect100ContinueFailureInAppend() throws Exception {
165165
(AbfsOutputStream) fs.create(path).getWrappedStream());
166166
AbfsClient spiedClient = Mockito.spy(os.getClient());
167167
AbfsHttpOperation[] httpOpForAppendTest = new AbfsHttpOperation[2];
168-
readyMocksForAppendTest(httpOpForAppendTest, spiedClient);
168+
mockSetupForAppend(httpOpForAppendTest, spiedClient);
169169
Mockito.doReturn(spiedClient).when(os).getClient();
170170
fs.delete(path, true);
171171
os.write(1);
172172
LambdaTestUtils.intercept(FileNotFoundException.class, () -> {
173173
os.close();
174174
});
175175
Assertions.assertThat(httpOpForAppendTest[0].getExpect100failureReceived())
176-
.isTrue();
176+
.describedAs("First try from AbfsClient will have expect-100 "
177+
+ "header and should fail with expect-100 error.").isTrue();
177178
Mockito.verify(httpOpForAppendTest[0], Mockito.times(0))
178179
.processConnHeadersAndInputStreams(Mockito.any(byte[].class),
179180
Mockito.anyInt(), Mockito.anyInt());
180181

181182
Assertions.assertThat(httpOpForAppendTest[1].getExpect100failureReceived())
182-
.isFalse();
183+
.describedAs("The retried operation from AbfsClient should not "
184+
+ "fail with expect-100 error. The retried operation does not have"
185+
+ "expect-100 header.").isFalse();
183186
Mockito.verify(httpOpForAppendTest[1], Mockito.times(1))
184187
.processConnHeadersAndInputStreams(Mockito.any(byte[].class),
185188
Mockito.anyInt(), Mockito.anyInt());
186189
}
187190

188-
private void readyMocksForAppendTest(final AbfsHttpOperation[] httpOpForAppendTest,
191+
private void mockSetupForAppend(final AbfsHttpOperation[] httpOpForAppendTest,
189192
final AbfsClient spiedClient) {
190193
int[] index = new int[1];
191194
index[0] = 0;

0 commit comments

Comments
 (0)