Pepper  3.6.0
A highly extensible plattform for conversion and manipulationoflinguisticdata.
org.corpus_tools.pepper.testFramework.PepperTestUtil Class Reference

This class offers some static fields and methods for testing PepperModule objects. More...

Static Public Member Functions

static File getTempPath_static (String testDirectory)
 Returns a File object pointing to a temporary path, where the caller can store temporary files. More...
 
static String getSrcResources ()
 Returns a default test folder, where to find resources for tests. More...
 
static String getTestResources ()
 Returns a default test folder, where to find resources for tests. More...
 
static Pepper createDefaultPepper ()
 
static void start (final Collection<? extends PepperModule > fixtures)
 This methods starts the processing of Pepper in the development environment for a set of Pepper modules. More...
 
static< T extends PepperModule > void runPepperForTest (T... fixtures)
 
static PepperJob prepareFixturesAndCreateJob (final Pepper pepper, final Collection<? extends PepperModule > fixtures)
 
static void start (final Pepper pepper, final Collection<? extends PepperModule > fixtures)
 

Static Public Attributes

static String TMP_TEST_DIR = "pepper-test"
 Name of the directory where tests for Pepper and Pepper modules can be stored.
 

Detailed Description

This class offers some static fields and methods for testing PepperModule objects.

Author
florian

Member Function Documentation

◆ getSrcResources()

static String org.corpus_tools.pepper.testFramework.PepperTestUtil.getSrcResources ( )
static

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

◆ getTempPath_static()

static File org.corpus_tools.pepper.testFramework.PepperTestUtil.getTempPath_static ( String  testDirectory)
static

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

◆ getTestResources()

static String org.corpus_tools.pepper.testFramework.PepperTestUtil.getTestResources ( )
static

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

◆ prepareFixturesAndCreateJob()

static PepperJob org.corpus_tools.pepper.testFramework.PepperTestUtil.prepareFixturesAndCreateJob ( final Pepper  pepper,
final Collection<? extends PepperModule fixtures 
)
static

set the salt project for all modules, if it is already set, check that it is equal in all modules. Extract all importers, manipulators and exporters

Create and add alibi steps

◆ runPepperForTest()

static <T extends PepperModule> void org.corpus_tools.pepper.testFramework.PepperTestUtil.runPepperForTest ( T...  fixtures)
static
See also
#start(Collection)

◆ start() [1/2]

static void org.corpus_tools.pepper.testFramework.PepperTestUtil.start ( final Collection<? extends PepperModule fixtures)
static

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
fixturesthe fixture modules

◆ start() [2/2]

static void org.corpus_tools.pepper.testFramework.PepperTestUtil.start ( final Pepper  pepper,
final Collection<? extends PepperModule fixtures 
)
static
See also
#start(Collection)
Parameters
peppera pepper instance to be used