Annotation Interface PrepareDatabase


@Target({METHOD,TYPE}) @Retention(RUNTIME) @Documented public @interface PrepareDatabase
Annotation used by the DatabaseExtension to define the setup and teardown SQL scripts. This annotation may be applied at the class level, providing default behavior for all tests, and/or it may be provided at the test method level to add or override configuration data.
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    boolean
    Defines whether the setup and teardown scripts will be added to or overrides of any defined at the class level.
    Defines the method (by name) on the test instance (static or non-static) which will be executed to create the DataSource instance used by the extension.
    Defines the method (by name) on the test instance (static or non-static) which will be executed to destroy the DataSource instance used by the extension.
    A list of setup SQL scripts which will be run in order to setup the database.
    A list of tear-down SQL scripts which will be run in order to tear down the database.
  • Element Details

    • creator

      String creator
      Defines the method (by name) on the test instance (static or non-static) which will be executed to create the DataSource instance used by the extension. The method must return a DataSource instance.
      Returns:
      the DataSource create method.
      Default:
      ""
    • setup

      String[] setup
      A list of setup SQL scripts which will be run in order to setup the database.
      Returns:
      the list of scripts
      Default:
      {""}
    • teardown

      String[] teardown
      A list of tear-down SQL scripts which will be run in order to tear down the database.
      Returns:
      the list of scripts
      Default:
      {""}
    • additive

      boolean additive
      Defines whether the setup and teardown scripts will be added to or overrides of any defined at the class level.
      Returns:
      whether the scripts are additive or overriding
      Default:
      true
    • destroyer

      String destroyer
      Defines the method (by name) on the test instance (static or non-static) which will be executed to destroy the DataSource instance used by the extension. The method must accept a DataSource parameter.
      Returns:
      the name of the method used to destroy the DataSource
      Default:
      ""