|
20 | 20 | import org.opensearch.flowframework.exception.FlowFrameworkException;
|
21 | 21 | import org.opensearch.flowframework.exception.WorkflowStepException;
|
22 | 22 | import org.opensearch.flowframework.indices.FlowFrameworkIndicesHandler;
|
| 23 | +import org.opensearch.flowframework.util.ApiSpecFetcher; |
23 | 24 | import org.opensearch.ml.client.MachineLearningNodeClient;
|
24 | 25 | import org.opensearch.ml.common.MLTask;
|
25 | 26 | import org.opensearch.ml.common.MLTaskState;
|
26 | 27 | import org.opensearch.ml.common.transport.register.MLRegisterModelInput;
|
27 | 28 | import org.opensearch.ml.common.transport.register.MLRegisterModelResponse;
|
| 29 | +import org.opensearch.rest.RestRequest; |
28 | 30 | import org.opensearch.test.OpenSearchTestCase;
|
29 | 31 | import org.opensearch.threadpool.ScalingExecutorBuilder;
|
30 | 32 | import org.opensearch.threadpool.TestThreadPool;
|
|
33 | 35 |
|
34 | 36 | import java.io.IOException;
|
35 | 37 | import java.util.Collections;
|
| 38 | +import java.util.List; |
36 | 39 | import java.util.Map;
|
37 | 40 | import java.util.concurrent.ExecutionException;
|
38 | 41 | import java.util.concurrent.TimeUnit;
|
|
42 | 45 |
|
43 | 46 | import static org.opensearch.flowframework.common.CommonValue.DEPLOY_FIELD;
|
44 | 47 | import static org.opensearch.flowframework.common.CommonValue.FLOW_FRAMEWORK_THREAD_POOL_PREFIX;
|
| 48 | +import static org.opensearch.flowframework.common.CommonValue.ML_COMMONS_API_SPEC_YAML_URI; |
45 | 49 | import static org.opensearch.flowframework.common.CommonValue.PROVISION_WORKFLOW_THREAD_POOL;
|
46 | 50 | import static org.opensearch.flowframework.common.CommonValue.REGISTER_MODEL_STATUS;
|
47 | 51 | import static org.opensearch.flowframework.common.CommonValue.WORKFLOW_THREAD_POOL;
|
@@ -310,4 +314,17 @@ public void testBoolParseFail() throws IOException, ExecutionException, Interrup
|
310 | 314 | assertEquals("Failed to parse value [no] as only [true] or [false] are allowed.", w.getMessage());
|
311 | 315 | assertEquals(RestStatus.BAD_REQUEST, w.getRestStatus());
|
312 | 316 | }
|
| 317 | + |
| 318 | + public void testApiSpecRegisterLocalSparseEncodingModelInputParamComparison() throws Exception { |
| 319 | + List<String> requiredEnumParams = WorkflowStepFactory.WorkflowSteps.REGISTER_LOCAL_SPARSE_ENCODING_MODEL.inputs(); |
| 320 | + |
| 321 | + boolean isMatch = ApiSpecFetcher.compareRequiredFields( |
| 322 | + requiredEnumParams, |
| 323 | + ML_COMMONS_API_SPEC_YAML_URI, |
| 324 | + "/_plugins/_ml/models/_register", |
| 325 | + RestRequest.Method.POST |
| 326 | + ); |
| 327 | + |
| 328 | + assertTrue(isMatch); |
| 329 | + } |
313 | 330 | }
|
0 commit comments