Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
spring-boot-admin
Project
Overview
Details
Activity
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
openSource
spring-boot-admin
Commits
6cb1208c
Commit
6cb1208c
authored
Dec 09, 2017
by
Johannes Edmeier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add legacy trace conversion, update to current snapshot
parent
668d19c1
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
142 additions
and
55 deletions
+142
-55
eclipse-code-formatter.xml
eclipse-code-formatter.xml
+0
-0
pom.xml
...g-boot-admin-samples/spring-boot-admin-sample-war/pom.xml
+7
-4
SpringBootAdminApplication.java
...de/codecentric/boot/admin/SpringBootAdminApplication.java
+11
-0
application.yml
...-boot-admin-sample-war/src/main/resources/application.yml
+6
-10
pom.xml
spring-boot-admin-samples/spring-boot-admin-sample/pom.xml
+4
-0
application.yml
...ring-boot-admin-sample/src/main/resources/application.yml
+1
-5
pom.xml
spring-boot-admin-server/pom.xml
+9
-0
AdminServerProperties.java
...ntric/boot/admin/server/config/AdminServerProperties.java
+3
-3
Endpoint.java
...codecentric/boot/admin/server/domain/values/Endpoint.java
+1
-0
InstanceWebClient.java
...ntric/boot/admin/server/web/client/InstanceWebClient.java
+4
-1
LegacyEndpointConverters.java
...oot/admin/server/web/client/LegacyEndpointConverters.java
+21
-7
AbstractAdminApplicationTest.java
...ntric/boot/admin/server/AbstractAdminApplicationTest.java
+4
-4
AdminApplicationTest.java
...e/codecentric/boot/admin/server/AdminApplicationTest.java
+1
-1
InstanceWebClientTest.java
...c/boot/admin/server/web/client/InstanceWebClientTest.java
+3
-1
LegacyEndpointConvertersTest.java
...admin/server/web/client/LegacyEndpointConvertersTest.java
+16
-0
trace-expected.json
...ecentric/boot/admin/server/web/client/trace-expected.json
+17
-0
trace-legacy.json
...odecentric/boot/admin/server/web/client/trace-legacy.json
+15
-0
DefaultApplicationFactoryTest.java
...in/client/registration/DefaultApplicationFactoryTest.java
+13
-13
ServletApplicationFactoryTest.java
...in/client/registration/ServletApplicationFactoryTest.java
+6
-6
No files found.
eclipse-code-formatter.xml
deleted
100644 → 0
View file @
668d19c1
This diff is collapsed.
Click to expand it.
spring-boot-admin-samples/spring-boot-admin-sample-war/pom.xml
View file @
6cb1208c
...
...
@@ -13,8 +13,11 @@
<dependencies>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-tomcat
</artifactId>
<scope>
provided
</scope>
<artifactId>
spring-boot-starter-web
</artifactId>
</dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-security
</artifactId>
</dependency>
<dependency>
<groupId>
de.codecentric
</groupId>
...
...
@@ -24,10 +27,10 @@
<groupId>
de.codecentric
</groupId>
<artifactId>
spring-boot-admin-server
</artifactId>
</dependency>
<
!--
dependency>
<dependency>
<groupId>
de.codecentric
</groupId>
<artifactId>
spring-boot-admin-server-ui
</artifactId>
</dependency
--
>
</dependency>
</dependencies>
<build>
<finalName>
${project.artifactId}
</finalName>
...
...
spring-boot-admin-samples/spring-boot-admin-sample-war/src/main/java/de/codecentric/boot/admin/SpringBootAdminApplication.java
View file @
6cb1208c
...
...
@@ -7,12 +7,23 @@ import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import
org.springframework.boot.builder.SpringApplicationBuilder
;
import
org.springframework.boot.web.servlet.support.SpringBootServletInitializer
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.security.config.annotation.web.builders.HttpSecurity
;
import
org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter
;
@Configuration
@EnableAutoConfiguration
@EnableAdminServer
public
class
SpringBootAdminApplication
extends
SpringBootServletInitializer
{
@Configuration
public
static
class
SecurityConfig
extends
WebSecurityConfigurerAdapter
{
@Override
protected
void
configure
(
HttpSecurity
http
)
throws
Exception
{
http
.
authorizeRequests
().
anyRequest
().
permitAll
()
//
.
and
().
csrf
().
disable
();
}
}
@Override
protected
SpringApplicationBuilder
configure
(
SpringApplicationBuilder
application
)
{
return
application
;
...
...
spring-boot-admin-samples/spring-boot-admin-sample-war/src/main/resources/application.yml
View file @
6cb1208c
info
:
stage
:
test
spring
:
application
:
name
:
spring-boot-admin-sample-war
boot
:
admin
:
url
:
http://localhost:8080
cloud
:
config
:
enabled
:
false
client
:
url
:
http://localhost:8080
endpoints
:
health
:
sensitive
:
false
management
:
endpoints
:
web
:
expose
:
"
*"
spring-boot-admin-samples/spring-boot-admin-sample/pom.xml
View file @
6cb1208c
...
...
@@ -43,6 +43,10 @@
<artifactId>
spring-boot-starter-security
</artifactId>
</dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-webflux
</artifactId>
</dependency>
<dependency>
<groupId>
de.codecentric
</groupId>
<artifactId>
spring-boot-admin-starter-client
</artifactId>
</dependency>
...
...
spring-boot-admin-samples/spring-boot-admin-sample/src/main/resources/application.yml
View file @
6cb1208c
...
...
@@ -2,7 +2,6 @@
info
:
scm-url
:
"
@scm.url@"
build-url
:
"
http://travis-ci.org/@env.TRAVIS_REPO_SLUG@/builds/@env.TRAVIS_BUILD_ID@"
stage
:
test
logging
:
file
:
"
target/boot-admin-sample.log"
...
...
@@ -10,14 +9,11 @@ logging:
management
:
endpoints
:
web
:
base-path
:
"
/actuator"
expose
:
"
*"
jolokia
:
enabled
:
true
spring
:
application
:
name
:
"
@pom.artifactId@"
name
:
spring-boot-admin-sample
boot
:
admin
:
client
:
...
...
spring-boot-admin-server/pom.xml
View file @
6cb1208c
...
...
@@ -36,6 +36,15 @@
</dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-web
</artifactId>
<optional>
true
</optional>
</dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-thymeleaf
</artifactId>
</dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-actuator
</artifactId>
</dependency>
<dependency>
...
...
spring-boot-admin-server/src/main/java/de/codecentric/boot/admin/server/config/AdminServerProperties.java
View file @
6cb1208c
...
...
@@ -29,12 +29,12 @@ public class AdminServerProperties {
private
MonitorProperties
monitor
=
new
MonitorProperties
();
/**
* For Spring Boot 2.x applications the endpoints should be discovered automatically.
* For Spring Boot 2.x applications the endpoints should be discovered automatically
using the actuator links
.
* For Spring Boot 1.x applications SBA probes for the specified endpoints using an OPTIONS request.
* If the path differs from the id you can specify this as id:path (e.g. health:ping).
*/
private
String
[]
probedEndpoints
=
{
"health"
,
"env"
,
"metrics"
,
"trace"
,
"
dump"
,
"jolokia"
,
"info"
,
"logfile
"
,
"refresh"
,
"flyway"
,
"liquibase"
,
"heapdump"
,
"loggers"
,
"auditevents"
};
private
String
[]
probedEndpoints
=
{
"health"
,
"env"
,
"metrics"
,
"trace"
,
"
threaddump:dump"
,
"jolokia"
,
"info
"
,
"
logfile"
,
"
refresh"
,
"flyway"
,
"liquibase"
,
"heapdump"
,
"loggers"
,
"auditevents"
};
public
void
setContextPath
(
String
pathPrefix
)
{
if
(!
pathPrefix
.
startsWith
(
"/"
)
||
pathPrefix
.
endsWith
(
"/"
))
{
...
...
spring-boot-admin-server/src/main/java/de/codecentric/boot/admin/server/domain/values/Endpoint.java
View file @
6cb1208c
...
...
@@ -24,6 +24,7 @@ public class Endpoint implements Serializable {
public
static
final
String
INFO
=
"info"
;
public
static
final
String
HEALTH
=
"health"
;
public
static
final
String
ENV
=
"env"
;
public
static
final
String
TRACE
=
"trace"
;
private
final
String
id
;
private
final
String
url
;
...
...
spring-boot-admin-server/src/main/java/de/codecentric/boot/admin/server/web/client/InstanceWebClient.java
View file @
6cb1208c
...
...
@@ -22,6 +22,7 @@ import io.netty.handler.timeout.ReadTimeoutHandler;
import
reactor.core.publisher.Mono
;
import
java.util.concurrent.TimeUnit
;
import
org.springframework.boot.actuate.endpoint.http.ActuatorMediaType
;
import
org.springframework.http.HttpHeaders
;
import
org.springframework.http.MediaType
;
import
org.springframework.http.client.reactive.ReactorClientHttpConnector
;
...
...
@@ -44,6 +45,7 @@ public class InstanceWebClient {
filters
.
add
(
InstanceFilterFunctions
.
rewriteEndpointUrl
());
filters
.
add
(
InstanceFilterFunctions
.
convertLegacyEndpoint
(
LegacyEndpointConverters
.
health
()));
filters
.
add
(
InstanceFilterFunctions
.
convertLegacyEndpoint
(
LegacyEndpointConverters
.
env
()));
filters
.
add
(
InstanceFilterFunctions
.
convertLegacyEndpoint
(
LegacyEndpointConverters
.
trace
()));
}).
build
();
}
...
...
@@ -68,7 +70,8 @@ public class InstanceWebClient {
}));
return
WebClient
.
builder
()
.
clientConnector
(
connector
)
.
defaultHeader
(
HttpHeaders
.
ACCEPT
,
MediaType
.
APPLICATION_JSON_VALUE
)
.
defaultHeader
(
HttpHeaders
.
ACCEPT
,
ActuatorMediaType
.
V2_JSON
,
ActuatorMediaType
.
V1_JSON
,
MediaType
.
APPLICATION_JSON_VALUE
)
.
build
();
}
}
spring-boot-admin-server/src/main/java/de/codecentric/boot/admin/server/web/client/LegacyEndpointConverters.java
View file @
6cb1208c
...
...
@@ -35,25 +35,36 @@ import org.springframework.http.codec.json.Jackson2JsonEncoder;
import
static
java
.
util
.
Collections
.
singletonMap
;
public
class
LegacyEndpointConverters
{
private
static
final
ParameterizedTypeReference
<
Map
<
String
,
Object
>>
RESPONSE_TYPE
=
new
ParameterizedTypeReference
<
Map
<
String
,
Object
>>()
{
private
static
final
ParameterizedTypeReference
<
Map
<
String
,
Object
>>
RESPONSE_TYPE_MAP
=
new
ParameterizedTypeReference
<
Map
<
String
,
Object
>>()
{
};
private
static
final
ParameterizedTypeReference
<
List
<
Object
>>
RESPONSE_TYPE_LIST
=
new
ParameterizedTypeReference
<
List
<
Object
>>()
{
};
private
static
final
Jackson2JsonDecoder
DECODER
=
new
Jackson2JsonDecoder
();
private
static
final
Jackson2JsonEncoder
ENCODER
=
new
Jackson2JsonEncoder
();
public
static
LegacyEndpointConverter
health
()
{
return
new
LegacyEndpointConverter
(
Endpoint
.
HEALTH
,
convertMapUsing
(
LegacyEndpointConverters:
:
convertHealth
));
return
new
LegacyEndpointConverter
(
Endpoint
.
HEALTH
,
convertUsing
(
RESPONSE_TYPE_MAP
,
RESPONSE_TYPE_MAP
,
LegacyEndpointConverters:
:
convertHealth
));
}
public
static
LegacyEndpointConverter
env
()
{
return
new
LegacyEndpointConverter
(
Endpoint
.
ENV
,
convertMapUsing
(
LegacyEndpointConverters:
:
convertEnv
));
return
new
LegacyEndpointConverter
(
Endpoint
.
ENV
,
convertUsing
(
RESPONSE_TYPE_MAP
,
RESPONSE_TYPE_MAP
,
LegacyEndpointConverters:
:
convertEnv
));
}
public
static
LegacyEndpointConverter
trace
()
{
return
new
LegacyEndpointConverter
(
Endpoint
.
TRACE
,
convertUsing
(
RESPONSE_TYPE_LIST
,
RESPONSE_TYPE_MAP
,
LegacyEndpointConverters:
:
convertTrace
));
}
@SuppressWarnings
(
"unchecked"
)
private
static
Function
<
Flux
<
DataBuffer
>,
Flux
<
DataBuffer
>>
convertMapUsing
(
Function
<
Map
<
String
,
Object
>,
Map
<
String
,
Object
>>
converterFn
)
{
return
input
->
DECODER
.
decodeToMono
(
input
,
ResolvableType
.
forType
(
RESPONSE_TYPE
),
null
,
null
)
.
map
(
body
->
converterFn
.
apply
((
Map
<
String
,
Object
>)
body
))
private
static
<
S
,
T
>
Function
<
Flux
<
DataBuffer
>,
Flux
<
DataBuffer
>>
convertUsing
(
ParameterizedTypeReference
<
S
>
sourceType
,
ParameterizedTypeReference
<
T
>
targetType
,
Function
<
S
,
T
>
converterFn
)
{
return
input
->
DECODER
.
decodeToMono
(
input
,
ResolvableType
.
forType
(
sourceType
),
null
,
null
)
.
map
(
body
->
converterFn
.
apply
((
S
)
body
))
.
flatMapMany
(
output
->
ENCODER
.
encode
(
Mono
.
just
(
output
),
new
DefaultDataBufferFactory
(),
ResolvableType
.
forType
(
RESPONSE_TYPE
),
null
,
null
));
ResolvableType
.
forType
(
targetType
),
null
,
null
));
}
@SuppressWarnings
(
"unchecked"
)
...
...
@@ -104,4 +115,7 @@ public class LegacyEndpointConverters {
return
converted
;
}
private
static
Map
<
String
,
Object
>
convertTrace
(
List
<
Object
>
traces
)
{
return
singletonMap
(
"traces"
,
traces
);
}
}
spring-boot-admin-server/src/test/java/de/codecentric/boot/admin/server/AbstractAdminApplicationTest.java
View file @
6cb1208c
...
...
@@ -97,9 +97,9 @@ public abstract class AbstractAdminApplicationTest {
.
exchange
()
.
expectStatus
().
isOk
()
.
expectBody
()
.
jsonPath
(
"$.registration.name"
).
isEqualTo
(
"Test-Instance"
)
.
jsonPath
(
"$.statusInfo.status"
).
isEqualTo
(
"UP"
)
.
jsonPath
(
"$.info.test"
).
isEqualTo
(
"foobar"
);
.
jsonPath
(
"$.registration.name"
).
isEqualTo
(
"Test-Instance"
)
.
jsonPath
(
"$.statusInfo.status"
).
isEqualTo
(
"UP"
)
.
jsonPath
(
"$.info.test"
).
isEqualTo
(
"foobar"
);
//@formatter:on
}
...
...
@@ -132,7 +132,7 @@ public abstract class AbstractAdminApplicationTest {
private
Registration
createRegistration
()
{
return
Registration
.
builder
()
.
name
(
"Test-Instance"
)
.
healthUrl
(
"http://localhost:"
+
port
+
"/mgmt/
status
"
)
.
healthUrl
(
"http://localhost:"
+
port
+
"/mgmt/
health
"
)
.
managementUrl
(
"http://localhost:"
+
port
+
"/mgmt"
)
.
serviceUrl
(
"http://localhost:"
+
port
)
.
build
();
...
...
spring-boot-admin-server/src/test/java/de/codecentric/boot/admin/server/AdminApplicationTest.java
View file @
6cb1208c
...
...
@@ -54,7 +54,7 @@ public class AdminApplicationTest extends AbstractAdminApplicationTest {
public
static
class
TestAdminApplication
{
@Bean
SecurityWebFilterChain
securityWebFilterChain
(
ServerHttpSecurity
http
)
{
public
SecurityWebFilterChain
securityWebFilterChain
(
ServerHttpSecurity
http
)
{
return
http
.
authorizeExchange
().
anyExchange
().
permitAll
()
//
.
and
().
csrf
().
disable
()
//
.
build
();
...
...
spring-boot-admin-server/src/test/java/de/codecentric/boot/admin/server/web/client/InstanceWebClientTest.java
View file @
6cb1208c
...
...
@@ -70,7 +70,9 @@ public class InstanceWebClientTest {
StepVerifier
.
create
(
exchange
).
expectNextCount
(
1
).
verifyComplete
();
wireMock
.
verify
(
1
,
getRequestedFor
(
urlEqualTo
(
"/status"
)).
withHeader
(
ACCEPT
,
equalTo
(
MediaType
.
APPLICATION_JSON_VALUE
)));
getRequestedFor
(
urlEqualTo
(
"/status"
)).
withHeader
(
ACCEPT
,
equalTo
(
MediaType
.
APPLICATION_JSON_VALUE
))
.
withHeader
(
ACCEPT
,
equalTo
(
ActuatorMediaType
.
V1_JSON
))
.
withHeader
(
ACCEPT
,
equalTo
(
ActuatorMediaType
.
V2_JSON
)));
}
@Test
...
...
spring-boot-admin-server/src/test/java/de/codecentric/boot/admin/server/web/client/LegacyEndpointConvertersTest.java
View file @
6cb1208c
...
...
@@ -71,6 +71,22 @@ public class LegacyEndpointConvertersTest {
.
verifyComplete
();
}
@Test
public
void
should_convert_trace
()
{
LegacyEndpointConverter
converter
=
LegacyEndpointConverters
.
trace
();
assertThat
(
converter
.
canConvert
(
"trace"
)).
isTrue
();
assertThat
(
converter
.
canConvert
(
"foo"
)).
isFalse
();
Flux
<
DataBuffer
>
legacyInput
=
this
.
read
(
"trace-legacy.json"
);
Flux
<
Object
>
converted
=
converter
.
convert
(
legacyInput
).
transform
(
this
::
unmarshal
);
Flux
<
Object
>
expected
=
this
.
read
(
"trace-expected.json"
).
transform
(
this
::
unmarshal
);
StepVerifier
.
create
(
Flux
.
zip
(
converted
,
expected
))
.
assertNext
(
t
->
assertThat
(
t
.
getT1
()).
isEqualTo
(
t
.
getT2
()))
.
verifyComplete
();
}
@SuppressWarnings
(
"unchecked"
)
private
Flux
<
Object
>
unmarshal
(
Flux
<
DataBuffer
>
buffer
)
{
return
decoder
.
decode
(
buffer
,
type
,
null
,
null
);
...
...
spring-boot-admin-server/src/test/resources/de/codecentric/boot/admin/server/web/client/trace-expected.json
0 → 100644
View file @
6cb1208c
{
"traces"
:
[
{
"timestamp"
:
"15610000"
,
"info"
:
{
"status"
:
200
}
},
{
"timestamp"
:
"15610001"
,
"info"
:
{
"status"
:
200
}
}
]
}
\ No newline at end of file
spring-boot-admin-server/src/test/resources/de/codecentric/boot/admin/server/web/client/trace-legacy.json
0 → 100644
View file @
6cb1208c
[
{
"timestamp"
:
"15610000"
,
"info"
:
{
"status"
:
200
}
},
{
"timestamp"
:
"15610001"
,
"info"
:
{
"status"
:
200
}
}
]
\ No newline at end of file
spring-boot-admin-starter-client/src/test/java/de/codecentric/boot/admin/client/registration/DefaultApplicationFactoryTest.java
View file @
6cb1208c
...
...
@@ -65,12 +65,12 @@ public class DefaultApplicationFactoryTest {
@Test
public
void
test_default
()
{
when
(
endpointPathProvider
.
getPath
(
"health"
)).
thenReturn
(
"/a
pplication
/health"
);
when
(
endpointPathProvider
.
getPath
(
"health"
)).
thenReturn
(
"/a
ctuator
/health"
);
publishApplicationReadyEvent
(
factory
,
8080
,
null
);
Application
app
=
factory
.
createApplication
();
assertThat
(
app
.
getManagementUrl
()).
isEqualTo
(
"http://"
+
getHostname
()
+
":8080/a
pplication
"
);
assertThat
(
app
.
getHealthUrl
()).
isEqualTo
(
"http://"
+
getHostname
()
+
":8080/a
pplication
/health"
);
assertThat
(
app
.
getManagementUrl
()).
isEqualTo
(
"http://"
+
getHostname
()
+
":8080/a
ctuator
"
);
assertThat
(
app
.
getHealthUrl
()).
isEqualTo
(
"http://"
+
getHostname
()
+
":8080/a
ctuator
/health"
);
assertThat
(
app
.
getServiceUrl
()).
isEqualTo
(
"http://"
+
getHostname
()
+
":8080/"
);
}
...
...
@@ -78,12 +78,12 @@ public class DefaultApplicationFactoryTest {
public
void
test_ssl
()
{
server
.
setSsl
(
new
Ssl
());
server
.
getSsl
().
setEnabled
(
true
);
when
(
endpointPathProvider
.
getPath
(
"health"
)).
thenReturn
(
"/a
pplication
/health"
);
when
(
endpointPathProvider
.
getPath
(
"health"
)).
thenReturn
(
"/a
ctuator
/health"
);
publishApplicationReadyEvent
(
factory
,
8080
,
null
);
Application
app
=
factory
.
createApplication
();
assertThat
(
app
.
getManagementUrl
()).
isEqualTo
(
"https://"
+
getHostname
()
+
":8080/a
pplication
"
);
assertThat
(
app
.
getHealthUrl
()).
isEqualTo
(
"https://"
+
getHostname
()
+
":8080/a
pplication
/health"
);
assertThat
(
app
.
getManagementUrl
()).
isEqualTo
(
"https://"
+
getHostname
()
+
":8080/a
ctuator
"
);
assertThat
(
app
.
getHealthUrl
()).
isEqualTo
(
"https://"
+
getHostname
()
+
":8080/a
ctuator
/health"
);
assertThat
(
app
.
getServiceUrl
()).
isEqualTo
(
"https://"
+
getHostname
()
+
":8080/"
);
}
...
...
@@ -91,12 +91,12 @@ public class DefaultApplicationFactoryTest {
public
void
test_ssl_management
()
{
management
.
setSsl
(
new
Ssl
());
management
.
getSsl
().
setEnabled
(
true
);
when
(
endpointPathProvider
.
getPath
(
"health"
)).
thenReturn
(
"/a
pplication
/alive"
);
when
(
endpointPathProvider
.
getPath
(
"health"
)).
thenReturn
(
"/a
ctuator
/alive"
);
publishApplicationReadyEvent
(
factory
,
8080
,
9090
);
Application
app
=
factory
.
createApplication
();
assertThat
(
app
.
getManagementUrl
()).
isEqualTo
(
"https://"
+
getHostname
()
+
":9090/a
pplication
"
);
assertThat
(
app
.
getHealthUrl
()).
isEqualTo
(
"https://"
+
getHostname
()
+
":9090/a
pplication
/alive"
);
assertThat
(
app
.
getManagementUrl
()).
isEqualTo
(
"https://"
+
getHostname
()
+
":9090/a
ctuator
"
);
assertThat
(
app
.
getHealthUrl
()).
isEqualTo
(
"https://"
+
getHostname
()
+
":9090/a
ctuator
/alive"
);
assertThat
(
app
.
getServiceUrl
()).
isEqualTo
(
"http://"
+
getHostname
()
+
":8080/"
);
}
...
...
@@ -117,7 +117,7 @@ public class DefaultApplicationFactoryTest {
publishApplicationReadyEvent
(
factory
,
8080
,
8081
);
Application
app
=
factory
.
createApplication
();
assertThat
(
app
.
getManagementUrl
()).
matches
(
"http://\\d{0,3}\\.\\d{0,3}\\.\\d{0,3}\\.\\d{0,3}:8081/a
pplication
"
);
assertThat
(
app
.
getManagementUrl
()).
matches
(
"http://\\d{0,3}\\.\\d{0,3}\\.\\d{0,3}\\.\\d{0,3}:8081/a
ctuator
"
);
}
@Test
...
...
@@ -125,12 +125,12 @@ public class DefaultApplicationFactoryTest {
instanceProperties
.
setPreferIp
(
true
);
server
.
setAddress
(
InetAddress
.
getByName
(
"127.0.0.1"
));
management
.
setAddress
(
InetAddress
.
getByName
(
"127.0.0.2"
));
when
(
endpointPathProvider
.
getPath
(
"health"
)).
thenReturn
(
"/a
pplication
/health"
);
when
(
endpointPathProvider
.
getPath
(
"health"
)).
thenReturn
(
"/a
ctuator
/health"
);
publishApplicationReadyEvent
(
factory
,
8080
,
8081
);
Application
app
=
factory
.
createApplication
();
assertThat
(
app
.
getManagementUrl
()).
isEqualTo
(
"http://127.0.0.2:8081/a
pplication
"
);
assertThat
(
app
.
getHealthUrl
()).
isEqualTo
(
"http://127.0.0.2:8081/a
pplication
/health"
);
assertThat
(
app
.
getManagementUrl
()).
isEqualTo
(
"http://127.0.0.2:8081/a
ctuator
"
);
assertThat
(
app
.
getHealthUrl
()).
isEqualTo
(
"http://127.0.0.2:8081/a
ctuator
/health"
);
assertThat
(
app
.
getServiceUrl
()).
isEqualTo
(
"http://127.0.0.1:8080/"
);
}
...
...
spring-boot-admin-starter-client/src/test/java/de/codecentric/boot/admin/client/registration/ServletApplicationFactoryTest.java
View file @
6cb1208c
...
...
@@ -79,12 +79,12 @@ public class ServletApplicationFactoryTest {
@Test
public
void
test_contextPath
()
{
servletContext
.
setContextPath
(
"app"
);
when
(
endpointPathProvider
.
getPath
(
"health"
)).
thenReturn
(
"/a
pplication
/health"
);
when
(
endpointPathProvider
.
getPath
(
"health"
)).
thenReturn
(
"/a
ctuator
/health"
);
publishApplicationReadyEvent
(
factory
,
80
,
null
);
Application
app
=
factory
.
createApplication
();
assertThat
(
app
.
getManagementUrl
()).
isEqualTo
(
"http://"
+
getHostname
()
+
":80/app/a
pplication
"
);
assertThat
(
app
.
getHealthUrl
()).
isEqualTo
(
"http://"
+
getHostname
()
+
":80/app/a
pplication
/health"
);
assertThat
(
app
.
getManagementUrl
()).
isEqualTo
(
"http://"
+
getHostname
()
+
":80/app/a
ctuator
"
);
assertThat
(
app
.
getHealthUrl
()).
isEqualTo
(
"http://"
+
getHostname
()
+
":80/app/a
ctuator
/health"
);
assertThat
(
app
.
getServiceUrl
()).
isEqualTo
(
"http://"
+
getHostname
()
+
":80/app"
);
}
...
...
@@ -92,12 +92,12 @@ public class ServletApplicationFactoryTest {
public
void
test_servletPath
()
{
server
.
getServlet
().
setPath
(
"app"
);
servletContext
.
setContextPath
(
"srv"
);
when
(
endpointPathProvider
.
getPath
(
"health"
)).
thenReturn
(
"/a
pplication
/health"
);
when
(
endpointPathProvider
.
getPath
(
"health"
)).
thenReturn
(
"/a
ctuator
/health"
);
publishApplicationReadyEvent
(
factory
,
80
,
null
);
Application
app
=
factory
.
createApplication
();
assertThat
(
app
.
getManagementUrl
()).
isEqualTo
(
"http://"
+
getHostname
()
+
":80/srv/app/a
pplication
"
);
assertThat
(
app
.
getHealthUrl
()).
isEqualTo
(
"http://"
+
getHostname
()
+
":80/srv/app/a
pplication
/health"
);
assertThat
(
app
.
getManagementUrl
()).
isEqualTo
(
"http://"
+
getHostname
()
+
":80/srv/app/a
ctuator
"
);
assertThat
(
app
.
getHealthUrl
()).
isEqualTo
(
"http://"
+
getHostname
()
+
":80/srv/app/a
ctuator
/health"
);
assertThat
(
app
.
getServiceUrl
()).
isEqualTo
(
"http://"
+
getHostname
()
+
":80/srv"
);
}
...
...
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