ch.inftec.ju.testing.db.DataSetConfig Maven / Gradle / Ivy
Show all versions of ju-testing Show documentation
package ch.inftec.ju.testing.db;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* Annotation to configure DataSet exporting and importing.
*
* This mainly includes the configuration of paths and prefixes to locate datasets.
*
* The DataSetConfig is inherited by class extension and can be overridden on a method. Only the most relevant config will be used, starting
* from method going up to class and super classes.
*
* If no DataSetConfig is specified, no comparison to resources on the file system will be performed, even if the
* ju-testing.export.compareToResource
is false.
*
* @author Martin
*
*/
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.TYPE, ElementType.METHOD})
public @interface DataSetConfig {
/**
* Target directory to copy resources to.
*
* Defaults to src/main/resources
*
* Note that the resourcePrefix will be added to this directory in order to perform dataSet exports, e.g. for prefix dataSetExport, the
* file will be saved to src/main/resources/dataSetExport/exportName
*
* If resourceDir is empty, we will never try to load the resource from the file system.
*
* @return Resource directory to export to and import from
*/
String resourceDir() default "src/main/resources";
/**
* Prefix of the resources on the classpath, used to perform resource lookup when compareToResource is true.
*
* Defaults to dataSetExport
*
* This prefix will also be added to the resourceDir when performing physical exports.
*
* Note that the prefix will NOT be automatically added to the name of the DataSet import, so we still need to supply
* it there, e.g. dataSetExport/myExport.xml
*
* @return resource prefix
*/
String resourcePrefix() default "dataSetExport";
/**
* Specifies if we should try to load the resource for a DataSet import from the file
* system provided the property ju-testing.export.compareToResource
is set to false.
* This allows us to use the exports of tests directly as imports for dependent test cases.
*
* Defaults to false, i.e. import resources are always loaded from the classpath exclusively.
*
* @return True if we support loading resources from the file system, false if we only load from classpath.
*/
boolean loadImportResourcesFromFileSystem() default false;
}