SOLR-6671: More generic fix to assert Solr's dataHome

This commit is contained in:
Uwe Schindler 2017-07-03 08:15:54 +02:00
parent eaf1d45a1c
commit 20dcb56da8
1 changed files with 1 additions and 6 deletions

View File

@ -20,7 +20,6 @@ import java.io.IOException;
import java.nio.file.Paths; import java.nio.file.Paths;
import java.util.Properties; import java.util.Properties;
import org.apache.lucene.util.Constants;
import org.apache.lucene.util.LuceneTestCase; import org.apache.lucene.util.LuceneTestCase;
import org.apache.solr.common.util.NamedList; import org.apache.solr.common.util.NamedList;
import org.apache.solr.handler.admin.CoreAdminHandler; import org.apache.solr.handler.admin.CoreAdminHandler;
@ -74,11 +73,7 @@ public class DirectoryFactoryTest extends LuceneTestCase {
private void assertDataHome(String expected, String instanceDir, RAMDirectoryFactory rdf, MockCoreContainer cc, String... properties) throws IOException { private void assertDataHome(String expected, String instanceDir, RAMDirectoryFactory rdf, MockCoreContainer cc, String... properties) throws IOException {
String dataHome = rdf.getDataHome(new CoreDescriptor("core_name", Paths.get(instanceDir), cc.containerProperties, cc.isZooKeeperAware(), properties)); String dataHome = rdf.getDataHome(new CoreDescriptor("core_name", Paths.get(instanceDir), cc.containerProperties, cc.isZooKeeperAware(), properties));
if (Constants.WINDOWS) { assertEquals(Paths.get(expected).toAbsolutePath(), Paths.get(dataHome).toAbsolutePath());
// TODO: find a less-hacky way to assert this!
dataHome = dataHome.replaceFirst("^[A-Z]:", "").replace("\\", "/");
}
assertEquals(expected, dataHome);
} }