use of org.opensearch.plugins.EnginePlugin in project OpenSearch by opensearch-project.
the class EngineConfigFactoryTests method testCreateEngineConfigFromFactoryMultipleCustomTranslogDeletionPolicyFactoryIllegalStateException.
public void testCreateEngineConfigFromFactoryMultipleCustomTranslogDeletionPolicyFactoryIllegalStateException() {
IndexMetadata meta = IndexMetadata.builder("test").settings(settings(Version.CURRENT)).numberOfShards(1).numberOfReplicas(1).build();
List<EnginePlugin> plugins = Arrays.asList(new FooEnginePlugin(), new BazEnginePlugin());
IndexSettings indexSettings = IndexSettingsModule.newIndexSettings("test", meta.getSettings());
expectThrows(IllegalStateException.class, () -> new EngineConfigFactory(plugins, indexSettings));
}
use of org.opensearch.plugins.EnginePlugin in project OpenSearch by opensearch-project.
the class EngineConfigFactoryTests method testCreateCodecServiceFromFactory.
public void testCreateCodecServiceFromFactory() {
IndexMetadata meta = IndexMetadata.builder("test").settings(settings(Version.CURRENT)).numberOfShards(1).numberOfReplicas(1).build();
List<EnginePlugin> plugins = Arrays.asList(new BakEnginePlugin());
IndexSettings indexSettings = IndexSettingsModule.newIndexSettings("test", meta.getSettings());
EngineConfigFactory factory = new EngineConfigFactory(plugins, indexSettings);
EngineConfig config = factory.newEngineConfig(null, null, indexSettings, null, null, null, null, null, null, null, null, null, null, TimeValue.timeValueMinutes(5), null, null, null, null, null, () -> new RetentionLeases(0, 0, Collections.emptyList()), null, null);
assertNotNull(config.getCodec());
}
use of org.opensearch.plugins.EnginePlugin in project OpenSearch by opensearch-project.
the class EngineConfigFactoryTests method testCreateEngineConfigFromFactory.
public void testCreateEngineConfigFromFactory() {
IndexMetadata meta = IndexMetadata.builder("test").settings(settings(Version.CURRENT)).numberOfShards(1).numberOfReplicas(1).build();
List<EnginePlugin> plugins = Collections.singletonList(new FooEnginePlugin());
IndexSettings indexSettings = IndexSettingsModule.newIndexSettings("test", meta.getSettings());
EngineConfigFactory factory = new EngineConfigFactory(plugins, indexSettings);
EngineConfig config = factory.newEngineConfig(null, null, indexSettings, null, null, null, null, null, null, null, null, null, null, TimeValue.timeValueMinutes(5), null, null, null, null, null, () -> new RetentionLeases(0, 0, Collections.emptyList()), null, null);
assertNotNull(config.getCodec());
assertNotNull(config.getCustomTranslogDeletionPolicyFactory());
assertTrue(config.getCustomTranslogDeletionPolicyFactory().create(indexSettings, null) instanceof CustomTranslogDeletionPolicy);
}
use of org.opensearch.plugins.EnginePlugin in project OpenSearch by opensearch-project.
the class EngineConfigFactoryTests method testCreateEngineConfigFromFactoryMultipleCodecServiceIllegalStateException.
public void testCreateEngineConfigFromFactoryMultipleCodecServiceIllegalStateException() {
IndexMetadata meta = IndexMetadata.builder("test").settings(settings(Version.CURRENT)).numberOfShards(1).numberOfReplicas(1).build();
List<EnginePlugin> plugins = Arrays.asList(new FooEnginePlugin(), new BarEnginePlugin());
IndexSettings indexSettings = IndexSettingsModule.newIndexSettings("test", meta.getSettings());
expectThrows(IllegalStateException.class, () -> new EngineConfigFactory(plugins, indexSettings));
}
use of org.opensearch.plugins.EnginePlugin in project OpenSearch by opensearch-project.
the class EngineConfigFactoryTests method testCreateEngineConfigFromFactoryMultipleCodecServiceAndFactoryIllegalStateException.
public void testCreateEngineConfigFromFactoryMultipleCodecServiceAndFactoryIllegalStateException() {
IndexMetadata meta = IndexMetadata.builder("test").settings(settings(Version.CURRENT)).numberOfShards(1).numberOfReplicas(1).build();
List<EnginePlugin> plugins = Arrays.asList(new FooEnginePlugin(), new BakEnginePlugin());
IndexSettings indexSettings = IndexSettingsModule.newIndexSettings("test", meta.getSettings());
expectThrows(IllegalStateException.class, () -> new EngineConfigFactory(plugins, indexSettings));
}
Aggregations