|
|
@ -1,5 +1,5 @@
|
|
|
|
/*
|
|
|
|
/*
|
|
|
|
* Copyright 2012-2019 the original author or authors.
|
|
|
|
* Copyright 2012-2020 the original author or authors.
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
@ -33,6 +33,7 @@ import org.flywaydb.core.api.migration.JavaMigration;
|
|
|
|
import org.flywaydb.core.internal.license.FlywayProUpgradeRequiredException;
|
|
|
|
import org.flywaydb.core.internal.license.FlywayProUpgradeRequiredException;
|
|
|
|
import org.hibernate.engine.transaction.jta.platform.internal.NoJtaPlatform;
|
|
|
|
import org.hibernate.engine.transaction.jta.platform.internal.NoJtaPlatform;
|
|
|
|
import org.junit.jupiter.api.Test;
|
|
|
|
import org.junit.jupiter.api.Test;
|
|
|
|
|
|
|
|
import org.junit.jupiter.api.extension.ExtendWith;
|
|
|
|
import org.mockito.InOrder;
|
|
|
|
import org.mockito.InOrder;
|
|
|
|
|
|
|
|
|
|
|
|
import org.springframework.beans.factory.BeanCreationException;
|
|
|
|
import org.springframework.beans.factory.BeanCreationException;
|
|
|
@ -42,6 +43,8 @@ import org.springframework.boot.jdbc.DataSourceBuilder;
|
|
|
|
import org.springframework.boot.jdbc.SchemaManagement;
|
|
|
|
import org.springframework.boot.jdbc.SchemaManagement;
|
|
|
|
import org.springframework.boot.orm.jpa.EntityManagerFactoryBuilder;
|
|
|
|
import org.springframework.boot.orm.jpa.EntityManagerFactoryBuilder;
|
|
|
|
import org.springframework.boot.test.context.runner.ApplicationContextRunner;
|
|
|
|
import org.springframework.boot.test.context.runner.ApplicationContextRunner;
|
|
|
|
|
|
|
|
import org.springframework.boot.test.system.CapturedOutput;
|
|
|
|
|
|
|
|
import org.springframework.boot.test.system.OutputCaptureExtension;
|
|
|
|
import org.springframework.context.annotation.Bean;
|
|
|
|
import org.springframework.context.annotation.Bean;
|
|
|
|
import org.springframework.context.annotation.Configuration;
|
|
|
|
import org.springframework.context.annotation.Configuration;
|
|
|
|
import org.springframework.context.annotation.Primary;
|
|
|
|
import org.springframework.context.annotation.Primary;
|
|
|
@ -75,6 +78,7 @@ import static org.mockito.Mockito.mock;
|
|
|
|
* @author Dominic Gunn
|
|
|
|
* @author Dominic Gunn
|
|
|
|
* @author András Deák
|
|
|
|
* @author András Deák
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
|
|
|
|
@ExtendWith(OutputCaptureExtension.class)
|
|
|
|
class FlywayAutoConfigurationTests {
|
|
|
|
class FlywayAutoConfigurationTests {
|
|
|
|
|
|
|
|
|
|
|
|
private ApplicationContextRunner contextRunner = new ApplicationContextRunner()
|
|
|
|
private ApplicationContextRunner contextRunner = new ApplicationContextRunner()
|
|
|
@ -427,14 +431,10 @@ class FlywayAutoConfigurationTests {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
@Test
|
|
|
|
void licenseKeyIsCorrectlyMapped() {
|
|
|
|
void licenseKeyIsCorrectlyMapped(CapturedOutput output) {
|
|
|
|
this.contextRunner.withUserConfiguration(EmbeddedDataSourceConfiguration.class)
|
|
|
|
this.contextRunner.withUserConfiguration(EmbeddedDataSourceConfiguration.class)
|
|
|
|
.withPropertyValues("spring.flyway.license-key=<<secret>>").run((context) -> {
|
|
|
|
.withPropertyValues("spring.flyway.license-key=<<secret>>").run((context) -> assertThat(output)
|
|
|
|
assertThat(context).hasFailed();
|
|
|
|
.contains("<<secret>> is not supported by Flyway Community Edition"));
|
|
|
|
Throwable failure = context.getStartupFailure();
|
|
|
|
|
|
|
|
assertThat(failure).hasRootCauseInstanceOf(FlywayProUpgradeRequiredException.class);
|
|
|
|
|
|
|
|
assertThat(failure).hasMessageContaining(" licenseKey ");
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
@Test
|
|
|
|