Subclass ElasticSearchTestCase across the board

All tests in the test package should subclass ESTestCase to benefit from
random time-zones and locale etc.
This commit is contained in:
Simon Willnauer 2013-10-13 20:33:22 +02:00
parent 9a062e465c
commit edbfb04af6
139 changed files with 349 additions and 252 deletions

View File

@ -25,17 +25,17 @@ import org.apache.lucene.analysis.Tokenizer;
import org.apache.lucene.analysis.core.WhitespaceTokenizer;
import org.apache.lucene.analysis.tokenattributes.CharTermAttribute;
import org.elasticsearch.common.lucene.Lucene;
import org.elasticsearch.test.ElasticSearchTestCase;
import org.junit.Test;
import java.io.IOException;
import java.io.Reader;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.equalTo;
/**
*/
public class TruncateTokenFilterTests {
public class TruncateTokenFilterTests extends ElasticSearchTestCase {
@Test
public void simpleTest() throws IOException {

View File

@ -19,17 +19,17 @@
package org.elasticsearch;
import org.elasticsearch.ElasticSearchException;
import org.elasticsearch.index.Index;
import org.elasticsearch.indices.IndexMissingException;
import org.elasticsearch.rest.RestStatus;
import org.elasticsearch.test.ElasticSearchTestCase;
import org.elasticsearch.transport.RemoteTransportException;
import org.junit.Test;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.equalTo;
public class ElasticSearchExceptionTests {
public class ElasticSearchExceptionTests extends ElasticSearchTestCase {
@Test
public void testStatus() {

View File

@ -19,6 +19,7 @@
package org.elasticsearch;
import org.elasticsearch.test.ElasticSearchTestCase;
import org.junit.Test;
import static org.elasticsearch.Version.V_0_20_0;
@ -26,7 +27,7 @@ import static org.elasticsearch.Version.V_0_90_0;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.is;
public class VersionTests {
public class VersionTests extends ElasticSearchTestCase {
@Test
public void testVersions() throws Exception {

View File

@ -19,20 +19,20 @@
package org.elasticsearch.action.bulk;
import com.google.common.base.Charsets;
import org.elasticsearch.action.delete.DeleteRequest;
import org.elasticsearch.action.index.IndexRequest;
import org.elasticsearch.action.update.UpdateRequest;
import org.elasticsearch.common.bytes.BytesArray;
import org.elasticsearch.test.ElasticSearchTestCase;
import org.junit.Test;
import com.google.common.base.Charsets;
import static org.elasticsearch.common.io.Streams.copyToStringFromClasspath;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.instanceOf;
public class BulkRequestTests {
public class BulkRequestTests extends ElasticSearchTestCase {
@Test
public void testSimpleBulk1() throws Exception {

View File

@ -22,16 +22,16 @@ import org.elasticsearch.action.support.IgnoreIndices;
import org.elasticsearch.common.collect.MapBuilder;
import org.elasticsearch.common.io.Streams;
import org.elasticsearch.common.xcontent.XContentFactory;
import org.elasticsearch.test.ElasticSearchTestCase;
import org.junit.Test;
import java.util.Map;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.*;
/**
*/
public class MultiPercolatorRequestTests {
public class MultiPercolatorRequestTests extends ElasticSearchTestCase {
@Test
public void testParseBulkRequests() throws Exception {

View File

@ -20,6 +20,7 @@
package org.elasticsearch.action.search;
import org.elasticsearch.common.io.Streams;
import org.elasticsearch.test.ElasticSearchTestCase;
import org.junit.Test;
import static org.hamcrest.MatcherAssert.assertThat;
@ -28,7 +29,7 @@ import static org.hamcrest.Matchers.nullValue;
/**
*/
public class MultiSearchRequestTests {
public class MultiSearchRequestTests extends ElasticSearchTestCase {
@Test
public void simpleAdd() throws Exception {

View File

@ -28,7 +28,6 @@ import org.elasticsearch.search.suggest.SuggestSearchTests;
import java.util.Arrays;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.equalTo;
/**

View File

@ -22,6 +22,7 @@ package org.elasticsearch.cluster.metadata;
import org.elasticsearch.common.compress.CompressedString;
import org.elasticsearch.common.xcontent.XContentFactory;
import org.elasticsearch.index.mapper.MapperParsingException;
import org.elasticsearch.test.ElasticSearchTestCase;
import org.junit.Test;
import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder;
@ -29,7 +30,7 @@ import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.nullValue;
public class MappingMetaDataParserTests {
public class MappingMetaDataParserTests extends ElasticSearchTestCase {
@Test
public void testParseIdAlone() throws Exception {

View File

@ -23,6 +23,7 @@ import com.google.common.collect.Sets;
import org.elasticsearch.action.support.IgnoreIndices;
import org.elasticsearch.common.settings.ImmutableSettings;
import org.elasticsearch.indices.IndexMissingException;
import org.elasticsearch.test.ElasticSearchTestCase;
import org.junit.Test;
import static com.google.common.collect.Sets.newHashSet;
@ -31,7 +32,7 @@ import static org.hamcrest.Matchers.equalTo;
/**
*/
public class MetaDataTests {
public class MetaDataTests extends ElasticSearchTestCase {
@Test
public void convertWildcardsJustIndicesTests() {

View File

@ -21,6 +21,7 @@ package org.elasticsearch.cluster.metadata;
import org.elasticsearch.common.xcontent.XContentFactory;
import org.elasticsearch.common.xcontent.XContentType;
import org.elasticsearch.test.ElasticSearchTestCase;
import org.junit.Test;
import java.io.IOException;
@ -36,7 +37,7 @@ import static org.hamcrest.Matchers.nullValue;
/**
*
*/
public class ToAndFromJsonMetaDataTests {
public class ToAndFromJsonMetaDataTests extends ElasticSearchTestCase {
@Test
public void testSimpleJsonFromAndTo() throws IOException {

View File

@ -24,6 +24,7 @@ import org.elasticsearch.Version;
import org.elasticsearch.common.settings.ImmutableSettings;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.transport.DummyTransportAddress;
import org.elasticsearch.test.ElasticSearchTestCase;
import org.junit.Test;
import static org.elasticsearch.cluster.node.DiscoveryNodeFilters.OpType.AND;
@ -33,7 +34,7 @@ import static org.hamcrest.Matchers.equalTo;
/**
*/
public class DiscoveryNodeFiltersTests {
public class DiscoveryNodeFiltersTests extends ElasticSearchTestCase {
@Test
public void nameMatch() {

View File

@ -12,6 +12,7 @@ import org.elasticsearch.cluster.routing.allocation.decider.ClusterRebalanceAllo
import org.elasticsearch.common.logging.ESLogger;
import org.elasticsearch.common.logging.Loggers;
import org.elasticsearch.common.settings.ImmutableSettings;
import org.elasticsearch.test.ElasticSearchTestCase;
import org.hamcrest.Matcher;
import org.hamcrest.Matchers;
import org.junit.Test;
@ -27,7 +28,7 @@ import static org.elasticsearch.cluster.routing.allocation.RoutingAllocationTest
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
import static org.hamcrest.MatcherAssert.assertThat;
public class AddIncrementallyTests {
public class AddIncrementallyTests extends ElasticSearchTestCase {
private final ESLogger logger = Loggers.getLogger(AddIncrementallyTests.class);
@Test

View File

@ -24,6 +24,7 @@ import org.elasticsearch.cluster.metadata.MetaData;
import org.elasticsearch.cluster.routing.RoutingTable;
import org.elasticsearch.common.logging.ESLogger;
import org.elasticsearch.common.logging.Loggers;
import org.elasticsearch.test.ElasticSearchTestCase;
import org.junit.Test;
import static org.elasticsearch.cluster.ClusterState.newClusterStateBuilder;
@ -39,7 +40,7 @@ import static org.hamcrest.Matchers.equalTo;
/**
*/
public class AllocatePostApiFlagTests {
public class AllocatePostApiFlagTests extends ElasticSearchTestCase {
private final ESLogger logger = Loggers.getLogger(AllocatePostApiFlagTests.class);

View File

@ -37,6 +37,7 @@ import org.elasticsearch.common.xcontent.XContentFactory;
import org.elasticsearch.common.xcontent.XContentParser;
import org.elasticsearch.common.xcontent.XContentType;
import org.elasticsearch.index.shard.ShardId;
import org.elasticsearch.test.ElasticSearchTestCase;
import org.junit.Test;
import static org.elasticsearch.cluster.ClusterState.newClusterStateBuilder;
@ -53,7 +54,7 @@ import static org.hamcrest.Matchers.equalTo;
/**
*/
public class AllocationCommandsTests {
public class AllocationCommandsTests extends ElasticSearchTestCase {
private final ESLogger logger = Loggers.getLogger(AllocationCommandsTests.class);

View File

@ -36,6 +36,7 @@ import org.elasticsearch.common.logging.Loggers;
import org.elasticsearch.common.settings.ImmutableSettings;
import org.elasticsearch.gateway.none.NoneGatewayAllocator;
import org.elasticsearch.node.settings.NodeSettingsService;
import org.elasticsearch.test.ElasticSearchTestCase;
import org.hamcrest.Matchers;
import org.junit.Test;
@ -52,7 +53,7 @@ import static org.elasticsearch.cluster.routing.allocation.RoutingAllocationTest
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
import static org.hamcrest.MatcherAssert.assertThat;
public class BalanceConfigurationTests {
public class BalanceConfigurationTests extends ElasticSearchTestCase {
private final ESLogger logger = Loggers.getLogger(BalanceConfigurationTests.class);
// TODO maybe we can randomize these numbers somehow

View File

@ -26,6 +26,7 @@ import org.elasticsearch.cluster.routing.RoutingTable;
import org.elasticsearch.cluster.routing.allocation.decider.ClusterRebalanceAllocationDecider;
import org.elasticsearch.common.logging.ESLogger;
import org.elasticsearch.common.logging.Loggers;
import org.elasticsearch.test.ElasticSearchTestCase;
import org.junit.Test;
import static org.elasticsearch.cluster.ClusterState.newClusterStateBuilder;
@ -39,7 +40,7 @@ import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilde
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.equalTo;
public class ClusterRebalanceRoutingTests {
public class ClusterRebalanceRoutingTests extends ElasticSearchTestCase {
private final ESLogger logger = Loggers.getLogger(ClusterRebalanceRoutingTests.class);

View File

@ -25,6 +25,7 @@ import org.elasticsearch.cluster.routing.RoutingNodes;
import org.elasticsearch.cluster.routing.RoutingTable;
import org.elasticsearch.common.logging.ESLogger;
import org.elasticsearch.common.logging.Loggers;
import org.elasticsearch.test.ElasticSearchTestCase;
import org.junit.Test;
import static org.elasticsearch.cluster.ClusterState.newClusterStateBuilder;
@ -39,7 +40,7 @@ import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.nullValue;
public class ConcurrentRebalanceRoutingTests {
public class ConcurrentRebalanceRoutingTests extends ElasticSearchTestCase {
private final ESLogger logger = Loggers.getLogger(ConcurrentRebalanceRoutingTests.class);

View File

@ -26,6 +26,7 @@ import org.elasticsearch.cluster.routing.allocation.command.AllocationCommands;
import org.elasticsearch.cluster.routing.allocation.command.MoveAllocationCommand;
import org.elasticsearch.common.logging.ESLogger;
import org.elasticsearch.common.logging.Loggers;
import org.elasticsearch.test.ElasticSearchTestCase;
import org.junit.Test;
import static org.elasticsearch.cluster.ClusterState.newClusterStateBuilder;
@ -41,7 +42,7 @@ import static org.hamcrest.Matchers.equalTo;
/**
*/
public class DeadNodesAllocationTests {
public class DeadNodesAllocationTests extends ElasticSearchTestCase {
private final ESLogger logger = Loggers.getLogger(DeadNodesAllocationTests.class);

View File

@ -26,6 +26,7 @@ import org.elasticsearch.cluster.routing.allocation.decider.DisableAllocationDec
import org.elasticsearch.common.logging.ESLogger;
import org.elasticsearch.common.logging.Loggers;
import org.elasticsearch.common.settings.ImmutableSettings;
import org.elasticsearch.test.ElasticSearchTestCase;
import org.junit.Test;
import static org.elasticsearch.cluster.ClusterState.newClusterStateBuilder;
@ -42,7 +43,7 @@ import static org.hamcrest.Matchers.equalTo;
/**
*/
public class DisableAllocationTests {
public class DisableAllocationTests extends ElasticSearchTestCase {
private final ESLogger logger = Loggers.getLogger(DisableAllocationTests.class);

View File

@ -26,6 +26,7 @@ import org.elasticsearch.cluster.routing.RoutingNodes;
import org.elasticsearch.cluster.routing.RoutingTable;
import org.elasticsearch.common.logging.ESLogger;
import org.elasticsearch.common.logging.Loggers;
import org.elasticsearch.test.ElasticSearchTestCase;
import org.junit.Test;
import static org.elasticsearch.cluster.ClusterState.newClusterStateBuilder;
@ -43,7 +44,7 @@ import static org.hamcrest.Matchers.equalTo;
/**
*
*/
public class ElectReplicaAsPrimaryDuringRelocationTests {
public class ElectReplicaAsPrimaryDuringRelocationTests extends ElasticSearchTestCase {
private final ESLogger logger = Loggers.getLogger(ElectReplicaAsPrimaryDuringRelocationTests.class);

View File

@ -27,6 +27,7 @@ import org.elasticsearch.cluster.routing.RoutingTable;
import org.elasticsearch.cluster.routing.allocation.decider.ClusterRebalanceAllocationDecider;
import org.elasticsearch.common.logging.ESLogger;
import org.elasticsearch.common.logging.Loggers;
import org.elasticsearch.test.ElasticSearchTestCase;
import org.junit.Test;
import static org.elasticsearch.cluster.ClusterState.newClusterStateBuilder;
@ -41,7 +42,7 @@ import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilde
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.equalTo;
public class FailedNodeRoutingTests {
public class FailedNodeRoutingTests extends ElasticSearchTestCase {
private final ESLogger logger = Loggers.getLogger(FailedNodeRoutingTests.class);

View File

@ -29,6 +29,7 @@ import org.elasticsearch.cluster.routing.allocation.command.AllocationCommands;
import org.elasticsearch.cluster.routing.allocation.command.MoveAllocationCommand;
import org.elasticsearch.common.logging.ESLogger;
import org.elasticsearch.common.logging.Loggers;
import org.elasticsearch.test.ElasticSearchTestCase;
import org.junit.Test;
import static org.elasticsearch.cluster.ClusterState.newClusterStateBuilder;
@ -45,7 +46,7 @@ import static org.hamcrest.Matchers.*;
/**
*
*/
public class FailedShardsRoutingTests {
public class FailedShardsRoutingTests extends ElasticSearchTestCase {
private final ESLogger logger = Loggers.getLogger(FailedShardsRoutingTests.class);

View File

@ -27,6 +27,7 @@ import org.elasticsearch.cluster.routing.RoutingTable;
import org.elasticsearch.cluster.routing.ShardRoutingState;
import org.elasticsearch.common.logging.ESLogger;
import org.elasticsearch.common.logging.Loggers;
import org.elasticsearch.test.ElasticSearchTestCase;
import org.hamcrest.Matchers;
import org.junit.Test;
@ -45,7 +46,7 @@ import static org.hamcrest.Matchers.equalTo;
/**
*/
public class FilterRoutingTests {
public class FilterRoutingTests extends ElasticSearchTestCase {
private final ESLogger logger = Loggers.getLogger(FilterRoutingTests.class);

View File

@ -27,6 +27,7 @@ import org.elasticsearch.cluster.routing.RoutingTable;
import org.elasticsearch.common.logging.ESLogger;
import org.elasticsearch.common.logging.Loggers;
import org.elasticsearch.common.settings.ImmutableSettings;
import org.elasticsearch.test.ElasticSearchTestCase;
import org.junit.Test;
import static org.elasticsearch.cluster.ClusterState.newClusterStateBuilder;
@ -44,7 +45,7 @@ import static org.hamcrest.Matchers.nullValue;
/**
*
*/
public class IndexBalanceTests {
public class IndexBalanceTests extends ElasticSearchTestCase {
private final ESLogger logger = Loggers.getLogger(IndexBalanceTests.class);

View File

@ -25,6 +25,7 @@ import org.elasticsearch.cluster.routing.RoutingNodes;
import org.elasticsearch.cluster.routing.RoutingTable;
import org.elasticsearch.common.logging.ESLogger;
import org.elasticsearch.common.logging.Loggers;
import org.elasticsearch.test.ElasticSearchTestCase;
import org.junit.Test;
import static org.elasticsearch.cluster.ClusterState.newClusterStateBuilder;
@ -43,7 +44,7 @@ import static org.hamcrest.Matchers.nullValue;
/**
*
*/
public class PrimaryElectionRoutingTests {
public class PrimaryElectionRoutingTests extends ElasticSearchTestCase {
private final ESLogger logger = Loggers.getLogger(PrimaryElectionRoutingTests.class);

View File

@ -25,6 +25,7 @@ import org.elasticsearch.cluster.routing.RoutingNodes;
import org.elasticsearch.cluster.routing.RoutingTable;
import org.elasticsearch.common.logging.ESLogger;
import org.elasticsearch.common.logging.Loggers;
import org.elasticsearch.test.ElasticSearchTestCase;
import org.junit.Test;
import static org.elasticsearch.cluster.ClusterState.newClusterStateBuilder;
@ -42,7 +43,7 @@ import static org.hamcrest.Matchers.equalTo;
/**
*
*/
public class PrimaryNotRelocatedWhileBeingRecoveredTests {
public class PrimaryNotRelocatedWhileBeingRecoveredTests extends ElasticSearchTestCase {
private final ESLogger logger = Loggers.getLogger(PrimaryNotRelocatedWhileBeingRecoveredTests.class);

View File

@ -26,6 +26,7 @@ import org.elasticsearch.cluster.routing.RoutingNodes;
import org.elasticsearch.cluster.routing.RoutingTable;
import org.elasticsearch.common.logging.ESLogger;
import org.elasticsearch.common.logging.Loggers;
import org.elasticsearch.test.ElasticSearchTestCase;
import org.junit.Test;
import static org.elasticsearch.cluster.ClusterState.newClusterStateBuilder;
@ -43,7 +44,7 @@ import static org.hamcrest.Matchers.nullValue;
/**
*
*/
public class RebalanceAfterActiveTests {
public class RebalanceAfterActiveTests extends ElasticSearchTestCase {
private final ESLogger logger = Loggers.getLogger(RebalanceAfterActiveTests.class);

View File

@ -25,6 +25,7 @@ import org.elasticsearch.cluster.routing.RoutingNodes;
import org.elasticsearch.cluster.routing.RoutingTable;
import org.elasticsearch.common.logging.ESLogger;
import org.elasticsearch.common.logging.Loggers;
import org.elasticsearch.test.ElasticSearchTestCase;
import org.junit.Test;
import static org.elasticsearch.cluster.ClusterState.newClusterStateBuilder;
@ -42,7 +43,7 @@ import static org.hamcrest.Matchers.nullValue;
/**
*
*/
public class ReplicaAllocatedAfterPrimaryTests {
public class ReplicaAllocatedAfterPrimaryTests extends ElasticSearchTestCase {
private final ESLogger logger = Loggers.getLogger(ReplicaAllocatedAfterPrimaryTests.class);

View File

@ -23,12 +23,13 @@ import org.elasticsearch.Version;
import org.elasticsearch.cluster.node.DiscoveryNode;
import org.elasticsearch.common.transport.DummyTransportAddress;
import org.elasticsearch.common.transport.TransportAddress;
import org.elasticsearch.test.ElasticSearchTestCase;
import org.junit.Ignore;
import java.util.Map;
@Ignore("Not a test")
public class RoutingAllocationTests {
public class RoutingAllocationTests extends ElasticSearchTestCase {
public static DiscoveryNode newNode(String nodeId) {
return new DiscoveryNode(nodeId, DummyTransportAddress.INSTANCE, Version.CURRENT);

View File

@ -26,6 +26,7 @@ import org.elasticsearch.cluster.routing.RoutingTable;
import org.elasticsearch.cluster.routing.allocation.decider.ClusterRebalanceAllocationDecider;
import org.elasticsearch.common.logging.ESLogger;
import org.elasticsearch.common.logging.Loggers;
import org.elasticsearch.test.ElasticSearchTestCase;
import org.junit.Test;
import static org.elasticsearch.cluster.ClusterState.newClusterStateBuilder;
@ -39,7 +40,7 @@ import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilde
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.equalTo;
public class ShardVersioningTests {
public class ShardVersioningTests extends ElasticSearchTestCase {
private final ESLogger logger = Loggers.getLogger(ShardVersioningTests.class);

View File

@ -30,6 +30,7 @@ import org.elasticsearch.cluster.routing.allocation.decider.ShardsLimitAllocatio
import org.elasticsearch.common.logging.ESLogger;
import org.elasticsearch.common.logging.Loggers;
import org.elasticsearch.common.settings.ImmutableSettings;
import org.elasticsearch.test.ElasticSearchTestCase;
import org.junit.Test;
import static org.elasticsearch.cluster.ClusterState.newClusterStateBuilder;
@ -45,7 +46,7 @@ import static org.hamcrest.Matchers.equalTo;
/**
*/
public class ShardsLimitAllocationTests {
public class ShardsLimitAllocationTests extends ElasticSearchTestCase {
private final ESLogger logger = Loggers.getLogger(ShardsLimitAllocationTests.class);

View File

@ -29,6 +29,7 @@ import org.elasticsearch.cluster.routing.RoutingNodes;
import org.elasticsearch.cluster.routing.RoutingTable;
import org.elasticsearch.common.logging.ESLogger;
import org.elasticsearch.common.logging.Loggers;
import org.elasticsearch.test.ElasticSearchTestCase;
import org.junit.Test;
import java.util.List;
@ -50,7 +51,7 @@ import static org.hamcrest.Matchers.*;
/**
*
*/
public class SingleShardNoReplicasRoutingTests {
public class SingleShardNoReplicasRoutingTests extends ElasticSearchTestCase {
private final ESLogger logger = Loggers.getLogger(SingleShardNoReplicasRoutingTests.class);

View File

@ -25,6 +25,7 @@ import org.elasticsearch.cluster.routing.RoutingNodes;
import org.elasticsearch.cluster.routing.RoutingTable;
import org.elasticsearch.common.logging.ESLogger;
import org.elasticsearch.common.logging.Loggers;
import org.elasticsearch.test.ElasticSearchTestCase;
import org.junit.Test;
import static org.elasticsearch.cluster.ClusterState.newClusterStateBuilder;
@ -42,7 +43,7 @@ import static org.hamcrest.Matchers.nullValue;
/**
*
*/
public class SingleShardOneReplicaRoutingTests {
public class SingleShardOneReplicaRoutingTests extends ElasticSearchTestCase {
private final ESLogger logger = Loggers.getLogger(SingleShardOneReplicaRoutingTests.class);

View File

@ -25,6 +25,7 @@ import org.elasticsearch.cluster.routing.RoutingNodes;
import org.elasticsearch.cluster.routing.RoutingTable;
import org.elasticsearch.common.logging.ESLogger;
import org.elasticsearch.common.logging.Loggers;
import org.elasticsearch.test.ElasticSearchTestCase;
import org.junit.Test;
import static org.elasticsearch.cluster.ClusterState.newClusterStateBuilder;
@ -41,7 +42,7 @@ import static org.hamcrest.Matchers.*;
/**
*
*/
public class TenShardsOneReplicaRoutingTests {
public class TenShardsOneReplicaRoutingTests extends ElasticSearchTestCase {
private final ESLogger logger = Loggers.getLogger(TenShardsOneReplicaRoutingTests.class);

View File

@ -24,6 +24,7 @@ import org.elasticsearch.cluster.metadata.MetaData;
import org.elasticsearch.cluster.routing.RoutingTable;
import org.elasticsearch.common.logging.ESLogger;
import org.elasticsearch.common.logging.Loggers;
import org.elasticsearch.test.ElasticSearchTestCase;
import org.junit.Test;
import static org.elasticsearch.cluster.ClusterState.newClusterStateBuilder;
@ -40,7 +41,7 @@ import static org.hamcrest.Matchers.equalTo;
/**
*
*/
public class ThrottlingAllocationTests {
public class ThrottlingAllocationTests extends ElasticSearchTestCase {
private final ESLogger logger = Loggers.getLogger(ThrottlingAllocationTests.class);

View File

@ -6,6 +6,7 @@ import org.elasticsearch.cluster.routing.RoutingNodes;
import org.elasticsearch.cluster.routing.RoutingTable;
import org.elasticsearch.common.logging.ESLogger;
import org.elasticsearch.common.logging.Loggers;
import org.elasticsearch.test.ElasticSearchTestCase;
import org.junit.Test;
import static org.elasticsearch.cluster.ClusterState.newClusterStateBuilder;
@ -22,7 +23,7 @@ import static org.hamcrest.Matchers.*;
/**
*
*/
public class UpdateNumberOfReplicasTests {
public class UpdateNumberOfReplicasTests extends ElasticSearchTestCase {
private final ESLogger logger = Loggers.getLogger(UpdateNumberOfReplicasTests.class);

View File

@ -29,6 +29,7 @@ import org.elasticsearch.cluster.routing.allocation.AllocationService;
import org.elasticsearch.common.io.stream.BytesStreamInput;
import org.elasticsearch.common.io.stream.BytesStreamOutput;
import org.elasticsearch.common.transport.DummyTransportAddress;
import org.elasticsearch.test.ElasticSearchTestCase;
import org.junit.Test;
import static org.elasticsearch.cluster.ClusterState.newClusterStateBuilder;
@ -41,7 +42,7 @@ import static org.hamcrest.Matchers.equalTo;
/**
*
*/
public class ClusterSerializationTests {
public class ClusterSerializationTests extends ElasticSearchTestCase {
@Test
public void testClusterStateSerialization() throws Exception {

View File

@ -26,6 +26,7 @@ import org.elasticsearch.common.settings.ImmutableSettings;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.node.Node;
import org.elasticsearch.node.NodeBuilder;
import org.elasticsearch.test.ElasticSearchTestCase;
import org.hamcrest.Matchers;
import org.junit.Test;
@ -33,7 +34,7 @@ import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.notNullValue;
import static org.hamcrest.Matchers.nullValue;
public class ClusterSettingsTests {
public class ClusterSettingsTests extends ElasticSearchTestCase {
@Test
public void clusterNonExistingSettingsUpdate() {

View File

@ -19,6 +19,7 @@
package org.elasticsearch.cluster.settings;
import org.elasticsearch.test.ElasticSearchTestCase;
import org.junit.Test;
import static org.hamcrest.MatcherAssert.assertThat;
@ -28,7 +29,7 @@ import static org.hamcrest.Matchers.nullValue;
/**
*
*/
public class SettingsValidatorTests {
public class SettingsValidatorTests extends ElasticSearchTestCase {
@Test
public void testValidators() throws Exception {

View File

@ -30,7 +30,7 @@ import org.elasticsearch.cluster.routing.operation.hash.djb.DjbHashFunction;
import org.elasticsearch.cluster.routing.operation.plain.PlainOperationRouting;
import org.elasticsearch.common.settings.ImmutableSettings;
import org.elasticsearch.index.shard.ShardId;
import org.elasticsearch.cluster.routing.allocation.RoutingAllocationTests;
import org.elasticsearch.test.ElasticSearchTestCase;
import org.junit.Test;
import static org.elasticsearch.cluster.ClusterState.newClusterStateBuilder;
@ -44,7 +44,7 @@ import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilde
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.*;
public class RoutingIteratorTests {
public class RoutingIteratorTests extends ElasticSearchTestCase {
@Test
public void testEmptyIterator() {

View File

@ -20,6 +20,7 @@
package org.elasticsearch.common.compress;
import org.elasticsearch.common.settings.ImmutableSettings;
import org.elasticsearch.test.ElasticSearchTestCase;
import org.junit.Test;
import java.io.IOException;
@ -31,7 +32,7 @@ import static org.hamcrest.Matchers.not;
/**
*
*/
public class CompressedStringTests {
public class CompressedStringTests extends ElasticSearchTestCase {
@Test
public void simpleTestsLZF() throws IOException {

View File

@ -19,36 +19,27 @@
package org.elasticsearch.common.geo;
import static org.junit.Assert.assertEquals;
import com.spatial4j.core.shape.Shape;
import com.spatial4j.core.shape.jts.JtsGeometry;
import com.spatial4j.core.shape.jts.JtsPoint;
import com.vividsolutions.jts.geom.*;
import org.elasticsearch.common.geo.builders.ShapeBuilder;
import org.elasticsearch.common.xcontent.XContentFactory;
import org.elasticsearch.common.xcontent.XContentParser;
import org.elasticsearch.common.xcontent.json.JsonXContent;
import org.elasticsearch.test.ElasticSearchTestCase;
import org.elasticsearch.test.hamcrest.ElasticSearchGeoAssertions;
import org.junit.Test;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import org.elasticsearch.common.geo.builders.ShapeBuilder;
import org.elasticsearch.common.xcontent.XContentFactory;
import org.elasticsearch.common.xcontent.XContentParser;
import org.elasticsearch.common.xcontent.json.JsonXContent;
import org.junit.Test;
import com.spatial4j.core.shape.Shape;
import com.spatial4j.core.shape.jts.JtsGeometry;
import com.spatial4j.core.shape.jts.JtsPoint;
import com.vividsolutions.jts.geom.Coordinate;
import com.vividsolutions.jts.geom.GeometryFactory;
import com.vividsolutions.jts.geom.LineString;
import com.vividsolutions.jts.geom.LinearRing;
import com.vividsolutions.jts.geom.MultiPoint;
import com.vividsolutions.jts.geom.MultiPolygon;
import com.vividsolutions.jts.geom.Point;
import com.vividsolutions.jts.geom.Polygon;
import static org.elasticsearch.test.hamcrest.ElasticSearchGeoAssertions.assertEquals;
/**
* Tests for {@link GeoJSONShapeParser}
*/
public class GeoJSONShapeParserTests {
public class GeoJSONShapeParserTests extends ElasticSearchTestCase {
private final static GeometryFactory GEOMETRY_FACTORY = new GeometryFactory();
@ -259,7 +250,7 @@ public class GeoJSONShapeParserTests {
private void assertGeometryEquals(Shape expected, String geoJson) throws IOException {
XContentParser parser = JsonXContent.jsonXContent.createParser(geoJson);
parser.nextToken();
assertEquals(ShapeBuilder.parse(parser).build(), expected);
ElasticSearchGeoAssertions.assertEquals(ShapeBuilder.parse(parser).build(), expected);
}
}

View File

@ -26,6 +26,7 @@ import com.vividsolutions.jts.geom.Coordinate;
import com.vividsolutions.jts.geom.LineString;
import com.vividsolutions.jts.geom.Polygon;
import org.elasticsearch.common.geo.builders.ShapeBuilder;
import org.elasticsearch.test.ElasticSearchTestCase;
import org.junit.Test;
import static org.elasticsearch.test.hamcrest.ElasticSearchGeoAssertions.assertMultiLineString;
@ -34,7 +35,7 @@ import static org.junit.Assert.assertEquals;
/**
* Tests for {@link ShapeBuilder}
*/
public class ShapeBuilderTests {
public class ShapeBuilderTests extends ElasticSearchTestCase {
@Test
public void testNewPoint() {

View File

@ -20,6 +20,7 @@
package org.elasticsearch.common.io;
import com.google.common.base.Charsets;
import org.elasticsearch.test.ElasticSearchTestCase;
import org.junit.Test;
import java.io.*;
@ -32,7 +33,7 @@ import static org.hamcrest.Matchers.equalTo;
/**
* Unit tests for {@link org.elasticsearch.common.io.Streams}.
*/
public class StreamsTests {
public class StreamsTests extends ElasticSearchTestCase {
@Test
public void testCopyFromInputStream() throws IOException {

View File

@ -22,6 +22,7 @@ package org.elasticsearch.common.io.streams;
import org.apache.lucene.util.Constants;
import org.elasticsearch.common.io.stream.BytesStreamInput;
import org.elasticsearch.common.io.stream.BytesStreamOutput;
import org.elasticsearch.test.ElasticSearchTestCase;
import org.junit.Test;
import static org.hamcrest.MatcherAssert.assertThat;
@ -32,7 +33,7 @@ import static org.junit.Assume.assumeTrue;
/**
*
*/
public class BytesStreamsTests {
public class BytesStreamsTests extends ElasticSearchTestCase {
@Test
public void testSimpleStreams() throws Exception {

View File

@ -23,6 +23,7 @@ import org.elasticsearch.common.io.stream.BytesStreamInput;
import org.elasticsearch.common.io.stream.BytesStreamOutput;
import org.elasticsearch.common.io.stream.HandlesStreamInput;
import org.elasticsearch.common.io.stream.HandlesStreamOutput;
import org.elasticsearch.test.ElasticSearchTestCase;
import org.junit.Test;
import static org.hamcrest.MatcherAssert.assertThat;
@ -31,7 +32,7 @@ import static org.hamcrest.Matchers.*;
/**
*
*/
public class HandlesStreamsTests {
public class HandlesStreamsTests extends ElasticSearchTestCase {
@Test
public void testSharedStringHandles() throws Exception {

View File

@ -1,5 +1,6 @@
package org.elasticsearch.common.joda;
import org.elasticsearch.test.ElasticSearchTestCase;
import org.junit.Test;
import java.util.concurrent.TimeUnit;
@ -9,7 +10,7 @@ import static org.hamcrest.Matchers.equalTo;
/**
*/
public class DateMathParserTests {
public class DateMathParserTests extends ElasticSearchTestCase {
@Test
public void dataMathTests() {

View File

@ -29,6 +29,7 @@ import org.apache.lucene.search.TopDocs;
import org.apache.lucene.store.Directory;
import org.apache.lucene.store.RAMDirectory;
import org.elasticsearch.common.lucene.Lucene;
import org.elasticsearch.test.ElasticSearchTestCase;
import org.junit.Test;
import java.io.IOException;
@ -39,7 +40,7 @@ import static org.hamcrest.Matchers.equalTo;
/**
*
*/
public class SimpleAllTests {
public class SimpleAllTests extends ElasticSearchTestCase {
@Test
public void testAllEntriesRead() throws Exception {

View File

@ -30,6 +30,7 @@ import org.apache.lucene.search.IndexSearcher;
import org.apache.lucene.store.Directory;
import org.apache.lucene.store.RAMDirectory;
import org.elasticsearch.common.lucene.Lucene;
import org.elasticsearch.test.ElasticSearchTestCase;
import org.junit.Test;
import static org.hamcrest.MatcherAssert.assertThat;
@ -38,7 +39,7 @@ import static org.hamcrest.Matchers.equalTo;
/**
*
*/
public class MatchAllDocsFilterTests {
public class MatchAllDocsFilterTests extends ElasticSearchTestCase {
@Test
public void testMatchAllDocsFilter() throws Exception {

View File

@ -30,6 +30,7 @@ import org.apache.lucene.search.IndexSearcher;
import org.apache.lucene.store.Directory;
import org.apache.lucene.store.RAMDirectory;
import org.elasticsearch.common.lucene.Lucene;
import org.elasticsearch.test.ElasticSearchTestCase;
import org.junit.Test;
import static org.hamcrest.MatcherAssert.assertThat;
@ -38,7 +39,7 @@ import static org.hamcrest.Matchers.equalTo;
/**
*
*/
public class MoreLikeThisQueryTests {
public class MoreLikeThisQueryTests extends ElasticSearchTestCase {
@Test
public void testSimple() throws Exception {

View File

@ -26,12 +26,13 @@ import org.apache.lucene.index.*;
import org.apache.lucene.search.IndexSearcher;
import org.apache.lucene.store.RAMDirectory;
import org.elasticsearch.common.lucene.Lucene;
import org.elasticsearch.test.ElasticSearchTestCase;
import org.junit.Test;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.equalTo;
public class MultiPhrasePrefixQueryTests {
public class MultiPhrasePrefixQueryTests extends ElasticSearchTestCase {
@Test
public void simpleTests() throws Exception {

View File

@ -32,6 +32,7 @@ import org.apache.lucene.store.RAMDirectory;
import org.apache.lucene.util.FixedBitSet;
import org.elasticsearch.common.lucene.Lucene;
import org.elasticsearch.common.lucene.docset.DocIdSets;
import org.elasticsearch.test.ElasticSearchTestCase;
import org.junit.Test;
import static org.hamcrest.MatcherAssert.assertThat;
@ -40,7 +41,7 @@ import static org.hamcrest.Matchers.nullValue;
/**
*/
public class TermsFilterTests {
public class TermsFilterTests extends ElasticSearchTestCase {
@Test
public void testTermFilter() throws Exception {

View File

@ -13,6 +13,7 @@ import org.apache.lucene.store.RAMDirectory;
import org.apache.lucene.util.Bits;
import org.apache.lucene.util.FixedBitSet;
import org.elasticsearch.common.lucene.Lucene;
import org.elasticsearch.test.ElasticSearchTestCase;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
@ -25,13 +26,14 @@ import static org.hamcrest.core.IsEqual.equalTo;
/**
* Tests ported from Lucene.
*/
public class XBooleanFilterLuceneTests {
public class XBooleanFilterLuceneTests extends ElasticSearchTestCase {
private Directory directory;
private AtomicReader reader;
@Before
public void setUp() throws Exception {
super.setUp();
directory = new RAMDirectory();
IndexWriter writer = new IndexWriter(directory, new IndexWriterConfig(Lucene.VERSION, new WhitespaceAnalyzer(Lucene.VERSION)));
@ -48,6 +50,7 @@ public class XBooleanFilterLuceneTests {
@After
public void tearDown() throws Exception {
super.tearDown();
reader.close();
directory.close();
}

View File

@ -15,6 +15,7 @@ import org.apache.lucene.store.Directory;
import org.apache.lucene.store.RAMDirectory;
import org.apache.lucene.util.FixedBitSet;
import org.elasticsearch.common.lucene.Lucene;
import org.elasticsearch.test.ElasticSearchTestCase;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
@ -23,18 +24,18 @@ import java.util.ArrayList;
import java.util.List;
import static org.apache.lucene.search.BooleanClause.Occur.*;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.core.IsEqual.equalTo;
/**
*/
public class XBooleanFilterTests {
public class XBooleanFilterTests extends ElasticSearchTestCase {
private Directory directory;
private AtomicReader reader;
@Before
public void setup() throws Exception {
super.setUp();
char[][] documentMatrix = new char[][] {
{'a', 'b', 'c', 'd', 'v'},
{'a', 'b', 'c', 'd', 'z'},
@ -58,6 +59,7 @@ public class XBooleanFilterTests {
@After
public void tearDown() throws Exception {
super.tearDown();
reader.close();
directory.close();
}

View File

@ -23,6 +23,7 @@ import org.apache.lucene.store.IOContext;
import org.apache.lucene.store.IndexInput;
import org.apache.lucene.store.IndexOutput;
import org.apache.lucene.store.RAMDirectory;
import org.elasticsearch.test.ElasticSearchTestCase;
import org.junit.Test;
import java.io.IOException;
@ -34,7 +35,7 @@ import static org.hamcrest.Matchers.lessThan;
/**
*
*/
public class InputStreamIndexInputTests {
public class InputStreamIndexInputTests extends ElasticSearchTestCase {
@Test
public void testSingleReadSingleByteLimit() throws IOException {

View File

@ -19,6 +19,7 @@
package org.elasticsearch.common.path;
import org.elasticsearch.test.ElasticSearchTestCase;
import org.junit.Test;
import java.util.Map;
@ -31,7 +32,7 @@ import static org.hamcrest.Matchers.nullValue;
/**
*
*/
public class PathTrieTests {
public class PathTrieTests extends ElasticSearchTestCase {
@Test
public void testPath() {

View File

@ -20,6 +20,7 @@
package org.elasticsearch.common.settings.loader;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.test.ElasticSearchTestCase;
import org.junit.Test;
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
@ -29,7 +30,7 @@ import static org.hamcrest.Matchers.equalTo;
/**
*
*/
public class JsonSettingsLoaderTests {
public class JsonSettingsLoaderTests extends ElasticSearchTestCase {
@Test
public void testSimpleJsonSettings() throws Exception {

View File

@ -20,6 +20,7 @@
package org.elasticsearch.common.settings.loader;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.test.ElasticSearchTestCase;
import org.junit.Test;
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
@ -29,7 +30,7 @@ import static org.hamcrest.Matchers.equalTo;
/**
*
*/
public class YamlSettingsLoaderTests {
public class YamlSettingsLoaderTests extends ElasticSearchTestCase {
@Test
public void testSimpleYamlSettings() throws Exception {

View File

@ -19,6 +19,7 @@
package org.elasticsearch.common.unit;
import org.elasticsearch.test.ElasticSearchTestCase;
import org.junit.Test;
import static org.elasticsearch.common.unit.ByteSizeUnit.*;
@ -28,7 +29,7 @@ import static org.hamcrest.Matchers.equalTo;
/**
*
*/
public class ByteSizeUnitTests {
public class ByteSizeUnitTests extends ElasticSearchTestCase {
@Test
public void testBytes() {

View File

@ -19,6 +19,7 @@
package org.elasticsearch.common.unit;
import org.elasticsearch.test.ElasticSearchTestCase;
import org.hamcrest.MatcherAssert;
import org.junit.Test;
@ -29,7 +30,7 @@ import static org.hamcrest.Matchers.is;
/**
*
*/
public class ByteSizeValueTests {
public class ByteSizeValueTests extends ElasticSearchTestCase {
@Test
public void testActual() {

View File

@ -19,6 +19,7 @@
package org.elasticsearch.common.unit;
import org.elasticsearch.test.ElasticSearchTestCase;
import org.junit.Test;
import static org.hamcrest.MatcherAssert.assertThat;
@ -28,7 +29,7 @@ import static org.hamcrest.Matchers.equalTo;
/**
*
*/
public class DistanceUnitTests {
public class DistanceUnitTests extends ElasticSearchTestCase {
@Test
public void testSimpleDistanceUnit() {

View File

@ -19,6 +19,7 @@
package org.elasticsearch.common.unit;
import org.elasticsearch.test.ElasticSearchTestCase;
import org.joda.time.PeriodType;
import org.junit.Test;
@ -31,7 +32,7 @@ import static org.hamcrest.Matchers.lessThan;
/**
*
*/
public class TimeValueTests {
public class TimeValueTests extends ElasticSearchTestCase {
@Test
public void testSimple() {

View File

@ -18,15 +18,16 @@
*/
package org.elasticsearch.common.util;
import org.elasticsearch.test.ElasticSearchTestCase;
import org.junit.Test;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.equalTo;
import org.junit.Test;
/**
* Tests for {@link SlicedDoubleList}
*/
public class SlicedDoubleListTests {
public class SlicedDoubleListTests extends ElasticSearchTestCase {
@Test
public void testCapacity() {

View File

@ -18,6 +18,7 @@
*/
package org.elasticsearch.common.util;
import org.elasticsearch.test.ElasticSearchTestCase;
import org.junit.Test;
import static org.hamcrest.MatcherAssert.assertThat;
@ -26,7 +27,7 @@ import static org.hamcrest.Matchers.equalTo;
/**
* Tests for {@link SlicedLongList}
*/
public class SlicedLongListTests {
public class SlicedLongListTests extends ElasticSearchTestCase {
@Test
public void testCapacity() {

View File

@ -18,16 +18,17 @@
*/
package org.elasticsearch.common.util;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.equalTo;
import org.apache.lucene.util.ArrayUtil;
import org.apache.lucene.util.RamUsageEstimator;
import org.elasticsearch.test.ElasticSearchTestCase;
import org.junit.Test;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.equalTo;
/**
* Tests for {@link SlicedObjectList}
*/
public class SlicedObjectListTests {
public class SlicedObjectListTests extends ElasticSearchTestCase {
public class TestList extends SlicedObjectList<Double> {

View File

@ -21,6 +21,7 @@ package org.elasticsearch.common.util.concurrent;
import org.elasticsearch.common.Priority;
import org.elasticsearch.common.unit.TimeValue;
import org.elasticsearch.test.ElasticSearchTestCase;
import org.junit.Test;
import java.util.ArrayList;
@ -34,7 +35,7 @@ import static org.hamcrest.Matchers.equalTo;
/**
*
*/
public class PrioritizedExecutorsTests {
public class PrioritizedExecutorsTests extends ElasticSearchTestCase {
@Test
public void testPriorityQueue() throws Exception {

View File

@ -24,6 +24,7 @@ import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.common.xcontent.XContentFactory;
import org.elasticsearch.common.xcontent.XContentParser;
import org.elasticsearch.common.xcontent.XContentType;
import org.elasticsearch.test.ElasticSearchTestCase;
import org.junit.Test;
import java.io.IOException;
@ -34,7 +35,7 @@ import static org.hamcrest.Matchers.equalTo;
/**
*
*/
public class BuilderRawFieldTests {
public class BuilderRawFieldTests extends ElasticSearchTestCase {
@Test
public void testJsonRawField() throws IOException {

View File

@ -26,6 +26,7 @@ import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.common.xcontent.XContentFactory;
import org.elasticsearch.common.xcontent.XContentGenerator;
import org.elasticsearch.common.xcontent.XContentType;
import org.elasticsearch.test.ElasticSearchTestCase;
import org.junit.Test;
import java.util.*;
@ -38,7 +39,7 @@ import static org.hamcrest.Matchers.equalTo;
/**
*
*/
public class XContentBuilderTests {
public class XContentBuilderTests extends ElasticSearchTestCase {
@Test
public void verifyReuseJsonGenerator() throws Exception {

View File

@ -24,6 +24,7 @@ import org.elasticsearch.common.xcontent.XContentFactory;
import org.elasticsearch.common.xcontent.XContentGenerator;
import org.elasticsearch.common.xcontent.XContentParser;
import org.elasticsearch.common.xcontent.XContentType;
import org.elasticsearch.test.ElasticSearchTestCase;
import org.junit.Test;
import java.io.IOException;
@ -35,7 +36,7 @@ import static org.hamcrest.Matchers.nullValue;
/**
*
*/
public class JsonVsSmileTests {
public class JsonVsSmileTests extends ElasticSearchTestCase {
// @Test public void testBinarySmileField() throws Exception {
// JsonGenerator gen = new SmileFactory().createJsonGenerator(new ByteArrayOutputStream());

View File

@ -20,6 +20,7 @@ package org.elasticsearch.common.xcontent.support;
import org.elasticsearch.common.xcontent.XContentHelper;
import org.elasticsearch.test.ElasticSearchTestCase;
import org.hamcrest.Matchers;
import org.junit.Test;
@ -30,7 +31,7 @@ import java.util.Map;
import static org.hamcrest.MatcherAssert.assertThat;
public class XContentHelperTests {
public class XContentHelperTests extends ElasticSearchTestCase {
Map<String, Object> getMap(Object... keyValues) {
Map<String, Object> map = new HashMap<String, Object>();

View File

@ -25,6 +25,7 @@ import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.common.xcontent.XContentFactory;
import org.elasticsearch.common.xcontent.XContentHelper;
import org.elasticsearch.common.xcontent.XContentType;
import org.elasticsearch.test.ElasticSearchTestCase;
import org.junit.Test;
import java.util.Arrays;
@ -38,7 +39,7 @@ import static org.hamcrest.core.IsEqual.equalTo;
/**
*/
public class XContentMapValuesTests {
public class XContentMapValuesTests extends ElasticSearchTestCase {
@Test
public void testFilter() throws Exception {

View File

@ -24,6 +24,7 @@ import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.core.JsonToken;
import org.elasticsearch.common.io.stream.BytesStreamOutput;
import org.elasticsearch.test.ElasticSearchTestCase;
import org.junit.Test;
import java.io.IOException;
@ -34,7 +35,7 @@ import static org.hamcrest.Matchers.equalTo;
/**
*
*/
public class JacksonLocationTests {
public class JacksonLocationTests extends ElasticSearchTestCase {
@Test
public void testLocationExtraction() throws IOException {

View File

@ -22,6 +22,7 @@ package org.elasticsearch.deps.joda;
import org.elasticsearch.common.joda.FormatDateTimeFormatter;
import org.elasticsearch.common.joda.Joda;
import org.elasticsearch.common.unit.TimeValue;
import org.elasticsearch.test.ElasticSearchTestCase;
import org.joda.time.DateTimeZone;
import org.joda.time.MutableDateTime;
import org.joda.time.format.*;
@ -36,7 +37,7 @@ import static org.junit.Assert.fail;
/**
*
*/
public class SimpleJodaTests {
public class SimpleJodaTests extends ElasticSearchTestCase {
@Test
public void testMultiParsers() {

View File

@ -21,6 +21,7 @@ package org.elasticsearch.deps.joda;
import org.elasticsearch.common.joda.TimeZoneRounding;
import org.elasticsearch.common.unit.TimeValue;
import org.elasticsearch.test.ElasticSearchTestCase;
import org.joda.time.Chronology;
import org.joda.time.DateTimeZone;
import org.joda.time.chrono.ISOChronology;
@ -32,7 +33,7 @@ import static org.hamcrest.Matchers.equalTo;
/**
*/
public class TimeZoneRoundingTests {
public class TimeZoneRoundingTests extends ElasticSearchTestCase {
@Test
public void testUTCMonthRounding() {

View File

@ -27,6 +27,7 @@ import org.apache.lucene.store.RAMDirectory;
import org.apache.lucene.util.BytesRef;
import org.apache.lucene.util.NumericUtils;
import org.elasticsearch.common.lucene.Lucene;
import org.elasticsearch.test.ElasticSearchTestCase;
import org.junit.Test;
import java.io.IOException;
@ -38,7 +39,7 @@ import static org.hamcrest.Matchers.equalTo;
/**
*
*/
public class SimpleLuceneTests {
public class SimpleLuceneTests extends ElasticSearchTestCase {
@Test
public void testSortValues() throws Exception {

View File

@ -29,6 +29,7 @@ import org.apache.lucene.search.vectorhighlight.FastVectorHighlighter;
import org.apache.lucene.store.Directory;
import org.apache.lucene.store.RAMDirectory;
import org.elasticsearch.common.lucene.Lucene;
import org.elasticsearch.test.ElasticSearchTestCase;
import org.junit.Test;
import static org.hamcrest.MatcherAssert.assertThat;
@ -37,7 +38,7 @@ import static org.hamcrest.Matchers.*;
/**
*
*/
public class VectorHighlighterTests {
public class VectorHighlighterTests extends ElasticSearchTestCase {
@Test
public void testVectorHighlighter() throws Exception {

View File

@ -20,14 +20,12 @@ package org.elasticsearch.index;
import org.elasticsearch.common.lucene.uid.Versions;
import org.elasticsearch.test.ElasticSearchTestCase;
import org.junit.Test;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.equalTo;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
public class VersionTypeTests {
public class VersionTypeTests extends ElasticSearchTestCase {
@Test
public void testInternalVersionConflict() throws Exception {

View File

@ -46,6 +46,7 @@ import org.elasticsearch.index.similarity.SimilarityModule;
import org.elasticsearch.indices.InvalidAliasNameException;
import org.elasticsearch.indices.query.IndicesQueriesModule;
import org.elasticsearch.script.ScriptModule;
import org.elasticsearch.test.ElasticSearchTestCase;
import org.junit.Test;
import java.io.IOException;
@ -58,7 +59,7 @@ import static org.hamcrest.Matchers.nullValue;
/**
*
*/
public class IndexAliasesServiceTests {
public class IndexAliasesServiceTests extends ElasticSearchTestCase {
public static IndexAliasesService newIndexAliasesService() {
return new IndexAliasesService(new Index("test"), ImmutableSettings.Builder.EMPTY_SETTINGS, newIndexQueryParserService());
}

View File

@ -43,6 +43,7 @@ import org.elasticsearch.index.analysis.filter1.MyFilterTokenFilterFactory;
import org.elasticsearch.index.settings.IndexSettingsModule;
import org.elasticsearch.indices.analysis.IndicesAnalysisModule;
import org.elasticsearch.indices.analysis.IndicesAnalysisService;
import org.elasticsearch.test.ElasticSearchTestCase;
import org.hamcrest.MatcherAssert;
import org.junit.Test;
@ -57,7 +58,7 @@ import static org.hamcrest.Matchers.instanceOf;
/**
*
*/
public class AnalysisModuleTests {
public class AnalysisModuleTests extends ElasticSearchTestCase {
@Test
public void testSimpleConfigurationJson() {

View File

@ -36,6 +36,7 @@ import org.elasticsearch.index.analysis.compound.DictionaryCompoundWordTokenFilt
import org.elasticsearch.index.settings.IndexSettingsModule;
import org.elasticsearch.indices.analysis.IndicesAnalysisModule;
import org.elasticsearch.indices.analysis.IndicesAnalysisService;
import org.elasticsearch.test.ElasticSearchTestCase;
import org.hamcrest.MatcherAssert;
import org.junit.Test;
@ -48,7 +49,7 @@ import static org.hamcrest.Matchers.*;
/**
*/
public class CompoundAnalysisTests {
public class CompoundAnalysisTests extends ElasticSearchTestCase {
@Test
public void testDefaultsCompoundAnalysis() throws Exception {

View File

@ -35,6 +35,7 @@ import org.elasticsearch.common.lucene.search.XConstantScoreQuery;
import org.elasticsearch.common.lucene.search.XFilteredQuery;
import org.elasticsearch.index.Index;
import org.elasticsearch.index.cache.filter.none.NoneFilterCache;
import org.elasticsearch.test.ElasticSearchTestCase;
import org.junit.Test;
import java.io.IOException;
@ -46,7 +47,7 @@ import static org.hamcrest.Matchers.equalTo;
/**
*
*/
public class FilterCacheTests {
public class FilterCacheTests extends ElasticSearchTestCase {
@Test

View File

@ -55,6 +55,7 @@ import org.elasticsearch.index.settings.IndexSettingsService;
import org.elasticsearch.index.shard.service.IndexShard;
import org.elasticsearch.index.similarity.SimilarityService;
import org.elasticsearch.index.store.IndexStore;
import org.elasticsearch.test.ElasticSearchTestCase;
import org.junit.Test;
import java.io.IOException;
@ -68,7 +69,7 @@ import static org.hamcrest.Matchers.nullValue;
/**
*/
public class SimpleIdCacheTests {
public class SimpleIdCacheTests extends ElasticSearchTestCase {
@Test
public void testDeletedDocuments() throws Exception {

View File

@ -32,6 +32,7 @@ import org.elasticsearch.common.lucene.Lucene;
import org.elasticsearch.index.codec.postingsformat.BloomFilterPostingsFormat;
import org.elasticsearch.index.codec.postingsformat.ElasticSearch090PostingsFormat;
import org.elasticsearch.index.mapper.internal.UidFieldMapper;
import org.elasticsearch.test.ElasticSearchTestCase;
import org.junit.Test;
import java.io.IOException;
@ -46,7 +47,7 @@ import static org.hamcrest.Matchers.*;
/**
* Simple smoke test for {@link ElasticSearch090PostingsFormat}
*/
public class DefaultPostingsFormatTests {
public class DefaultPostingsFormatTests extends ElasticSearchTestCase {
private final class TestCodec extends Lucene45Codec {

View File

@ -28,19 +28,19 @@ import org.apache.lucene.store.RAMDirectory;
import org.elasticsearch.common.lucene.Lucene;
import org.elasticsearch.index.Index;
import org.elasticsearch.index.shard.ShardId;
import org.elasticsearch.test.ElasticSearchTestCase;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import static org.apache.lucene.index.DirectoryReader.listCommits;
import static org.elasticsearch.common.settings.ImmutableSettings.Builder.EMPTY_SETTINGS;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.equalTo;
/**
* A set of tests for {@link org.elasticsearch.index.deletionpolicy.SnapshotDeletionPolicy}.
*/
public class SnapshotDeletionPolicyTests {
public class SnapshotDeletionPolicyTests extends ElasticSearchTestCase {
protected final ShardId shardId = new ShardId(new Index("index"), 1);
@ -50,16 +50,17 @@ public class SnapshotDeletionPolicyTests {
@Before
public void setUp() throws Exception {
super.setUp();
dir = new RAMDirectory();
deletionPolicy = new SnapshotDeletionPolicy(new KeepOnlyLastDeletionPolicy(shardId, EMPTY_SETTINGS));
// LUCENE 4 UPGRADE: Not sure about version.
indexWriter = new IndexWriter(dir, new IndexWriterConfig(Lucene.VERSION, Lucene.STANDARD_ANALYZER)
indexWriter = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, Lucene.STANDARD_ANALYZER)
.setIndexDeletionPolicy(deletionPolicy)
.setOpenMode(IndexWriterConfig.OpenMode.CREATE));
}
@After
public void tearDown() throws Exception {
super.tearDown();
indexWriter.close();
dir.close();
}

View File

@ -20,6 +20,7 @@
package org.elasticsearch.index.fielddata.ordinals;
import org.elasticsearch.common.settings.ImmutableSettings;
import org.elasticsearch.test.ElasticSearchTestCase;
import org.junit.Test;
import java.io.IOException;
@ -31,7 +32,7 @@ import static org.hamcrest.Matchers.*;
/**
*/
public class SingleOrdinalsTests {
public class SingleOrdinalsTests extends ElasticSearchTestCase {
@Test
public void testSvValues() throws IOException {

View File

@ -21,9 +21,9 @@ package org.elasticsearch.index.gateway;
import com.google.common.base.Charsets;
import com.google.common.collect.Lists;
import org.elasticsearch.common.logging.ESLogger;
import org.elasticsearch.common.logging.Loggers;
import org.elasticsearch.test.ElasticSearchTestCase;
import org.junit.Test;
import java.util.ArrayList;
@ -35,7 +35,7 @@ import static org.hamcrest.Matchers.nullValue;
/**
*
*/
public class CommitPointsTests {
public class CommitPointsTests extends ElasticSearchTestCase {
private final ESLogger logger = Loggers.getLogger(CommitPointsTests.class);

View File

@ -20,11 +20,13 @@ package org.elasticsearch.index.mapper;
import org.apache.lucene.util.BytesRef;
import org.elasticsearch.common.bytes.HashedBytesArray;
import org.elasticsearch.test.ElasticSearchTestCase;
import org.junit.Test;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.equalTo;
public class UidTests {
public class UidTests extends ElasticSearchTestCase {
@Test
public void testCreateAndSplitId() {

View File

@ -30,6 +30,7 @@ import org.elasticsearch.common.lucene.all.AllTokenStream;
import org.elasticsearch.index.mapper.DocumentMapper;
import org.elasticsearch.index.mapper.FieldMapper;
import org.elasticsearch.index.mapper.MapperTestUtils;
import org.elasticsearch.test.ElasticSearchTestCase;
import org.hamcrest.Matchers;
import org.junit.Test;
@ -41,7 +42,7 @@ import static org.hamcrest.Matchers.equalTo;
/**
*
*/
public class SimpleAllMapperTests {
public class SimpleAllMapperTests extends ElasticSearchTestCase {
@Test
public void testSimpleAllMappers() throws Exception {

View File

@ -23,8 +23,9 @@ import org.elasticsearch.common.xcontent.XContentFactory;
import org.elasticsearch.index.analysis.FieldNameAnalyzer;
import org.elasticsearch.index.analysis.NamedAnalyzer;
import org.elasticsearch.index.mapper.DocumentMapper;
import org.elasticsearch.index.mapper.ParsedDocument;
import org.elasticsearch.index.mapper.MapperTestUtils;
import org.elasticsearch.index.mapper.ParsedDocument;
import org.elasticsearch.test.ElasticSearchTestCase;
import org.junit.Test;
import static org.hamcrest.MatcherAssert.assertThat;
@ -34,7 +35,7 @@ import static org.hamcrest.Matchers.nullValue;
/**
*
*/
public class AnalyzerMapperTests {
public class AnalyzerMapperTests extends ElasticSearchTestCase {
@Test
public void testAnalyzerMapping() throws Exception {

View File

@ -22,9 +22,10 @@ package org.elasticsearch.index.mapper.boost;
import org.apache.lucene.index.IndexableField;
import org.elasticsearch.common.xcontent.XContentFactory;
import org.elasticsearch.index.mapper.DocumentMapper;
import org.elasticsearch.index.mapper.MapperTestUtils;
import org.elasticsearch.index.mapper.ParsedDocument;
import org.elasticsearch.index.mapper.internal.BoostFieldMapper;
import org.elasticsearch.index.mapper.MapperTestUtils;
import org.elasticsearch.test.ElasticSearchTestCase;
import org.junit.Test;
import static org.hamcrest.MatcherAssert.assertThat;
@ -32,7 +33,7 @@ import static org.hamcrest.Matchers.equalTo;
/**
*/
public class BoostMappingTests {
public class BoostMappingTests extends ElasticSearchTestCase {
@Test
public void testDefaultMapping() throws Exception {

View File

@ -21,14 +21,15 @@ package org.elasticsearch.index.mapper.boost;
import org.elasticsearch.common.xcontent.XContentFactory;
import org.elasticsearch.index.mapper.DocumentMapper;
import org.elasticsearch.index.mapper.ParsedDocument;
import org.elasticsearch.index.mapper.MapperTestUtils;
import org.elasticsearch.index.mapper.ParsedDocument;
import org.elasticsearch.test.ElasticSearchTestCase;
import org.junit.Test;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.equalTo;
public class CustomBoostMappingTests {
public class CustomBoostMappingTests extends ElasticSearchTestCase {
@Test
public void testCustomBoostValues() throws Exception {

View File

@ -26,6 +26,7 @@ import org.elasticsearch.common.xcontent.XContentFactory;
import org.elasticsearch.index.mapper.DocumentMapper;
import org.elasticsearch.index.mapper.MapperParsingException;
import org.elasticsearch.index.mapper.MapperTestUtils;
import org.elasticsearch.test.ElasticSearchTestCase;
import org.junit.Test;
import static org.hamcrest.MatcherAssert.assertThat;
@ -33,7 +34,7 @@ import static org.hamcrest.Matchers.closeTo;
/**
*/
public class FieldLevelBoostTests {
public class FieldLevelBoostTests extends ElasticSearchTestCase {
@Test
public void testFieldLevelBoost() throws Exception {

View File

@ -21,8 +21,9 @@ package org.elasticsearch.index.mapper.camelcase;
import org.elasticsearch.common.xcontent.XContentFactory;
import org.elasticsearch.index.mapper.DocumentMapper;
import org.elasticsearch.index.mapper.ParsedDocument;
import org.elasticsearch.index.mapper.MapperTestUtils;
import org.elasticsearch.index.mapper.ParsedDocument;
import org.elasticsearch.test.ElasticSearchTestCase;
import org.junit.Test;
import static org.hamcrest.MatcherAssert.assertThat;
@ -32,7 +33,7 @@ import static org.hamcrest.Matchers.nullValue;
/**
*
*/
public class CamelCaseFieldNameTests {
public class CamelCaseFieldNameTests extends ElasticSearchTestCase {
@Test
public void testCamelCaseFieldNameStaysAsIs() throws Exception {

View File

@ -22,8 +22,9 @@ import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.common.xcontent.json.JsonXContent;
import org.elasticsearch.index.mapper.DocumentMapper;
import org.elasticsearch.index.mapper.FieldMapper;
import org.elasticsearch.index.mapper.core.CompletionFieldMapper;
import org.elasticsearch.index.mapper.MapperTestUtils;
import org.elasticsearch.index.mapper.core.CompletionFieldMapper;
import org.elasticsearch.test.ElasticSearchTestCase;
import org.junit.Test;
import java.io.IOException;
@ -34,7 +35,7 @@ import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.instanceOf;
import static org.hamcrest.Matchers.is;
public class CompletionFieldMapperTests {
public class CompletionFieldMapperTests extends ElasticSearchTestCase {
@Test
public void testDefaultConfiguration() throws IOException {

View File

@ -21,15 +21,16 @@ package org.elasticsearch.index.mapper.compound;
import org.elasticsearch.common.xcontent.XContentFactory;
import org.elasticsearch.index.mapper.DocumentMapper;
import org.elasticsearch.index.mapper.ParsedDocument;
import org.elasticsearch.index.mapper.MapperTestUtils;
import org.elasticsearch.index.mapper.ParsedDocument;
import org.elasticsearch.test.ElasticSearchTestCase;
import org.junit.Test;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.closeTo;
import static org.hamcrest.Matchers.equalTo;
public class CompoundTypesTests {
public class CompoundTypesTests extends ElasticSearchTestCase {
@Test
public void testStringType() throws Exception {

View File

@ -19,18 +19,6 @@
package org.elasticsearch.index.mapper.date;
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.instanceOf;
import static org.hamcrest.Matchers.notNullValue;
import static org.hamcrest.Matchers.nullValue;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
import org.apache.lucene.analysis.NumericTokenStream.NumericTermAttribute;
import org.apache.lucene.analysis.TokenStream;
import org.apache.lucene.search.Filter;
@ -42,19 +30,25 @@ import org.elasticsearch.common.xcontent.ToXContent;
import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.common.xcontent.XContentFactory;
import org.elasticsearch.common.xcontent.XContentType;
import org.elasticsearch.index.mapper.DocumentMapper;
import org.elasticsearch.index.mapper.FieldMapper;
import org.elasticsearch.index.mapper.MapperParsingException;
import org.elasticsearch.index.mapper.ParsedDocument;
import org.elasticsearch.index.mapper.*;
import org.elasticsearch.index.mapper.core.DateFieldMapper;
import org.elasticsearch.index.mapper.core.LongFieldMapper;
import org.elasticsearch.index.mapper.core.StringFieldMapper;
import org.elasticsearch.index.mapper.MapperTestUtils;
import org.elasticsearch.test.ElasticSearchTestCase;
import org.joda.time.DateTime;
import org.joda.time.DateTimeZone;
import org.junit.Test;
public class SimpleDateMappingTests {
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.*;
public class SimpleDateMappingTests extends ElasticSearchTestCase {
@Test
public void testAutomaticDateParser() throws Exception {

View File

@ -21,9 +21,10 @@ package org.elasticsearch.index.mapper.dynamic;
import org.elasticsearch.common.xcontent.XContentFactory;
import org.elasticsearch.index.mapper.DocumentMapper;
import org.elasticsearch.index.mapper.MapperTestUtils;
import org.elasticsearch.index.mapper.ParsedDocument;
import org.elasticsearch.index.mapper.StrictDynamicMappingException;
import org.elasticsearch.index.mapper.MapperTestUtils;
import org.elasticsearch.test.ElasticSearchTestCase;
import org.junit.Test;
import java.io.IOException;
@ -32,7 +33,7 @@ import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.nullValue;
public class DynamicMappingTests {
public class DynamicMappingTests extends ElasticSearchTestCase {
@Test
public void testDynamicTrue() throws IOException {

View File

@ -25,6 +25,7 @@ import org.elasticsearch.common.bytes.BytesArray;
import org.elasticsearch.index.mapper.DocumentMapper;
import org.elasticsearch.index.mapper.FieldMappers;
import org.elasticsearch.index.mapper.MapperTestUtils;
import org.elasticsearch.test.ElasticSearchTestCase;
import org.junit.Test;
import static org.elasticsearch.common.io.Streams.copyToBytesFromClasspath;
@ -35,7 +36,7 @@ import static org.hamcrest.Matchers.equalTo;
/**
*
*/
public class GenericStoreDynamicTemplateTests {
public class GenericStoreDynamicTemplateTests extends ElasticSearchTestCase {
@Test
public void testSimple() throws Exception {

View File

@ -25,6 +25,7 @@ import org.elasticsearch.common.bytes.BytesArray;
import org.elasticsearch.index.mapper.DocumentMapper;
import org.elasticsearch.index.mapper.FieldMappers;
import org.elasticsearch.index.mapper.MapperTestUtils;
import org.elasticsearch.test.ElasticSearchTestCase;
import org.junit.Test;
import static org.elasticsearch.common.io.Streams.copyToBytesFromClasspath;
@ -35,7 +36,7 @@ import static org.hamcrest.Matchers.equalTo;
/**
*
*/
public class PathMatchDynamicTemplateTests {
public class PathMatchDynamicTemplateTests extends ElasticSearchTestCase {
@Test
public void testSimple() throws Exception {

View File

@ -28,6 +28,7 @@ import org.elasticsearch.index.mapper.DocumentFieldMappers;
import org.elasticsearch.index.mapper.DocumentMapper;
import org.elasticsearch.index.mapper.FieldMappers;
import org.elasticsearch.index.mapper.MapperTestUtils;
import org.elasticsearch.test.ElasticSearchTestCase;
import org.hamcrest.Matchers;
import org.junit.Test;
@ -39,7 +40,7 @@ import static org.hamcrest.Matchers.equalTo;
/**
*
*/
public class SimpleDynamicTemplatesTests {
public class SimpleDynamicTemplatesTests extends ElasticSearchTestCase {
@Test
public void testMatchTypeOnly() throws Exception {

Some files were not shown because too many files have changed in this diff Show More