public static Configuration load(InputStream configurationInputStream) throws IOException { return load(configurationInputStream, DEFAULT_CONFIGURATION_FORMAT); }
public static Configuration load(Path configurationPath) throws IOException { InputStream inputStream = FileUtils.newInputStream(configurationPath); return load(inputStream, DEFAULT_CONFIGURATION_FORMAT); }
/** * This method attempts to load general configuration from OpenCGA installation folder, if not exists then loads JAR configuration.yml. * * @throws IOException If any IO problem occurs */ public void loadConfiguration() throws IOException { FileUtils.checkDirectory(Paths.get(this.opencgaHome)); // We load configuration file either from app home folder or from the JAR Path path = Paths.get(this.opencgaHome).resolve("conf").resolve("configuration.yml"); if (Files.exists(path)) { logger.debug("Loading configuration from '{}'", path.toAbsolutePath()); this.configuration = Configuration.load(new FileInputStream(path.toFile())); } else { logger.debug("Loading configuration from JAR file"); this.configuration = Configuration .load(Configuration.class.getClassLoader().getResourceAsStream("configuration.yml")); } }
public CatalogIOManager(String catalogConfigurationFile) throws CatalogIOException { this(); this.configuration = new Configuration(); try { this.configuration.load(new FileInputStream(catalogConfigurationFile)); } catch (IOException e) { throw new CatalogIOException("Error loading Catalog Configuration file", e); } setup(); }
@Override public void before() throws Exception { int c = 0; do { opencgaHome = Paths.get("target/test-data").resolve("junit_opencga_home_" + TimeUtils.getTimeMillis() + (c > 0 ? "_" + c : "")); c++; } while (opencgaHome.toFile().exists()); Files.createDirectories(opencgaHome); configuration = Configuration.load(getClass().getResource("/configuration-test.yml").openStream()); configuration.getAdmin().setAlgorithm("HS256"); configuration.setDataDir(opencgaHome.resolve("sessions").toUri().toString()); configuration.setTempJobsDir(opencgaHome.resolve("jobs").toUri().toString()); catalogManager = new CatalogManager(configuration); try { catalogManager.deleteCatalogDB(false); } catch (Exception ignore) {} clearCatalog(configuration); if (!opencgaHome.toFile().exists()) { deleteFolderTree(opencgaHome.toFile()); Files.createDirectory(opencgaHome); } catalogManager.installCatalogDB("dummy", "admin"); }
@Before public void setUp() throws Exception { Configuration configuration = Configuration.load(getClass().getResource("/configuration-test.yml").openStream()); configuration.getAdmin().setSecretKey("12345"); configuration.getAdmin().setAlgorithm("HS256"); jwtSessionManager = new JwtManager(configuration); testCreateJWTToken(); }
@Before public void before() throws IOException, CatalogException { MongoDBAdaptorTest dbAdaptorTest = new MongoDBAdaptorTest(); dbAdaptorTest.before(); Configuration configuration = Configuration.load(getClass().getResource("/configuration-test.yml").openStream()); user1 = MongoDBAdaptorTest.user1; user2 = MongoDBAdaptorTest.user2; user3 = MongoDBAdaptorTest.user3; dbAdaptorFactory = MongoDBAdaptorTest.catalogDBAdaptor; aclDBAdaptor = new AuthorizationMongoDBAdaptor(configuration); studyId = user3.getProjects().get(0).getStudies().get(0).getUid(); s1 = dbAdaptorFactory.getCatalogSampleDBAdaptor().insert(studyId, new Sample("s1", "", new Individual(), null, null, 1, 1, "", "", false, Collections.emptyList(), new ArrayList<>(), Collections.emptyMap()), QueryOptions.empty()).first(); acl_s1_user1 = new SampleAclEntry(user1.getId(), Arrays.asList()); acl_s1_user2 = new SampleAclEntry(user2.getId(), Arrays.asList( SampleAclEntry.SamplePermissions.VIEW.name(), SampleAclEntry.SamplePermissions.VIEW_ANNOTATIONS.name(), SampleAclEntry.SamplePermissions.UPDATE.name() )); aclDBAdaptor.setAcls(Arrays.asList(s1.getUid()), Arrays.asList(acl_s1_user1, acl_s1_user2), Entity.SAMPLE); }
@BeforeClass public static void beforeClass() throws IOException, CatalogException, URISyntaxException { Configuration configuration = Configuration.load(CatalogSampleAnnotationsLoaderTest.class.getClassLoader() .getClass().getResource("/configuration-test.yml").openStream()); configuration.getAdmin().setAlgorithm("HS256"); catalogManager = new CatalogManager(configuration); catalogManager.deleteCatalogDB(true); catalogManager.installCatalogDB("dummy", "admin"); loader = new CatalogSampleAnnotationsLoader(catalogManager); String pedFileName = "20130606_g1k.ped"; URL pedFileURL = CatalogSampleAnnotationsLoader.class.getClassLoader().getResource(pedFileName); pedigree = loader.readPedigree(pedFileURL.getPath()); userId = "user1"; catalogManager.getUserManager().create(userId, userId, "asdasd@asd.asd", userId, "", -1L, Account.FULL, QueryOptions.empty(), null); sessionId = catalogManager.getUserManager().login(userId, userId); Project project = catalogManager.getProjectManager().create("def", "default", "", "ACME", "Homo sapiens", null, null, "GRCh38", new QueryOptions(), sessionId).getResult().get(0); Study study = catalogManager.getStudyManager().create(project.getFqn(), "def", null, "default", Study.Type.FAMILY, null, "", null, null, null, null, null, null, null, null, sessionId).getResult().get(0); studyId = study.getFqn(); pedFile = catalogManager.getFileManager().create(studyId, File.Type.FILE, File.Format.PED, File.Bioformat .OTHER_PED, "data/" + pedFileName, null, "", null, 0, -1, null, (long) -1, null, null, true, null, null, sessionId) .getResult().get(0); new FileUtils(catalogManager).upload(pedFileURL.toURI(), pedFile, null, sessionId, false, false, false, true, 10000000); pedFile = catalogManager.getFileManager().get(studyId, pedFile.getPath(), null, sessionId).getResult().get(0); }
@Before public void beforeClass() throws Exception { Configuration configuration = Configuration.load(getClass().getResource("/configuration-test.yml") .openStream());
@Before public void before() throws CatalogException, IOException, URISyntaxException { Configuration configuration = Configuration.load(getClass().getResource("/configuration-test.yml") .openStream()); configuration.getAdmin().setAlgorithm("HS256");
@Before public void before() throws IOException, CatalogException { configuration = Configuration.load(getClass().getResource("/configuration-test.yml") .openStream());
@Before public void before() throws Exception { Configuration configuration = Configuration.load(getClass().getResource("/configuration-test.yml") .openStream()); configuration.getAdmin().setAlgorithm("HS256");