|
@@ -745,18 +745,18 @@ public final class ITestAbfsClient extends AbstractAbfsIntegrationTest {
|
|
true, 2, false);
|
|
true, 2, false);
|
|
testIsNonEmptyDirectoryInternal(TEST_CONTINUATION_TOKEN, true, EMPTY_STRING,
|
|
testIsNonEmptyDirectoryInternal(TEST_CONTINUATION_TOKEN, true, EMPTY_STRING,
|
|
false, 2, true);
|
|
false, 2, true);
|
|
- testIsNonEmptyDirectoryInternal(TEST_CONTINUATION_TOKEN, true, TEST_CONTINUATION_TOKEN,
|
|
|
|
|
|
+ testIsNonEmptyDirectoryInternal(TEST_CONTINUATION_TOKEN + 1, true, TEST_CONTINUATION_TOKEN + 2,
|
|
true, 3, false);
|
|
true, 3, false);
|
|
- testIsNonEmptyDirectoryInternal(TEST_CONTINUATION_TOKEN, true, TEST_CONTINUATION_TOKEN,
|
|
|
|
|
|
+ testIsNonEmptyDirectoryInternal(TEST_CONTINUATION_TOKEN + 1, true, TEST_CONTINUATION_TOKEN + 2,
|
|
false, 2, true);
|
|
false, 2, true);
|
|
|
|
|
|
testIsNonEmptyDirectoryInternal(TEST_CONTINUATION_TOKEN, false, EMPTY_STRING,
|
|
testIsNonEmptyDirectoryInternal(TEST_CONTINUATION_TOKEN, false, EMPTY_STRING,
|
|
true, 1, true);
|
|
true, 1, true);
|
|
testIsNonEmptyDirectoryInternal(TEST_CONTINUATION_TOKEN, false, EMPTY_STRING,
|
|
testIsNonEmptyDirectoryInternal(TEST_CONTINUATION_TOKEN, false, EMPTY_STRING,
|
|
false, 1, true);
|
|
false, 1, true);
|
|
- testIsNonEmptyDirectoryInternal(TEST_CONTINUATION_TOKEN, false, TEST_CONTINUATION_TOKEN,
|
|
|
|
|
|
+ testIsNonEmptyDirectoryInternal(TEST_CONTINUATION_TOKEN + 1, false, TEST_CONTINUATION_TOKEN + 2,
|
|
true, 1, true);
|
|
true, 1, true);
|
|
- testIsNonEmptyDirectoryInternal(TEST_CONTINUATION_TOKEN, false, TEST_CONTINUATION_TOKEN,
|
|
|
|
|
|
+ testIsNonEmptyDirectoryInternal(TEST_CONTINUATION_TOKEN + 1, false, TEST_CONTINUATION_TOKEN + 2,
|
|
false, 1, true);
|
|
false, 1, true);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -801,11 +801,45 @@ public final class ITestAbfsClient extends AbstractAbfsIntegrationTest {
|
|
.when(spiedClient).listPath(eq("/testPath"), eq(false), eq(1),
|
|
.when(spiedClient).listPath(eq("/testPath"), eq(false), eq(1),
|
|
any(), any(), any());
|
|
any(), any(), any());
|
|
|
|
|
|
|
|
+ final int[] itr = new int[1];
|
|
|
|
+ final String[] continuationTokenUsed = new String[3];
|
|
|
|
+
|
|
|
|
+ Mockito.doAnswer(invocationOnMock -> {
|
|
|
|
+ if (itr[0] == 0) {
|
|
|
|
+ itr[0]++;
|
|
|
|
+ continuationTokenUsed[0] = invocationOnMock.getArgument(3);
|
|
|
|
+ return listResponseData1;
|
|
|
|
+ } else if (itr[0] == 1) {
|
|
|
|
+ itr[0]++;
|
|
|
|
+ continuationTokenUsed[1] = invocationOnMock.getArgument(3);
|
|
|
|
+ return listResponseData2;
|
|
|
|
+ }
|
|
|
|
+ continuationTokenUsed[2] = invocationOnMock.getArgument(3);
|
|
|
|
+ return listResponseData3;
|
|
|
|
+ }).when(spiedClient).listPath(eq("/testPath"), eq(false), eq(1),
|
|
|
|
+ any(), any(TracingContext.class), any());
|
|
|
|
+
|
|
Assertions.assertThat(spiedClient.isNonEmptyDirectory("/testPath",
|
|
Assertions.assertThat(spiedClient.isNonEmptyDirectory("/testPath",
|
|
Mockito.mock(TracingContext.class)))
|
|
Mockito.mock(TracingContext.class)))
|
|
.describedAs("isNonEmptyDirectory in client giving unexpected results")
|
|
.describedAs("isNonEmptyDirectory in client giving unexpected results")
|
|
.isEqualTo(isNonEmpty);
|
|
.isEqualTo(isNonEmpty);
|
|
|
|
|
|
|
|
+ Assertions.assertThat(continuationTokenUsed[0])
|
|
|
|
+ .describedAs("First continuation token used is not as expected")
|
|
|
|
+ .isNull();
|
|
|
|
+
|
|
|
|
+ if (expectedInvocations > 1) {
|
|
|
|
+ Assertions.assertThat(continuationTokenUsed[1])
|
|
|
|
+ .describedAs("Second continuation token used is not as expected")
|
|
|
|
+ .isEqualTo(firstCT);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (expectedInvocations > 2) {
|
|
|
|
+ Assertions.assertThat(continuationTokenUsed[2])
|
|
|
|
+ .describedAs("Third continuation token used is not as expected")
|
|
|
|
+ .isEqualTo(secondCT);
|
|
|
|
+ }
|
|
|
|
+
|
|
Mockito.verify(spiedClient, times(expectedInvocations))
|
|
Mockito.verify(spiedClient, times(expectedInvocations))
|
|
.listPath(eq("/testPath"), eq(false), eq(1),
|
|
.listPath(eq("/testPath"), eq(false), eq(1),
|
|
any(), any(TracingContext.class), any());
|
|
any(), any(TracingContext.class), any());
|