Skip to content

Commit

Permalink
Adding javadocs
Browse files Browse the repository at this point in the history
Signed-off-by: Joshua Palis <[email protected]>
  • Loading branch information
joshpalis committed Mar 26, 2024
1 parent fb1fd0e commit ccda5a7
Show file tree
Hide file tree
Showing 8 changed files with 40 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ public class RestOrchestrateAction extends BaseRestHandler {

private static final String ORCHESTRATE_ACTION = "orchestrate_action";

/*
* Creates a new RestOrchestrateAction
*/
public RestOrchestrateAction() {}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,21 @@ public class OrchestrateRequest extends ActionRequest {
*/
private Map<String, String> userInputs;

/**
* Creates a new orchestrate request
* @param workflowId the workflow ID
* @param userInputs the user inputs to substitute values for in the template
*/
public OrchestrateRequest(String workflowId, Map<String, String> userInputs) {
this.workflowId = workflowId;
this.userInputs = userInputs;
}

/**
* Creates a new orchestrate request from stream input
* @param in the stream input
* @throws IOException on error reading from the stream input
*/
public OrchestrateRequest(StreamInput in) throws IOException {
super(in);
this.workflowId = in.readString();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,16 @@ public class OrchestrateTransportAction extends HandledTransportAction<Orchestra
private final PluginsService pluginsService;
private final SearchPipelineService searchPipelineService;

/**
* Creates a new Orchestrate Transport Action instance
* @param transportService the transport service
* @param actionFilters action filters
* @param threadPool the thread pool
* @param client the opensearch client
* @param workflowProcessSorter the workflow process sorter
* @param pluginsService the plugins service
* @param searchPipelineService the search pipeline service
*/
@Inject
public OrchestrateTransportAction(
TransportService transportService,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ public class SearchResponseProcessorStep implements WorkflowStep {
private final SearchPipelineService searchPipelineService;
public static final String NAME = "search_response_processor";

/**
* Creates a new SearchResponseProcessorStep
* @param searchPipelineService the search pipeline service
*/
public SearchResponseProcessorStep(SearchPipelineService searchPipelineService) {
this.searchPipelineService = searchPipelineService;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,10 @@ public WorkflowProcessSorter(
this.client = client;
}

/**
* Updates the workflow step factory
* @param searchPipelineService the search pipeline service
*/
public void updateWorkflowStepFactory(SearchPipelineService searchPipelineService) {
this.workflowStepFactory.updateWorkflowStepFactory(searchPipelineService);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,10 @@ public WorkflowStepFactory(
stepMap.put(CreateSearchPipelineStep.NAME, () -> new CreateSearchPipelineStep(client, flowFrameworkIndicesHandler));
}

/**
* Updates the step map with search response processors
* @param searchPipelineService the search pipeline service
*/
public void updateWorkflowStepFactory(SearchPipelineService searchPipelineService) {
if (!this.stepMap.containsKey(SearchResponseProcessorStep.NAME)) {
this.stepMap.put(SearchResponseProcessorStep.NAME, () -> new SearchResponseProcessorStep(searchPipelineService));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@ public void testPlugin() throws IOException {
5,
ffp.createComponents(client, clusterService, threadPool, null, null, null, environment, null, null, null, null).size()
);
assertEquals(9, ffp.getRestHandlers(settings, null, null, null, null, null, null).size());
assertEquals(9, ffp.getActions().size());
assertEquals(10, ffp.getRestHandlers(settings, null, null, null, null, null, null).size());
assertEquals(10, ffp.getActions().size());
assertEquals(3, ffp.getExecutorBuilders(settings).size());
assertEquals(5, ffp.getSettings().size());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import org.opensearch.flowframework.workflow.WorkflowStepFactory;
import org.opensearch.flowframework.workflow.WorkflowStepFactory.WorkflowSteps;
import org.opensearch.ml.client.MachineLearningNodeClient;
import org.opensearch.search.pipeline.SearchPipelineService;
import org.opensearch.test.OpenSearchTestCase;
import org.opensearch.threadpool.ThreadPool;

Expand Down Expand Up @@ -46,7 +47,7 @@ public void testParseWorkflowValidator() throws IOException {

WorkflowValidator validator = new WorkflowValidator(workflowStepValidators);

assertEquals(17, validator.getWorkflowStepValidators().size());
assertEquals(18, validator.getWorkflowStepValidators().size());

assertTrue(validator.getWorkflowStepValidators().keySet().contains("create_connector"));
assertEquals(7, validator.getWorkflowStepValidators().get("create_connector").getInputs().size());
Expand Down Expand Up @@ -118,6 +119,7 @@ public void testWorkflowStepFactoryHasValidators() throws IOException {
flowFrameworkSettings,
client
);
workflowStepFactory.updateWorkflowStepFactory(mock(SearchPipelineService.class));

WorkflowValidator workflowValidator = workflowStepFactory.getWorkflowValidator();

Expand Down

0 comments on commit ccda5a7

Please sign in to comment.