From 7e58483ead8841f54a12df4ba3ac98a5861c48e8 Mon Sep 17 00:00:00 2001 From: Phillip Webb Date: Tue, 7 Jul 2015 18:07:37 -0700 Subject: [PATCH 1/3] Add serialization endpoint tests Test basic serialization in Endpoint tests to ensure that JSON can always be produced. --- .../actuate/endpoint/AbstractEndpointTests.java | 15 +++++++++++++-- .../AutoConfigurationReportEndpointTests.java | 4 ++++ 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/AbstractEndpointTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/AbstractEndpointTests.java index 88fa22fc12..1ba977e514 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/AbstractEndpointTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/AbstractEndpointTests.java @@ -23,11 +23,14 @@ import java.util.Map; import org.junit.After; import org.junit.Before; import org.junit.Test; +import org.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration; import org.springframework.boot.test.EnvironmentTestUtils; import org.springframework.context.annotation.AnnotationConfigApplicationContext; import org.springframework.core.env.MapPropertySource; import org.springframework.core.env.PropertySource; +import com.fasterxml.jackson.databind.ObjectMapper; + import static org.hamcrest.Matchers.equalTo; import static org.junit.Assert.assertThat; @@ -41,7 +44,7 @@ public abstract class AbstractEndpointTests> { protected AnnotationConfigApplicationContext context; - private final Class configClass; + protected final Class configClass; private final Class type; @@ -63,7 +66,7 @@ public abstract class AbstractEndpointTests> { @Before public void setup() { this.context = new AnnotationConfigApplicationContext(); - this.context.register(this.configClass); + this.context.register(JacksonAutoConfiguration.class, this.configClass); this.context.refresh(); } @@ -160,6 +163,14 @@ public abstract class AbstractEndpointTests> { assertThat(getEndpointBean().isEnabled(), equalTo(true)); } + @Test + public void serialize() throws Exception { + Object result = getEndpointBean().invoke(); + if (result != null) { + this.context.getBean(ObjectMapper.class).writeValue(System.out, result); + } + } + @SuppressWarnings("unchecked") protected T getEndpointBean() { return (T) this.context.getBean(this.type); diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/AutoConfigurationReportEndpointTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/AutoConfigurationReportEndpointTests.java index af159457e4..d2152b376d 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/AutoConfigurationReportEndpointTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/AutoConfigurationReportEndpointTests.java @@ -27,6 +27,7 @@ import org.springframework.boot.autoconfigure.condition.ConditionEvaluationRepor import org.springframework.boot.autoconfigure.condition.ConditionOutcome; import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.context.ConfigurableApplicationContext; +import org.springframework.context.annotation.AnnotationConfigApplicationContext; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Condition; import org.springframework.context.annotation.Configuration; @@ -51,6 +52,9 @@ public class AutoConfigurationReportEndpointTests extends @Test public void invoke() throws Exception { + this.context = new AnnotationConfigApplicationContext(); + this.context.register(this.configClass); + this.context.refresh(); Report report = getEndpointBean().invoke(); assertTrue(report.getPositiveMatches().isEmpty()); assertTrue(report.getNegativeMatches().containsKey("a")); From 3995c16ba60bbeb1933c2233ffcab368655fb3c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edd=C3=BA=20Mel=C3=A9ndez?= Date: Mon, 6 Jul 2015 18:39:20 -0500 Subject: [PATCH 2/3] Add 'flyway' and 'liquibase' actuator endpoints Add `/flyway` and `/liquibase` actuator endpoints to provide details of any database migrations that have been applied. Fixes gh-3434 Closes gh-3435 --- spring-boot-actuator/pom.xml | 10 ++ .../EndpointAutoConfiguration.java | 36 ++++++ .../boot/actuate/endpoint/FlywayEndpoint.java | 121 ++++++++++++++++++ .../actuate/endpoint/LiquibaseEndpoint.java | 65 ++++++++++ .../EndpointAutoConfigurationTests.java | 29 ++++- .../actuate/endpoint/FlywayEndpointTests.java | 61 +++++++++ .../endpoint/LiquibaseEndpointTests.java | 63 +++++++++ .../db/changelog/db.changelog-master.yaml | 20 +++ .../test/resources/db/migration/V1__init.sql | 0 9 files changed, 404 insertions(+), 1 deletion(-) create mode 100644 spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/FlywayEndpoint.java create mode 100644 spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/LiquibaseEndpoint.java create mode 100644 spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/FlywayEndpointTests.java create mode 100644 spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/LiquibaseEndpointTests.java create mode 100644 spring-boot-actuator/src/test/resources/db/changelog/db.changelog-master.yaml create mode 100644 spring-boot-actuator/src/test/resources/db/migration/V1__init.sql diff --git a/spring-boot-actuator/pom.xml b/spring-boot-actuator/pom.xml index 10b7554350..d7441c9489 100644 --- a/spring-boot-actuator/pom.xml +++ b/spring-boot-actuator/pom.xml @@ -112,6 +112,11 @@ activemq-broker true + + org.flywaydb + flyway-core + true + org.hibernate hibernate-validator @@ -122,6 +127,11 @@ infinispan-spring4 true + + org.liquibase + liquibase-core + true + org.springframework spring-messaging diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/EndpointAutoConfiguration.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/EndpointAutoConfiguration.java index 308462d400..591aaf5dd2 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/EndpointAutoConfiguration.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/EndpointAutoConfiguration.java @@ -25,6 +25,9 @@ import java.util.List; import java.util.Map; import java.util.Properties; +import liquibase.integration.spring.SpringLiquibase; + +import org.flywaydb.core.Flyway; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.actuate.endpoint.AutoConfigurationReportEndpoint; @@ -33,8 +36,10 @@ import org.springframework.boot.actuate.endpoint.ConfigurationPropertiesReportEn import org.springframework.boot.actuate.endpoint.DumpEndpoint; import org.springframework.boot.actuate.endpoint.Endpoint; import org.springframework.boot.actuate.endpoint.EnvironmentEndpoint; +import org.springframework.boot.actuate.endpoint.FlywayEndpoint; import org.springframework.boot.actuate.endpoint.HealthEndpoint; import org.springframework.boot.actuate.endpoint.InfoEndpoint; +import org.springframework.boot.actuate.endpoint.LiquibaseEndpoint; import org.springframework.boot.actuate.endpoint.MetricsEndpoint; import org.springframework.boot.actuate.endpoint.PublicMetrics; import org.springframework.boot.actuate.endpoint.RequestMappingEndpoint; @@ -45,12 +50,15 @@ import org.springframework.boot.actuate.health.HealthIndicator; import org.springframework.boot.actuate.health.OrderedHealthAggregator; import org.springframework.boot.actuate.trace.InMemoryTraceRepository; import org.springframework.boot.actuate.trace.TraceRepository; +import org.springframework.boot.autoconfigure.AutoConfigureAfter; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.boot.autoconfigure.condition.ConditionEvaluationReport; import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; import org.springframework.boot.autoconfigure.condition.SearchStrategy; +import org.springframework.boot.autoconfigure.flyway.FlywayAutoConfiguration; +import org.springframework.boot.autoconfigure.liquibase.LiquibaseAutoConfiguration; import org.springframework.boot.bind.PropertiesConfigurationFactory; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @@ -70,8 +78,10 @@ import org.springframework.web.servlet.handler.AbstractHandlerMethodMapping; * @author Greg Turnquist * @author Christian Dupuis * @author Stephane Nicoll + * @author Eddú Meléndez */ @Configuration +@AutoConfigureAfter({ FlywayAutoConfiguration.class, LiquibaseAutoConfiguration.class }) public class EndpointAutoConfiguration { @Autowired @@ -161,6 +171,32 @@ public class EndpointAutoConfiguration { return new ConfigurationPropertiesReportEndpoint(); } + @Configuration + @ConditionalOnBean(Flyway.class) + @ConditionalOnClass(Flyway.class) + static class FlywayEndpointConfiguration { + + @Bean + @ConditionalOnMissingBean + public FlywayEndpoint flywayEndpoint(Flyway flyway) { + return new FlywayEndpoint(flyway); + } + + } + + @Configuration + @ConditionalOnBean(SpringLiquibase.class) + @ConditionalOnClass(SpringLiquibase.class) + static class LiquibaseEndpointConfiguration { + + @Bean + @ConditionalOnMissingBean + public LiquibaseEndpoint liquibaseEndpoint(SpringLiquibase liquibase) { + return new LiquibaseEndpoint(liquibase); + } + + } + @Configuration @ConditionalOnClass(AbstractHandlerMethodMapping.class) protected static class RequestMappingEndpointConfiguration { diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/FlywayEndpoint.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/FlywayEndpoint.java new file mode 100644 index 0000000000..c18b3534bc --- /dev/null +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/FlywayEndpoint.java @@ -0,0 +1,121 @@ +/* + * Copyright 2012-2015 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.springframework.boot.actuate.endpoint; + +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +import org.flywaydb.core.Flyway; +import org.flywaydb.core.api.MigrationInfo; +import org.flywaydb.core.api.MigrationState; +import org.flywaydb.core.api.MigrationType; +import org.springframework.boot.actuate.endpoint.FlywayEndpoint.FlywayMigration; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.util.Assert; + +/** + * {@link Endpoint} to expose flyway info. + * + * @author Eddú Meléndez + * @author Phillip Webb + * @since 1.3.0 + */ +@ConfigurationProperties(prefix = "endpoints.flyway", ignoreUnknownFields = true) +public class FlywayEndpoint extends AbstractEndpoint> { + + private final Flyway flyway; + + public FlywayEndpoint(Flyway flyway) { + super("flyway"); + Assert.notNull(flyway, "Flyway must not be null"); + this.flyway = flyway; + } + + @Override + public List invoke() { + List migrations = new ArrayList(); + for (MigrationInfo info : this.flyway.info().all()) { + migrations.add(new FlywayMigration(info)); + } + return migrations; + } + + public static class FlywayMigration { + + private MigrationType type; + + private Integer checksum; + + private String version; + + private String description; + + private String script; + + private MigrationState state; + + private Date installedOn; + + private Integer executionTime; + + public FlywayMigration(MigrationInfo info) { + this.type = info.getType(); + this.checksum = info.getChecksum(); + this.version = info.getVersion().toString(); + this.description = info.getDescription(); + this.script = info.getScript(); + this.state = info.getState(); + this.installedOn = info.getInstalledOn(); + this.executionTime = info.getExecutionTime(); + } + + public MigrationType getType() { + return this.type; + } + + public Integer getChecksum() { + return this.checksum; + } + + public String getVersion() { + return this.version; + } + + public String getDescription() { + return this.description; + } + + public String getScript() { + return this.script; + } + + public MigrationState getState() { + return this.state; + } + + public Date getInstalledOn() { + return this.installedOn; + } + + public Integer getExecutionTime() { + return this.executionTime; + } + + } + +} diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/LiquibaseEndpoint.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/LiquibaseEndpoint.java new file mode 100644 index 0000000000..d96a99973a --- /dev/null +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/LiquibaseEndpoint.java @@ -0,0 +1,65 @@ +/* + * Copyright 2012-2015 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.springframework.boot.actuate.endpoint; + +import java.util.List; +import java.util.Map; + +import javax.sql.DataSource; + +import liquibase.changelog.StandardChangeLogHistoryService; +import liquibase.database.Database; +import liquibase.database.DatabaseFactory; +import liquibase.database.jvm.JdbcConnection; +import liquibase.integration.spring.SpringLiquibase; + +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.util.Assert; + +/** + * {@link Endpoint} to expose liquibase info. + * + * @author Eddú Meléndez + * @since 1.3.0 + */ +@ConfigurationProperties(prefix = "endpoints.liquibase", ignoreUnknownFields = true) +public class LiquibaseEndpoint extends AbstractEndpoint>> { + + private final SpringLiquibase liquibase; + + public LiquibaseEndpoint(SpringLiquibase liquibase) { + super("liquibase"); + Assert.notNull(liquibase, "Liquibase must not be null"); + this.liquibase = liquibase; + } + + @Override + public List> invoke() { + StandardChangeLogHistoryService service = new StandardChangeLogHistoryService(); + try { + DatabaseFactory factory = DatabaseFactory.getInstance(); + DataSource dataSource = this.liquibase.getDataSource(); + JdbcConnection connection = new JdbcConnection(dataSource.getConnection()); + Database database = factory.findCorrectDatabaseImplementation(connection); + return service.queryDatabaseChangeLogTable(database); + } + catch (Exception ex) { + throw new IllegalStateException("Unable to get Liquibase changelog", ex); + } + } + +} diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/EndpointAutoConfigurationTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/EndpointAutoConfigurationTests.java index bc127565e0..8d55c718a4 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/EndpointAutoConfigurationTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/EndpointAutoConfigurationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2014 the original author or authors. + * Copyright 2012-2015 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. @@ -26,8 +26,10 @@ import org.springframework.boot.actuate.endpoint.AutoConfigurationReportEndpoint import org.springframework.boot.actuate.endpoint.BeansEndpoint; import org.springframework.boot.actuate.endpoint.DumpEndpoint; import org.springframework.boot.actuate.endpoint.EnvironmentEndpoint; +import org.springframework.boot.actuate.endpoint.FlywayEndpoint; import org.springframework.boot.actuate.endpoint.HealthEndpoint; import org.springframework.boot.actuate.endpoint.InfoEndpoint; +import org.springframework.boot.actuate.endpoint.LiquibaseEndpoint; import org.springframework.boot.actuate.endpoint.MetricsEndpoint; import org.springframework.boot.actuate.endpoint.PublicMetrics; import org.springframework.boot.actuate.endpoint.RequestMappingEndpoint; @@ -36,7 +38,9 @@ import org.springframework.boot.actuate.endpoint.TraceEndpoint; import org.springframework.boot.actuate.health.Health; import org.springframework.boot.actuate.metrics.Metric; import org.springframework.boot.autoconfigure.condition.ConditionEvaluationReport; +import org.springframework.boot.autoconfigure.flyway.FlywayAutoConfiguration; import org.springframework.boot.autoconfigure.jdbc.EmbeddedDataSourceConfiguration; +import org.springframework.boot.autoconfigure.liquibase.LiquibaseAutoConfiguration; import org.springframework.boot.test.EnvironmentTestUtils; import org.springframework.context.annotation.AnnotationConfigApplicationContext; import org.springframework.context.annotation.Bean; @@ -55,6 +59,7 @@ import static org.junit.Assert.assertTrue; * @author Greg Turnquist * @author Christian Dupuis * @author Stephane Nicoll + * @author Eddú Meléndez */ public class EndpointAutoConfigurationTests { @@ -156,6 +161,28 @@ public class EndpointAutoConfigurationTests { assertNull(endpoint.invoke().get("git")); } + @Test + public void testFlywayEndpoint() { + this.context = new AnnotationConfigApplicationContext(); + this.context.register(EmbeddedDataSourceConfiguration.class, + FlywayAutoConfiguration.class, EndpointAutoConfiguration.class); + this.context.refresh(); + FlywayEndpoint endpoint = this.context.getBean(FlywayEndpoint.class); + assertNotNull(endpoint); + assertEquals(1, endpoint.invoke().size()); + } + + @Test + public void testLiquibaseEndpoint() { + this.context = new AnnotationConfigApplicationContext(); + this.context.register(EmbeddedDataSourceConfiguration.class, + LiquibaseAutoConfiguration.class, EndpointAutoConfiguration.class); + this.context.refresh(); + LiquibaseEndpoint endpoint = this.context.getBean(LiquibaseEndpoint.class); + assertNotNull(endpoint); + assertEquals(1, endpoint.invoke().size()); + } + private void load(Class... config) { this.context = new AnnotationConfigApplicationContext(); this.context.register(config); diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/FlywayEndpointTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/FlywayEndpointTests.java new file mode 100644 index 0000000000..63816378f8 --- /dev/null +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/FlywayEndpointTests.java @@ -0,0 +1,61 @@ +/* + * Copyright 2012-2015 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.springframework.boot.actuate.endpoint; + +import org.flywaydb.core.Flyway; +import org.junit.Test; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.autoconfigure.flyway.FlywayAutoConfiguration; +import org.springframework.boot.autoconfigure.jdbc.EmbeddedDataSourceConfiguration; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.Import; + +import static org.hamcrest.Matchers.is; +import static org.junit.Assert.assertThat; + +/** + * Tests for {@link FlywayEndpoint}. + * + * @author Eddú Meléndez + */ +public class FlywayEndpointTests extends AbstractEndpointTests { + + public FlywayEndpointTests() { + super(Config.class, FlywayEndpoint.class, "flyway", true, "endpoints.flyway"); + } + + @Test + public void invoke() throws Exception { + assertThat(getEndpointBean().invoke().size(), is(1)); + } + + @Configuration + @Import({ EmbeddedDataSourceConfiguration.class, FlywayAutoConfiguration.class }) + public static class Config { + + @Autowired + private Flyway flyway; + + @Bean + public FlywayEndpoint endpoint() { + return new FlywayEndpoint(this.flyway); + } + + } + +} diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/LiquibaseEndpointTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/LiquibaseEndpointTests.java new file mode 100644 index 0000000000..875b9f0ec2 --- /dev/null +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/LiquibaseEndpointTests.java @@ -0,0 +1,63 @@ +/* + * Copyright 2012-2015 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.springframework.boot.actuate.endpoint; + +import liquibase.integration.spring.SpringLiquibase; + +import org.junit.Test; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.autoconfigure.jdbc.EmbeddedDataSourceConfiguration; +import org.springframework.boot.autoconfigure.liquibase.LiquibaseAutoConfiguration; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.Import; + +import static org.hamcrest.Matchers.is; +import static org.junit.Assert.assertThat; + +/** + * Tests for {@link LiquibaseEndpoint}. + * + * @author Eddú Meléndez + */ +public class LiquibaseEndpointTests extends AbstractEndpointTests { + + public LiquibaseEndpointTests() { + super(Config.class, LiquibaseEndpoint.class, "liquibase", true, + "endpoints.liquibase"); + } + + @Test + public void invoke() throws Exception { + assertThat(getEndpointBean().invoke().size(), is(1)); + } + + @Configuration + @Import({ EmbeddedDataSourceConfiguration.class, LiquibaseAutoConfiguration.class }) + public static class Config { + + @Autowired + private SpringLiquibase liquibase; + + @Bean + public LiquibaseEndpoint endpoint() { + return new LiquibaseEndpoint(this.liquibase); + } + + } + +} diff --git a/spring-boot-actuator/src/test/resources/db/changelog/db.changelog-master.yaml b/spring-boot-actuator/src/test/resources/db/changelog/db.changelog-master.yaml new file mode 100644 index 0000000000..134b17b543 --- /dev/null +++ b/spring-boot-actuator/src/test/resources/db/changelog/db.changelog-master.yaml @@ -0,0 +1,20 @@ +databaseChangeLog: + - changeSet: + id: 1 + author: marceloverdijk + changes: + - createTable: + tableName: customer + columns: + - column: + name: id + type: int + autoIncrement: true + constraints: + primaryKey: true + nullable: false + - column: + name: name + type: varchar(50) + constraints: + nullable: false diff --git a/spring-boot-actuator/src/test/resources/db/migration/V1__init.sql b/spring-boot-actuator/src/test/resources/db/migration/V1__init.sql new file mode 100644 index 0000000000..e69de29bb2 From a087dbc9c36d0f4afd56788329e0bb7b76fee84f Mon Sep 17 00:00:00 2001 From: Phillip Webb Date: Tue, 7 Jul 2015 18:44:36 -0700 Subject: [PATCH 3/3] Add flyway and liquibase endpoint documentation See gh-3434 --- .../src/main/asciidoc/production-ready-features.adoc | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/spring-boot-docs/src/main/asciidoc/production-ready-features.adoc b/spring-boot-docs/src/main/asciidoc/production-ready-features.adoc index 7673950d4e..4440f863dc 100644 --- a/spring-boot-docs/src/main/asciidoc/production-ready-features.adoc +++ b/spring-boot-docs/src/main/asciidoc/production-ready-features.adoc @@ -85,6 +85,10 @@ The following endpoints are available: |Exposes properties from Spring's `ConfigurableEnvironment`. |true +|`flyway` +|Shows any Flyway database migrations that have been applied. +|true + |`health` |Shows application health information (when the application is secure, a simple '`status`' when accessed over an unauthenticated connection or full message details when authenticated). @@ -94,6 +98,10 @@ unauthenticated connection or full message details when authenticated). |Displays arbitrary application info. |false +|`liquibase` +|Shows any Liquibase database migrations that have been applied. +|true + |`logfile` |Returns the contents of the logfile (if `logging.file` or `logging.path` properties have been set). Only available via MVC.