All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.flywaydb.test.annotation.FlywayTest Maven / Gradle / Ivy

/**
 * Copyright (C) 2011-2016 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *         http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.flywaydb.test.annotation;

import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;


/**
 * Support for executing flyway commands during test without any special flyway command in test code.

* * The default behavior is to execute the flyway commands: *
    *
  • {@link org.flywaydb.core.Flyway#clean()}
  • *
  • {@link org.flywaydb.core.Flyway#init()}
  • *
  • {@link org.flywaydb.core.Flyway#migrate()}
  • *
* * For usage together with JUnit see {@link org.flywaydb.test.junit.FlywayTestExecutionListener}.

* * @author Florian * @version 2011-12-10 * @version 1.7 */ @Retention(RetentionPolicy.RUNTIME) public @interface FlywayTest { /** * invoke flyway command clean before a init/migrate call.

* If set to true it will invoke {@link org.flywaydb.core.Flyway#clean()}. * * Default: true */ public boolean invokeCleanDB() default true; /** * invoke flyway command init before a migrate call

* * Init will create the schema_version table with a initialization entry * depending on {@link org.flywaydb.core.Flyway} configuration property * {@link org.flywaydb.core.Flyway#baselineVersion}. * * Note: if this is set to true than it will invoke * {@link org.flywaydb.core.Flyway#baseline()}. * * Default: false */ @Deprecated public boolean invokeInitDB() default false; /** * invoke flyway command baseline before a migrate call

* * Baseline will create the schema_version table with a initialization entry * depending on {@link org.flywaydb.core.Flyway} configuration property * {@link org.flywaydb.core.Flyway#baselineVersion}. * It will invoke {@link org.flywaydb.core.Flyway#baseline()}. * * Default: false */ public boolean invokeBaselineDB() default false; /** * invoke flyway command migrate

* If set to true it will invoke {@link org.flywaydb.core.Flyway#migrate()}. * * Default: true */ public boolean invokeMigrateDB() default true; /** * Support to add locations to the default location settings.

* * if {link #overrideLocations()} returns true the complete locations will * be changed.

* * Default: empty list

*/ public String[] locationsForMigrate() default {}; /** * With this attribute the handling of the locationsForMigrate can be changed.

* * Default: false */ public boolean overrideLocations() default false; /** * Reference the flyway bean name.

* * If no name are specified the first Flyway instance {@link org.flywaydb.core.Flyway} of the * application context are used.

* * If the name of the {@link org.flywaydb.core.Flyway} instance are not part of the application * context, the test will fail with {@link org.springframework.beans.factory.NoSuchBeanDefinitionException}.

* * Default: empty string

*/ public String flywayName() default ""; }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy