Class RefineTest

  • Direct Known Subclasses:
    ImporterTest

    public class RefineTest
    extends Object
    A base class containing various utilities to help testing Refine.
    • Field Detail

      • logger

        protected org.slf4j.Logger logger
      • workspaceDir

        protected File workspaceDir
    • Constructor Detail

      • RefineTest

        public RefineTest()
    • Method Detail

      • createDatamodelRunner

        protected Runner createDatamodelRunner()
        Method that subclasses can override to change the runner used in the test.
      • runner

        protected Runner runner()
        Method to access the runner easily from tests.
      • init

        @BeforeSuite
        public void init()
      • initProjectManager

        @BeforeMethod
        protected void initProjectManager()
      • createProject

        protected Project createProject​(String[] columns,
                                        Serializable[][] rows)
        Helper to create a project with given contents. Not much control is given on the import options, because this method is intended to be a quick way to create a project for a test. For more control over the import, just call the importer directly.
        Parameters:
        columns - the list of column names
        rows - the cell values, as a flattened array of arrays
        Returns:
      • createProject

        protected Project createProject​(String projectName,
                                        String[] columns,
                                        Serializable[][] rows)
        Helper to create a project with given contents. Not much control is given on the import options, because this method is intended to be a quick way to create a project for a test. For more control over the import, just call the importer directly. The projects created via this method will be disposed of at the end of each test.
        Parameters:
        projectName - the name of the project to create
        columns - the list of column names
        rows - the cell values, as a flattened array of arrays
        Returns:
      • createProject

        protected Project createProject​(String projectName,
                                        Grid grid)
      • toRows

        protected List<Row> toRows​(Cell[][] cells)
      • assertGridEquals

        protected void assertGridEquals​(Grid actual,
                                        Grid expected)
      • prepareImportOptions

        public static void prepareImportOptions​(com.fasterxml.jackson.databind.node.ObjectNode options,
                                                String sep,
                                                int limit,
                                                int skip,
                                                int ignoreLines,
                                                int headerLines,
                                                boolean guessValueType,
                                                boolean ignoreQuotes)
        Initializes the importing options for the CSV importer.
        Parameters:
        options -
        sep -
        limit -
        skip -
        ignoreLines -
        headerLines -
        guessValueType -
        ignoreQuotes -
      • cleanupProjectsAndJobs

        @AfterMethod
        protected void cleanupProjectsAndJobs()
        Cleans up the projects and jobs created with createCSVProject
      • assertProjectCreated

        public static void assertProjectCreated​(Project project,
                                                int numCols,
                                                int numRows)
        Check that a project was created with the appropriate number of columns and rows.
        Parameters:
        project - project to check
        numCols - expected column count
        numRows - expected row count
      • parseEvalType

        protected void parseEvalType​(Properties bindings,
                                     String test,
                                     Class clazz)
                              throws ParsingException
        Parse and evaluate a GREL expression and compare the result an expected type using instanceof
        Parameters:
        bindings -
        test -
        Throws:
        ParsingException