QueryOptions options = new QueryOptions(QueryOptions.INCLUDE, FileDBAdaptor.QueryParams.UID.key()); if (CollectionUtils.isNotEmpty(pathList)) { .append(FileDBAdaptor.QueryParams.STUDY_UID.key(), resource.getStudy().getUid()) .append(FileDBAdaptor.QueryParams.PATH.key(), pathList); QueryResult<File> fileQueryResult1 = fileDBAdaptor.get(query, options); for (File file1 : fileQueryResult1.getResult()) {
.append(FileManager.SKIP_TRASH, true) .append(FileManager.FORCE_DELETE, true); catalogManager.getFileManager().delete(studyFqn, new Query(FileDBAdaptor.QueryParams.UID.key(), folder.getUid()), params, sessionIdUser); Query query = new Query() .append(FileDBAdaptor.QueryParams.UID.key(), folder.getUid()) .append(FileDBAdaptor.QueryParams.STATUS_NAME.key(), File.FileStatus.DELETED); File fileTmp = fileManager.get(studyFqn, query, QueryOptions.empty(), sessionIdUser).first(); query.put(FileDBAdaptor.QueryParams.UID.key(), file.getUid()); fileTmp = fileManager.get(studyFqn, query, QueryOptions.empty(), sessionIdUser).first(); assertTrue("Folder name should have been modified", fileTmp.getPath().contains(myPath));
.append(FileDBAdaptor.QueryParams.PATH.key(), "myDirectory/"), null, sessionIdUser); assertEquals(1, folderQueryResult.getNumResults()); assertTrue(!folderQueryResult.first().isExternal()); folderQueryResult = catalogManager.getFileManager().get(studyFqn, new Query(FileDBAdaptor.QueryParams.PATH.key(), "myDirectory/data/"), null, sessionIdUser); assertEquals(1, folderQueryResult.getNumResults()); assertTrue(folderQueryResult.first().isExternal()); folderQueryResult = catalogManager.getFileManager().get(studyFqn, new Query(FileDBAdaptor.QueryParams.PATH.key(), "myDirectory/data/test/"), null, sessionIdUser); assertEquals(1, folderQueryResult.getNumResults()); assertTrue(folderQueryResult.first().isExternal()); folderQueryResult = catalogManager.getFileManager().get(studyFqn, new Query(FileDBAdaptor.QueryParams.PATH.key(), "myDirectory/data/test/folder/"), null, sessionIdUser); assertEquals(1, folderQueryResult.getNumResults());
updateFileAttributes(file, checksum, targetUri, new ObjectMap(FileDBAdaptor.QueryParams.STATUS_NAME.key(), File.FileStatus.READY), sessionId);
private File getOriginalFromTransformed(String study, File file, String sessionId) throws URISyntaxException, CatalogException { // Look for the vcf file String vcfId = null; // Matchup variant files, if missing if (file.getRelatedFiles() == null || file.getRelatedFiles().isEmpty()) { catalogManager.getFileManager().matchUpVariantFiles(null, Collections.singletonList(file), sessionId); } for (File.RelatedFile relatedFile : file.getRelatedFiles()) { if (File.RelatedFile.Relation.PRODUCED_FROM.equals(relatedFile.getRelation())) { long fileUid = relatedFile.getFileId(); // FIXME!!! vcfId = catalogManager.getFileManager().get(study, new Query(UID.key(), fileUid), new QueryOptions(QueryOptions.INCLUDE, ID.key()), sessionId).first().getId(); break; } } if (vcfId == null) { logger.error("This code should never be executed. Every transformed avro file should come from a registered vcf file"); throw new CatalogException("Internal error. No vcf file could be found for file " + file.getPath()); } QueryResult<File> vcfQueryResult = fileManager.get(study, vcfId, FILE_GET_QUERY_OPTIONS, sessionId); if (vcfQueryResult.getNumResults() != 1) { logger.error("This code should never be executed. No vcf file could be found for vcf id " + vcfId); throw new CatalogException("Internal error. No vcf file could be found under id " + vcfId); } file = vcfQueryResult.first(); return file; }
if (parameters.containsKey(QueryParams.SIZE.key())) { QueryOptions options = new QueryOptions(QueryOptions.INCLUDE, Arrays.asList( FILTER_ROUTE_FILES + QueryParams.SIZE.key(), FILTER_ROUTE_FILES + PRIVATE_STUDY_ID)); fileQueryResult = nativeGet(query, options); UpdateDocument tmpUpdateDocument = getValidatedUpdateParams(parameters, queryOptions); updateAnnotationSets(query.getLong(QueryParams.UID.key(), -1L), parameters, variableSetList, queryOptions, false); long newDiskUsage = parameters.getLong(QueryParams.SIZE.key()); for (Document file : (List<Document>) fileQueryResult.getResult()) { long difDiskUsage = newDiskUsage - Long.parseLong(file.get(QueryParams.SIZE.key()).toString()); long studyId = (long) file.get(PRIVATE_STUDY_ID); dbAdaptorFactory.getCatalogStudyDBAdaptor().updateDiskUsage(studyId, difDiskUsage);
QueryOptions includeOptions = new QueryOptions(QueryOptions.INCLUDE, FileDBAdaptor.QueryParams.STATS.key()); QueryResult<File> fileQueryResult = catalogManager.getFileManager().get(fileInfo.getFileUid(), includeOptions, sessionId);
public List<File> removeFiles(StudyInfo studyInfo, QueryOptions options, String sessionId) throws CatalogException, StorageEngineException, IOException { // We get the credentials of the Datastore to insert the variants DataStore dataStore = studyInfo.getDataStores().get(File.Bioformat.VARIANT); // Update study configuration BEFORE executing the operation and fetching files from Catalog updateCatalogFromStudyConfiguration(sessionId, studyInfo.getStudyFQN(), dataStore); List<String> fileNames = new ArrayList<>(studyInfo.getFileInfos().size()); List<String> filePaths = new ArrayList<>(studyInfo.getFileInfos().size()); for (FileInfo fileInfo : studyInfo.getFileInfos()) { File file = catalogManager.getFileManager().get(studyInfo.getStudyFQN(), fileInfo.getPath(), null, sessionId).first(); if (file.getIndex().getStatus().getName().equals(FileIndex.IndexStatus.READY)) { fileNames.add(fileInfo.getName()); filePaths.add(fileInfo.getPath()); } else { throw new CatalogException("Unable to remove variants from file " + file.getName() + ". " + "IndexStatus = " + file.getIndex().getStatus().getName()); } } if (fileNames.isEmpty()) { throw new CatalogException("Nothing to do!"); } VariantStorageEngine variantStorageEngine = getVariantStorageEngine(dataStore); variantStorageEngine.getOptions().putAll(options); variantStorageEngine.removeFiles(studyInfo.getStudyFQN(), fileNames); // Update study configuration to synchronize updateCatalogFromStudyConfiguration(sessionId, studyInfo.getStudyFQN(), dataStore); return catalogManager.getFileManager().get(studyInfo.getStudyFQN(), new Query(FileDBAdaptor.QueryParams.PATH.key(), filePaths), new QueryOptions(), sessionId) .getResult(); }
@Test public void testUnlinkFolder() throws CatalogException, IOException { URI uri = Paths.get(getStudyURI()).resolve("data").toUri(); link(uri, "myDirectory", studyFqn, new ObjectMap("parents", true), sessionIdUser); CatalogIOManager ioManager = catalogManager.getCatalogIOManagerFactory().get(uri); Query query = new Query() .append(FileDBAdaptor.QueryParams.STUDY_UID.key(), studyUid) .append(FileDBAdaptor.QueryParams.PATH.key(), "~myDirectory/*") .append(FileDBAdaptor.QueryParams.STATUS_NAME.key(), File.FileStatus.READY); QueryResult<File> fileQueryResultLinked = catalogManager.getFileManager().get(studyFqn, query, null, sessionIdUser); System.out.println("Number of files/folders linked = " + fileQueryResultLinked.getNumResults()); // Now we try to unlink them catalogManager.getFileManager().unlink(studyFqn, "myDirectory/data/", sessionIdUser); fileQueryResultLinked = catalogManager.getFileManager().get(studyFqn, query, null, sessionIdUser); assertEquals(1, fileQueryResultLinked.getNumResults()); query = new Query() .append(FileDBAdaptor.QueryParams.STUDY_UID.key(), studyUid) .append(FileDBAdaptor.QueryParams.PATH.key(), "~myDirectory/*") .append(FileDBAdaptor.QueryParams.STATUS_NAME.key(), File.FileStatus.REMOVED); QueryResult<File> fileQueryResultUnlinked = catalogManager.getFileManager().get(studyFqn, query, null, sessionIdUser); assertEquals(6, fileQueryResultUnlinked.getNumResults()); String myPath = "myDirectory/data" + AbstractManager.INTERNAL_DELIMITER + "REMOVED"; for (File file : fileQueryResultUnlinked.getResult()) { assertTrue("File name should have been modified", file.getPath().contains(myPath)); assertEquals("Status should be to REMOVED", File.FileStatus.REMOVED, file.getStatus().getName()); assertEquals("Name should not have changed", file.getName(), file.getName()); assertTrue("File uri: " + file.getUri() + " should exist", ioManager.exists(file.getUri())); } }
@Test public void deleteFolderTest3() throws CatalogException, IOException { List<File> folderFiles = new LinkedList<>(); File folder = createBasicDirectoryFileTestEnvironment(folderFiles); CatalogIOManager ioManager = catalogManager.getCatalogIOManagerFactory().get(catalogManager.getFileManager().getUri(folder)); for (File file : folderFiles) { assertTrue(ioManager.exists(catalogManager.getFileManager().getUri(file))); } catalogManager.getFileManager().delete(studyFqn, new Query(FileDBAdaptor.QueryParams.UID.key(), folder.getUid()), new ObjectMap(FileManager.SKIP_TRASH, true), sessionIdUser); Query query = new Query() .append(FileDBAdaptor.QueryParams.UID.key(), folder.getUid()) .append(FileDBAdaptor.QueryParams.STATUS_NAME.key(), File.FileStatus.PENDING_DELETE); File fileTmp = fileManager.get(studyFqn, query, QueryOptions.empty(), sessionIdUser).first(); String myPath = Paths.get(folder.getPath()) + AbstractManager.INTERNAL_DELIMITER + "DELETED"; assertTrue("Folder name should have been modified", fileTmp.getPath().contains(myPath)); assertEquals("Status should be to PENDING_DELETE", File.FileStatus.PENDING_DELETE, fileTmp.getStatus().getName()); assertEquals("Name should not have changed", folder.getName(), fileTmp.getName()); assertTrue(ioManager.exists(fileTmp.getUri())); for (File file : folderFiles) { query.put(FileDBAdaptor.QueryParams.UID.key(), file.getUid()); fileTmp = fileManager.get(studyFqn, query, QueryOptions.empty(), sessionIdUser).first(); assertTrue("Folder name should have been modified", fileTmp.getPath().contains(myPath)); assertEquals("Status should be to PENDING_DELETE", File.FileStatus.PENDING_DELETE, fileTmp.getStatus().getName()); assertEquals("Name should not have changed", file.getName(), fileTmp.getName()); assertTrue("File uri: " + fileTmp.getUri() + " should exist", ioManager.exists(fileTmp.getUri())); } }
@Test public void deleteFolderTest2() throws CatalogException, IOException { List<File> folderFiles = new LinkedList<>(); File folder = createBasicDirectoryFileTestEnvironment(folderFiles); CatalogIOManager ioManager = catalogManager.getCatalogIOManagerFactory().get(catalogManager.getFileManager().getUri(folder)); for (File file : folderFiles) { assertTrue(ioManager.exists(catalogManager.getFileManager().getUri(file))); } catalogManager.getFileManager().delete(studyFqn, new Query(FileDBAdaptor.QueryParams.UID.key(), folder.getUid()), null, sessionIdUser); Query query = new Query() .append(FileDBAdaptor.QueryParams.UID.key(), folder.getUid()) .append(FileDBAdaptor.QueryParams.STATUS_NAME.key(), File.FileStatus.TRASHED); File fileTmp = catalogManager.getFileManager().get(studyFqn, query, QueryOptions.empty(), sessionIdUser).first(); assertEquals("Folder name should not be modified", folder.getPath(), fileTmp.getPath()); assertEquals("Status should be to TRASHED", File.FileStatus.TRASHED, fileTmp.getStatus().getName()); assertEquals("Name should not have changed", folder.getName(), fileTmp.getName()); assertTrue(ioManager.exists(fileTmp.getUri())); for (File file : folderFiles) { query.put(FileDBAdaptor.QueryParams.UID.key(), file.getUid()); fileTmp = fileManager.get(studyFqn, query, QueryOptions.empty(), sessionIdUser).first(); assertEquals("Folder name should not be modified", file.getPath(), fileTmp.getPath()); assertEquals("Status should be to TRASHED", File.FileStatus.TRASHED, fileTmp.getStatus().getName()); assertEquals("Name should not have changed", file.getName(), fileTmp.getName()); assertTrue("File uri: " + fileTmp.getUri() + " should exist", ioManager.exists(fileTmp.getUri())); } }
public QueryResult<FileIndex> updateFileIndexStatus(File file, String newStatus, String message, Integer release, String sessionId) throws CatalogException { String userId = catalogManager.getUserManager().getUserId(sessionId); Long studyId = file.getStudyUid(); authorizationManager.checkFilePermission(studyId, file.getUid(), userId, FileAclEntry.FilePermissions.WRITE); FileIndex index = file.getIndex(); if (index != null) { if (!FileIndex.IndexStatus.isValid(newStatus)) { throw new CatalogException("The status " + newStatus + " is not a valid status."); } else { index.setStatus(new FileIndex.IndexStatus(newStatus, message)); } } else { index = new FileIndex(userId, TimeUtils.getTime(), new FileIndex.IndexStatus(newStatus), -1, new ObjectMap()); } if (release != null) { if (newStatus.equals(FileIndex.IndexStatus.READY)) { index.setRelease(release); } } ObjectMap params = new ObjectMap(FileDBAdaptor.QueryParams.INDEX.key(), index); fileDBAdaptor.update(file.getUid(), params, QueryOptions.empty()); auditManager.recordUpdate(AuditRecord.Resource.file, file.getUid(), userId, params, null, null); return new QueryResult<>("Update file index", 0, 1, 1, "", "", Arrays.asList(index)); }
/** * Check tracking from all files from a study. * * Set file status {@link File.FileStatus#MISSING} if the file (fileUri) is unreachable * Set file status to {@link File.FileStatus#READY} if was {@link File.FileStatus#MISSING} and file (fileUri) is reachable * * @param study The study to check * @param sessionId User sessionId * @param calculateChecksum Calculate checksum for "found files" * @throws CatalogException if a Catalog error occurs * @return found and lost files */ public List<File> checkStudyFiles(Study study, boolean calculateChecksum, String sessionId) throws CatalogException { Query query = new Query(); query.put(FileDBAdaptor.QueryParams.STATUS_NAME.key(), Arrays.asList( File.FileStatus.READY, File.FileStatus.MISSING, File.FileStatus.TRASHED)); QueryResult<File> files = catalogManager.getFileManager().get(study.getFqn(), query, new QueryOptions(), sessionId); List<File> modifiedFiles = new LinkedList<>(); for (File file : files.getResult()) { File checkedFile = catalogFileUtils.checkFile(study.getFqn(), file, calculateChecksum, sessionId); if (checkedFile != file) { modifiedFiles.add(checkedFile); } } return modifiedFiles; }
@Deprecated public void checkInUse(long sampleId) throws CatalogDBException { long studyId = getStudyId(sampleId); Query query = new Query(FileDBAdaptor.QueryParams.SAMPLE_UIDS.key(), sampleId); QueryOptions queryOptions = new QueryOptions(MongoDBCollection.INCLUDE, Arrays.asList(FILTER_ROUTE_FILES + FileDBAdaptor .QueryParams.UID.key(), FILTER_ROUTE_FILES + FileDBAdaptor.QueryParams.PATH.key())); QueryResult<File> fileQueryResult = dbAdaptorFactory.getCatalogFileDBAdaptor().get(query, queryOptions); if (fileQueryResult.getNumResults() != 0) { String msg = "Can't delete Sample " + sampleId + ", still in use in \"sampleId\" array of files : " + fileQueryResult.getResult().stream() .map(file -> "{ id: " + file.getUid() + ", path: \"" + file.getPath() + "\" }") .collect(Collectors.joining(", ", "[", "]")); throw new CatalogDBException(msg); } queryOptions = new QueryOptions(CohortDBAdaptor.QueryParams.SAMPLES.key(), sampleId) .append(MongoDBCollection.INCLUDE, Arrays.asList(FILTER_ROUTE_COHORTS + CohortDBAdaptor.QueryParams.UID.key(), FILTER_ROUTE_COHORTS + CohortDBAdaptor.QueryParams.ID.key())); QueryResult<Cohort> cohortQueryResult = dbAdaptorFactory.getCatalogCohortDBAdaptor().getAllInStudy(studyId, queryOptions); if (cohortQueryResult.getNumResults() != 0) { String msg = "Can't delete Sample " + sampleId + ", still in use in cohorts : " + cohortQueryResult.getResult().stream() .map(cohort -> "{ id: " + cohort.getUid() + ", name: \"" + cohort.getId() + "\" }") .collect(Collectors.joining(", ", "[", "]")); throw new CatalogDBException(msg); } }
@Test public void testUnlinkFile() throws CatalogException, IOException { URI uri = Paths.get(getStudyURI()).resolve("data").toUri(); link(uri, "myDirectory", studyFqn, new ObjectMap("parents", true), sessionIdUser); Query query = new Query() .append(FileDBAdaptor.QueryParams.PATH.key(), "~myDirectory/*") .append(FileDBAdaptor.QueryParams.STATUS_NAME.key(), File.FileStatus.READY); QueryResult<File> fileQueryResultLinked = catalogManager.getFileManager().get(studyFqn, query, null, sessionIdUser); System.out.println("Number of files/folders linked = " + fileQueryResultLinked.getNumResults()); // Now we try to unlink the file catalogManager.getFileManager().unlink(studyFqn, "myDirectory/data/test/folder/test_0.5K.txt", sessionIdUser); query = new Query(FileDBAdaptor.QueryParams.UID.key(), 35L); fileQueryResultLinked = catalogManager.getFileManager().get(studyFqn, query, QueryOptions.empty(), sessionIdUser); assertEquals(1, fileQueryResultLinked.getNumResults()); assertTrue(fileQueryResultLinked.first().getPath().contains(AbstractManager.INTERNAL_DELIMITER + "REMOVED")); assertEquals(fileQueryResultLinked.first().getPath().indexOf(AbstractManager.INTERNAL_DELIMITER + "REMOVED"), fileQueryResultLinked.first().getPath().lastIndexOf(AbstractManager.INTERNAL_DELIMITER + "REMOVED")); fileQueryResultLinked = catalogManager.getFileManager().get(studyFqn, query, QueryOptions.empty(), sessionIdUser); // We check REMOVED is only contained once in the path assertEquals(fileQueryResultLinked.first().getPath().indexOf(AbstractManager.INTERNAL_DELIMITER + "REMOVED"), fileQueryResultLinked.first().getPath().lastIndexOf(AbstractManager.INTERNAL_DELIMITER + "REMOVED")); // We send the unlink command again thrown.expect(CatalogException.class); thrown.expectMessage("not found"); catalogManager.getFileManager().unlink(studyFqn, "myDirectory/data/test/folder/test_0.5K.txt", sessionIdUser); }
@Test public void testDelete1() throws CatalogException, IOException { String filePath = "data/"; Query query = new Query() .append(FileDBAdaptor.QueryParams.STUDY_UID.key(), studyUid) .append(FileDBAdaptor.QueryParams.PATH.key(), filePath); QueryResult<File> fileQueryResult = catalogManager.getFileManager().get(studyFqn, query, null, sessionIdUser); // Change the status to MISSING catalogManager.getFileManager().setStatus(studyFqn, filePath, File.FileStatus.MISSING, null, sessionIdUser); WriteResult deleteResult = catalogManager.getFileManager().delete(studyFqn, new Query(FileDBAdaptor.QueryParams.UID.key(), fileQueryResult.first().getUid()), null, sessionIdUser); assertEquals(1, deleteResult.getNumMatches()); assertEquals(0, deleteResult.getNumModified()); assertTrue(deleteResult.getFailed().get(0).getMessage().contains("Cannot delete")); // Change the status to STAGED catalogManager.getFileManager().setStatus(studyFqn, filePath, File.FileStatus.STAGE, null, sessionIdUser); deleteResult = catalogManager.getFileManager().delete(studyFqn, new Query(FileDBAdaptor.QueryParams.UID.key(), fileQueryResult.first().getUid()), null, sessionIdUser); assertEquals(1, deleteResult.getNumMatches()); assertEquals(0, deleteResult.getNumModified()); assertTrue(deleteResult.getFailed().get(0).getMessage().contains("Cannot delete")); // Change the status to READY catalogManager.getFileManager().setStatus(studyFqn, filePath, File.FileStatus.READY, null, sessionIdUser); deleteResult = catalogManager.getFileManager().delete(studyFqn, new Query(FileDBAdaptor.QueryParams.UID.key(), fileQueryResult.first().getUid()), null, sessionIdUser); assertEquals(6, deleteResult.getNumMatches()); assertEquals(6, deleteResult.getNumModified()); }
@Test public void testAnnotations() throws CatalogException, JsonProcessingException { List<Variable> variables = new ArrayList<>(); variables.add(new Variable("var_name", "", "", Variable.VariableType.TEXT, "", true, false, Collections.emptyList(), 0, "", "", null, Collections.emptyMap())); variables.add(new Variable("AGE", "", "", Variable.VariableType.INTEGER, "", false, false, Collections.emptyList(), 0, "", "", null, Collections.emptyMap())); variables.add(new Variable("HEIGHT", "", "", Variable.VariableType.DOUBLE, "", false, false, Collections.emptyList(), 0, "", "", null, Collections.emptyMap())); VariableSet vs1 = catalogManager.getStudyManager().createVariableSet(studyFqn, "vs1", "vs1", false, false, "", null, variables, sessionIdUser).first(); ObjectMap annotations = new ObjectMap() .append("var_name", "Joe") .append("AGE", 25) .append("HEIGHT", 180); AnnotationSet annotationSet = new AnnotationSet("annotation1", vs1.getId(), annotations); AnnotationSet annotationSet1 = new AnnotationSet("annotation2", vs1.getId(), annotations); ObjectMapper jsonObjectMapper = getDefaultObjectMapper(); ObjectMap updateAnnotation = new ObjectMap() // Update the annotation values .append(FileDBAdaptor.QueryParams.ANNOTATION_SETS.key(), Arrays.asList( new ObjectMap(jsonObjectMapper.writeValueAsString(annotationSet)), new ObjectMap(jsonObjectMapper.writeValueAsString(annotationSet1)) )); QueryResult<File> update = catalogManager.getFileManager().update(studyFqn, "data/", updateAnnotation, QueryOptions.empty(), sessionIdUser); assertEquals(2, update.first().getAnnotationSets().size()); }
/** * Scan the study folder, add all untracked files and check tracking. * * @param study Study to resync * @param calculateChecksum Calculates checksum of all the files in the directory to scan * @param sessionId User sessionId * @return New, lost and found files * @throws CatalogException if a Catalog error occurs * @throws IOException if an I/O error occurs */ public List<File> reSync(Study study, boolean calculateChecksum, String sessionId) throws CatalogException, IOException { // File root = catalogManager.getAllFiles(studyId, new QueryOptions("path", ""), sessionId).first(); Query query = new Query(); query.put(FileDBAdaptor.QueryParams.URI.key(), "~.*"); //Where URI exists query.put(FileDBAdaptor.QueryParams.TYPE.key(), File.Type.DIRECTORY); List<File> files = catalogManager.getFileManager().get(study.getFqn(), query, null, sessionId).getResult(); List<File> scan = new LinkedList<>(); for (File file : files) { scan.addAll(scan(file, catalogManager.getFileManager().getUri(file), FileScannerPolicy.REPLACE, calculateChecksum, false, sessionId)); } // TODO: Scan per file scan.addAll(checkStudyFiles(study, calculateChecksum, sessionId)); return scan; }
@Test public void testDelete3() throws CatalogException, IOException { String filePath = "data/"; Query query = new Query() .append(FileDBAdaptor.QueryParams.STUDY_UID.key(), studyUid) .append(FileDBAdaptor.QueryParams.PATH.key(), filePath); File file = catalogManager.getFileManager().get(studyFqn, query, null, sessionIdUser).first(); // We look for all the files and folders that fall within that folder query = new Query() .append(FileDBAdaptor.QueryParams.STUDY_UID.key(), studyUid) .append(FileDBAdaptor.QueryParams.PATH.key(), "~^" + filePath + "*") .append(FileDBAdaptor.QueryParams.STATUS_NAME.key(), File.FileStatus.READY); int numResults = catalogManager.getFileManager().get(studyFqn, query, null, sessionIdUser).getNumResults(); assertEquals(6, numResults); // We delete it QueryOptions queryOptions = new QueryOptions(FileManager.SKIP_TRASH, true); catalogManager.getFileManager().delete(studyFqn, new Query(FileDBAdaptor.QueryParams.UID.key(), file.getUid()), queryOptions, sessionIdUser); // The files should have been moved to trashed status numResults = catalogManager.getFileManager().get(studyFqn, query, null, sessionIdUser).getNumResults(); assertEquals(0, numResults); query.put(FileDBAdaptor.QueryParams.STATUS_NAME.key(), File.FileStatus.PENDING_DELETE); numResults = catalogManager.getFileManager().get(studyFqn, query, null, sessionIdUser).getNumResults(); assertEquals(6, numResults); }