Class PepperTestUtil


  • public class PepperTestUtil
    extends Object
    This class offers some static fields and methods for testing PepperModule objects.
    Author:
    florian
    • Field Detail

      • TMP_TEST_DIR

        public static String TMP_TEST_DIR
        Name of the directory where tests for Pepper and Pepper modules can be stored.
    • Constructor Detail

      • PepperTestUtil

        public PepperTestUtil()
    • Method Detail

      • getTempPath_static

        public static File getTempPath_static​(String testDirectory)
        Returns a File object pointing to a temporary path, where the caller can store temporary files. The temporary path is located in the temporary directory provided by the underlying os. The resulting directory is located in TEMP_PATH_BY_OS// testDirectory.
        Parameters:
        testDirectory - last part of the temporary path
        Returns:
        a file object locating to a temporary folder, where files can be stored temporarily
      • getSrcResources

        public static String getSrcResources()
        Returns a default test folder, where to find resources for tests. When using the default maven structure, this folder is located at 'src/test/resources/'.
        Returns:
        a folder where to find test resources
      • getTestResources

        public static String getTestResources()
        Returns a default test folder, where to find resources for tests. When using the default maven structure, this folder is located at 'src/test/resources/'.
        Returns:
        a folder where to find test resources
      • createDefaultPepper

        public static Pepper createDefaultPepper()
      • start

        public static void start​(Collection<? extends PepperModule> fixtures)
        This methods starts the processing of Pepper in the development environment for a set of Pepper modules. This enables the test of multiple modules at once, for instance the import and export of data to check no data is lost. In case of the fixture is PepperImporter, first the method PepperImporter.importCorpusStructure(SCorpusGraph) is called. For all kinds of fixture, the method PepperModule.start(org.corpus_tools.salt.graph.Identifier) is called for each SDocument object contained in the variable PepperModule.getSaltProject(). This method will wait, until each ModuleControllerImpl return having finished the process.
        To create a test using this method do the following:
        • Create CorpusDefinition and add it to this object and set its FormatDefinition and corpus path
        • Create a SCorpusGraph object as the one to be filled and add it with
           getFixture().getSaltProject().getCorpusGraphs().add(importedCorpusGraph);
           getFixture().importCorpusStructure(importedCorpusGraph);
           
        Parameters:
        fixtures - the fixture modules