Skip to content

Apache Lucene open-source search software

SOLR-1301: Ignore windows tests that cannot work because they use UNIX semantics. Also remove a never-executed test which tests nothing

Uwe Schindler4a1301c75084
diff --git a/solr/contrib/solr-mr/src/test/org/apache/solr/hadoop/MapReduceIndexerToolArgumentParserTest.java b/solr/contrib/solr-mr/src/test/org/apache/solr/hadoop/MapReduceIndexerToolArgumentParserTest.java
index a292a1b0d39..e95ebb851d7 100644
--- a/solr/contrib/solr-mr/src/test/org/apache/solr/hadoop/MapReduceIndexerToolArgumentParserTest.java
+++ b/solr/contrib/solr-mr/src/test/org/apache/solr/hadoop/MapReduceIndexerToolArgumentParserTest.java
@@ -26,6 +26,7 @@ import java.util.Collections;
import org.apache.commons.io.FileUtils;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.Path;
+import org.apache.lucene.util.Constants;
import org.apache.lucene.util.LuceneTestCase;
import org.apache.solr.cloud.AbstractZkTestCase;
import org.apache.solr.hadoop.dedup.NoChangeUpdateConflictResolver;
@@ -33,6 +34,7 @@ import org.apache.solr.hadoop.dedup.RetainMostRecentUpdateConflictResolver;
import org.apache.solr.util.ExternalPaths;
import org.junit.After;
import org.junit.Before;
+import org.junit.BeforeClass;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -53,10 +55,14 @@ public class MapReduceIndexerToolArgumentParserTest extends LuceneTestCase {
private static final String MORPHLINE_FILE = RESOURCES_DIR + "/test-morphlines/solrCellDocumentTypes.conf";
private static final Logger LOG = LoggerFactory.getLogger(MapReduceIndexerToolArgumentParserTest.class);
-
private static final File solrHomeDirectory = new File(TEMP_DIR, MorphlineGoLiveMiniMRTest.class.getName());
+ @BeforeClass
+ public static void beforeClass() {
+ assumeFalse("Does not work on Windows, because it uses UNIX shell commands or POSIX paths", Constants.WINDOWS);
+ }
+
@Before
public void setUp() throws Exception {
super.setUp();
diff --git a/solr/contrib/solr-mr/src/test/org/apache/solr/hadoop/MorphlineMapperTest.java b/solr/contrib/solr-mr/src/test/org/apache/solr/hadoop/MorphlineMapperTest.java
index 3316caa0824..bbd3897df69 100644
--- a/solr/contrib/solr-mr/src/test/org/apache/solr/hadoop/MorphlineMapperTest.java
+++ b/solr/contrib/solr-mr/src/test/org/apache/solr/hadoop/MorphlineMapperTest.java
@@ -23,12 +23,19 @@ import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mrunit.mapreduce.MapDriver;
import org.apache.hadoop.mrunit.types.Pair;
+import org.apache.lucene.util.Constants;
import org.apache.solr.common.SolrInputDocument;
import org.apache.solr.hadoop.morphline.MorphlineMapper;
+import org.junit.BeforeClass;
import org.junit.Test;
public class MorphlineMapperTest extends MRUnitBase {
+ @BeforeClass
+ public static void beforeClass() {
+ assumeFalse("Does not work on Windows, because it uses UNIX shell commands or POSIX paths", Constants.WINDOWS);
+ }
+
@Test
public void testMapper() throws Exception {
MorphlineMapper mapper = new MorphlineMapper();
diff --git a/solr/contrib/solr-mr/src/test/org/apache/solr/hadoop/MorphlineReducerTest.java b/solr/contrib/solr-mr/src/test/org/apache/solr/hadoop/MorphlineReducerTest.java
index dee44119243..faa92ea2d09 100644
--- a/solr/contrib/solr-mr/src/test/org/apache/solr/hadoop/MorphlineReducerTest.java
+++ b/solr/contrib/solr-mr/src/test/org/apache/solr/hadoop/MorphlineReducerTest.java
@@ -34,6 +34,7 @@ import org.apache.hadoop.mapreduce.RecordReader;
import org.apache.hadoop.mapreduce.TaskAttemptContext;
import org.apache.hadoop.mapreduce.TaskAttemptID;
import org.apache.hadoop.mrunit.mapreduce.ReduceDriver;
+import org.apache.lucene.util.Constants;
import org.apache.lucene.util.LuceneTestCase;
import org.apache.solr.cloud.AbstractZkTestCase;
import org.apache.solr.common.SolrInputDocument;
@@ -46,6 +47,11 @@ import com.google.common.collect.Lists;
public class MorphlineReducerTest extends MRUnitBase {
+ @BeforeClass
+ public static void beforeClass() {
+ assumeFalse("Does not work on Windows, because it uses UNIX shell commands or POSIX paths", Constants.WINDOWS);
+ }
+
public static class MySolrReducer extends SolrReducer {
Context context;
diff --git a/solr/contrib/solr-mr/src/test/org/apache/solr/hadoop/PathValidation.java b/solr/contrib/solr-mr/src/test/org/apache/solr/hadoop/PathValidation.java
deleted file mode 100644
index c76649edb71..00000000000
--- a/solr/contrib/solr-mr/src/test/org/apache/solr/hadoop/PathValidation.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.solr.hadoop;
-
-import java.util.regex.Pattern;
-
-import org.apache.hadoop.fs.Path;
-import org.junit.Test;
-
-public class PathValidation extends MRUnitBase {
-
- @Test
- public void testPath() {
- Path path = new Path("hdfs://c2202.mycompany.com:8020/user/foo/bar.txt");
- assertEquals("/user/foo/bar.txt", path.toUri().getPath());
- assertEquals("bar.txt", path.getName());
- assertEquals("hdfs", path.toUri().getScheme());
- assertEquals("c2202.mycompany.com:8020", path.toUri().getAuthority());
-
- path = new Path("/user/foo/bar.txt");
- assertEquals("/user/foo/bar.txt", path.toUri().getPath());
- assertEquals("bar.txt", path.getName());
- assertEquals(null, path.toUri().getScheme());
- assertEquals(null, path.toUri().getAuthority());
-
- assertEquals("-", new Path("-").toString());
- }
-
- @Test
- public void testRegex() {
- Pattern regex = Pattern.compile("text/plain|text/html");
- assertTrue(regex.matcher("text/plain").matches());
- assertTrue(regex.matcher("text/html").matches());
- assertFalse(regex.matcher("xxtext/html").matches());
- }
-
-}