Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into replace-master-internal
Browse files Browse the repository at this point in the history
Signed-off-by: Tianli Feng <[email protected]>
Tianli Feng committed Mar 17, 2022
2 parents 717bc11 + 3675400 commit 36a5bbe
Showing 398 changed files with 980 additions and 1,452 deletions.
Original file line number Diff line number Diff line change
@@ -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'
Original file line number Diff line number Diff line change
@@ -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");
Original file line number Diff line number Diff line change
@@ -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
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
Original file line number Diff line number Diff line change
@@ -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;
Original file line number Diff line number Diff line change
@@ -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;
Original file line number Diff line number Diff line change
@@ -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;
Original file line number Diff line number Diff line change
@@ -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;
Original file line number Diff line number Diff line change
@@ -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;
Original file line number Diff line number Diff line change
@@ -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;
Original file line number Diff line number Diff line change
@@ -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;
Original file line number Diff line number Diff line change
@@ -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;
Original file line number Diff line number Diff line change
@@ -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;
Original file line number Diff line number Diff line change
@@ -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")
@@ -88,7 +86,6 @@ public void testNgramHighlightingWithBrokenPositions() throws IOException {
.endObject()
.endObject()
.endObject()
.endObject()
)
.setSettings(
Settings.builder()
@@ -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();

@@ -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")
@@ -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
@@ -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;
Original file line number Diff line number Diff line change
@@ -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;
Original file line number Diff line number Diff line change
@@ -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;
Original file line number Diff line number Diff line change
@@ -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;
Original file line number Diff line number Diff line change
@@ -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 {

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
@@ -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")
@@ -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,
Original file line number Diff line number Diff line change
@@ -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")
@@ -162,7 +160,6 @@ private void init() throws IOException {
.endObject()
.endObject()
.endObject()
.endObject()
)
.get();
ensureGreen();
Original file line number Diff line number Diff line change
@@ -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;
Original file line number Diff line number Diff line change
@@ -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",
Original file line number Diff line number Diff line change
@@ -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")
)
);
@@ -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",
@@ -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",
@@ -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",
Loading

0 comments on commit 36a5bbe

Please sign in to comment.