You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by ab...@apache.org on 2017/07/03 11:58:32 UTC

[52/58] [abbrv] lucene-solr:jira/solr-10879: SOLR-6671: Fix precommit and use the Lucene-Constant to detect Windows. Also allow other local drives!

SOLR-6671: Fix precommit and use the Lucene-Constant to detect Windows. Also allow other local drives!


Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/7b322bd6
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/7b322bd6
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/7b322bd6

Branch: refs/heads/jira/solr-10879
Commit: 7b322bd67e5a3a9c7f9ecf165d89da60c3767fbd
Parents: 8000b25
Author: Uwe Schindler <us...@apache.org>
Authored: Sun Jul 2 11:44:10 2017 +0200
Committer: Uwe Schindler <us...@apache.org>
Committed: Sun Jul 2 11:44:10 2017 +0200

----------------------------------------------------------------------
 .../src/test/org/apache/solr/core/DirectoryFactoryTest.java | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/7b322bd6/solr/core/src/test/org/apache/solr/core/DirectoryFactoryTest.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/core/DirectoryFactoryTest.java b/solr/core/src/test/org/apache/solr/core/DirectoryFactoryTest.java
index 35bb09b..2c2ddd9 100755
--- a/solr/core/src/test/org/apache/solr/core/DirectoryFactoryTest.java
+++ b/solr/core/src/test/org/apache/solr/core/DirectoryFactoryTest.java
@@ -20,19 +20,17 @@ import java.io.IOException;
 import java.nio.file.Paths;
 import java.util.Properties;
 
-import org.apache.commons.exec.OS;
+import org.apache.lucene.util.Constants;
 import org.apache.lucene.util.LuceneTestCase;
 import org.apache.solr.common.util.NamedList;
 import org.apache.solr.handler.admin.CoreAdminHandler;
 import org.apache.solr.handler.component.HttpShardHandlerFactory;
-import org.apache.solr.util.MockCoreContainer;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
 
 public class DirectoryFactoryTest extends LuceneTestCase {
 
-  private static boolean IS_WINDOWS = (OS.isFamilyDOS() || OS.isFamilyWin9x() || OS.isFamilyWindows());
   public void testLockTypesUnchanged() throws Exception {
     assertEquals("simple", DirectoryFactory.LOCK_TYPE_SIMPLE);
     assertEquals("native", DirectoryFactory.LOCK_TYPE_NATIVE);
@@ -76,8 +74,9 @@ public class DirectoryFactoryTest extends LuceneTestCase {
 
   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));
-    if (IS_WINDOWS) {
-      dataHome = dataHome.replaceFirst("^C:", "").replaceAll("\\\\","/");
+    if (Constants.WINDOWS) {
+      // TODO: find a less-hacky way to assert this!
+      dataHome = dataHome.replaceFirst("^[A-Z]:", "").replace("\\", "/");
     }
     assertEquals(expected, dataHome);
   }