Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add default for EnginePlugin.getEngineFactory #2419

Merged
merged 3 commits into from
Mar 16, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add EnginePluginTests for getEngineFactory method
Signed-off-by: John Mazanec <jmazane@amazon.com>
  • Loading branch information
jmazanec15 committed Mar 9, 2022
commit 9e10d0ea6e34f1534a7666db035224b26b0ad167
33 changes: 33 additions & 0 deletions server/src/test/java/org/opensearch/plugins/EnginePluginTests.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/*
* SPDX-License-Identifier: Apache-2.0
*
* The OpenSearch Contributors require contributions made to
* this file be licensed under the Apache-2.0 license or a
* compatible open source license.
*/

package org.opensearch.plugins;

import org.opensearch.index.IndexSettings;
import org.opensearch.index.engine.EngineFactory;
import org.opensearch.test.OpenSearchTestCase;

import java.util.Optional;

public class EnginePluginTests extends OpenSearchTestCase {

public void testGetEngineFactory() {
final EngineFactory engineFactory = config -> null;
EnginePlugin enginePluginThatImplementsGetEngineFactory = new EnginePlugin() {
@Override
public Optional<EngineFactory> getEngineFactory(IndexSettings indexSettings) {
return Optional.of(engineFactory);
}
};
assertEquals(engineFactory, enginePluginThatImplementsGetEngineFactory.getEngineFactory(null).orElse(null));

EnginePlugin enginePluginThatDoesNotImplementsGetEngineFactory = new EnginePlugin() {
};
assertFalse(enginePluginThatDoesNotImplementsGetEngineFactory.getEngineFactory(null).isPresent());
}
}