Pepper  3.6.0
A highly extensible plattform for conversion and manipulationoflinguisticdata.
org.corpus_tools.pepper.testFramework.helpers.PepperModuleTestHelper Class Referenceabstract

Inherited by org.corpus_tools.pepper.testFramework.helpers.PepperModuleTest.

Public Member Functions

 PepperModuleTestHelper ()
 Creates an object of type PepperModuleTest. More...
 
void initialize ()
 Initializes this object. More...
 
URI getTempURI (String testDirectory)
 Returns a File object pointing to a temporary path, where the caller can store temporary files. More...
 
File getTempPath (String testDirectory)
 Returns a File object pointing to a temporary path, where the caller can store temporary files. More...
 
void start ()
 This methods starts the processing of Pepper in the development environment. More...
 
void setResourcesURI (URI resourceURI)
 Sets the path to resources folder for module. More...
 
boolean compareFiles (URI uri1, URI uri2) throws IOException
 Compares the content of two files. More...
 
boolean compareFiles (File file1, File file2) throws IOException
 Compares the content of two files. More...
 

Static Public Member Functions

static File getTempPath_static (String testDirectory)
 {@inheritDoc PepperTestUtil::getTempPath_static(String)}
 
static String getTestResources ()
 {@inheritDoc PepperTestUtil::getTestResources()}
 
static String getSrcResources ()
 {@inheritDoc PepperTestUtil::getSrcResources()}
 

Static Public Attributes

static String TMP_TEST_DIR = PepperTestUtil.TMP_TEST_DIR
 {@inheritDoc PepperTestUtil::TMP_TEST_DIR}
 

Protected Member Functions

void setFixture (PepperModule fixture)
 Sets the current fixture to test. More...
 
PepperModule getFixture ()
 Returns the current fixture to test. More...
 

Protected Attributes

URI resourceURI = null
 
PepperModule fixture = null
 

Static Protected Attributes

static final Logger logger = LoggerFactory.getLogger("Pepper")
 

Constructor & Destructor Documentation

◆ PepperModuleTestHelper()

org.corpus_tools.pepper.testFramework.helpers.PepperModuleTestHelper.PepperModuleTestHelper ( )

Creates an object of type PepperModuleTest.

To initialize it, the overridable method initialize() is called.

Member Function Documentation

◆ compareFiles() [1/2]

boolean org.corpus_tools.pepper.testFramework.helpers.PepperModuleTestHelper.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
file1first file to compare
file2second file to compare
Returns
true, iff files are exactly the same
Exceptions
IOException
IOException

◆ compareFiles() [2/2]

boolean org.corpus_tools.pepper.testFramework.helpers.PepperModuleTestHelper.compareFiles ( URI  uri1,
URI  uri2 
) throws IOException

Compares the content of two files.

Iff they are exactly the same, than true will be returned. False otherwise.

Parameters
uri1first file to compare
uri2second file to compare
Returns
true, iff files are exactly the same
Exceptions
IOException

◆ getFixture()

PepperModule org.corpus_tools.pepper.testFramework.helpers.PepperModuleTestHelper.getFixture ( )
protected

Returns the current fixture to test.

Returns
object to test, derived from PepperModule

Reimplemented in org.corpus_tools.pepper.testFramework.PepperImporterTest, and org.corpus_tools.pepper.testFramework.PepperExporterTest.

◆ getTempPath()

File org.corpus_tools.pepper.testFramework.helpers.PepperModuleTestHelper.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/{@value TMP_TEST_DIR}/ testDirectory.

Parameters
testDirectorylast part of the temporary path
Returns
a file object locating to a temporary folder, where files can be stored temporarily

◆ getTempURI()

URI org.corpus_tools.pepper.testFramework.helpers.PepperModuleTestHelper.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/{@value TMP_TEST_DIR}/ testDirectory.

Parameters
testDirectorylast part of the temporary path
Returns
a file object locating to a temporary folder, where files can be stored temporarily

◆ initialize()

void org.corpus_tools.pepper.testFramework.helpers.PepperModuleTestHelper.initialize ( )

Initializes this object.

This means:

◆ setFixture()

void org.corpus_tools.pepper.testFramework.helpers.PepperModuleTestHelper.setFixture ( PepperModule  fixture)
protected

Sets the current fixture to test.

Parameters
fixtureobject to test, derived from PepperModule

Reimplemented in org.corpus_tools.pepper.testFramework.helpers.PepperImExporterTest.

◆ setResourcesURI()

void org.corpus_tools.pepper.testFramework.helpers.PepperModuleTestHelper.setResourcesURI ( URI  resourceURI)

Sets the path to resources folder for module.

Parameters
resourceURIURI with path

◆ start()

void org.corpus_tools.pepper.testFramework.helpers.PepperModuleTestHelper.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: