DataSourceMode.java
package net.morimekta.testing.junit5.sql;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* Selects the SQL compatibility mode for the H2 in-memory database created by
* {@link DataSourceExtension}. Only applies when no external database is configured
* via {@link DataSourceURIMethod}. Default is {@link Mode#POSTGRESQL}.
*/
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.METHOD, ElementType.TYPE})
public @interface DataSourceMode {
/**
* @return The SQL compatibility mode.
*/
Mode value();
/**
* SQL compatibility modes supported by the H2 database engine.
*/
enum Mode {
/**
* Use MySQL query syntax and nits.
*/
MYSQL("MySQL;DATABASE_TO_LOWER=TRUE"),
/**
* Use MariaDB query syntax and nits.
*/
MARIADB("MariaDB;DATABASE_TO_LOWER=TRUE"),
/**
* Use PostgreSQL query syntax and nits.
*/
POSTGRESQL("PostgreSQL;DATABASE_TO_LOWER=TRUE;DEFAULT_NULL_ORDERING=HIGH"),
;
final String mode;
Mode(String mode) {
this.mode = mode;
}
}
}