|
@@ -14,8 +14,12 @@ import org.apache.lucene.analysis.Tokenizer;
|
|
|
import org.elasticsearch.env.Environment;
|
|
|
import org.elasticsearch.index.analysis.AnalyzerScope;
|
|
|
import org.elasticsearch.indices.analysis.AnalysisModule;
|
|
|
-import org.elasticsearch.plugin.analysis.api.AnalysisMode;
|
|
|
-import org.elasticsearch.plugin.api.NamedComponent;
|
|
|
+import org.elasticsearch.plugin.NamedComponent;
|
|
|
+import org.elasticsearch.plugin.analysis.AnalysisMode;
|
|
|
+import org.elasticsearch.plugin.analysis.AnalyzerFactory;
|
|
|
+import org.elasticsearch.plugin.analysis.CharFilterFactory;
|
|
|
+import org.elasticsearch.plugin.analysis.TokenFilterFactory;
|
|
|
+import org.elasticsearch.plugin.analysis.TokenizerFactory;
|
|
|
import org.elasticsearch.plugins.scanners.PluginInfo;
|
|
|
import org.elasticsearch.plugins.scanners.StablePluginsRegistry;
|
|
|
import org.elasticsearch.test.ESTestCase;
|
|
@@ -36,9 +40,8 @@ public class StableApiWrappersTests extends ESTestCase {
|
|
|
|
|
|
public void testUnknownClass() throws IOException {
|
|
|
StablePluginsRegistry registry = Mockito.mock(StablePluginsRegistry.class);
|
|
|
- Mockito.when(
|
|
|
- registry.getPluginInfosForExtensible(eq(org.elasticsearch.plugin.analysis.api.AnalyzerFactory.class.getCanonicalName()))
|
|
|
- ).thenReturn(List.of(new PluginInfo("namedComponentName1", "someRandomName", getClass().getClassLoader())));
|
|
|
+ Mockito.when(registry.getPluginInfosForExtensible(eq(AnalyzerFactory.class.getCanonicalName())))
|
|
|
+ .thenReturn(List.of(new PluginInfo("namedComponentName1", "someRandomName", getClass().getClassLoader())));
|
|
|
|
|
|
Map<String, AnalysisModule.AnalysisProvider<org.elasticsearch.index.analysis.AnalyzerProvider<?>>> analysisProviderMap =
|
|
|
StableApiWrappers.oldApiForAnalyzerFactory(registry);
|
|
@@ -56,9 +59,7 @@ public class StableApiWrappersTests extends ESTestCase {
|
|
|
|
|
|
public void testStablePluginHasNoArgConstructor() throws IOException {
|
|
|
StablePluginsRegistry registry = Mockito.mock(StablePluginsRegistry.class);
|
|
|
- Mockito.when(
|
|
|
- registry.getPluginInfosForExtensible(eq(org.elasticsearch.plugin.analysis.api.AnalyzerFactory.class.getCanonicalName()))
|
|
|
- )
|
|
|
+ Mockito.when(registry.getPluginInfosForExtensible(eq(AnalyzerFactory.class.getCanonicalName())))
|
|
|
.thenReturn(
|
|
|
List.of(new PluginInfo("namedComponentName1", DefaultConstrAnalyzerFactory.class.getName(), getClass().getClassLoader()))
|
|
|
);
|
|
@@ -79,9 +80,8 @@ public class StableApiWrappersTests extends ESTestCase {
|
|
|
|
|
|
public void testAnalyzerFactoryDelegation() throws IOException {
|
|
|
StablePluginsRegistry registry = Mockito.mock(StablePluginsRegistry.class);
|
|
|
- Mockito.when(
|
|
|
- registry.getPluginInfosForExtensible(eq(org.elasticsearch.plugin.analysis.api.AnalyzerFactory.class.getCanonicalName()))
|
|
|
- ).thenReturn(List.of(new PluginInfo("namedComponentName1", TestAnalyzerFactory.class.getName(), getClass().getClassLoader())));
|
|
|
+ Mockito.when(registry.getPluginInfosForExtensible(eq(AnalyzerFactory.class.getCanonicalName())))
|
|
|
+ .thenReturn(List.of(new PluginInfo("namedComponentName1", TestAnalyzerFactory.class.getName(), getClass().getClassLoader())));
|
|
|
|
|
|
Map<String, AnalysisModule.AnalysisProvider<org.elasticsearch.index.analysis.AnalyzerProvider<?>>> analysisProviderMap =
|
|
|
StableApiWrappers.oldApiForAnalyzerFactory(registry);
|
|
@@ -107,9 +107,8 @@ public class StableApiWrappersTests extends ESTestCase {
|
|
|
|
|
|
public void testTokenizerFactoryDelegation() throws IOException {
|
|
|
StablePluginsRegistry registry = Mockito.mock(StablePluginsRegistry.class);
|
|
|
- Mockito.when(
|
|
|
- registry.getPluginInfosForExtensible(eq(org.elasticsearch.plugin.analysis.api.TokenizerFactory.class.getCanonicalName()))
|
|
|
- ).thenReturn(List.of(new PluginInfo("namedComponentName1", TestTokenizerFactory.class.getName(), getClass().getClassLoader())));
|
|
|
+ Mockito.when(registry.getPluginInfosForExtensible(eq(TokenizerFactory.class.getCanonicalName())))
|
|
|
+ .thenReturn(List.of(new PluginInfo("namedComponentName1", TestTokenizerFactory.class.getName(), getClass().getClassLoader())));
|
|
|
|
|
|
Map<String, AnalysisModule.AnalysisProvider<org.elasticsearch.index.analysis.TokenizerFactory>> analysisProviderMap =
|
|
|
StableApiWrappers.oldApiForTokenizerFactory(registry);
|
|
@@ -130,9 +129,10 @@ public class StableApiWrappersTests extends ESTestCase {
|
|
|
|
|
|
public void testTokenFilterFactoryDelegation() throws IOException {
|
|
|
StablePluginsRegistry registry = Mockito.mock(StablePluginsRegistry.class);
|
|
|
- Mockito.when(
|
|
|
- registry.getPluginInfosForExtensible(eq(org.elasticsearch.plugin.analysis.api.TokenFilterFactory.class.getCanonicalName()))
|
|
|
- ).thenReturn(List.of(new PluginInfo("namedComponentName1", TestTokenFilterFactory.class.getName(), getClass().getClassLoader())));
|
|
|
+ Mockito.when(registry.getPluginInfosForExtensible(eq(TokenFilterFactory.class.getCanonicalName())))
|
|
|
+ .thenReturn(
|
|
|
+ List.of(new PluginInfo("namedComponentName1", TestTokenFilterFactory.class.getName(), getClass().getClassLoader()))
|
|
|
+ );
|
|
|
|
|
|
Map<String, AnalysisModule.AnalysisProvider<org.elasticsearch.index.analysis.TokenFilterFactory>> analysisProviderMap =
|
|
|
StableApiWrappers.oldApiForTokenFilterFactory(registry);
|
|
@@ -168,9 +168,8 @@ public class StableApiWrappersTests extends ESTestCase {
|
|
|
|
|
|
public void testCharFilterFactoryDelegation() throws IOException {
|
|
|
StablePluginsRegistry registry = Mockito.mock(StablePluginsRegistry.class);
|
|
|
- Mockito.when(
|
|
|
- registry.getPluginInfosForExtensible(eq(org.elasticsearch.plugin.analysis.api.CharFilterFactory.class.getCanonicalName()))
|
|
|
- ).thenReturn(List.of(new PluginInfo("namedComponentName1", TestCharFilterFactory.class.getName(), getClass().getClassLoader())));
|
|
|
+ Mockito.when(registry.getPluginInfosForExtensible(eq(CharFilterFactory.class.getCanonicalName())))
|
|
|
+ .thenReturn(List.of(new PluginInfo("namedComponentName1", TestCharFilterFactory.class.getName(), getClass().getClassLoader())));
|
|
|
|
|
|
Map<String, AnalysisModule.AnalysisProvider<org.elasticsearch.index.analysis.CharFilterFactory>> analysisProviderMap =
|
|
|
StableApiWrappers.oldApiForStableCharFilterFactory(registry);
|
|
@@ -198,7 +197,7 @@ public class StableApiWrappersTests extends ESTestCase {
|
|
|
}
|
|
|
|
|
|
@NamedComponent("DefaultConstrAnalyzerFactory")
|
|
|
- public static class DefaultConstrAnalyzerFactory implements org.elasticsearch.plugin.analysis.api.AnalyzerFactory {
|
|
|
+ public static class DefaultConstrAnalyzerFactory implements AnalyzerFactory {
|
|
|
|
|
|
public DefaultConstrAnalyzerFactory(int x) {}
|
|
|
|
|
@@ -210,7 +209,7 @@ public class StableApiWrappersTests extends ESTestCase {
|
|
|
}
|
|
|
|
|
|
@NamedComponent("TestAnalyzerFactory")
|
|
|
- public static class TestAnalyzerFactory implements org.elasticsearch.plugin.analysis.api.AnalyzerFactory {
|
|
|
+ public static class TestAnalyzerFactory implements AnalyzerFactory {
|
|
|
|
|
|
@Override
|
|
|
public Analyzer create() {
|
|
@@ -220,7 +219,7 @@ public class StableApiWrappersTests extends ESTestCase {
|
|
|
}
|
|
|
|
|
|
@NamedComponent("TestTokenizerFactory")
|
|
|
- public static class TestTokenizerFactory implements org.elasticsearch.plugin.analysis.api.TokenizerFactory {
|
|
|
+ public static class TestTokenizerFactory implements TokenizerFactory {
|
|
|
|
|
|
@Override
|
|
|
public Tokenizer create() {
|
|
@@ -229,7 +228,7 @@ public class StableApiWrappersTests extends ESTestCase {
|
|
|
}
|
|
|
|
|
|
@NamedComponent("TestTokenFilterFactory")
|
|
|
- public static class TestTokenFilterFactory implements org.elasticsearch.plugin.analysis.api.TokenFilterFactory {
|
|
|
+ public static class TestTokenFilterFactory implements TokenFilterFactory {
|
|
|
|
|
|
@Override
|
|
|
public TokenStream create(TokenStream tokenStream) {
|
|
@@ -254,7 +253,7 @@ public class StableApiWrappersTests extends ESTestCase {
|
|
|
}
|
|
|
|
|
|
@NamedComponent("TestCharFilterFactory")
|
|
|
- public static class TestCharFilterFactory implements org.elasticsearch.plugin.analysis.api.CharFilterFactory {
|
|
|
+ public static class TestCharFilterFactory implements CharFilterFactory {
|
|
|
|
|
|
@Override
|
|
|
public Reader create(Reader reader) {
|