Package play.test
Class Fixtures
- java.lang.Object
-
- play.test.Fixtures
-
public class Fixtures extends java.lang.Object
-
-
Field Summary
Fields Modifier and Type Field Description static java.util.Map<java.lang.String,java.lang.Object>
idCache
static java.lang.String
PROFILE_NAME
Name of the profile use when loading fixture Allow to define the behavior when loading fixtures
-
Constructor Summary
Constructors Constructor Description Fixtures()
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static void
delete(java.lang.Class<? extends Model>... types)
Delete all Model instances for the given types using the underlying persistence mechanismsstatic void
delete(java.util.List<java.lang.Class<? extends Model>> classes)
Delete all Model instances for the given types using the underlying persistence mechanismsstatic void
deleteAll()
Deprecated.usedeleteDatabase()
insteadstatic void
deleteAllModels()
Delete all Model instances for the all available types using the underlying persistence mechanismsstatic void
deleteDatabase()
Flush the entire JDBC databasestatic void
deleteDirectory(java.lang.String path)
Delete a directory recursivelystatic void
executeSQL(java.io.File sqlScript)
static void
executeSQL(java.lang.String sqlScript)
static void
load(java.lang.String name)
Deprecated.useloadModels(String...)
insteadstatic void
load(java.lang.String... names)
Deprecated.useloadModels(String...)
insteadstatic void
load(java.util.List<java.lang.String> names)
Deprecated.useloadModels(String...)
insteadstatic void
loadModels(boolean loadAsTemplate, java.lang.String name)
Load Model instances from a YAML file and persist them using the underlying persistence mechanism.static void
loadModels(boolean loadAsTemplate, java.lang.String... names)
Load Model instances from multiple YAML files (compile first as a template) and persist them using the underlying persistence mechanism.static void
loadModels(boolean loadAsTemplate, java.util.List<java.lang.String> names)
Load Model instances from multiple YAML files (compile first as a template) and persist them using the underlying persistence mechanism.static void
loadModels(java.lang.String name)
Load Model instances from a YAML file and persist them using the underlying persistence mechanism.static void
loadModels(java.lang.String... names)
Load Model instances from multiple YAML files and persist them using the underlying persistence mechanism.static void
loadModels(java.util.List<java.lang.String> names)
Load Model instances from multiple YAML files (compile first as a template) and persist them using the underlying persistence mechanism.static java.lang.Object
loadYaml(java.lang.String name)
Load and parse a plain YAML file and returns the corresponding Java objects.static <T> T
loadYaml(java.lang.String name, java.lang.Class<T> clazz)
Load and parse a plain YAML file and returns the corresponding Java Map.static <T> T
loadYaml(java.lang.String name, org.yaml.snakeyaml.Yaml yaml)
static java.util.List<?>
loadYamlAsList(java.lang.String name)
Load and parse a plain YAML file and returns the corresponding Java List.static java.util.Map<?,?>
loadYamlAsMap(java.lang.String name)
Load and parse a plain YAML file and returns the corresponding Java Map.
-
-
-
Field Detail
-
PROFILE_NAME
public static final java.lang.String PROFILE_NAME
Name of the profile use when loading fixture Allow to define the behavior when loading fixtures- See Also:
- Constant Field Values
-
idCache
public static java.util.Map<java.lang.String,java.lang.Object> idCache
-
-
Method Detail
-
executeSQL
public static void executeSQL(java.lang.String sqlScript)
-
executeSQL
public static void executeSQL(java.io.File sqlScript)
-
delete
public static void delete(java.lang.Class<? extends Model>... types)
Delete all Model instances for the given types using the underlying persistence mechanisms- Parameters:
types
- Types to delete
-
delete
public static void delete(java.util.List<java.lang.Class<? extends Model>> classes)
Delete all Model instances for the given types using the underlying persistence mechanisms- Parameters:
classes
- Types to delete
-
deleteAllModels
public static void deleteAllModels()
Delete all Model instances for the all available types using the underlying persistence mechanisms
-
deleteAll
@Deprecated public static void deleteAll()
Deprecated.usedeleteDatabase()
insteadUse deleteDatabase() instead
-
deleteDatabase
public static void deleteDatabase()
Flush the entire JDBC database
-
load
@Deprecated public static void load(java.lang.String name)
Deprecated.useloadModels(String...)
insteadLoad Model instances from a YAML file and persist them using the underlying persistence mechanism. The format of the YAML file is constrained, see the Fixtures manual page- Parameters:
name
- Name of a YAML file somewhere in the classpath (or conf/)
-
loadModels
public static void loadModels(java.lang.String name)
Load Model instances from a YAML file and persist them using the underlying persistence mechanism. The format of the YAML file is constrained, see the Fixtures manual page- Parameters:
name
- Name of a YAML file somewhere in the classpath (or conf/)
-
loadModels
public static void loadModels(boolean loadAsTemplate, java.lang.String name)
Load Model instances from a YAML file and persist them using the underlying persistence mechanism. The format of the YAML file is constrained, see the Fixtures manual page- Parameters:
name
- Name of a YAML file somewhere in the classpath (or conf/)loadAsTemplate
- indicate if the file must interpreted as a Template
-
load
@Deprecated public static void load(java.lang.String... names)
Deprecated.useloadModels(String...)
insteadLoad Model instances from multiple YAML files and persist them using the underlying persistence mechanism. The format of the YAML file is constrained, see the Fixtures manual page- Parameters:
names
- Name of a YAML files somewhere in the classpath (or conf/)
-
loadModels
public static void loadModels(java.lang.String... names)
Load Model instances from multiple YAML files and persist them using the underlying persistence mechanism. The format of the YAML file is constrained, see the Fixtures manual page- Parameters:
names
- Name of a YAML files somewhere in the classpath (or conf/)- See Also:
loadModels(String name)
-
loadModels
public static void loadModels(boolean loadAsTemplate, java.lang.String... names)
Load Model instances from multiple YAML files (compile first as a template) and persist them using the underlying persistence mechanism. The format of the YAML file is constrained, see the Fixtures manual page- Parameters:
loadAsTemplate
- Indicate if the YAML file should be compile first as a templatenames
- Name of a YAML files somewhere in the classpath (or conf/)- See Also:
loadModels(boolean loadAsTemplate, String name)
-
load
@Deprecated public static void load(java.util.List<java.lang.String> names)
Deprecated.useloadModels(String...)
instead/** Load Model instances from multiple YAML files (compile first as a template) and persist them using the underlying persistence mechanism. The format of the YAML file is constrained, see the Fixtures manual page- Parameters:
names
- Name of a YAML files somewhere in the classpath (or conf/)
-
loadModels
public static void loadModels(java.util.List<java.lang.String> names)
Load Model instances from multiple YAML files (compile first as a template) and persist them using the underlying persistence mechanism. The format of the YAML file is constrained, see the Fixtures manual page- Parameters:
names
- Name of a YAML files somewhere in the classpath (or conf/)- See Also:
loadModels(String name)
-
loadModels
public static void loadModels(boolean loadAsTemplate, java.util.List<java.lang.String> names)
Load Model instances from multiple YAML files (compile first as a template) and persist them using the underlying persistence mechanism. The format of the YAML file is constrained, see the Fixtures manual page- Parameters:
loadAsTemplate
- Indicate if the YAML file should be compile first as a templatenames
- Name of a YAML files somewhere in the classpath (or conf/)- See Also:
loadModels(boolean, String...)
-
loadYaml
public static java.lang.Object loadYaml(java.lang.String name)
Load and parse a plain YAML file and returns the corresponding Java objects. The YAML parser used is SnakeYAML (http://code.google.com/p/snakeyaml/)- Parameters:
name
- Name of a YAML file somewhere in the classpath (or conf/)me- Returns:
- Java objects
-
loadYamlAsList
public static java.util.List<?> loadYamlAsList(java.lang.String name)
Load and parse a plain YAML file and returns the corresponding Java List. The YAML parser used is SnakeYAML (http://code.google.com/p/snakeyaml/)- Parameters:
name
- Name of a YAML file somewhere in the classpath (or conf/)me- Returns:
- Java List representing the YAML data
-
loadYamlAsMap
public static java.util.Map<?,?> loadYamlAsMap(java.lang.String name)
Load and parse a plain YAML file and returns the corresponding Java Map. The YAML parser used is SnakeYAML (http://code.google.com/p/snakeyaml/)- Parameters:
name
- Name of a YAML file somewhere in the classpath (or conf/)me- Returns:
- Java Map representing the YAML data
-
loadYaml
public static <T> T loadYaml(java.lang.String name, java.lang.Class<T> clazz)
Load and parse a plain YAML file and returns the corresponding Java Map. The YAML parser used is SnakeYAML (http://code.google.com/p/snakeyaml/)- Type Parameters:
T
- The entity load- Parameters:
name
- Name of a YAML file somewhere in the classpath (or conf/)meclazz
- the expected class- Returns:
- Object representing the YAML data
-
loadYaml
public static <T> T loadYaml(java.lang.String name, org.yaml.snakeyaml.Yaml yaml)
-
deleteDirectory
public static void deleteDirectory(java.lang.String path)
Delete a directory recursively- Parameters:
path
- relative path of the directory to delete
-
-