Search in sources :

Example 1 with SampleAlgoParams

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());
}
Also used : SampleAlgoParams(org.opensearch.ml.common.parameter.SampleAlgoParams) Test(org.junit.Test)

Example 2 with SampleAlgoParams

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());
}
Also used : SampleAlgoParams(org.opensearch.ml.common.parameter.SampleAlgoParams) Test(org.junit.Test)

Example 3 with SampleAlgoParams

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());
}
Also used : MLAlgoParams(org.opensearch.ml.common.parameter.MLAlgoParams) SampleAlgoParams(org.opensearch.ml.common.parameter.SampleAlgoParams) Test(org.junit.Test)

Example 4 with SampleAlgoParams

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();
}
Also used : SampleAlgoParams(org.opensearch.ml.common.parameter.SampleAlgoParams) BytesStreamOutput(org.opensearch.common.io.stream.BytesStreamOutput) Before(org.junit.Before)

Aggregations

SampleAlgoParams (org.opensearch.ml.common.parameter.SampleAlgoParams)4 Test (org.junit.Test)3 Before (org.junit.Before)1 BytesStreamOutput (org.opensearch.common.io.stream.BytesStreamOutput)1 MLAlgoParams (org.opensearch.ml.common.parameter.MLAlgoParams)1