Search in sources :

Example 1 with EnginePlugin

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));
}
Also used : EnginePlugin(org.opensearch.plugins.EnginePlugin) IndexSettings(org.opensearch.index.IndexSettings) IndexMetadata(org.opensearch.cluster.metadata.IndexMetadata)

Example 2 with EnginePlugin

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());
}
Also used : EnginePlugin(org.opensearch.plugins.EnginePlugin) IndexSettings(org.opensearch.index.IndexSettings) IndexMetadata(org.opensearch.cluster.metadata.IndexMetadata) RetentionLeases(org.opensearch.index.seqno.RetentionLeases)

Example 3 with EnginePlugin

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);
}
Also used : EnginePlugin(org.opensearch.plugins.EnginePlugin) IndexSettings(org.opensearch.index.IndexSettings) IndexMetadata(org.opensearch.cluster.metadata.IndexMetadata) RetentionLeases(org.opensearch.index.seqno.RetentionLeases)

Example 4 with EnginePlugin

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));
}
Also used : EnginePlugin(org.opensearch.plugins.EnginePlugin) IndexSettings(org.opensearch.index.IndexSettings) IndexMetadata(org.opensearch.cluster.metadata.IndexMetadata)

Example 5 with EnginePlugin

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));
}
Also used : EnginePlugin(org.opensearch.plugins.EnginePlugin) IndexSettings(org.opensearch.index.IndexSettings) IndexMetadata(org.opensearch.cluster.metadata.IndexMetadata)

Aggregations

IndexMetadata (org.opensearch.cluster.metadata.IndexMetadata)5 IndexSettings (org.opensearch.index.IndexSettings)5 EnginePlugin (org.opensearch.plugins.EnginePlugin)5 RetentionLeases (org.opensearch.index.seqno.RetentionLeases)2