Skip to content

Commit

Permalink
Merge branch 'main' into setting-no-master-block
Browse files Browse the repository at this point in the history
Signed-off-by: Tianli Feng <[email protected]>
  • Loading branch information
Tianli Feng committed Mar 17, 2022
2 parents 301edbc + 3675400 commit 36e230a
Show file tree
Hide file tree
Showing 398 changed files with 980 additions and 1,452 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ class PluginBuildPlugin implements Plugin<Project> {
naming.clear()
naming {
Tests {
baseClass 'org.apache.lucene.util.LuceneTestCase'
baseClass 'org.apache.lucene.tests.util.LuceneTestCase'
}
IT {
baseClass 'org.opensearch.test.OpenSearchIntegTestCase'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public TaskProvider<? extends Task> createTask(Project project) {
.register("testingConventions", TestingConventionsTasks.class);
testingConventions.configure(t -> {
TestingConventionRule testsRule = t.getNaming().maybeCreate("Tests");
testsRule.baseClass("org.apache.lucene.util.LuceneTestCase");
testsRule.baseClass("org.apache.lucene.tests.util.LuceneTestCase");
TestingConventionRule itRule = t.getNaming().maybeCreate("IT");
itRule.baseClass("org.opensearch.test.OpenSearchIntegTestCase");
itRule.baseClass("org.opensearch.test.rest.OpenSearchRestTestCase");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ com.carrotsearch.randomizedtesting.annotations.Seed @ Don't commit hardcoded see
com.carrotsearch.randomizedtesting.annotations.Repeat @ Don't commit hardcoded repeats

org.apache.lucene.codecs.Codec#setDefault(org.apache.lucene.codecs.Codec) @ Use the SuppressCodecs("*") annotation instead
org.apache.lucene.util.LuceneTestCase$Slow @ Don't write slow tests
org.apache.lucene.tests.util.LuceneTestCase$Slow @ Don't write slow tests
org.junit.Ignore @ Use AwaitsFix instead
org.apache.lucene.util.LuceneTestCase$Nightly @ We don't run nightly tests at this point!
org.apache.lucene.tests.util.LuceneTestCase$Nightly @ We don't run nightly tests at this point!
com.carrotsearch.randomizedtesting.annotations.Nightly @ We don't run nightly tests at this point!

org.junit.Test @defaultMessage Just name your test method testFooBar
Expand Down
2 changes: 1 addition & 1 deletion buildSrc/version.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
opensearch = 2.0.0
lucene = 9.0.0
lucene = 9.1.0-snapshot-ea989fe8f30

bundled_jdk_vendor = adoptium
bundled_jdk = 17.0.2+8
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
import org.apache.http.client.methods.HttpHead;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.client.methods.HttpPut;
import org.apache.lucene.util.LuceneTestCase;
import org.apache.lucene.tests.util.LuceneTestCase;
import org.opensearch.action.ActionRequestValidationException;
import org.opensearch.action.admin.indices.alias.Alias;
import org.opensearch.action.admin.indices.alias.IndicesAliasesRequest;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
import com.google.common.jimfs.Configuration;
import com.google.common.jimfs.Jimfs;
import org.opensearch.core.internal.io.IOUtils;
import org.apache.lucene.util.LuceneTestCase;
import org.apache.lucene.tests.util.LuceneTestCase;
import org.opensearch.cli.CommandTestCase;
import org.opensearch.common.io.PathUtilsForTesting;
import org.opensearch.env.Environment;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
import com.carrotsearch.randomizedtesting.annotations.ParametersFactory;
import com.google.common.jimfs.Configuration;
import com.google.common.jimfs.Jimfs;
import org.apache.lucene.util.LuceneTestCase;
import org.apache.lucene.tests.util.LuceneTestCase;
import org.bouncycastle.bcpg.ArmoredOutputStream;
import org.bouncycastle.bcpg.BCPGOutputStream;
import org.bouncycastle.bcpg.HashAlgorithmTags;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
import java.util.Map;
import java.util.stream.Collectors;

import org.apache.lucene.util.LuceneTestCase;
import org.apache.lucene.tests.util.LuceneTestCase;
import org.opensearch.LegacyESVersion;
import org.opensearch.Version;
import org.opensearch.cli.ExitCodes;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

package org.opensearch.plugins;

import org.apache.lucene.util.LuceneTestCase;
import org.apache.lucene.tests.util.LuceneTestCase;
import org.opensearch.Version;
import org.opensearch.cli.ExitCodes;
import org.opensearch.cli.MockTerminal;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@

package org.opensearch.core.internal.io;

import org.apache.lucene.mockfile.FilterFileSystemProvider;
import org.apache.lucene.mockfile.FilterPath;
import org.apache.lucene.tests.mockfile.FilterFileSystemProvider;
import org.apache.lucene.tests.mockfile.FilterPath;
import org.apache.lucene.util.Constants;
import org.opensearch.common.CheckedConsumer;
import org.opensearch.common.io.PathUtils;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
import org.apache.lucene.document.SortedNumericDocValuesField;
import org.apache.lucene.document.StringField;
import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.RandomIndexWriter;
import org.apache.lucene.tests.index.RandomIndexWriter;
import org.apache.lucene.search.IndexSearcher;
import org.apache.lucene.search.MatchAllDocsQuery;
import org.apache.lucene.store.Directory;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@

package org.opensearch.analysis.common;

import org.apache.lucene.analysis.CannedTokenStream;
import org.apache.lucene.analysis.Token;
import org.apache.lucene.tests.analysis.CannedTokenStream;
import org.apache.lucene.tests.analysis.Token;
import org.apache.lucene.analysis.TokenStream;
import org.apache.lucene.analysis.Tokenizer;
import org.apache.lucene.analysis.core.WhitespaceTokenizer;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@

package org.opensearch.analysis.common;

import org.apache.lucene.analysis.CannedTokenStream;
import org.apache.lucene.analysis.Token;
import org.apache.lucene.tests.analysis.CannedTokenStream;
import org.apache.lucene.tests.analysis.Token;
import org.apache.lucene.analysis.TokenStream;
import org.opensearch.common.settings.Settings;
import org.opensearch.index.Index;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,8 @@ protected Collection<Class<? extends Plugin>> nodePlugins() {

public void testNgramHighlightingWithBrokenPositions() throws IOException {
assertAcked(
prepareCreate("test").addMapping(
"test",
prepareCreate("test").setMapping(
jsonBuilder().startObject()
.startObject("test")
.startObject("properties")
.startObject("name")
.field("type", "text")
Expand All @@ -88,7 +86,6 @@ public void testNgramHighlightingWithBrokenPositions() throws IOException {
.endObject()
.endObject()
.endObject()
.endObject()
)
.setSettings(
Settings.builder()
Expand Down Expand Up @@ -260,7 +257,7 @@ public void testPhrasePrefix() throws IOException {
.put("index.analysis.filter.synonym.type", "synonym")
.putList("index.analysis.filter.synonym.synonyms", "quick => fast");

assertAcked(prepareCreate("first_test_index").setSettings(builder.build()).addMapping("type1", type1TermVectorMapping()));
assertAcked(prepareCreate("first_test_index").setSettings(builder.build()).setMapping(type1TermVectorMapping()));

ensureGreen();

Expand Down Expand Up @@ -421,7 +418,6 @@ public void testPhrasePrefix() throws IOException {
public static XContentBuilder type1TermVectorMapping() throws IOException {
return XContentFactory.jsonBuilder()
.startObject()
.startObject("type1")
.startObject("properties")
.startObject("field1")
.field("type", "text")
Expand All @@ -432,7 +428,6 @@ public static XContentBuilder type1TermVectorMapping() throws IOException {
.field("term_vector", "with_positions_offsets")
.endObject()
.endObject()
.endObject()
.endObject();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

package org.opensearch.analysis.common;

import org.apache.lucene.analysis.MockTokenizer;
import org.apache.lucene.tests.analysis.MockTokenizer;
import org.apache.lucene.analysis.TokenStream;
import org.apache.lucene.analysis.Tokenizer;
import org.apache.lucene.analysis.ngram.EdgeNGramTokenFilter;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@

package org.opensearch.analysis.common;

import org.apache.lucene.analysis.CannedTokenStream;
import org.apache.lucene.analysis.Token;
import org.apache.lucene.tests.analysis.CannedTokenStream;
import org.apache.lucene.tests.analysis.Token;
import org.opensearch.common.settings.Settings;
import org.opensearch.env.Environment;
import org.opensearch.index.analysis.AnalysisTestsHelper;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
package org.opensearch.analysis.common;

import org.apache.lucene.analysis.Analyzer;
import org.apache.lucene.analysis.BaseTokenStreamTestCase;
import org.apache.lucene.tests.analysis.BaseTokenStreamTestCase;
import org.apache.lucene.analysis.TokenStream;
import org.apache.lucene.analysis.core.KeywordTokenizer;
import org.apache.lucene.analysis.tokenattributes.CharTermAttribute;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
package org.opensearch.analysis.common;

import org.apache.lucene.analysis.Analyzer;
import org.apache.lucene.analysis.MockTokenizer;
import org.apache.lucene.tests.analysis.MockTokenizer;
import org.apache.lucene.analysis.TokenStream;
import org.apache.lucene.analysis.Tokenizer;
import org.apache.lucene.analysis.tokenattributes.CharTermAttribute;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
import java.io.Reader;
import java.io.StringReader;

import static org.apache.lucene.analysis.BaseTokenStreamTestCase.assertTokenStreamContents;
import static org.apache.lucene.tests.analysis.BaseTokenStreamTestCase.assertTokenStreamContents;

public class WhitespaceTokenizerFactoryTests extends OpenSearchTestCase {

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
c7317bb4e72b820a516e0c8a90beac5acc82c2e2
Original file line number Diff line number Diff line change
Expand Up @@ -641,12 +641,11 @@ public void testPipelineAggregationScript() throws Exception {
public void testGeo() throws Exception {
XContentBuilder xContentBuilder = XContentFactory.jsonBuilder()
.startObject()
.startObject("type1")
.startObject("properties")
.startObject("location")
.field("type", "geo_point");
xContentBuilder.endObject().endObject().endObject().endObject();
assertAcked(prepareCreate("test").addMapping("type1", xContentBuilder));
xContentBuilder.endObject().endObject().endObject();
assertAcked(prepareCreate("test").setMapping(xContentBuilder));
ensureGreen();
client().prepareIndex("test")
.setId("1")
Expand Down Expand Up @@ -687,12 +686,11 @@ public void testGeo() throws Exception {
public void testBoolean() throws Exception {
XContentBuilder xContentBuilder = XContentFactory.jsonBuilder()
.startObject()
.startObject("doc")
.startObject("properties")
.startObject("vip")
.field("type", "boolean");
xContentBuilder.endObject().endObject().endObject().endObject();
assertAcked(prepareCreate("test").addMapping("doc", xContentBuilder));
xContentBuilder.endObject().endObject().endObject();
assertAcked(prepareCreate("test").setMapping(xContentBuilder));
ensureGreen();
indexRandom(
true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,10 +128,8 @@ private void init() throws IOException {
settings.put("index.analysis.analyzer.mock_english.tokenizer", "standard");
settings.put("index.analysis.analyzer.mock_english.filter", "stop");
prepareCreate("test").setSettings(settings)
.addMapping(
"test",
.setMapping(
jsonBuilder().startObject()
.startObject("test")
.startObject("properties")
.startObject("foo")
.field("type", "text")
Expand Down Expand Up @@ -162,7 +160,6 @@ private void init() throws IOException {
.endObject()
.endObject()
.endObject()
.endObject()
)
.get();
ensureGreen();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@
package org.opensearch.index.mapper;

import org.apache.lucene.analysis.Analyzer;
import org.apache.lucene.analysis.CannedTokenStream;
import org.apache.lucene.analysis.MockTokenizer;
import org.apache.lucene.analysis.Token;
import org.apache.lucene.tests.analysis.CannedTokenStream;
import org.apache.lucene.tests.analysis.MockTokenizer;
import org.apache.lucene.tests.analysis.Token;
import org.apache.lucene.analysis.TokenStream;
import org.apache.lucene.analysis.core.KeywordAnalyzer;
import org.apache.lucene.analysis.standard.StandardAnalyzer;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,7 @@ public abstract class AbstractParentChildTestCase extends ParentChildTestCase {
@Before
public void setupCluster() throws Exception {
assertAcked(
prepareCreate("test").addMapping(
"doc",
prepareCreate("test").setMapping(
addFieldMappings(
buildParentJoinFieldMappingFromSimplifiedDef("join_field", true, "article", "comment"),
"commenter",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,7 @@ public void testParentWithMultipleBuckets() throws Exception {
public void testWithDeletes() throws Exception {
String indexName = "xyz";
assertAcked(
prepareCreate(indexName).addMapping(
"doc",
prepareCreate(indexName).setMapping(
addFieldMappings(buildParentJoinFieldMappingFromSimplifiedDef("join_field", true, "parent", "child"), "name", "keyword")
)
);
Expand Down Expand Up @@ -234,8 +233,7 @@ public void testPostCollection() throws Exception {
prepareCreate(indexName).setSettings(
Settings.builder().put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1).put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0)
)
.addMapping(
"doc",
.setMapping(
addFieldMappings(
buildParentJoinFieldMappingFromSimplifiedDef("join_field", true, masterType, childType),
"brand",
Expand Down Expand Up @@ -309,8 +307,7 @@ public void testHierarchicalChildrenAggs() {
String parentType = "country";
String childType = "city";
assertAcked(
prepareCreate(indexName).addMapping(
"doc",
prepareCreate(indexName).setMapping(
addFieldMappings(
buildParentJoinFieldMappingFromSimplifiedDef("join_field", true, grandParentType, parentType, parentType, childType),
"name",
Expand Down Expand Up @@ -352,8 +349,7 @@ public void testPostCollectAllLeafReaders() throws Exception {
// Before we only evaluated segments that yielded matches in 'towns' and 'parent_names' aggs, which caused
// us to miss to evaluate child docs in segments we didn't have parent matches for.
assertAcked(
prepareCreate("index").addMapping(
"doc",
prepareCreate("index").setMapping(
addFieldMappings(
buildParentJoinFieldMappingFromSimplifiedDef("join_field", true, "parentType", "childType"),
"name",
Expand Down
Loading

0 comments on commit 36e230a

Please sign in to comment.