public static URI getResourceUri(String resourceName, String targetName) throws IOException { Path rootDir = getTmpRootDir(); Path resourcePath = rootDir.resolve(targetName); if (!resourcePath.getParent().toFile().exists()) { Files.createDirectories(resourcePath.getParent()); } if (!resourcePath.toFile().exists()) { InputStream stream = VariantStorageEngineTest.class.getClassLoader().getResourceAsStream(resourceName); Files.copy(stream, resourcePath, StandardCopyOption.REPLACE_EXISTING); } return resourcePath.toUri(); }
public static void printVariantsFromVariantsTable(VariantHadoopDBAdaptor dbAdaptor) throws IOException { printVariantsFromVariantsTable(dbAdaptor, getTmpRootDir()); }
@Override protected void before() throws Throwable { super.before(); Path rootDir = getTmpRootDir(); String confFolder = VariantSearchManager.CONF_SET; // Copy configuration getResourceUri("configsets/variantsCollection/solrconfig.xml", "configsets/" + confFolder + "/solrconfig.xml"); getResourceUri("solr/variant/managed-schema", "configsets/" + confFolder + "/managed-schema"); getResourceUri("configsets/variantsCollection/params.json", "configsets/" + confFolder + "/params.json"); getResourceUri("configsets/variantsCollection/protwords.txt", "configsets/" + confFolder + "/protwords.txt"); getResourceUri("configsets/variantsCollection/stopwords.txt", "configsets/" + confFolder + "/stopwords.txt"); getResourceUri("configsets/variantsCollection/synonyms.txt", "configsets/" + confFolder + "/synonyms.txt"); getResourceUri("configsets/variantsCollection/lang/stopwords_en.txt", "configsets/" + confFolder + "/lang/stopwords_en.txt"); String solrHome = rootDir.resolve("solr").toString(); if (embeded) { solrClient = create(solrHome, rootDir.resolve("configsets").toString(), coreName); } else { String host = "http://localhost:8983/solr"; String configSet = VariantSearchManager.CONF_SET; int timeout = 5000; SolrManager solrManager = new SolrManager(host, "core", timeout); if (!solrManager.existsCore(coreName)) { solrManager.createCore(coreName, configSet); } this.solrClient = solrManager.getSolrClient(); } }