/** * * * <h3>Fixtures</h3> * * You can add test or init data by creating a 'fixtures' directory under a Solr core. Test files * are described using the Solr XML format for documents. * * <h4>Fixtures properties</h4> * * <ul> * solr.fixtures: enabled or disabled the loading of test files. Default is: true. * solr.fixtures.async: if true, a new thread will be created for loading the fixtures. Default * is: true. * </ul> */ @PostConstruct public void runFixtures() { Environment env = applicationContext.getEnvironment(); boolean runFixtures = env.getProperty(SOLR_FIXTURES, boolean.class, true); if (runFixtures) { Map<String, SolrServer> servers = applicationContext.getBeansOfType(SolrServer.class); CoreContainer cores = applicationContext.getBean(CoreContainer.class); String solrHome = cores.getSolrHome(); boolean async = env.getProperty(SOLR_FIXTURES_ASYNC, boolean.class, true); for (Entry<String, SolrServer> server : servers.entrySet()) { String coreName = server.getKey(); File coreHome = new File(solrHome, coreName); File fixtures = new File(coreHome, "fixtures"); if (fixtures.exists()) { populate(server.getValue(), coreName, fixtures, async); } } } }