@Test
public void testComplexAdd() throws IOException, CatalogException, URISyntaxException {
CatalogIOManager ioManager = catalogManager.getCatalogIOManagerFactory().getDefault();
URI fileUri = getClass().getResource("/biofiles/variant-test-file.vcf.gz").toURI();
ioManager.copyFile(fileUri, directory.resolve("file1.vcf.gz").toUri());
CatalogManagerTest.createDebugFile(directory.resolve("file1.vcf.variants.json").toString());
CatalogManagerTest.createDebugFile(directory.resolve("file1.vcf.variants.json.gz").toString());
CatalogManagerTest.createDebugFile(directory.resolve("file1.vcf.variants.json.snappy").toString());
CatalogManagerTest.createDebugFile(directory.resolve("file2.bam").toString());
CatalogManagerTest.createDebugFile(directory.resolve("file2.sam.gz").toString());
FileScanner fileScanner = new FileScanner(catalogManager);
List<File> files = fileScanner.scan(folder, directory.toUri(), FileScanner.FileScannerPolicy.REPLACE, true, true, sessionIdUser);
Map<String, File> map = files.stream().collect(Collectors.toMap(File::getName, (f) -> f));
assertEquals(6, files.size());
files.forEach((file) -> assertEquals(File.FileStatus.READY, file.getStatus().getName()));
assertEquals(File.Bioformat.VARIANT, map.get("file1.vcf.gz").getBioformat());
assertEquals(File.Bioformat.VARIANT, map.get("file1.vcf.variants.json").getBioformat());
assertEquals(File.Bioformat.VARIANT, map.get("file1.vcf.variants.json.gz").getBioformat());
assertEquals(File.Bioformat.VARIANT, map.get("file1.vcf.variants.json.snappy").getBioformat());
assertEquals(File.Bioformat.ALIGNMENT, map.get("file2.bam").getBioformat());
assertEquals(File.Bioformat.ALIGNMENT, map.get("file2.sam.gz").getBioformat());
assertEquals(File.Format.VCF, map.get("file1.vcf.gz").getFormat());
assertEquals(File.Format.JSON, map.get("file1.vcf.variants.json").getFormat());
assertEquals(File.Format.JSON, map.get("file1.vcf.variants.json.gz").getFormat());
assertEquals(File.Format.JSON, map.get("file1.vcf.variants.json.snappy").getFormat());
assertEquals(File.Format.BAM, map.get("file2.bam").getFormat());
assertEquals(File.Format.SAM, map.get("file2.sam.gz").getFormat());
}