play.test
Class Fixtures

java.lang.Object
  extended by play.test.Fixtures

public class Fixtures
extends java.lang.Object


Field Summary
static java.util.Map<java.lang.String,java.lang.Object> idCache
           
 
Constructor Summary
Fixtures()
           
 
Method Summary
static void delete(java.lang.Class<? extends Model>... types)
          Delete all Model instances for the given types using the underlying persistence mechanisms
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
static void deleteAll()
          Deprecated. use deleteDatabase() instead
static void deleteAllModels()
          Delete all Model instances for the all available types using the underlying persistence mechanisms
static void deleteDatabase()
          Flush the entire JDBC database
static void deleteDirectory(java.lang.String path)
          Delete a directory recursively
static void executeSQL(java.io.File sqlScript)
           
static void executeSQL(java.lang.String sqlScript)
           
static void load(java.util.List<java.lang.String> names)
          Deprecated. use loadModels(String...) instead
static void load(java.lang.String... names)
          Deprecated. use loadModels(String...) instead
static void load(java.lang.String name)
          Deprecated. use loadModels(String...) instead
static void loadModels(java.util.List<java.lang.String> names)
           
static void loadModels(java.lang.String... names)
           
static void loadModels(java.lang.String name)
          Load Model instances from a YAML file 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

idCache

public static java.util.Map<java.lang.String,java.lang.Object> idCache
Constructor Detail

Fixtures

public Fixtures()
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:
types - 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. use deleteDatabase() instead

Use deleteDatabase() instead


deleteDatabase

public static void deleteDatabase()
Flush the entire JDBC database


load

@Deprecated
public static void load(java.lang.String name)
Deprecated. use loadModels(String...) instead

Parameters:
name -

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/)

load

@Deprecated
public static void load(java.lang.String... names)
Deprecated. use loadModels(String...) instead


loadModels

public static void loadModels(java.lang.String... names)
See Also:
loadModels(String name)

load

public static void load(java.util.List<java.lang.String> names)
Deprecated. use loadModels(String...) instead


loadModels

public static void loadModels(java.util.List<java.lang.String> names)
See Also:
loadModels(String name)

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/)

Parameters:
name - Name of a YAML file somewhere in the classpath (or conf/)me
clazz - 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


Guillaume Bort & zenexity - Distributed under Apache 2 licence, without any warrantly