Class PepperModuleTestHelper

    • Field Detail

      • logger

        protected static final org.slf4j.Logger logger
      • resourceURI

        protected org.eclipse.emf.common.util.URI resourceURI
      • TMP_TEST_DIR

        public static String TMP_TEST_DIR
        {@inheritDoc PepperTestUtil#TMP_TEST_DIR}
    • Constructor Detail

      • PepperModuleTestHelper

        public PepperModuleTestHelper()
        Creates an object of type PepperModuleTest. To initialize it, the overridable method initialize() is called.
    • Method Detail

      • setFixture

        protected void setFixture​(PepperModule fixture)
        Sets the current fixture to test.
        Parameters:
        fixture - object to test, derived from PepperModule
      • getFixture

        protected PepperModule getFixture()
        Returns the current fixture to test.
        Returns:
        object to test, derived from PepperModule
      • initialize

        public void initialize()
        Initializes this object. This means:
      • getTempURI

        public org.eclipse.emf.common.util.URI getTempURI​(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
      • getTempPath

        public File getTempPath​(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
      • getTempPath_static

        public static File getTempPath_static​(String testDirectory)
        {@inheritDoc PepperTestUtil#getTempPath_static(String)}
      • getTestResources

        public static String getTestResources()
        {@inheritDoc PepperTestUtil#getTestResources()}
      • getSrcResources

        public static String getSrcResources()
        {@inheritDoc PepperTestUtil#getSrcResources()}
      • start

        public void start()
        This methods starts the processing of Pepper in the development environment. 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);
           
      • setResourcesURI

        public void setResourcesURI​(org.eclipse.emf.common.util.URI resourceURI)
        Sets the path to resources folder for module.
        Parameters:
        resourceURI - URI with path
      • compareFiles

        public boolean compareFiles​(org.eclipse.emf.common.util.URI uri1,
                                    org.eclipse.emf.common.util.URI uri2)
                             throws IOException
        Compares the content of two files. Iff they are exactly the same, than true will be returned. False otherwise.
        Parameters:
        uri1 - first file to compare
        uri2 - second file to compare
        Returns:
        true, iff files are exactly the same
        Throws:
        IOException
      • compareFiles

        public boolean compareFiles​(File file1,
                                    File file2)
                             throws IOException
        Compares the content of two files. Iff they are exactly the same, than true will be returned. False otherwise.
        Parameters:
        file1 - first file to compare
        file2 - second file to compare
        Returns:
        true, iff files are exactly the same
        Throws:
        IOException
        IOException