|
@@ -21,17 +21,20 @@ package org.apache.hadoop.fs.azurebfs;
|
|
import java.io.FileNotFoundException;
|
|
import java.io.FileNotFoundException;
|
|
import java.io.IOException;
|
|
import java.io.IOException;
|
|
import java.util.ArrayList;
|
|
import java.util.ArrayList;
|
|
|
|
+import java.util.Collections;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
import java.util.NoSuchElementException;
|
|
import java.util.NoSuchElementException;
|
|
-import java.util.concurrent.Callable;
|
|
|
|
import java.util.concurrent.ExecutionException;
|
|
import java.util.concurrent.ExecutionException;
|
|
import java.util.concurrent.ExecutorService;
|
|
import java.util.concurrent.ExecutorService;
|
|
import java.util.concurrent.Executors;
|
|
import java.util.concurrent.Executors;
|
|
import java.util.concurrent.Future;
|
|
import java.util.concurrent.Future;
|
|
|
|
|
|
import org.assertj.core.api.Assertions;
|
|
import org.assertj.core.api.Assertions;
|
|
|
|
+import org.junit.Assert;
|
|
import org.junit.Test;
|
|
import org.junit.Test;
|
|
import org.mockito.Mockito;
|
|
import org.mockito.Mockito;
|
|
|
|
+import org.slf4j.Logger;
|
|
|
|
+import org.slf4j.LoggerFactory;
|
|
|
|
|
|
import org.apache.hadoop.fs.FileStatus;
|
|
import org.apache.hadoop.fs.FileStatus;
|
|
import org.apache.hadoop.fs.Path;
|
|
import org.apache.hadoop.fs.Path;
|
|
@@ -39,6 +42,7 @@ import org.apache.hadoop.fs.RemoteIterator;
|
|
import org.apache.hadoop.fs.azurebfs.services.AbfsListStatusRemoteIterator;
|
|
import org.apache.hadoop.fs.azurebfs.services.AbfsListStatusRemoteIterator;
|
|
import org.apache.hadoop.fs.azurebfs.services.ListingSupport;
|
|
import org.apache.hadoop.fs.azurebfs.services.ListingSupport;
|
|
import org.apache.hadoop.fs.azurebfs.utils.TracingContext;
|
|
import org.apache.hadoop.fs.azurebfs.utils.TracingContext;
|
|
|
|
+import org.apache.hadoop.test.LambdaTestUtils;
|
|
|
|
|
|
import static org.mockito.ArgumentMatchers.any;
|
|
import static org.mockito.ArgumentMatchers.any;
|
|
import static org.mockito.ArgumentMatchers.anyBoolean;
|
|
import static org.mockito.ArgumentMatchers.anyBoolean;
|
|
@@ -52,6 +56,8 @@ import static org.mockito.Mockito.verify;
|
|
public class ITestAbfsListStatusRemoteIterator extends AbstractAbfsIntegrationTest {
|
|
public class ITestAbfsListStatusRemoteIterator extends AbstractAbfsIntegrationTest {
|
|
|
|
|
|
private static final int TEST_FILES_NUMBER = 1000;
|
|
private static final int TEST_FILES_NUMBER = 1000;
|
|
|
|
+ private static final Logger LOG = LoggerFactory.getLogger(
|
|
|
|
+ ITestAbfsListStatusRemoteIterator.class);
|
|
|
|
|
|
public ITestAbfsListStatusRemoteIterator() throws Exception {
|
|
public ITestAbfsListStatusRemoteIterator() throws Exception {
|
|
}
|
|
}
|
|
@@ -60,8 +66,7 @@ public class ITestAbfsListStatusRemoteIterator extends AbstractAbfsIntegrationTe
|
|
public void testAbfsIteratorWithHasNext() throws Exception {
|
|
public void testAbfsIteratorWithHasNext() throws Exception {
|
|
Path testDir = createTestDirectory();
|
|
Path testDir = createTestDirectory();
|
|
setPageSize(10);
|
|
setPageSize(10);
|
|
- final List<String> fileNames = createFilesUnderDirectory(TEST_FILES_NUMBER,
|
|
|
|
- testDir, "testListPath");
|
|
|
|
|
|
+ final List<String> fileNames = createFilesUnderDirectory(testDir);
|
|
|
|
|
|
ListingSupport listngSupport = Mockito.spy(getFileSystem().getAbfsStore());
|
|
ListingSupport listngSupport = Mockito.spy(getFileSystem().getAbfsStore());
|
|
RemoteIterator<FileStatus> fsItr = new AbfsListStatusRemoteIterator(
|
|
RemoteIterator<FileStatus> fsItr = new AbfsListStatusRemoteIterator(
|
|
@@ -74,20 +79,12 @@ public class ITestAbfsListStatusRemoteIterator extends AbstractAbfsIntegrationTe
|
|
int itrCount = 0;
|
|
int itrCount = 0;
|
|
while (fsItr.hasNext()) {
|
|
while (fsItr.hasNext()) {
|
|
FileStatus fileStatus = fsItr.next();
|
|
FileStatus fileStatus = fsItr.next();
|
|
- String pathStr = fileStatus.getPath().toString();
|
|
|
|
- fileNames.remove(pathStr);
|
|
|
|
|
|
+ verifyIteratorResultContent(fileStatus, fileNames);
|
|
itrCount++;
|
|
itrCount++;
|
|
}
|
|
}
|
|
- Assertions.assertThat(itrCount)
|
|
|
|
- .describedAs("Number of iterations should be equal to the files "
|
|
|
|
- + "created")
|
|
|
|
- .isEqualTo(TEST_FILES_NUMBER);
|
|
|
|
- Assertions.assertThat(fileNames.size())
|
|
|
|
- .describedAs("After removing every iterm found from the iterator, "
|
|
|
|
- + "there should be no more elements in the fileNames")
|
|
|
|
- .isEqualTo(0);
|
|
|
|
- int minNumberOfInvokations = TEST_FILES_NUMBER / 10;
|
|
|
|
- verify(listngSupport, Mockito.atLeast(minNumberOfInvokations))
|
|
|
|
|
|
+ verifyIteratorResultCount(itrCount, fileNames);
|
|
|
|
+ int minNumberOfInvocations = TEST_FILES_NUMBER / 10;
|
|
|
|
+ verify(listngSupport, Mockito.atLeast(minNumberOfInvocations))
|
|
.listStatus(any(Path.class), nullable(String.class),
|
|
.listStatus(any(Path.class), nullable(String.class),
|
|
anyList(), anyBoolean(),
|
|
anyList(), anyBoolean(),
|
|
nullable(String.class),
|
|
nullable(String.class),
|
|
@@ -98,8 +95,7 @@ public class ITestAbfsListStatusRemoteIterator extends AbstractAbfsIntegrationTe
|
|
public void testAbfsIteratorWithoutHasNext() throws Exception {
|
|
public void testAbfsIteratorWithoutHasNext() throws Exception {
|
|
Path testDir = createTestDirectory();
|
|
Path testDir = createTestDirectory();
|
|
setPageSize(10);
|
|
setPageSize(10);
|
|
- final List<String> fileNames = createFilesUnderDirectory(TEST_FILES_NUMBER,
|
|
|
|
- testDir, "testListPath");
|
|
|
|
|
|
+ final List<String> fileNames = createFilesUnderDirectory(testDir);
|
|
|
|
|
|
ListingSupport listngSupport = Mockito.spy(getFileSystem().getAbfsStore());
|
|
ListingSupport listngSupport = Mockito.spy(getFileSystem().getAbfsStore());
|
|
RemoteIterator<FileStatus> fsItr = new AbfsListStatusRemoteIterator(
|
|
RemoteIterator<FileStatus> fsItr = new AbfsListStatusRemoteIterator(
|
|
@@ -112,25 +108,13 @@ public class ITestAbfsListStatusRemoteIterator extends AbstractAbfsIntegrationTe
|
|
int itrCount = 0;
|
|
int itrCount = 0;
|
|
for (int i = 0; i < TEST_FILES_NUMBER; i++) {
|
|
for (int i = 0; i < TEST_FILES_NUMBER; i++) {
|
|
FileStatus fileStatus = fsItr.next();
|
|
FileStatus fileStatus = fsItr.next();
|
|
- String pathStr = fileStatus.getPath().toString();
|
|
|
|
- fileNames.remove(pathStr);
|
|
|
|
|
|
+ verifyIteratorResultContent(fileStatus, fileNames);
|
|
itrCount++;
|
|
itrCount++;
|
|
}
|
|
}
|
|
- Assertions.assertThatThrownBy(() -> fsItr.next())
|
|
|
|
- .describedAs(
|
|
|
|
- "next() should throw NoSuchElementException since next has been "
|
|
|
|
- + "called " + TEST_FILES_NUMBER + " times")
|
|
|
|
- .isInstanceOf(NoSuchElementException.class);
|
|
|
|
- Assertions.assertThat(itrCount)
|
|
|
|
- .describedAs("Number of iterations should be equal to the files "
|
|
|
|
- + "created")
|
|
|
|
- .isEqualTo(TEST_FILES_NUMBER);
|
|
|
|
- Assertions.assertThat(fileNames.size())
|
|
|
|
- .describedAs("After removing every iterm found from the iterator, "
|
|
|
|
- + "there should be no more elements in the fileNames")
|
|
|
|
- .isEqualTo(0);
|
|
|
|
- int minNumberOfInvokations = TEST_FILES_NUMBER / 10;
|
|
|
|
- verify(listngSupport, Mockito.atLeast(minNumberOfInvokations))
|
|
|
|
|
|
+ LambdaTestUtils.intercept(NoSuchElementException.class, fsItr::next);
|
|
|
|
+ verifyIteratorResultCount(itrCount, fileNames);
|
|
|
|
+ int minNumberOfInvocations = TEST_FILES_NUMBER / 10;
|
|
|
|
+ verify(listngSupport, Mockito.atLeast(minNumberOfInvocations))
|
|
.listStatus(any(Path.class), nullable(String.class),
|
|
.listStatus(any(Path.class), nullable(String.class),
|
|
anyList(), anyBoolean(),
|
|
anyList(), anyBoolean(),
|
|
nullable(String.class),
|
|
nullable(String.class),
|
|
@@ -141,9 +125,8 @@ public class ITestAbfsListStatusRemoteIterator extends AbstractAbfsIntegrationTe
|
|
public void testWithAbfsIteratorDisabled() throws Exception {
|
|
public void testWithAbfsIteratorDisabled() throws Exception {
|
|
Path testDir = createTestDirectory();
|
|
Path testDir = createTestDirectory();
|
|
setPageSize(10);
|
|
setPageSize(10);
|
|
- setEnableAbfsIterator(false);
|
|
|
|
- final List<String> fileNames = createFilesUnderDirectory(TEST_FILES_NUMBER,
|
|
|
|
- testDir, "testListPath");
|
|
|
|
|
|
+ disableAbfsIterator();
|
|
|
|
+ final List<String> fileNames = createFilesUnderDirectory(testDir);
|
|
|
|
|
|
RemoteIterator<FileStatus> fsItr =
|
|
RemoteIterator<FileStatus> fsItr =
|
|
getFileSystem().listStatusIterator(testDir);
|
|
getFileSystem().listStatusIterator(testDir);
|
|
@@ -154,73 +137,46 @@ public class ITestAbfsListStatusRemoteIterator extends AbstractAbfsIntegrationTe
|
|
int itrCount = 0;
|
|
int itrCount = 0;
|
|
while (fsItr.hasNext()) {
|
|
while (fsItr.hasNext()) {
|
|
FileStatus fileStatus = fsItr.next();
|
|
FileStatus fileStatus = fsItr.next();
|
|
- String pathStr = fileStatus.getPath().toString();
|
|
|
|
- fileNames.remove(pathStr);
|
|
|
|
|
|
+ verifyIteratorResultContent(fileStatus, fileNames);
|
|
itrCount++;
|
|
itrCount++;
|
|
}
|
|
}
|
|
- Assertions.assertThat(itrCount)
|
|
|
|
- .describedAs("Number of iterations should be equal to the files "
|
|
|
|
- + "created")
|
|
|
|
- .isEqualTo(TEST_FILES_NUMBER);
|
|
|
|
- Assertions.assertThat(fileNames.size())
|
|
|
|
- .describedAs("After removing every iterm found from the iterator, "
|
|
|
|
- + "there should be no more elements in the fileNames")
|
|
|
|
- .isEqualTo(0);
|
|
|
|
|
|
+ verifyIteratorResultCount(itrCount, fileNames);
|
|
}
|
|
}
|
|
|
|
|
|
@Test
|
|
@Test
|
|
public void testWithAbfsIteratorDisabledWithoutHasNext() throws Exception {
|
|
public void testWithAbfsIteratorDisabledWithoutHasNext() throws Exception {
|
|
Path testDir = createTestDirectory();
|
|
Path testDir = createTestDirectory();
|
|
setPageSize(10);
|
|
setPageSize(10);
|
|
- setEnableAbfsIterator(false);
|
|
|
|
- final List<String> fileNames = createFilesUnderDirectory(TEST_FILES_NUMBER,
|
|
|
|
- testDir, "testListPath");
|
|
|
|
-
|
|
|
|
- RemoteIterator<FileStatus> fsItr =
|
|
|
|
- getFileSystem().listStatusIterator(testDir);
|
|
|
|
- Assertions.assertThat(fsItr)
|
|
|
|
- .describedAs("RemoteIterator should not be instance of "
|
|
|
|
- + "AbfsListStatusRemoteIterator when it is disabled")
|
|
|
|
|
|
+ disableAbfsIterator();
|
|
|
|
+ final List<String> fileNames = createFilesUnderDirectory(testDir);
|
|
|
|
+
|
|
|
|
+ RemoteIterator<FileStatus> fsItr = getFileSystem().listStatusIterator(
|
|
|
|
+ testDir);
|
|
|
|
+ Assertions.assertThat(fsItr).describedAs(
|
|
|
|
+ "RemoteIterator should not be instance of "
|
|
|
|
+ + "AbfsListStatusRemoteIterator when it is disabled")
|
|
.isNotInstanceOf(AbfsListStatusRemoteIterator.class);
|
|
.isNotInstanceOf(AbfsListStatusRemoteIterator.class);
|
|
- int itrCount = 0;
|
|
|
|
- for (int i = 0; i < TEST_FILES_NUMBER; i++) {
|
|
|
|
|
|
+ int itrCount;
|
|
|
|
+ for (itrCount = 0; itrCount < TEST_FILES_NUMBER; itrCount++) {
|
|
FileStatus fileStatus = fsItr.next();
|
|
FileStatus fileStatus = fsItr.next();
|
|
- String pathStr = fileStatus.getPath().toString();
|
|
|
|
- fileNames.remove(pathStr);
|
|
|
|
- itrCount++;
|
|
|
|
|
|
+ verifyIteratorResultContent(fileStatus, fileNames);
|
|
}
|
|
}
|
|
- Assertions.assertThatThrownBy(() -> fsItr.next())
|
|
|
|
- .describedAs(
|
|
|
|
- "next() should throw NoSuchElementException since next has been "
|
|
|
|
- + "called " + TEST_FILES_NUMBER + " times")
|
|
|
|
- .isInstanceOf(NoSuchElementException.class);
|
|
|
|
- Assertions.assertThat(itrCount)
|
|
|
|
- .describedAs("Number of iterations should be equal to the files "
|
|
|
|
- + "created")
|
|
|
|
- .isEqualTo(TEST_FILES_NUMBER);
|
|
|
|
- Assertions.assertThat(fileNames.size())
|
|
|
|
- .describedAs("After removing every iterm found from the iterator, "
|
|
|
|
- + "there should be no more elements in the fileNames")
|
|
|
|
- .isEqualTo(0);
|
|
|
|
|
|
+ LambdaTestUtils.intercept(NoSuchElementException.class, fsItr::next);
|
|
|
|
+ verifyIteratorResultCount(itrCount, fileNames);
|
|
}
|
|
}
|
|
|
|
|
|
@Test
|
|
@Test
|
|
public void testNextWhenNoMoreElementsPresent() throws Exception {
|
|
public void testNextWhenNoMoreElementsPresent() throws Exception {
|
|
Path testDir = createTestDirectory();
|
|
Path testDir = createTestDirectory();
|
|
setPageSize(10);
|
|
setPageSize(10);
|
|
- RemoteIterator fsItr =
|
|
|
|
|
|
+ RemoteIterator<FileStatus> fsItr =
|
|
new AbfsListStatusRemoteIterator(getFileSystem().getFileStatus(testDir),
|
|
new AbfsListStatusRemoteIterator(getFileSystem().getFileStatus(testDir),
|
|
getFileSystem().getAbfsStore(),
|
|
getFileSystem().getAbfsStore(),
|
|
getTestTracingContext(getFileSystem(), true));
|
|
getTestTracingContext(getFileSystem(), true));
|
|
fsItr = Mockito.spy(fsItr);
|
|
fsItr = Mockito.spy(fsItr);
|
|
Mockito.doReturn(false).when(fsItr).hasNext();
|
|
Mockito.doReturn(false).when(fsItr).hasNext();
|
|
|
|
|
|
- RemoteIterator<FileStatus> finalFsItr = fsItr;
|
|
|
|
- Assertions.assertThatThrownBy(() -> finalFsItr.next())
|
|
|
|
- .describedAs(
|
|
|
|
- "next() should throw NoSuchElementException if hasNext() return "
|
|
|
|
- + "false")
|
|
|
|
- .isInstanceOf(NoSuchElementException.class);
|
|
|
|
|
|
+ LambdaTestUtils.intercept(NoSuchElementException.class, fsItr::next);
|
|
}
|
|
}
|
|
|
|
|
|
@Test
|
|
@Test
|
|
@@ -257,38 +213,47 @@ public class ITestAbfsListStatusRemoteIterator extends AbstractAbfsIntegrationTe
|
|
|
|
|
|
String exceptionMessage = "test exception";
|
|
String exceptionMessage = "test exception";
|
|
ListingSupport lsSupport =getMockListingSupport(exceptionMessage);
|
|
ListingSupport lsSupport =getMockListingSupport(exceptionMessage);
|
|
- RemoteIterator fsItr =
|
|
|
|
|
|
+ RemoteIterator<FileStatus> fsItr =
|
|
new AbfsListStatusRemoteIterator(getFileSystem().getFileStatus(testDir),
|
|
new AbfsListStatusRemoteIterator(getFileSystem().getFileStatus(testDir),
|
|
lsSupport, getTestTracingContext(getFileSystem(), true));
|
|
lsSupport, getTestTracingContext(getFileSystem(), true));
|
|
|
|
|
|
- Assertions.assertThatThrownBy(() -> fsItr.next())
|
|
|
|
- .describedAs(
|
|
|
|
- "When ioException is not null and queue is empty exception should be "
|
|
|
|
- + "thrown")
|
|
|
|
- .isInstanceOf(IOException.class)
|
|
|
|
- .hasMessage(exceptionMessage);
|
|
|
|
|
|
+ LambdaTestUtils.intercept(IOException.class, fsItr::next);
|
|
}
|
|
}
|
|
|
|
|
|
@Test
|
|
@Test
|
|
- public void testNonExistingPath() throws Throwable {
|
|
|
|
|
|
+ public void testNonExistingPath() throws Exception {
|
|
Path nonExistingDir = new Path("nonExistingPath");
|
|
Path nonExistingDir = new Path("nonExistingPath");
|
|
- Assertions.assertThatThrownBy(
|
|
|
|
- () -> getFileSystem().listStatusIterator(nonExistingDir)).describedAs(
|
|
|
|
- "test the listStatusIterator call on a path which is not "
|
|
|
|
- + "present should result in FileNotFoundException")
|
|
|
|
- .isInstanceOf(FileNotFoundException.class);
|
|
|
|
|
|
+ LambdaTestUtils.intercept(FileNotFoundException.class,
|
|
|
|
+ () -> getFileSystem().listStatusIterator(nonExistingDir));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private void verifyIteratorResultContent(FileStatus fileStatus,
|
|
|
|
+ List<String> fileNames) {
|
|
|
|
+ String pathStr = fileStatus.getPath().toString();
|
|
|
|
+ Assert.assertTrue(
|
|
|
|
+ String.format("Could not remove path %s from filenames %s", pathStr,
|
|
|
|
+ fileNames), fileNames.remove(pathStr));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private void verifyIteratorResultCount(int itrCount, List<String> fileNames) {
|
|
|
|
+ Assertions.assertThat(itrCount).describedAs(
|
|
|
|
+ "Number of iterations should be equal to the files created")
|
|
|
|
+ .isEqualTo(TEST_FILES_NUMBER);
|
|
|
|
+ Assertions.assertThat(fileNames)
|
|
|
|
+ .describedAs("After removing every item found from the iterator, "
|
|
|
|
+ + "there should be no more elements in the fileNames")
|
|
|
|
+ .hasSize(0);
|
|
}
|
|
}
|
|
|
|
|
|
private ListingSupport getMockListingSupport(String exceptionMessage) {
|
|
private ListingSupport getMockListingSupport(String exceptionMessage) {
|
|
return new ListingSupport() {
|
|
return new ListingSupport() {
|
|
@Override
|
|
@Override
|
|
- public FileStatus[] listStatus(Path path, TracingContext tracingContext) throws IOException {
|
|
|
|
|
|
+ public FileStatus[] listStatus(Path path, TracingContext tracingContext) {
|
|
return null;
|
|
return null;
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
- public FileStatus[] listStatus(Path path, String startFrom, TracingContext tracingContext)
|
|
|
|
- throws IOException {
|
|
|
|
|
|
+ public FileStatus[] listStatus(Path path, String startFrom, TracingContext tracingContext) {
|
|
return null;
|
|
return null;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -303,15 +268,14 @@ public class ITestAbfsListStatusRemoteIterator extends AbstractAbfsIntegrationTe
|
|
}
|
|
}
|
|
|
|
|
|
private Path createTestDirectory() throws IOException {
|
|
private Path createTestDirectory() throws IOException {
|
|
- String testDirectoryName = "testDirectory" + System.currentTimeMillis();
|
|
|
|
- Path testDirectory = path(testDirectoryName);
|
|
|
|
|
|
+ Path testDirectory = path("testDirectory");
|
|
getFileSystem().mkdirs(testDirectory);
|
|
getFileSystem().mkdirs(testDirectory);
|
|
return testDirectory;
|
|
return testDirectory;
|
|
}
|
|
}
|
|
|
|
|
|
- private void setEnableAbfsIterator(boolean shouldEnable) throws IOException {
|
|
|
|
|
|
+ private void disableAbfsIterator() throws IOException {
|
|
AzureBlobFileSystemStore abfsStore = getAbfsStore(getFileSystem());
|
|
AzureBlobFileSystemStore abfsStore = getAbfsStore(getFileSystem());
|
|
- abfsStore.getAbfsConfiguration().setEnableAbfsListIterator(shouldEnable);
|
|
|
|
|
|
+ abfsStore.getAbfsConfiguration().setEnableAbfsListIterator(false);
|
|
}
|
|
}
|
|
|
|
|
|
private void setPageSize(int pageSize) throws IOException {
|
|
private void setPageSize(int pageSize) throws IOException {
|
|
@@ -319,21 +283,21 @@ public class ITestAbfsListStatusRemoteIterator extends AbstractAbfsIntegrationTe
|
|
abfsStore.getAbfsConfiguration().setListMaxResults(pageSize);
|
|
abfsStore.getAbfsConfiguration().setListMaxResults(pageSize);
|
|
}
|
|
}
|
|
|
|
|
|
- private List<String> createFilesUnderDirectory(int numFiles, Path rootPath,
|
|
|
|
- String filenamePrefix)
|
|
|
|
|
|
+ private List<String> createFilesUnderDirectory(Path rootPath)
|
|
throws ExecutionException, InterruptedException, IOException {
|
|
throws ExecutionException, InterruptedException, IOException {
|
|
final List<Future<Void>> tasks = new ArrayList<>();
|
|
final List<Future<Void>> tasks = new ArrayList<>();
|
|
- final List<String> fileNames = new ArrayList<>();
|
|
|
|
|
|
+ final List<String> fileNames = Collections.synchronizedList(new ArrayList<>());
|
|
ExecutorService es = Executors.newFixedThreadPool(10);
|
|
ExecutorService es = Executors.newFixedThreadPool(10);
|
|
try {
|
|
try {
|
|
- for (int i = 0; i < numFiles; i++) {
|
|
|
|
- final Path filePath = new Path(rootPath, filenamePrefix + i);
|
|
|
|
- Callable<Void> callable = () -> {
|
|
|
|
- getFileSystem().create(filePath);
|
|
|
|
- fileNames.add(makeQualified(filePath).toString());
|
|
|
|
|
|
+ for (int i = 0; i < ITestAbfsListStatusRemoteIterator.TEST_FILES_NUMBER; i++) {
|
|
|
|
+ Path filePath = makeQualified(new Path(rootPath, "testListPath" + i));
|
|
|
|
+ tasks.add(es.submit(() -> {
|
|
|
|
+ touch(filePath);
|
|
|
|
+ synchronized (fileNames) {
|
|
|
|
+ Assert.assertTrue(fileNames.add(filePath.toString()));
|
|
|
|
+ }
|
|
return null;
|
|
return null;
|
|
- };
|
|
|
|
- tasks.add(es.submit(callable));
|
|
|
|
|
|
+ }));
|
|
}
|
|
}
|
|
for (Future<Void> task : tasks) {
|
|
for (Future<Void> task : tasks) {
|
|
task.get();
|
|
task.get();
|
|
@@ -341,6 +305,10 @@ public class ITestAbfsListStatusRemoteIterator extends AbstractAbfsIntegrationTe
|
|
} finally {
|
|
} finally {
|
|
es.shutdownNow();
|
|
es.shutdownNow();
|
|
}
|
|
}
|
|
|
|
+ LOG.debug(fileNames.toString());
|
|
|
|
+ Assertions.assertThat(fileNames)
|
|
|
|
+ .describedAs("File creation incorrect or fileNames not added to list")
|
|
|
|
+ .hasSize(ITestAbfsListStatusRemoteIterator.TEST_FILES_NUMBER);
|
|
return fileNames;
|
|
return fileNames;
|
|
}
|
|
}
|
|
|
|
|