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

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1547242 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Uwe Schindler 2013-12-02 23:49:30 +00:00
parent ae33505da5
commit 4a1301c750
4 changed files with 20 additions and 52 deletions

View File

@ -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();

View File

@ -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();

View File

@ -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;

View File

@ -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());
}
}