use of org.opensearch.common.io.stream.NamedWriteableRegistry in project OpenSearch by opensearch-project.
the class HighlightBuilderTests method init.
/**
* setup for the whole base test class
*/
@BeforeClass
public static void init() {
SearchModule searchModule = new SearchModule(Settings.EMPTY, emptyList());
namedWriteableRegistry = new NamedWriteableRegistry(searchModule.getNamedWriteables());
xContentRegistry = new NamedXContentRegistry(searchModule.getNamedXContents());
}
use of org.opensearch.common.io.stream.NamedWriteableRegistry in project OpenSearch by opensearch-project.
the class AbstractSortTestCase method init.
@BeforeClass
public static void init() {
Settings baseSettings = Settings.builder().put(Environment.PATH_HOME_SETTING.getKey(), createTempDir().toString()).build();
Map<String, Function<Map<String, Object>, Object>> scripts = Collections.singletonMap(MOCK_SCRIPT_NAME, p -> null);
ScriptEngine engine = new MockScriptEngine(MockScriptEngine.NAME, scripts, Collections.emptyMap());
scriptService = new ScriptService(baseSettings, Collections.singletonMap(engine.getType(), engine), ScriptModule.CORE_CONTEXTS);
SearchModule searchModule = new SearchModule(Settings.EMPTY, emptyList());
namedWriteableRegistry = new NamedWriteableRegistry(searchModule.getNamedWriteables());
xContentRegistry = new NamedXContentRegistry(searchModule.getNamedXContents());
}
use of org.opensearch.common.io.stream.NamedWriteableRegistry in project OpenSearch by opensearch-project.
the class NestedSortBuilderTests method init.
@BeforeClass
public static void init() {
SearchModule searchModule = new SearchModule(Settings.EMPTY, emptyList());
namedWriteableRegistry = new NamedWriteableRegistry(searchModule.getNamedWriteables());
xContentRegistry = new NamedXContentRegistry(searchModule.getNamedXContents());
}
use of org.opensearch.common.io.stream.NamedWriteableRegistry in project OpenSearch by opensearch-project.
the class FuzzyOptionsTests method testSerialization.
/**
* Test serialization and deserialization
*/
public void testSerialization() throws IOException {
for (int i = 0; i < NUMBER_OF_RUNS; i++) {
FuzzyOptions testModel = randomFuzzyOptions();
FuzzyOptions deserializedModel = copyWriteable(testModel, new NamedWriteableRegistry(Collections.emptyList()), FuzzyOptions::new);
assertEquals(testModel, deserializedModel);
assertEquals(testModel.hashCode(), deserializedModel.hashCode());
assertNotSame(testModel, deserializedModel);
}
}
use of org.opensearch.common.io.stream.NamedWriteableRegistry in project OpenSearch by opensearch-project.
the class SmoothingModelTestCase method init.
/**
* setup for the whole base test class
*/
@BeforeClass
public static void init() {
if (namedWriteableRegistry == null) {
List<NamedWriteableRegistry.Entry> namedWriteables = new ArrayList<>();
SearchModule.registerSmoothingModels(namedWriteables);
namedWriteableRegistry = new NamedWriteableRegistry(namedWriteables);
}
}
Aggregations