|
|
@ -19,6 +19,10 @@ package sample.integration.consumer;
|
|
|
|
import java.io.File;
|
|
|
|
import java.io.File;
|
|
|
|
import java.io.IOException;
|
|
|
|
import java.io.IOException;
|
|
|
|
import java.io.InputStream;
|
|
|
|
import java.io.InputStream;
|
|
|
|
|
|
|
|
import java.nio.file.FileVisitOption;
|
|
|
|
|
|
|
|
import java.nio.file.Files;
|
|
|
|
|
|
|
|
import java.nio.file.Path;
|
|
|
|
|
|
|
|
import java.util.Comparator;
|
|
|
|
import java.util.concurrent.Callable;
|
|
|
|
import java.util.concurrent.Callable;
|
|
|
|
import java.util.concurrent.Executors;
|
|
|
|
import java.util.concurrent.Executors;
|
|
|
|
import java.util.concurrent.Future;
|
|
|
|
import java.util.concurrent.Future;
|
|
|
@ -35,7 +39,6 @@ import org.springframework.context.ConfigurableApplicationContext;
|
|
|
|
import org.springframework.core.io.DefaultResourceLoader;
|
|
|
|
import org.springframework.core.io.DefaultResourceLoader;
|
|
|
|
import org.springframework.core.io.Resource;
|
|
|
|
import org.springframework.core.io.Resource;
|
|
|
|
import org.springframework.core.io.support.ResourcePatternUtils;
|
|
|
|
import org.springframework.core.io.support.ResourcePatternUtils;
|
|
|
|
import org.springframework.util.FileSystemUtils;
|
|
|
|
|
|
|
|
import org.springframework.util.StreamUtils;
|
|
|
|
import org.springframework.util.StreamUtils;
|
|
|
|
|
|
|
|
|
|
|
|
import static org.assertj.core.api.Assertions.assertThat;
|
|
|
|
import static org.assertj.core.api.Assertions.assertThat;
|
|
|
@ -51,14 +54,16 @@ public class SampleIntegrationApplicationTests {
|
|
|
|
private ConfigurableApplicationContext context;
|
|
|
|
private ConfigurableApplicationContext context;
|
|
|
|
|
|
|
|
|
|
|
|
@Before
|
|
|
|
@Before
|
|
|
|
public void deleteInputAndOutput() throws InterruptedException {
|
|
|
|
public void deleteInputAndOutput() throws InterruptedException, IOException {
|
|
|
|
deleteIfExists(new File("target/input"));
|
|
|
|
deleteIfExists(new File("target/input"));
|
|
|
|
deleteIfExists(new File("target/output"));
|
|
|
|
deleteIfExists(new File("target/output"));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void deleteIfExists(File directory) throws InterruptedException {
|
|
|
|
private void deleteIfExists(File directory) throws InterruptedException, IOException {
|
|
|
|
if (directory.exists()) {
|
|
|
|
if (directory.exists()) {
|
|
|
|
assertThat(FileSystemUtils.deleteRecursively(directory)).isTrue();
|
|
|
|
Files.walk(directory.toPath(), FileVisitOption.FOLLOW_LINKS)
|
|
|
|
|
|
|
|
.sorted(Comparator.reverseOrder()).map(Path::toFile)
|
|
|
|
|
|
|
|
.forEach(File::delete);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|