Class TestingRunner

  • All Implemented Interfaces:

    public class TestingRunner
    extends Object
    implements Runner
    A massively inefficient but very simple implementation of the datamodel, for testing purposes.
    Antonin Delpeuch
    • Constructor Detail

      • TestingRunner

        public TestingRunner()
      • TestingRunner

        public TestingRunner​(RunnerConfiguration configuration)
        Constructor provided to match the expected signature of runners.
    • Method Detail

      • ensureSerializable

        protected static void ensureSerializable​(Object obj)
        Asserts that an object is serializable using Java serialization.
        obj -
      • serializeAndDeserialize

        protected static <T> T serializeAndDeserialize​(T obj)
        Serializes an object and then deserializes it back. This ensures that the object is serializable and is useful to simulate distributed environments (for instance to null out all transient fields).
        Type Parameters:
        T -
        obj -
      • loadGrid

        public Grid loadGrid​(File path)
                      throws IOException
        Description copied from interface: Runner
        Loads a Grid serialized at a given location.
        Specified by:
        loadGrid in interface Runner
        path - the directory where the Grid is stored
        the grid
        IOException - when loading the grid failed, or when the grid's serialization was incomplete (lacking a _SUCCESS marker)
      • gridFromIterable

        public Grid gridFromIterable​(ColumnModel columnModel,
                                     CloseableIterable<Row> rows,
                                     Map<String,​OverlayModel> overlayModels,
                                     long rowCount,
                                     long recordCount)
        Description copied from interface: Runner
        Creates a Grid from an iterable collection of rows. By default, this just gathers the iterable in a list and delegates to Runner.gridFromList(ColumnModel, List, Map), but implementations may implement a different approach which delays the loading of the collection in memory.
        Specified by:
        gridFromIterable in interface Runner
        rowCount - if the number of rows is known, supply it in this parameter as it might improve efficiency. Otherwise, set to -1.
        recordCount - if the number of records is known, supply it in this parameter as it might improve efficiency. Otherwise, set to -1.
      • emptyChangeData

        public <T> ChangeData<T> emptyChangeData()
        Description copied from interface: Runner
        Creates an empty change data object of a given type, marked as incomplete.
        Specified by:
        emptyChangeData in interface Runner
      • loadTextFile

        public Grid loadTextFile​(String path,
                                 MultiFileReadingProgress progress,
                                 Charset encoding,
                                 long limit)
                          throws IOException
        Description copied from interface: Runner
        Loads a text file as a Grid with a single column named "Column" and whose contents are the lines in the file, parsed as strings.
        Specified by:
        loadTextFile in interface Runner
        path - the path to the text file to load
        encoding - TODO
        limit - the maximum number of lines to read
      • supportsProgressReporting

        public boolean supportsProgressReporting()
        Description copied from interface: Runner
        Indicates whether this implementation supports progress reporting. If not, progress objects will be left untouched when passed to methods in this interface.
        Specified by:
        supportsProgressReporting in interface Runner