Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
S
spring-boot
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
DEMO
spring-boot
Commits
edee342d
Commit
edee342d
authored
Jul 28, 2017
by
Stephane Nicoll
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch '1.5.x'
parents
c3bc449e
3bc9718c
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
3 deletions
+23
-3
LiquibaseEndpoint.java
...ingframework/boot/actuate/endpoint/LiquibaseEndpoint.java
+5
-0
LiquibaseEndpointTests.java
...amework/boot/actuate/endpoint/LiquibaseEndpointTests.java
+17
-3
create-custom-schema.sql
...t-actuator/src/test/resources/db/create-custom-schema.sql
+1
-0
No files found.
spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/LiquibaseEndpoint.java
View file @
edee342d
...
...
@@ -32,6 +32,7 @@ import liquibase.integration.spring.SpringLiquibase;
import
org.springframework.boot.actuate.endpoint.LiquibaseEndpoint.LiquibaseReport
;
import
org.springframework.boot.context.properties.ConfigurationProperties
;
import
org.springframework.util.Assert
;
import
org.springframework.util.StringUtils
;
/**
* {@link Endpoint} to expose liquibase info.
...
...
@@ -67,6 +68,10 @@ public class LiquibaseEndpoint extends AbstractEndpoint<List<LiquibaseReport>> {
try
{
Database
database
=
factory
.
findCorrectDatabaseImplementation
(
connection
);
String
defaultSchema
=
entry
.
getValue
().
getDefaultSchema
();
if
(
StringUtils
.
hasText
(
defaultSchema
))
{
database
.
setDefaultSchemaName
(
defaultSchema
);
}
reports
.
add
(
new
LiquibaseReport
(
entry
.
getKey
(),
service
.
queryDatabaseChangeLogTable
(
database
)));
}
...
...
spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/LiquibaseEndpointTests.java
View file @
edee342d
/*
* Copyright 2012-201
6
the original author or authors.
* Copyright 2012-201
7
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.
...
...
@@ -19,8 +19,10 @@ package org.springframework.boot.actuate.endpoint;
import
liquibase.integration.spring.SpringLiquibase
;
import
org.junit.Test
;
import
org.springframework.boot.autoconfigure.jdbc.
EmbeddedDataSource
Configuration
;
import
org.springframework.boot.autoconfigure.jdbc.
DataSourceAuto
Configuration
;
import
org.springframework.boot.autoconfigure.liquibase.LiquibaseAutoConfiguration
;
import
org.springframework.boot.test.util.TestPropertyValues
;
import
org.springframework.context.annotation.AnnotationConfigApplicationContext
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.context.annotation.Import
;
...
...
@@ -44,8 +46,20 @@ public class LiquibaseEndpointTests extends AbstractEndpointTests<LiquibaseEndpo
assertThat
(
getEndpointBean
().
invoke
()).
hasSize
(
1
);
}
@Test
public
void
invokeWithCustomSchema
()
throws
Exception
{
this
.
context
=
new
AnnotationConfigApplicationContext
();
TestPropertyValues
.
of
(
"liquibase.default-schema=CUSTOMSCHEMA"
,
"spring.datasource.generate-unique-name=true"
,
"spring.datasource.schema=classpath:/db/create-custom-schema.sql"
)
.
applyTo
(
this
.
context
);
this
.
context
.
register
(
Config
.
class
);
this
.
context
.
refresh
();
assertThat
(
getEndpointBean
().
invoke
()).
hasSize
(
1
);
}
@Configuration
@Import
({
EmbeddedDataSource
Configuration
.
class
,
LiquibaseAutoConfiguration
.
class
})
@Import
({
DataSourceAuto
Configuration
.
class
,
LiquibaseAutoConfiguration
.
class
})
public
static
class
Config
{
private
final
SpringLiquibase
liquibase
;
...
...
spring-boot-actuator/src/test/resources/db/create-custom-schema.sql
0 → 100644
View file @
edee342d
CREATE
SCHEMA
CUSTOMSCHEMA
;
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment