Ah, I see what you mean. Putting the dataDir property into the Map certainly ought to work - can you write a test case that shows what’s happening?
Alan Woodward www.flax.co.uk > On 3 Oct 2016, at 23:50, Bryan Bende <bbe...@gmail.com> wrote: > > Alan, > > Thanks for the response. I will double-check, but I believe that is going > to put the data directory for the core under coreHome/coreName. > > What I am trying to setup (and did a poor job of explaining) is something > like the following... > > - Solr home in src/test/resources/solr > - Core home in src/test/resources/myCore > - dataDir for the myCore in target/myCore (or something not in the source > tree). > > This way the unit tests can use the Solr home and core config that is under > version control, but the data from testing would be written somewhere not > under version control. > > in 5.x I was specifying the dataDir through the properties object... I > would calculate the path to the target dir in Java code relative to the > class file, and then pass that as dataDir to the following: > > Properties props = new Properties(); > props.setProperty("dataDir", dataDir + "/" + coreName); > > In 6.x it seems like Properties has been replaced with the > Map<String,String> ? and I tried putting dataDir in there, but didn't seem > to do anything. > > For now I have just been using RAMDirectoryFactory so that no data ever > gets written to disk. > > I'll keep trying different things, but if you have any thoughts let me know. > > Thanks, > > Bryan > > > On Mon, Oct 3, 2016 at 2:07 PM, Alan Woodward <a...@flax.co.uk> wrote: > >> This should work: >> >> SolrCore solrCore >> = coreContainer.create(coreName, >> Paths.get(coreHome).resolve(coreName), >> Collections.emptyMap()); >> >> >> Alan Woodward >> www.flax.co.uk >> >> >>> On 3 Oct 2016, at 18:41, Bryan Bende <bbe...@gmail.com> wrote: >>> >>> Curious if anyone knows how to create an EmbeddedSolrServer in Solr 6.x, >>> with a core where the dataDir is located somewhere outside of where the >>> config is located. >>> >>> I'd like to do this without system properties, and all through Java code. >>> >>> In Solr 5.x I was able to do this with the following code: >>> >>> CoreContainer coreContainer = new CoreContainer(solrHome); >>> coreContainer.load(); >>> >>> Properties props = new Properties(); >>> props.setProperty("dataDir", dataDir + "/" + coreName); >>> >>> CoreDescriptor descriptor = new CoreDescriptor(coreContainer, coreName, >>> new File(coreHome, coreName).getAbsolutePath(), props); >>> >>> SolrCore solrCore = coreContainer.create(descriptor); >>> new EmbeddedSolrServer(coreContainer, coreName); >>> >>> >>> The CoreContainer API changed a bit in 6.x and you can no longer pass in >> a >>> descriptor. I've tried a couple of things with the current API, but >> haven't >>> been able to get it working. >>> >>> Any ideas are appreciated. >>> >>> Thanks, >>> >>> Bryan >> >>