public File create(String resourceName) throws IOException, CatalogException { File file; URI uri = getResourceUri(resourceName); file = fileMetadataReader.create(studyId, uri, "data/vcfs/", "", true, null, sessionId).first(); catalogFileUtils.upload(uri, file, null, sessionId, false, false, true, false, Long.MAX_VALUE); return catalogManager.getFile(file.getId(), sessionId).first(); }
@Before public void before() throws Exception { catalogPropertiesFile = getResourceUri("catalog.properties").getPath(); Properties properties = new Properties(); properties.load( CatalogManagerTest.class.getClassLoader().getResourceAsStream("catalog.properties")); CatalogManagerTest.clearCatalog(properties); catalogManager = new CatalogManager(properties); fileMetadataReader = FileMetadataReader.get(catalogManager); catalogFileUtils = new CatalogFileUtils(catalogManager); User user = catalogManager.createUser(userId, "User", "*****@*****.**", "user", "ACME", null).first(); sessionId = catalogManager.login(userId, "user", "localhost").first().getString("sessionId"); projectId = catalogManager .createProject(userId, "p1", "p1", "Project 1", "ACME", null, sessionId) .first() .getId(); studyId = catalogManager .createStudy( projectId, "s1", "s1", Study.Type.CASE_CONTROL, null, null, "Study 1", null, null, null, null, Collections.singletonMap(File.Bioformat.VARIANT, new DataStore("mongodb", DB_NAME)), null, null, null, sessionId) .first() .getId(); outputId = catalogManager .createFolder(studyId, Paths.get("data", "index"), false, null, sessionId) .first() .getId(); files.add( create( "1-500.filtered.10k.chr22.phase3_shapeit2_mvncall_integrated_v5.20130502.genotypes.vcf.gz")); files.add( create( "501-1000.filtered.10k.chr22.phase3_shapeit2_mvncall_integrated_v5.20130502.genotypes.vcf.gz")); files.add( create( "1001-1500.filtered.10k.chr22.phase3_shapeit2_mvncall_integrated_v5.20130502.genotypes.vcf.gz")); files.add( create( "1501-2000.filtered.10k.chr22.phase3_shapeit2_mvncall_integrated_v5.20130502.genotypes.vcf.gz")); files.add( create( "2001-2504.filtered.10k.chr22.phase3_shapeit2_mvncall_integrated_v5.20130502.genotypes.vcf.gz")); }