rename more before() methods that now conflict with ESTestCase

This commit is contained in:
Boaz Leskes 2016-12-01 13:28:26 +01:00
parent 087a85a4e7
commit 92fa9149f3
10 changed files with 14 additions and 53 deletions

View File

@ -60,7 +60,7 @@ public class ParentChildFieldDataTests extends AbstractFieldDataTestCase {
private final String grandChildType = "grand-child";
@Before
public void before() throws Exception {
public void setupData() throws Exception {
mapperService.merge(
childType, new CompressedXContent(PutMappingRequest.buildFromSimplifiedDef(childType, "_parent", "type=" + parentType).string()), MapperService.MergeReason.MAPPING_UPDATE, false
);

View File

@ -43,7 +43,7 @@ public abstract class AbstractNumericFieldMapperTestCase extends ESSingleNodeTes
protected DocumentMapperParser parser;
@Before
public void before() {
public void setup() {
indexService = createIndex("test");
parser = indexService.mapperService().documentMapperParser();
setTypeList();

View File

@ -30,31 +30,21 @@ import org.apache.lucene.index.SortedNumericDocValues;
import org.apache.lucene.store.Directory;
import org.apache.lucene.store.RAMDirectory;
import org.apache.lucene.util.BytesRef;
import org.elasticsearch.Version;
import org.elasticsearch.cluster.metadata.IndexMetaData;
import org.elasticsearch.common.bytes.BytesReference;
import org.elasticsearch.common.compress.CompressedXContent;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.xcontent.ToXContent;
import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.common.xcontent.XContentFactory;
import org.elasticsearch.index.IndexService;
import org.elasticsearch.index.mapper.DocumentMapper;
import org.elasticsearch.index.mapper.DocumentMapperParser;
import org.elasticsearch.index.mapper.FieldMapper;
import org.elasticsearch.index.mapper.MapperService;
import org.elasticsearch.index.mapper.ParsedDocument;
import org.elasticsearch.index.mapper.ParseContext.Document;
import org.elasticsearch.plugins.Plugin;
import org.elasticsearch.test.ESSingleNodeTestCase;
import org.elasticsearch.test.InternalSettingsPlugin;
import org.elasticsearch.test.VersionUtils;
import org.junit.Before;
import java.io.IOException;
import java.util.Collection;
import static com.carrotsearch.randomizedtesting.RandomizedTest.getRandom;
import static org.hamcrest.Matchers.containsString;
public class BooleanFieldMapperTests extends ESSingleNodeTestCase {
@ -63,7 +53,7 @@ public class BooleanFieldMapperTests extends ESSingleNodeTestCase {
DocumentMapperParser parser;
@Before
public void before() {
public void setup() {
indexService = createIndex("test");
parser = indexService.mapperService().documentMapperParser();
}

View File

@ -21,16 +21,12 @@ package org.elasticsearch.index.mapper;
import org.apache.lucene.index.DocValuesType;
import org.apache.lucene.index.IndexableField;
import org.elasticsearch.Version;
import org.elasticsearch.cluster.metadata.IndexMetaData;
import org.elasticsearch.common.compress.CompressedXContent;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.xcontent.XContentFactory;
import org.elasticsearch.index.IndexService;
import org.elasticsearch.plugins.Plugin;
import org.elasticsearch.test.ESSingleNodeTestCase;
import org.elasticsearch.test.InternalSettingsPlugin;
import org.elasticsearch.test.VersionUtils;
import org.joda.time.DateTime;
import org.joda.time.DateTimeZone;
import org.joda.time.format.DateTimeFormat;
@ -39,7 +35,6 @@ import org.junit.Before;
import java.io.IOException;
import java.util.Collection;
import static com.carrotsearch.randomizedtesting.RandomizedTest.getRandom;
import static org.hamcrest.Matchers.containsString;
public class DateFieldMapperTests extends ESSingleNodeTestCase {
@ -48,7 +43,7 @@ public class DateFieldMapperTests extends ESSingleNodeTestCase {
DocumentMapperParser parser;
@Before
public void before() {
public void setup() {
indexService = createIndex("test");
parser = indexService.mapperService().documentMapperParser();
}

View File

@ -23,40 +23,30 @@ import org.apache.lucene.document.InetAddressPoint;
import org.apache.lucene.index.DocValuesType;
import org.apache.lucene.index.IndexableField;
import org.apache.lucene.util.BytesRef;
import org.elasticsearch.Version;
import org.elasticsearch.cluster.metadata.IndexMetaData;
import org.elasticsearch.common.compress.CompressedXContent;
import org.elasticsearch.common.network.InetAddresses;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.xcontent.ToXContent;
import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.common.xcontent.XContentFactory;
import org.elasticsearch.index.IndexService;
import org.elasticsearch.index.mapper.DocumentMapper;
import org.elasticsearch.index.mapper.DocumentMapperParser;
import org.elasticsearch.index.mapper.IpFieldMapper;
import org.elasticsearch.index.mapper.MapperParsingException;
import org.elasticsearch.index.mapper.ParsedDocument;
import org.elasticsearch.plugins.Plugin;
import org.elasticsearch.test.ESSingleNodeTestCase;
import org.elasticsearch.test.InternalSettingsPlugin;
import org.elasticsearch.test.VersionUtils;
import org.junit.Before;
import static com.carrotsearch.randomizedtesting.RandomizedTest.getRandom;
import static org.hamcrest.Matchers.containsString;
import java.io.IOException;
import java.net.InetAddress;
import java.util.Collection;
import static org.hamcrest.Matchers.containsString;
public class IpFieldMapperTests extends ESSingleNodeTestCase {
IndexService indexService;
DocumentMapperParser parser;
@Before
public void before() {
public void setup() {
indexService = createIndex("test");
parser = indexService.mapperService().documentMapperParser();
}

View File

@ -24,23 +24,18 @@ import org.apache.lucene.index.IndexOptions;
import org.apache.lucene.index.IndexableField;
import org.apache.lucene.index.IndexableFieldType;
import org.apache.lucene.util.BytesRef;
import org.elasticsearch.Version;
import org.elasticsearch.cluster.metadata.IndexMetaData;
import org.elasticsearch.common.compress.CompressedXContent;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.xcontent.XContentFactory;
import org.elasticsearch.index.IndexService;
import org.elasticsearch.plugins.Plugin;
import org.elasticsearch.test.ESSingleNodeTestCase;
import org.elasticsearch.test.InternalSettingsPlugin;
import org.elasticsearch.test.VersionUtils;
import org.junit.Before;
import java.io.IOException;
import java.util.Arrays;
import java.util.Collection;
import static com.carrotsearch.randomizedtesting.RandomizedTest.getRandom;
import static org.hamcrest.Matchers.containsString;
import static org.hamcrest.Matchers.equalTo;
@ -55,7 +50,7 @@ public class KeywordFieldMapperTests extends ESSingleNodeTestCase {
DocumentMapperParser parser;
@Before
public void before() {
public void setup() {
indexService = createIndex("test");
parser = indexService.mapperService().documentMapperParser();
}

View File

@ -24,10 +24,6 @@ import org.apache.lucene.index.IndexableField;
import org.elasticsearch.common.compress.CompressedXContent;
import org.elasticsearch.common.xcontent.XContentFactory;
import org.elasticsearch.index.IndexService;
import org.elasticsearch.index.mapper.DocumentMapper;
import org.elasticsearch.index.mapper.DocumentMapperParser;
import org.elasticsearch.index.mapper.MapperParsingException;
import org.elasticsearch.index.mapper.ParsedDocument;
import org.elasticsearch.plugins.Plugin;
import org.elasticsearch.test.ESSingleNodeTestCase;
import org.elasticsearch.test.InternalSettingsPlugin;
@ -44,7 +40,7 @@ public class ScaledFloatFieldMapperTests extends ESSingleNodeTestCase {
DocumentMapperParser parser;
@Before
public void before() {
public void setup() {
indexService = createIndex("test");
parser = indexService.mapperService().documentMapperParser();
}

View File

@ -28,10 +28,7 @@ import org.apache.lucene.index.PostingsEnum;
import org.apache.lucene.index.Term;
import org.apache.lucene.index.TermsEnum;
import org.apache.lucene.util.BytesRef;
import org.elasticsearch.Version;
import org.elasticsearch.cluster.metadata.IndexMetaData;
import org.elasticsearch.common.compress.CompressedXContent;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.xcontent.ToXContent;
import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.common.xcontent.XContentFactory;
@ -43,7 +40,6 @@ import org.elasticsearch.index.shard.IndexShard;
import org.elasticsearch.plugins.Plugin;
import org.elasticsearch.test.ESSingleNodeTestCase;
import org.elasticsearch.test.InternalSettingsPlugin;
import org.elasticsearch.test.VersionUtils;
import org.junit.Before;
import java.io.IOException;
@ -53,7 +49,6 @@ import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import static com.carrotsearch.randomizedtesting.RandomizedTest.getRandom;
import static org.hamcrest.Matchers.containsString;
import static org.hamcrest.Matchers.equalTo;
@ -63,7 +58,7 @@ public class TextFieldMapperTests extends ESSingleNodeTestCase {
DocumentMapperParser parser;
@Before
public void before() {
public void setup() {
indexService = createIndex("test");
parser = indexService.mapperService().documentMapperParser();
}

View File

@ -44,7 +44,7 @@ public class SearchCancellationTests extends ESTestCase {
static IndexReader reader;
@BeforeClass
public static void before() throws IOException {
public static void setup() throws IOException {
dir = newDirectory();
RandomIndexWriter w = new RandomIndexWriter(random(), dir);
// we need at least 2 segments - so no merges should be allowed
@ -66,7 +66,7 @@ public class SearchCancellationTests extends ESTestCase {
}
@AfterClass
public static void after() throws IOException {
public static void cleanup() throws IOException {
IOUtils.close(reader, dir);
dir = null;
reader = null;

View File

@ -56,7 +56,7 @@ public class QueryProfilerTests extends ESTestCase {
static ContextIndexSearcher searcher;
@BeforeClass
public static void before() throws IOException {
public static void setup() throws IOException {
dir = newDirectory();
RandomIndexWriter w = new RandomIndexWriter(random(), dir);
final int numDocs = TestUtil.nextInt(random(), 1, 20);
@ -76,7 +76,7 @@ public class QueryProfilerTests extends ESTestCase {
}
@AfterClass
public static void after() throws IOException {
public static void cleanup() throws IOException {
IOUtils.close(reader, dir);
dir = null;
reader = null;