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
1c5ba86d
Commit
1c5ba86d
authored
Jan 20, 2018
by
Johannes Edmeier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix compile errors
parent
051e46e6
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
64 additions
and
64 deletions
+64
-64
pom.xml
...-admin-samples/spring-boot-admin-sample-zookeeper/pom.xml
+7
-3
InstancesServletProxyController.java
...oot/admin/server/web/InstancesServletProxyController.java
+14
-18
LegacyEndpointConvertersTest.java
...admin/server/web/client/LegacyEndpointConvertersTest.java
+4
-3
SpringBootAdminClientAutoConfiguration.java
...client/config/SpringBootAdminClientAutoConfiguration.java
+8
-8
DefaultApplicationFactory.java
.../admin/client/registration/DefaultApplicationFactory.java
+6
-7
ServletApplicationFactory.java
.../admin/client/registration/ServletApplicationFactory.java
+4
-4
DefaultApplicationFactoryTest.java
...in/client/registration/DefaultApplicationFactoryTest.java
+13
-13
ServletApplicationFactoryTest.java
...in/client/registration/ServletApplicationFactoryTest.java
+8
-8
No files found.
spring-boot-admin-samples/spring-boot-admin-sample-zookeeper/pom.xml
View file @
1c5ba86d
<!--
<!--
~ Copyright 2014-201
7
the original author or authors.
~ Copyright 2014-201
8
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.
...
@@ -29,10 +29,10 @@
...
@@ -29,10 +29,10 @@
<groupId>
de.codecentric
</groupId>
<groupId>
de.codecentric
</groupId>
<artifactId>
spring-boot-admin-server
</artifactId>
<artifactId>
spring-boot-admin-server
</artifactId>
</dependency>
</dependency>
<
!--
dependency>
<dependency>
<groupId>
de.codecentric
</groupId>
<groupId>
de.codecentric
</groupId>
<artifactId>
spring-boot-admin-server-ui
</artifactId>
<artifactId>
spring-boot-admin-server-ui
</artifactId>
</dependency
--
>
</dependency>
<dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-web
</artifactId>
<artifactId>
spring-boot-starter-web
</artifactId>
...
@@ -42,6 +42,10 @@
...
@@ -42,6 +42,10 @@
<artifactId>
spring-cloud-starter-zookeeper-discovery
</artifactId>
<artifactId>
spring-cloud-starter-zookeeper-discovery
</artifactId>
</dependency>
</dependency>
<dependency>
<dependency>
<groupId>
org.springframework.cloud
</groupId>
<artifactId>
spring-cloud-context
</artifactId>
</dependency>
<dependency>
<groupId>
org.jolokia
</groupId>
<groupId>
org.jolokia
</groupId>
<artifactId>
jolokia-core
</artifactId>
<artifactId>
jolokia-core
</artifactId>
</dependency>
</dependency>
...
...
spring-boot-admin-server/src/main/java/de/codecentric/boot/admin/server/web/InstancesServletProxyController.java
View file @
1c5ba86d
...
@@ -69,23 +69,19 @@ public class InstancesServletProxyController extends AbstractInstancesProxyContr
...
@@ -69,23 +69,19 @@ public class InstancesServletProxyController extends AbstractInstancesProxyContr
.
build
(
true
)
.
build
(
true
)
.
toUri
();
.
toUri
();
return
super
.
forward
(
instanceId
,
uri
,
request
.
getMethod
(),
request
.
getHeaders
(),
()
->
{
return
super
.
forward
(
instanceId
,
uri
,
request
.
getMethod
(),
request
.
getHeaders
(),
try
{
()
->
BodyInserters
.
fromDataBuffers
(
return
BodyInserters
.
fromDataBuffers
(
DataBufferUtils
.
read
(
request
.
getBody
(),
this
.
bufferFactory
,
4096
));
DataBufferUtils
.
readInputStream
(
request:
:
getBody
,
this
.
bufferFactory
,
4096
)))
}
catch
(
IOException
ex
)
{
.
flatMap
(
clientResponse
->
{
throw
new
ResponseStatusException
(
HttpStatus
.
INTERNAL_SERVER_ERROR
,
null
,
ex
);
response
.
setStatusCode
(
clientResponse
.
statusCode
());
}
response
.
getHeaders
().
addAll
(
clientResponse
.
headers
().
asHttpHeaders
());
}).
flatMap
(
clientResponse
->
{
Arrays
.
stream
(
HOP_BY_HOP_HEADERS
).
forEach
(
response
.
getHeaders
()::
remove
);
response
.
setStatusCode
(
clientResponse
.
statusCode
());
try
{
response
.
getHeaders
().
addAll
(
clientResponse
.
headers
().
asHttpHeaders
());
return
DataBufferUtils
.
write
(
clientResponse
.
body
(
BodyExtractors
.
toDataBuffers
()),
Arrays
.
stream
(
HOP_BY_HOP_HEADERS
).
forEach
(
response
.
getHeaders
()::
remove
);
response
.
getBody
()).
doOnNext
(
DataBufferUtils:
:
release
).
then
();
try
{
}
catch
(
IOException
ex
)
{
return
DataBufferUtils
.
write
(
clientResponse
.
body
(
BodyExtractors
.
toDataBuffers
()),
response
.
getBody
())
throw
new
ResponseStatusException
(
HttpStatus
.
INTERNAL_SERVER_ERROR
,
null
,
ex
);
.
doOnNext
(
DataBufferUtils:
:
release
)
}
.
then
();
});
}
catch
(
IOException
ex
)
{
throw
new
ResponseStatusException
(
HttpStatus
.
INTERNAL_SERVER_ERROR
,
null
,
ex
);
}
});
}
}
}
}
spring-boot-admin-server/src/test/java/de/codecentric/boot/admin/server/web/client/LegacyEndpointConvertersTest.java
View file @
1c5ba86d
/*
/*
* Copyright 2014-201
7
the original author or authors.
* Copyright 2014-201
8
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.
...
@@ -142,7 +142,7 @@ public class LegacyEndpointConvertersTest {
...
@@ -142,7 +142,7 @@ public class LegacyEndpointConvertersTest {
}
}
private
Flux
<
DataBuffer
>
read
(
String
resourceName
)
{
private
Flux
<
DataBuffer
>
read
(
String
resourceName
)
{
return
DataBufferUtils
.
read
(
LegacyEndpointConvertersTest
.
class
.
getResourceAsStream
(
resourceName
),
bufferFactory
,
return
DataBufferUtils
.
read
InputStream
(
10
);
()
->
LegacyEndpointConvertersTest
.
class
.
getResourceAsStream
(
resourceName
),
bufferFactory
,
10
);
}
}
}
}
\ No newline at end of file
spring-boot-admin-starter-client/src/main/java/de/codecentric/boot/admin/client/config/SpringBootAdminClientAutoConfiguration.java
View file @
1c5ba86d
/*
/*
* Copyright 2014-201
7
the original author or authors.
* Copyright 2014-201
8
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.
...
@@ -23,10 +23,10 @@ import de.codecentric.boot.admin.client.registration.ServletApplicationFactory;
...
@@ -23,10 +23,10 @@ import de.codecentric.boot.admin.client.registration.ServletApplicationFactory;
import
javax.servlet.ServletContext
;
import
javax.servlet.ServletContext
;
import
org.springframework.beans.factory.annotation.Qualifier
;
import
org.springframework.beans.factory.annotation.Qualifier
;
import
org.springframework.boot.actuate.autoconfigure.endpoint.web.EndpointPathProvider
;
import
org.springframework.boot.actuate.autoconfigure.endpoint.web.WebEndpointProperties
;
import
org.springframework.boot.actuate.autoconfigure.endpoint.web.WebEndpointProperties
;
import
org.springframework.boot.actuate.autoconfigure.endpoint.web.servlet.WebMvcEndpointManagementContextConfiguration
;
import
org.springframework.boot.actuate.autoconfigure.endpoint.web.servlet.WebMvcEndpointManagementContextConfiguration
;
import
org.springframework.boot.actuate.autoconfigure.web.server.ManagementServerProperties
;
import
org.springframework.boot.actuate.autoconfigure.web.server.ManagementServerProperties
;
import
org.springframework.boot.actuate.endpoint.web.PathMappedEndpoints
;
import
org.springframework.boot.autoconfigure.AutoConfigureAfter
;
import
org.springframework.boot.autoconfigure.AutoConfigureAfter
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication
;
...
@@ -59,9 +59,9 @@ public class SpringBootAdminClientAutoConfiguration {
...
@@ -59,9 +59,9 @@ public class SpringBootAdminClientAutoConfiguration {
ManagementServerProperties
management
,
ManagementServerProperties
management
,
ServerProperties
server
,
ServerProperties
server
,
ServletContext
servletContext
,
ServletContext
servletContext
,
EndpointPathProvider
endpointPathProvider
,
PathMappedEndpoints
pathMappedEndpoints
,
WebEndpointProperties
webEndpoint
)
{
WebEndpointProperties
webEndpoint
)
{
return
new
ServletApplicationFactory
(
instance
,
management
,
server
,
servletContext
,
endpointPathProvider
,
return
new
ServletApplicationFactory
(
instance
,
management
,
server
,
servletContext
,
pathMappedEndpoints
,
webEndpoint
);
webEndpoint
);
}
}
}
}
...
@@ -74,9 +74,9 @@ public class SpringBootAdminClientAutoConfiguration {
...
@@ -74,9 +74,9 @@ public class SpringBootAdminClientAutoConfiguration {
public
ApplicationFactory
applicationFactory
(
InstanceProperties
instance
,
public
ApplicationFactory
applicationFactory
(
InstanceProperties
instance
,
ManagementServerProperties
management
,
ManagementServerProperties
management
,
ServerProperties
server
,
ServerProperties
server
,
EndpointPathProvider
endpointPathProvider
,
PathMappedEndpoints
pathMappedEndpoints
,
WebEndpointProperties
webEndpoint
)
{
WebEndpointProperties
webEndpoint
)
{
return
new
DefaultApplicationFactory
(
instance
,
management
,
server
,
endpointPathProvider
,
webEndpoint
);
return
new
DefaultApplicationFactory
(
instance
,
management
,
server
,
pathMappedEndpoints
,
webEndpoint
);
}
}
}
}
...
@@ -100,9 +100,9 @@ public class SpringBootAdminClientAutoConfiguration {
...
@@ -100,9 +100,9 @@ public class SpringBootAdminClientAutoConfiguration {
public
ApplicationFactory
applicationFactory
(
InstanceProperties
instance
,
public
ApplicationFactory
applicationFactory
(
InstanceProperties
instance
,
ManagementServerProperties
management
,
ManagementServerProperties
management
,
ServerProperties
server
,
ServerProperties
server
,
EndpointPathProvider
endpointPathProvider
,
PathMappedEndpoints
pathMappedEndpoints
,
WebEndpointProperties
webEndpoint
)
{
WebEndpointProperties
webEndpoint
)
{
return
new
DefaultApplicationFactory
(
instance
,
management
,
server
,
endpointPathProvider
,
webEndpoint
);
return
new
DefaultApplicationFactory
(
instance
,
management
,
server
,
pathMappedEndpoints
,
webEndpoint
);
}
}
@Bean
@Bean
...
...
spring-boot-admin-starter-client/src/main/java/de/codecentric/boot/admin/client/registration/DefaultApplicationFactory.java
View file @
1c5ba86d
...
@@ -24,9 +24,9 @@ import java.time.OffsetDateTime;
...
@@ -24,9 +24,9 @@ import java.time.OffsetDateTime;
import
java.time.format.DateTimeFormatter
;
import
java.time.format.DateTimeFormatter
;
import
java.util.LinkedHashMap
;
import
java.util.LinkedHashMap
;
import
java.util.Map
;
import
java.util.Map
;
import
org.springframework.boot.actuate.autoconfigure.endpoint.web.EndpointPathProvider
;
import
org.springframework.boot.actuate.autoconfigure.endpoint.web.WebEndpointProperties
;
import
org.springframework.boot.actuate.autoconfigure.endpoint.web.WebEndpointProperties
;
import
org.springframework.boot.actuate.autoconfigure.web.server.ManagementServerProperties
;
import
org.springframework.boot.actuate.autoconfigure.web.server.ManagementServerProperties
;
import
org.springframework.boot.actuate.endpoint.web.PathMappedEndpoints
;
import
org.springframework.boot.autoconfigure.web.ServerProperties
;
import
org.springframework.boot.autoconfigure.web.ServerProperties
;
import
org.springframework.boot.web.context.WebServerInitializedEvent
;
import
org.springframework.boot.web.context.WebServerInitializedEvent
;
import
org.springframework.boot.web.server.Ssl
;
import
org.springframework.boot.web.server.Ssl
;
...
@@ -45,7 +45,7 @@ public class DefaultApplicationFactory implements ApplicationFactory {
...
@@ -45,7 +45,7 @@ public class DefaultApplicationFactory implements ApplicationFactory {
private
final
InstanceProperties
instance
;
private
final
InstanceProperties
instance
;
private
final
ServerProperties
server
;
private
final
ServerProperties
server
;
private
final
ManagementServerProperties
management
;
private
final
ManagementServerProperties
management
;
private
final
EndpointPathProvider
endpointPathProvider
;
private
final
PathMappedEndpoints
pathMappedEndpoints
;
private
final
WebEndpointProperties
webEndpoint
;
private
final
WebEndpointProperties
webEndpoint
;
private
final
OffsetDateTime
timestamp
;
private
final
OffsetDateTime
timestamp
;
private
Integer
localServerPort
;
private
Integer
localServerPort
;
...
@@ -54,13 +54,12 @@ public class DefaultApplicationFactory implements ApplicationFactory {
...
@@ -54,13 +54,12 @@ public class DefaultApplicationFactory implements ApplicationFactory {
public
DefaultApplicationFactory
(
InstanceProperties
instance
,
public
DefaultApplicationFactory
(
InstanceProperties
instance
,
ManagementServerProperties
management
,
ManagementServerProperties
management
,
ServerProperties
server
,
ServerProperties
server
,
PathMappedEndpoints
pathMappedEndpoints
,
EndpointPathProvider
endpointPathProvider
,
WebEndpointProperties
webEndpoint
)
{
WebEndpointProperties
webEndpoint
)
{
this
.
instance
=
instance
;
this
.
instance
=
instance
;
this
.
management
=
management
;
this
.
management
=
management
;
this
.
server
=
server
;
this
.
server
=
server
;
this
.
endpointPathProvider
=
endpointPathProvider
;
this
.
pathMappedEndpoints
=
pathMappedEndpoints
;
this
.
webEndpoint
=
webEndpoint
;
this
.
webEndpoint
=
webEndpoint
;
this
.
timestamp
=
OffsetDateTime
.
now
();
this
.
timestamp
=
OffsetDateTime
.
now
();
}
}
...
@@ -205,11 +204,11 @@ public class DefaultApplicationFactory implements ApplicationFactory {
...
@@ -205,11 +204,11 @@ public class DefaultApplicationFactory implements ApplicationFactory {
}
}
protected
String
getHealthEndpointPath
()
{
protected
String
getHealthEndpointPath
()
{
String
health
=
endpointPathProvider
.
getPath
(
"health"
);
String
health
=
pathMappedEndpoints
.
getPath
(
"health"
);
if
(
StringUtils
.
hasText
(
health
))
{
if
(
StringUtils
.
hasText
(
health
))
{
return
health
;
return
health
;
}
}
String
status
=
endpointPathProvider
.
getPath
(
"status"
);
String
status
=
pathMappedEndpoints
.
getPath
(
"status"
);
if
(
StringUtils
.
hasText
(
status
))
{
if
(
StringUtils
.
hasText
(
status
))
{
return
status
;
return
status
;
}
}
...
...
spring-boot-admin-starter-client/src/main/java/de/codecentric/boot/admin/client/registration/ServletApplicationFactory.java
View file @
1c5ba86d
/*
/*
* Copyright 2014-201
7
the original author or authors.
* Copyright 2014-201
8
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.
...
@@ -19,9 +19,9 @@ package de.codecentric.boot.admin.client.registration;
...
@@ -19,9 +19,9 @@ package de.codecentric.boot.admin.client.registration;
import
de.codecentric.boot.admin.client.config.InstanceProperties
;
import
de.codecentric.boot.admin.client.config.InstanceProperties
;
import
javax.servlet.ServletContext
;
import
javax.servlet.ServletContext
;
import
org.springframework.boot.actuate.autoconfigure.endpoint.web.EndpointPathProvider
;
import
org.springframework.boot.actuate.autoconfigure.endpoint.web.WebEndpointProperties
;
import
org.springframework.boot.actuate.autoconfigure.endpoint.web.WebEndpointProperties
;
import
org.springframework.boot.actuate.autoconfigure.web.server.ManagementServerProperties
;
import
org.springframework.boot.actuate.autoconfigure.web.server.ManagementServerProperties
;
import
org.springframework.boot.actuate.endpoint.web.PathMappedEndpoints
;
import
org.springframework.boot.autoconfigure.web.ServerProperties
;
import
org.springframework.boot.autoconfigure.web.ServerProperties
;
import
org.springframework.web.util.UriComponentsBuilder
;
import
org.springframework.web.util.UriComponentsBuilder
;
...
@@ -34,9 +34,9 @@ public class ServletApplicationFactory extends DefaultApplicationFactory {
...
@@ -34,9 +34,9 @@ public class ServletApplicationFactory extends DefaultApplicationFactory {
ManagementServerProperties
management
,
ManagementServerProperties
management
,
ServerProperties
server
,
ServerProperties
server
,
ServletContext
servletContext
,
ServletContext
servletContext
,
EndpointPathProvider
endpointPathProvider
,
PathMappedEndpoints
pathMappedEndpoints
,
WebEndpointProperties
webEndpoint
)
{
WebEndpointProperties
webEndpoint
)
{
super
(
instance
,
management
,
server
,
endpointPathProvider
,
webEndpoint
);
super
(
instance
,
management
,
server
,
pathMappedEndpoints
,
webEndpoint
);
this
.
servletContext
=
servletContext
;
this
.
servletContext
=
servletContext
;
this
.
servlet
=
server
.
getServlet
();
this
.
servlet
=
server
.
getServlet
();
this
.
managementServlet
=
management
.
getServlet
();
this
.
managementServlet
=
management
.
getServlet
();
...
...
spring-boot-admin-starter-client/src/test/java/de/codecentric/boot/admin/client/registration/DefaultApplicationFactoryTest.java
View file @
1c5ba86d
/*
/*
* Copyright 2014-201
7
the original author or authors.
* Copyright 2014-201
8
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.
...
@@ -22,9 +22,9 @@ import java.net.InetAddress;
...
@@ -22,9 +22,9 @@ import java.net.InetAddress;
import
java.net.UnknownHostException
;
import
java.net.UnknownHostException
;
import
org.junit.Before
;
import
org.junit.Before
;
import
org.junit.Test
;
import
org.junit.Test
;
import
org.springframework.boot.actuate.autoconfigure.endpoint.web.EndpointPathProvider
;
import
org.springframework.boot.actuate.autoconfigure.endpoint.web.WebEndpointProperties
;
import
org.springframework.boot.actuate.autoconfigure.endpoint.web.WebEndpointProperties
;
import
org.springframework.boot.actuate.autoconfigure.web.server.ManagementServerProperties
;
import
org.springframework.boot.actuate.autoconfigure.web.server.ManagementServerProperties
;
import
org.springframework.boot.actuate.endpoint.web.PathMappedEndpoints
;
import
org.springframework.boot.autoconfigure.web.ServerProperties
;
import
org.springframework.boot.autoconfigure.web.ServerProperties
;
import
org.springframework.boot.web.context.WebServerInitializedEvent
;
import
org.springframework.boot.web.context.WebServerInitializedEvent
;
import
org.springframework.boot.web.server.Ssl
;
import
org.springframework.boot.web.server.Ssl
;
...
@@ -40,11 +40,11 @@ public class DefaultApplicationFactoryTest {
...
@@ -40,11 +40,11 @@ public class DefaultApplicationFactoryTest {
private
InstanceProperties
instanceProperties
=
new
InstanceProperties
();
private
InstanceProperties
instanceProperties
=
new
InstanceProperties
();
private
ServerProperties
server
=
new
ServerProperties
();
private
ServerProperties
server
=
new
ServerProperties
();
private
ManagementServerProperties
management
=
new
ManagementServerProperties
();
private
ManagementServerProperties
management
=
new
ManagementServerProperties
();
private
EndpointPathProvider
endpointPathProvider
=
mock
(
EndpointPathProvider
.
class
);
private
PathMappedEndpoints
pathMappedEndpoints
=
mock
(
PathMappedEndpoints
.
class
);
private
WebEndpointProperties
webEndpoint
=
new
WebEndpointProperties
();
private
WebEndpointProperties
webEndpoint
=
new
WebEndpointProperties
();
private
DefaultApplicationFactory
factory
=
new
DefaultApplicationFactory
(
instanceProperties
,
management
,
server
,
private
DefaultApplicationFactory
factory
=
new
DefaultApplicationFactory
(
instanceProperties
,
management
,
server
,
endpointPathProvider
,
webEndpoint
);
pathMappedEndpoints
,
webEndpoint
);
@Before
@Before
public
void
setup
()
{
public
void
setup
()
{
...
@@ -54,7 +54,7 @@ public class DefaultApplicationFactoryTest {
...
@@ -54,7 +54,7 @@ public class DefaultApplicationFactoryTest {
@Test
@Test
public
void
test_mgmtPortPath
()
{
public
void
test_mgmtPortPath
()
{
webEndpoint
.
setBasePath
(
"/admin"
);
webEndpoint
.
setBasePath
(
"/admin"
);
when
(
endpointPathProvider
.
getPath
(
"health"
)).
thenReturn
(
"/admin/alive"
);
when
(
pathMappedEndpoints
.
getPath
(
"health"
)).
thenReturn
(
"/admin/alive"
);
publishApplicationReadyEvent
(
factory
,
8080
,
8081
);
publishApplicationReadyEvent
(
factory
,
8080
,
8081
);
Application
app
=
factory
.
createApplication
();
Application
app
=
factory
.
createApplication
();
...
@@ -65,7 +65,7 @@ public class DefaultApplicationFactoryTest {
...
@@ -65,7 +65,7 @@ public class DefaultApplicationFactoryTest {
@Test
@Test
public
void
test_default
()
{
public
void
test_default
()
{
when
(
endpointPathProvider
.
getPath
(
"health"
)).
thenReturn
(
"/actuator/health"
);
when
(
pathMappedEndpoints
.
getPath
(
"health"
)).
thenReturn
(
"/actuator/health"
);
publishApplicationReadyEvent
(
factory
,
8080
,
null
);
publishApplicationReadyEvent
(
factory
,
8080
,
null
);
Application
app
=
factory
.
createApplication
();
Application
app
=
factory
.
createApplication
();
...
@@ -78,7 +78,7 @@ public class DefaultApplicationFactoryTest {
...
@@ -78,7 +78,7 @@ public class DefaultApplicationFactoryTest {
public
void
test_ssl
()
{
public
void
test_ssl
()
{
server
.
setSsl
(
new
Ssl
());
server
.
setSsl
(
new
Ssl
());
server
.
getSsl
().
setEnabled
(
true
);
server
.
getSsl
().
setEnabled
(
true
);
when
(
endpointPathProvider
.
getPath
(
"health"
)).
thenReturn
(
"/actuator/health"
);
when
(
pathMappedEndpoints
.
getPath
(
"health"
)).
thenReturn
(
"/actuator/health"
);
publishApplicationReadyEvent
(
factory
,
8080
,
null
);
publishApplicationReadyEvent
(
factory
,
8080
,
null
);
Application
app
=
factory
.
createApplication
();
Application
app
=
factory
.
createApplication
();
...
@@ -91,7 +91,7 @@ public class DefaultApplicationFactoryTest {
...
@@ -91,7 +91,7 @@ public class DefaultApplicationFactoryTest {
public
void
test_ssl_management
()
{
public
void
test_ssl_management
()
{
management
.
setSsl
(
new
Ssl
());
management
.
setSsl
(
new
Ssl
());
management
.
getSsl
().
setEnabled
(
true
);
management
.
getSsl
().
setEnabled
(
true
);
when
(
endpointPathProvider
.
getPath
(
"health"
)).
thenReturn
(
"/actuator/alive"
);
when
(
pathMappedEndpoints
.
getPath
(
"health"
)).
thenReturn
(
"/actuator/alive"
);
publishApplicationReadyEvent
(
factory
,
8080
,
9090
);
publishApplicationReadyEvent
(
factory
,
8080
,
9090
);
Application
app
=
factory
.
createApplication
();
Application
app
=
factory
.
createApplication
();
...
@@ -103,7 +103,7 @@ public class DefaultApplicationFactoryTest {
...
@@ -103,7 +103,7 @@ public class DefaultApplicationFactoryTest {
@Test
@Test
public
void
test_preferIpAddress_serveraddress_missing
()
{
public
void
test_preferIpAddress_serveraddress_missing
()
{
instanceProperties
.
setPreferIp
(
true
);
instanceProperties
.
setPreferIp
(
true
);
when
(
endpointPathProvider
.
getPath
(
"health"
)).
thenReturn
(
"/application/alive"
);
when
(
pathMappedEndpoints
.
getPath
(
"health"
)).
thenReturn
(
"/application/alive"
);
publishApplicationReadyEvent
(
factory
,
8080
,
null
);
publishApplicationReadyEvent
(
factory
,
8080
,
null
);
Application
app
=
factory
.
createApplication
();
Application
app
=
factory
.
createApplication
();
...
@@ -113,7 +113,7 @@ public class DefaultApplicationFactoryTest {
...
@@ -113,7 +113,7 @@ public class DefaultApplicationFactoryTest {
@Test
@Test
public
void
test_preferIpAddress_managementaddress_missing
()
{
public
void
test_preferIpAddress_managementaddress_missing
()
{
instanceProperties
.
setPreferIp
(
true
);
instanceProperties
.
setPreferIp
(
true
);
when
(
endpointPathProvider
.
getPath
(
"health"
)).
thenReturn
(
"/application/alive"
);
when
(
pathMappedEndpoints
.
getPath
(
"health"
)).
thenReturn
(
"/application/alive"
);
publishApplicationReadyEvent
(
factory
,
8080
,
8081
);
publishApplicationReadyEvent
(
factory
,
8080
,
8081
);
Application
app
=
factory
.
createApplication
();
Application
app
=
factory
.
createApplication
();
...
@@ -125,7 +125,7 @@ public class DefaultApplicationFactoryTest {
...
@@ -125,7 +125,7 @@ public class DefaultApplicationFactoryTest {
instanceProperties
.
setPreferIp
(
true
);
instanceProperties
.
setPreferIp
(
true
);
server
.
setAddress
(
InetAddress
.
getByName
(
"127.0.0.1"
));
server
.
setAddress
(
InetAddress
.
getByName
(
"127.0.0.1"
));
management
.
setAddress
(
InetAddress
.
getByName
(
"127.0.0.2"
));
management
.
setAddress
(
InetAddress
.
getByName
(
"127.0.0.2"
));
when
(
endpointPathProvider
.
getPath
(
"health"
)).
thenReturn
(
"/actuator/health"
);
when
(
pathMappedEndpoints
.
getPath
(
"health"
)).
thenReturn
(
"/actuator/health"
);
publishApplicationReadyEvent
(
factory
,
8080
,
8081
);
publishApplicationReadyEvent
(
factory
,
8080
,
8081
);
Application
app
=
factory
.
createApplication
();
Application
app
=
factory
.
createApplication
();
...
@@ -151,7 +151,7 @@ public class DefaultApplicationFactoryTest {
...
@@ -151,7 +151,7 @@ public class DefaultApplicationFactoryTest {
instanceProperties
.
setManagementBaseUrl
(
"http://management:8090"
);
instanceProperties
.
setManagementBaseUrl
(
"http://management:8090"
);
instanceProperties
.
setServiceBaseUrl
(
"http://service:80"
);
instanceProperties
.
setServiceBaseUrl
(
"http://service:80"
);
webEndpoint
.
setBasePath
(
"/admin"
);
webEndpoint
.
setBasePath
(
"/admin"
);
when
(
endpointPathProvider
.
getPath
(
"health"
)).
thenReturn
(
"/admin/health"
);
when
(
pathMappedEndpoints
.
getPath
(
"health"
)).
thenReturn
(
"/admin/health"
);
Application
app
=
factory
.
createApplication
();
Application
app
=
factory
.
createApplication
();
assertThat
(
app
.
getServiceUrl
()).
isEqualTo
(
"http://service:80/"
);
assertThat
(
app
.
getServiceUrl
()).
isEqualTo
(
"http://service:80/"
);
...
@@ -163,7 +163,7 @@ public class DefaultApplicationFactoryTest {
...
@@ -163,7 +163,7 @@ public class DefaultApplicationFactoryTest {
public
void
test_service_baseUrl
()
{
public
void
test_service_baseUrl
()
{
instanceProperties
.
setServiceBaseUrl
(
"http://service:80"
);
instanceProperties
.
setServiceBaseUrl
(
"http://service:80"
);
webEndpoint
.
setBasePath
(
"/admin"
);
webEndpoint
.
setBasePath
(
"/admin"
);
when
(
endpointPathProvider
.
getPath
(
"health"
)).
thenReturn
(
"/admin/health"
);
when
(
pathMappedEndpoints
.
getPath
(
"health"
)).
thenReturn
(
"/admin/health"
);
Application
app
=
factory
.
createApplication
();
Application
app
=
factory
.
createApplication
();
assertThat
(
app
.
getServiceUrl
()).
isEqualTo
(
"http://service:80/"
);
assertThat
(
app
.
getServiceUrl
()).
isEqualTo
(
"http://service:80/"
);
...
...
spring-boot-admin-starter-client/src/test/java/de/codecentric/boot/admin/client/registration/ServletApplicationFactoryTest.java
View file @
1c5ba86d
/*
/*
* Copyright 2014-201
7
the original author or authors.
* Copyright 2014-201
8
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.
...
@@ -22,9 +22,9 @@ import java.net.InetAddress;
...
@@ -22,9 +22,9 @@ import java.net.InetAddress;
import
java.net.UnknownHostException
;
import
java.net.UnknownHostException
;
import
org.junit.Before
;
import
org.junit.Before
;
import
org.junit.Test
;
import
org.junit.Test
;
import
org.springframework.boot.actuate.autoconfigure.endpoint.web.EndpointPathProvider
;
import
org.springframework.boot.actuate.autoconfigure.endpoint.web.WebEndpointProperties
;
import
org.springframework.boot.actuate.autoconfigure.endpoint.web.WebEndpointProperties
;
import
org.springframework.boot.actuate.autoconfigure.web.server.ManagementServerProperties
;
import
org.springframework.boot.actuate.autoconfigure.web.server.ManagementServerProperties
;
import
org.springframework.boot.actuate.endpoint.web.PathMappedEndpoints
;
import
org.springframework.boot.autoconfigure.web.ServerProperties
;
import
org.springframework.boot.autoconfigure.web.ServerProperties
;
import
org.springframework.boot.web.context.WebServerInitializedEvent
;
import
org.springframework.boot.web.context.WebServerInitializedEvent
;
import
org.springframework.boot.web.server.WebServer
;
import
org.springframework.boot.web.server.WebServer
;
...
@@ -40,10 +40,10 @@ public class ServletApplicationFactoryTest {
...
@@ -40,10 +40,10 @@ public class ServletApplicationFactoryTest {
private
ServerProperties
server
=
new
ServerProperties
();
private
ServerProperties
server
=
new
ServerProperties
();
private
ManagementServerProperties
management
=
new
ManagementServerProperties
();
private
ManagementServerProperties
management
=
new
ManagementServerProperties
();
private
MockServletContext
servletContext
=
new
MockServletContext
();
private
MockServletContext
servletContext
=
new
MockServletContext
();
private
EndpointPathProvider
endpointPathProvider
=
mock
(
EndpointPathProvider
.
class
);
private
PathMappedEndpoints
pathMappedEndpoints
=
mock
(
PathMappedEndpoints
.
class
);
private
WebEndpointProperties
webEndpoint
=
new
WebEndpointProperties
();
private
WebEndpointProperties
webEndpoint
=
new
WebEndpointProperties
();
private
ServletApplicationFactory
factory
=
new
ServletApplicationFactory
(
instance
,
management
,
server
,
private
ServletApplicationFactory
factory
=
new
ServletApplicationFactory
(
instance
,
management
,
server
,
servletContext
,
endpointPathProvider
,
webEndpoint
);
servletContext
,
pathMappedEndpoints
,
webEndpoint
);
@Before
@Before
public
void
setup
()
{
public
void
setup
()
{
...
@@ -54,7 +54,7 @@ public class ServletApplicationFactoryTest {
...
@@ -54,7 +54,7 @@ public class ServletApplicationFactoryTest {
public
void
test_contextPath_mgmtPath
()
{
public
void
test_contextPath_mgmtPath
()
{
servletContext
.
setContextPath
(
"app"
);
servletContext
.
setContextPath
(
"app"
);
webEndpoint
.
setBasePath
(
"/admin"
);
webEndpoint
.
setBasePath
(
"/admin"
);
when
(
endpointPathProvider
.
getPath
(
"health"
)).
thenReturn
(
"/admin/health"
);
when
(
pathMappedEndpoints
.
getPath
(
"health"
)).
thenReturn
(
"/admin/health"
);
publishApplicationReadyEvent
(
factory
,
8080
,
null
);
publishApplicationReadyEvent
(
factory
,
8080
,
null
);
Application
app
=
factory
.
createApplication
();
Application
app
=
factory
.
createApplication
();
...
@@ -67,7 +67,7 @@ public class ServletApplicationFactoryTest {
...
@@ -67,7 +67,7 @@ public class ServletApplicationFactoryTest {
public
void
test_contextPath_mgmtPortPath
()
{
public
void
test_contextPath_mgmtPortPath
()
{
servletContext
.
setContextPath
(
"app"
);
servletContext
.
setContextPath
(
"app"
);
webEndpoint
.
setBasePath
(
"/admin"
);
webEndpoint
.
setBasePath
(
"/admin"
);
when
(
endpointPathProvider
.
getPath
(
"health"
)).
thenReturn
(
"/admin/health"
);
when
(
pathMappedEndpoints
.
getPath
(
"health"
)).
thenReturn
(
"/admin/health"
);
publishApplicationReadyEvent
(
factory
,
8080
,
8081
);
publishApplicationReadyEvent
(
factory
,
8080
,
8081
);
Application
app
=
factory
.
createApplication
();
Application
app
=
factory
.
createApplication
();
...
@@ -79,7 +79,7 @@ public class ServletApplicationFactoryTest {
...
@@ -79,7 +79,7 @@ public class ServletApplicationFactoryTest {
@Test
@Test
public
void
test_contextPath
()
{
public
void
test_contextPath
()
{
servletContext
.
setContextPath
(
"app"
);
servletContext
.
setContextPath
(
"app"
);
when
(
endpointPathProvider
.
getPath
(
"health"
)).
thenReturn
(
"/actuator/health"
);
when
(
pathMappedEndpoints
.
getPath
(
"health"
)).
thenReturn
(
"/actuator/health"
);
publishApplicationReadyEvent
(
factory
,
80
,
null
);
publishApplicationReadyEvent
(
factory
,
80
,
null
);
Application
app
=
factory
.
createApplication
();
Application
app
=
factory
.
createApplication
();
...
@@ -92,7 +92,7 @@ public class ServletApplicationFactoryTest {
...
@@ -92,7 +92,7 @@ public class ServletApplicationFactoryTest {
public
void
test_servletPath
()
{
public
void
test_servletPath
()
{
server
.
getServlet
().
setPath
(
"app"
);
server
.
getServlet
().
setPath
(
"app"
);
servletContext
.
setContextPath
(
"srv"
);
servletContext
.
setContextPath
(
"srv"
);
when
(
endpointPathProvider
.
getPath
(
"health"
)).
thenReturn
(
"/actuator/health"
);
when
(
pathMappedEndpoints
.
getPath
(
"health"
)).
thenReturn
(
"/actuator/health"
);
publishApplicationReadyEvent
(
factory
,
80
,
null
);
publishApplicationReadyEvent
(
factory
,
80
,
null
);
Application
app
=
factory
.
createApplication
();
Application
app
=
factory
.
createApplication
();
...
...
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