Class PromptQueryTestExecutionHelper

  • All Implemented Interfaces:
    Serializable

    public final class PromptQueryTestExecutionHelper
    extends Object
    implements Serializable
    Helper class with logic for executing prompt queries on the prompt configuration UI, allowing users to test their query beforehand.
    Since:
    8.5.0
    See Also:
    Serialized Form
    • Method Detail

      • createOrUpdateTestViewModel

        public static <ConnectionConfig,​QueryConfig> PromptQueryTestViewModel createOrUpdateTestViewModel​(PromptQueryBeanEnvironment environment,
                                                                                                                PromptQueryTestViewModel testModel,
                                                                                                                PromptQuerySelectionModel<ConnectionConfig,​QueryConfig> selectionModel)
        Creates or updates the view model for testing a prompt query. Re-reads the input descriptor of the selected prompt query from the given selection model, and recreates the UI controls for the JSON configuration and file inputs. When the given test model is not null, reuses that model's data where possible (e.g. uploaded files, JSON parameter values).
        Type Parameters:
        ConnectionConfig - The type of the connection configuration.
        QueryConfig - The type of the query configuration.
        Parameters:
        environment - Environmental data of the prompt query UI context.
        testModel - The existing test model, or null to create a new one.
        selectionModel - The selection model containing the selected prompt query.
        Returns:
        The created or updated test view model.
      • newInputTestFileListHandler

        public static IFileListHandler<PromptTestFile> newInputTestFileListHandler​(PromptQueryBeanEnvironment environment)
        Creates a new file list handler for the uploaded input test files needed for the execution of a prompt query, to be used with the <xi:fileList handler="..."/> component.
        Parameters:
        environment - Environmental data of the prompt query UI context.
        Returns:
        The new file list handler.
      • newOutputTestFileListHandler

        public static IFileListHandler<IPromptBinaryData> newOutputTestFileListHandler()
        Creates a new file list handler for the output test files produces during the execution of a prompt query, to be used with the <xi:fileList handler="..."/> component.
        Returns:
        The new file list handler.
      • testExecuteQuery

        public static <ConnectionConfig,​QueryConfig> void testExecuteQuery​(PromptQueryBeanEnvironment environment,
                                                                                 PromptQueryTestViewModel testModel,
                                                                                 PromptQuerySelectionModel<ConnectionConfig,​QueryConfig> selectionModel)
                                                                          throws InvalidInputParamsException
        Performs a test execution for the prompt query from the given selection model, using the JSON data and files from the given test model. Updates the test model with the result of the test execution.
        Type Parameters:
        ConnectionConfig - The type of the connection configuration.
        QueryConfig - The type of the query configuration.
        Parameters:
        environment - Environmental data of the prompt query UI context.
        testModel - The test model containing the input parameters for the test execution.
        selectionModel - The selection model containing the selected prompt query.
        Throws:
        InvalidInputParamsException