diff --git a/src/test/java/org/elasticsearch/index/store/CorruptedFileTest.java b/src/test/java/org/elasticsearch/index/store/CorruptedFileTest.java index 9dfeea80d54..5017887b50c 100644 --- a/src/test/java/org/elasticsearch/index/store/CorruptedFileTest.java +++ b/src/test/java/org/elasticsearch/index/store/CorruptedFileTest.java @@ -71,6 +71,7 @@ import org.elasticsearch.indices.recovery.RecoveryTarget; import org.elasticsearch.monitor.fs.FsStats; import org.elasticsearch.snapshots.SnapshotState; import org.elasticsearch.test.ElasticsearchIntegrationTest; +import org.elasticsearch.test.index.merge.NoMergePolicyProvider; import org.elasticsearch.test.store.MockFSDirectoryService; import org.elasticsearch.test.transport.MockTransportService; import org.elasticsearch.transport.*; @@ -596,22 +597,4 @@ public class CorruptedFileTest extends ElasticsearchIntegrationTest { "index.routing.allocation.enable", "all" )).get(); } - - public static class NoMergePolicyProvider extends AbstractMergePolicyProvider { - - @Inject - public NoMergePolicyProvider(Store store) { - super(store); - } - - @Override - public MergePolicy getMergePolicy() { - return NoMergePolicy.INSTANCE; - } - - @Override - public void close() throws ElasticsearchException { - } - } - } diff --git a/src/test/java/org/elasticsearch/search/child/ParentFieldLoadingTest.java b/src/test/java/org/elasticsearch/search/child/ParentFieldLoadingTest.java index 79c60587836..1e3d2fafe0a 100644 --- a/src/test/java/org/elasticsearch/search/child/ParentFieldLoadingTest.java +++ b/src/test/java/org/elasticsearch/search/child/ParentFieldLoadingTest.java @@ -35,6 +35,7 @@ import org.elasticsearch.index.service.IndexService; import org.elasticsearch.index.shard.service.InternalIndexShard; import org.elasticsearch.indices.IndicesService; import org.elasticsearch.test.ElasticsearchIntegrationTest; +import org.elasticsearch.test.index.merge.NoMergePolicyProvider; import org.elasticsearch.test.junit.annotations.TestLogging; import org.elasticsearch.update.UpdateTests; import org.junit.Test; @@ -55,7 +56,7 @@ public class ParentFieldLoadingTest extends ElasticsearchIntegrationTest { .put(IndexMetaData.SETTING_NUMBER_OF_REPLICAS, 0) .put(InternalIndexShard.INDEX_REFRESH_INTERVAL, -1) // We never want merges in this test to ensure we have two segments for the last validation - .put(MergePolicyModule.MERGE_POLICY_TYPE_KEY, UpdateTests.NoMergePolicyProvider.class) + .put(MergePolicyModule.MERGE_POLICY_TYPE_KEY, NoMergePolicyProvider.class) .build(); @Test diff --git a/src/test/java/org/elasticsearch/test/index/merge/NoMergePolicyProvider.java b/src/test/java/org/elasticsearch/test/index/merge/NoMergePolicyProvider.java new file mode 100644 index 00000000000..d73f501a3ab --- /dev/null +++ b/src/test/java/org/elasticsearch/test/index/merge/NoMergePolicyProvider.java @@ -0,0 +1,46 @@ +/* + * Licensed to Elasticsearch under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch 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.elasticsearch.test.index.merge; + +import org.apache.lucene.index.MergePolicy; +import org.apache.lucene.index.NoMergePolicy; +import org.elasticsearch.ElasticsearchException; +import org.elasticsearch.common.inject.Inject; +import org.elasticsearch.index.merge.policy.AbstractMergePolicyProvider; +import org.elasticsearch.index.store.Store; + +/** + * {@link org.elasticsearch.index.merge.policy.MergePolicyProvider} for lucenes {@link org.apache.lucene.index.NoMergePolicy} + */ +public class NoMergePolicyProvider extends AbstractMergePolicyProvider { + + @Inject + public NoMergePolicyProvider(Store store) { + super(store); + } + + @Override + public MergePolicy getMergePolicy() { + return NoMergePolicy.INSTANCE; + } + + @Override + public void close() throws ElasticsearchException {} +} + diff --git a/src/test/java/org/elasticsearch/update/UpdateTests.java b/src/test/java/org/elasticsearch/update/UpdateTests.java index 03acc6eb8b6..450ee0f4035 100644 --- a/src/test/java/org/elasticsearch/update/UpdateTests.java +++ b/src/test/java/org/elasticsearch/update/UpdateTests.java @@ -46,6 +46,7 @@ import org.elasticsearch.index.merge.policy.MergePolicyModule; import org.elasticsearch.index.store.Store; import org.elasticsearch.script.ScriptService; import org.elasticsearch.test.ElasticsearchIntegrationTest; +import org.elasticsearch.test.index.merge.NoMergePolicyProvider; import org.junit.Test; import java.util.ArrayList; @@ -614,23 +615,6 @@ public class UpdateTests extends ElasticsearchIntegrationTest { } - public static class NoMergePolicyProvider extends AbstractMergePolicyProvider { - - @Inject - public NoMergePolicyProvider(Store store) { - super(store); - } - - @Override - public MergePolicy getMergePolicy() { - return NoMergePolicy.INSTANCE; - } - - @Override - public void close() throws ElasticsearchException { - } - } - @Test @Slow public void stressUpdateDeleteConcurrency() throws Exception {