use of org.opensearch.ml.common.parameter.SampleAlgoParams in project ml-commons by opensearch-project.
the class MLCommonsClassLoaderTests method testClassLoader_WrongType.
@Test
public void testClassLoader_WrongType() {
exceptionRule.expect(IllegalArgumentException.class);
exceptionRule.expectMessage("Can't find class for type TEST");
SampleAlgoParams mlAlgoParams = MLCommonsClassLoader.initInstance(TestEnum.TEST, streamInput, StreamInput.class);
assertEquals(params.getSampleParam(), mlAlgoParams.getSampleParam());
}
use of org.opensearch.ml.common.parameter.SampleAlgoParams in project ml-commons by opensearch-project.
the class MLCommonsClassLoaderTests method testClassLoader_SampleAlgoParams.
@Test
public void testClassLoader_SampleAlgoParams() {
SampleAlgoParams sampleAlgoParams = MLCommonsClassLoader.initInstance(FunctionName.SAMPLE_ALGO, streamInput, StreamInput.class);
assertEquals(params.getSampleParam(), sampleAlgoParams.getSampleParam());
}
use of org.opensearch.ml.common.parameter.SampleAlgoParams in project ml-commons by opensearch-project.
the class MLCommonsClassLoaderTests method testClassLoader_Return_MLAlgoParams.
@Test
public void testClassLoader_Return_MLAlgoParams() {
MLAlgoParams mlAlgoParams = MLCommonsClassLoader.initInstance(FunctionName.SAMPLE_ALGO, streamInput, StreamInput.class);
assertTrue(mlAlgoParams instanceof SampleAlgoParams);
assertEquals(params.getSampleParam(), ((SampleAlgoParams) mlAlgoParams).getSampleParam());
}
use of org.opensearch.ml.common.parameter.SampleAlgoParams in project ml-commons by opensearch-project.
the class MLCommonsClassLoaderTests method setUp.
@Before
public void setUp() throws IOException {
MLCommonsClassLoader.loadClassMapping();
params = new SampleAlgoParams(11);
BytesStreamOutput bytesStreamOutput = new BytesStreamOutput();
params.writeTo(bytesStreamOutput);
streamInput = bytesStreamOutput.bytes().streamInput();
}
Aggregations