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");
~ you may not use this file except in compliance with the License.
...
...
@@ -29,10 +29,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>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-web
</artifactId>
...
...
@@ -42,6 +42,10 @@
<artifactId>
spring-cloud-starter-zookeeper-discovery
</artifactId>
</dependency>
<dependency>
<groupId>
org.springframework.cloud
</groupId>
<artifactId>
spring-cloud-context
</artifactId>
</dependency>
<dependency>
<groupId>
org.jolokia
</groupId>
<artifactId>
jolokia-core
</artifactId>
</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
.
build
(
true
)
.
toUri
();
return
super
.
forward
(
instanceId
,
uri
,
request
.
getMethod
(),
request
.
getHeaders
(),
()
->
{
try
{
return
BodyInserters
.
fromDataBuffers
(
DataBufferUtils
.
read
(
request
.
getBody
(),
this
.
bufferFactory
,
4096
));
}
catch
(
IOException
ex
)
{
throw
new
ResponseStatusException
(
HttpStatus
.
INTERNAL_SERVER_ERROR
,
null
,
ex
);
}
}).
flatMap
(
clientResponse
->
{
response
.
setStatusCode
(
clientResponse
.
statusCode
());
response
.
getHeaders
().
addAll
(
clientResponse
.
headers
().
asHttpHeaders
());
Arrays
.
stream
(
HOP_BY_HOP_HEADERS
).
forEach
(
response
.
getHeaders
()::
remove
);
try
{
return
DataBufferUtils
.
write
(
clientResponse
.
body
(
BodyExtractors
.
toDataBuffers
()),
response
.
getBody
())
.
doOnNext
(
DataBufferUtils:
:
release
)
.
then
();
}
catch
(
IOException
ex
)
{
throw
new
ResponseStatusException
(
HttpStatus
.
INTERNAL_SERVER_ERROR
,
null
,
ex
);
}
});
return
super
.
forward
(
instanceId
,
uri
,
request
.
getMethod
(),
request
.
getHeaders
(),
()
->
BodyInserters
.
fromDataBuffers
(
DataBufferUtils
.
readInputStream
(
request:
:
getBody
,
this
.
bufferFactory
,
4096
)))
.
flatMap
(
clientResponse
->
{
response
.
setStatusCode
(
clientResponse
.
statusCode
());
response
.
getHeaders
().
addAll
(
clientResponse
.
headers
().
asHttpHeaders
());
Arrays
.
stream
(
HOP_BY_HOP_HEADERS
).
forEach
(
response
.
getHeaders
()::
remove
);
try
{
return
DataBufferUtils
.
write
(
clientResponse
.
body
(
BodyExtractors
.
toDataBuffers
()),
response
.
getBody
()).
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");
* you may not use this file except in compliance with the License.
...
...
@@ -142,7 +142,7 @@ public class LegacyEndpointConvertersTest {
}
private
Flux
<
DataBuffer
>
read
(
String
resourceName
)
{
return
DataBufferUtils
.
read
(
LegacyEndpointConvertersTest
.
class
.
getResourceAsStream
(
resourceName
),
bufferFactory
,
10
);
return
DataBufferUtils
.
read
InputStream
(
()
->
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");
* you may not use this file except in compliance with the License.
...
...
@@ -23,10 +23,10 @@ import de.codecentric.boot.admin.client.registration.ServletApplicationFactory;
import
javax.servlet.ServletContext
;
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.servlet.WebMvcEndpointManagementContextConfiguration
;
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.condition.ConditionalOnMissingBean
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication
;
...
...
@@ -59,9 +59,9 @@ public class SpringBootAdminClientAutoConfiguration {
ManagementServerProperties
management
,
ServerProperties
server
,
ServletContext
servletContext
,
EndpointPathProvider
endpointPathProvider
,
PathMappedEndpoints
pathMappedEndpoints
,
WebEndpointProperties
webEndpoint
)
{
return
new
ServletApplicationFactory
(
instance
,
management
,
server
,
servletContext
,
endpointPathProvider
,
return
new
ServletApplicationFactory
(
instance
,
management
,
server
,
servletContext
,
pathMappedEndpoints
,
webEndpoint
);
}
}
...
...
@@ -74,9 +74,9 @@ public class SpringBootAdminClientAutoConfiguration {
public
ApplicationFactory
applicationFactory
(
InstanceProperties
instance
,
ManagementServerProperties
management
,
ServerProperties
server
,
EndpointPathProvider
endpointPathProvider
,
PathMappedEndpoints
pathMappedEndpoints
,
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 {
public
ApplicationFactory
applicationFactory
(
InstanceProperties
instance
,
ManagementServerProperties
management
,
ServerProperties
server
,
EndpointPathProvider
endpointPathProvider
,
PathMappedEndpoints
pathMappedEndpoints
,
WebEndpointProperties
webEndpoint
)
{
return
new
DefaultApplicationFactory
(
instance
,
management
,
server
,
endpointPathProvider
,
webEndpoint
);
return
new
DefaultApplicationFactory
(
instance
,
management
,
server
,
pathMappedEndpoints
,
webEndpoint
);
}
@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;
import
java.time.format.DateTimeFormatter
;
import
java.util.LinkedHashMap
;
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.web.server.ManagementServerProperties
;
import
org.springframework.boot.actuate.endpoint.web.PathMappedEndpoints
;
import
org.springframework.boot.autoconfigure.web.ServerProperties
;
import
org.springframework.boot.web.context.WebServerInitializedEvent
;
import
org.springframework.boot.web.server.Ssl
;
...
...
@@ -45,7 +45,7 @@ public class DefaultApplicationFactory implements ApplicationFactory {
private
final
InstanceProperties
instance
;
private
final
ServerProperties
server
;
private
final
ManagementServerProperties
management
;
private
final
EndpointPathProvider
endpointPathProvider
;
private
final
PathMappedEndpoints
pathMappedEndpoints
;
private
final
WebEndpointProperties
webEndpoint
;
private
final
OffsetDateTime
timestamp
;
private
Integer
localServerPort
;
...
...
@@ -54,13 +54,12 @@ public class DefaultApplicationFactory implements ApplicationFactory {
public
DefaultApplicationFactory
(
InstanceProperties
instance
,
ManagementServerProperties
management
,
ServerProperties
server
,
EndpointPathProvider
endpointPathProvider
,
ServerProperties
server
,
PathMappedEndpoints
pathMappedEndpoints
,
WebEndpointProperties
webEndpoint
)
{
this
.
instance
=
instance
;
this
.
management
=
management
;
this
.
server
=
server
;
this
.
endpointPathProvider
=
endpointPathProvider
;
this
.
pathMappedEndpoints
=
pathMappedEndpoints
;
this
.
webEndpoint
=
webEndpoint
;
this
.
timestamp
=
OffsetDateTime
.
now
();
}
...
...
@@ -205,11 +204,11 @@ public class DefaultApplicationFactory implements ApplicationFactory {
}
protected
String
getHealthEndpointPath
()
{
String
health
=
endpointPathProvider
.
getPath
(
"health"
);
String
health
=
pathMappedEndpoints
.
getPath
(
"health"
);
if
(
StringUtils
.
hasText
(
health
))
{
return
health
;
}
String
status
=
endpointPathProvider
.
getPath
(
"status"
);
String
status
=
pathMappedEndpoints
.
getPath
(
"status"
);
if
(
StringUtils
.
hasText
(
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");
* you may not use this file except in compliance with the License.
...
...
@@ -19,9 +19,9 @@ package de.codecentric.boot.admin.client.registration;
import
de.codecentric.boot.admin.client.config.InstanceProperties
;
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.web.server.ManagementServerProperties
;
import
org.springframework.boot.actuate.endpoint.web.PathMappedEndpoints
;
import
org.springframework.boot.autoconfigure.web.ServerProperties
;
import
org.springframework.web.util.UriComponentsBuilder
;
...
...
@@ -34,9 +34,9 @@ public class ServletApplicationFactory extends DefaultApplicationFactory {
ManagementServerProperties
management
,
ServerProperties
server
,
ServletContext
servletContext
,
EndpointPathProvider
endpointPathProvider
,
PathMappedEndpoints
pathMappedEndpoints
,
WebEndpointProperties
webEndpoint
)
{
super
(
instance
,
management
,
server
,
endpointPathProvider
,
webEndpoint
);
super
(
instance
,
management
,
server
,
pathMappedEndpoints
,
webEndpoint
);
this
.
servletContext
=
servletContext
;
this
.
servlet
=
server
.
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");
* you may not use this file except in compliance with the License.
...
...
@@ -22,9 +22,9 @@ import java.net.InetAddress;
import
java.net.UnknownHostException
;
import
org.junit.Before
;
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.web.server.ManagementServerProperties
;
import
org.springframework.boot.actuate.endpoint.web.PathMappedEndpoints
;
import
org.springframework.boot.autoconfigure.web.ServerProperties
;
import
org.springframework.boot.web.context.WebServerInitializedEvent
;
import
org.springframework.boot.web.server.Ssl
;
...
...
@@ -40,11 +40,11 @@ public class DefaultApplicationFactoryTest {
private
InstanceProperties
instanceProperties
=
new
InstanceProperties
();
private
ServerProperties
server
=
new
ServerProperties
();
private
ManagementServerProperties
management
=
new
ManagementServerProperties
();
private
EndpointPathProvider
endpointPathProvider
=
mock
(
EndpointPathProvider
.
class
);
private
PathMappedEndpoints
pathMappedEndpoints
=
mock
(
PathMappedEndpoints
.
class
);
private
WebEndpointProperties
webEndpoint
=
new
WebEndpointProperties
();
private
DefaultApplicationFactory
factory
=
new
DefaultApplicationFactory
(
instanceProperties
,
management
,
server
,
endpointPathProvider
,
webEndpoint
);
pathMappedEndpoints
,
webEndpoint
);
@Before
public
void
setup
()
{
...
...
@@ -54,7 +54,7 @@ public class DefaultApplicationFactoryTest {
@Test
public
void
test_mgmtPortPath
()
{
webEndpoint
.
setBasePath
(
"/admin"
);
when
(
endpointPathProvider
.
getPath
(
"health"
)).
thenReturn
(
"/admin/alive"
);
when
(
pathMappedEndpoints
.
getPath
(
"health"
)).
thenReturn
(
"/admin/alive"
);
publishApplicationReadyEvent
(
factory
,
8080
,
8081
);
Application
app
=
factory
.
createApplication
();
...
...
@@ -65,7 +65,7 @@ public class DefaultApplicationFactoryTest {
@Test
public
void
test_default
()
{
when
(
endpointPathProvider
.
getPath
(
"health"
)).
thenReturn
(
"/actuator/health"
);
when
(
pathMappedEndpoints
.
getPath
(
"health"
)).
thenReturn
(
"/actuator/health"
);
publishApplicationReadyEvent
(
factory
,
8080
,
null
);
Application
app
=
factory
.
createApplication
();
...
...
@@ -78,7 +78,7 @@ public class DefaultApplicationFactoryTest {
public
void
test_ssl
()
{
server
.
setSsl
(
new
Ssl
());
server
.
getSsl
().
setEnabled
(
true
);
when
(
endpointPathProvider
.
getPath
(
"health"
)).
thenReturn
(
"/actuator/health"
);
when
(
pathMappedEndpoints
.
getPath
(
"health"
)).
thenReturn
(
"/actuator/health"
);
publishApplicationReadyEvent
(
factory
,
8080
,
null
);
Application
app
=
factory
.
createApplication
();
...
...
@@ -91,7 +91,7 @@ public class DefaultApplicationFactoryTest {
public
void
test_ssl_management
()
{
management
.
setSsl
(
new
Ssl
());
management
.
getSsl
().
setEnabled
(
true
);
when
(
endpointPathProvider
.
getPath
(
"health"
)).
thenReturn
(
"/actuator/alive"
);
when
(
pathMappedEndpoints
.
getPath
(
"health"
)).
thenReturn
(
"/actuator/alive"
);
publishApplicationReadyEvent
(
factory
,
8080
,
9090
);
Application
app
=
factory
.
createApplication
();
...
...
@@ -103,7 +103,7 @@ public class DefaultApplicationFactoryTest {
@Test
public
void
test_preferIpAddress_serveraddress_missing
()
{
instanceProperties
.
setPreferIp
(
true
);
when
(
endpointPathProvider
.
getPath
(
"health"
)).
thenReturn
(
"/application/alive"
);
when
(
pathMappedEndpoints
.
getPath
(
"health"
)).
thenReturn
(
"/application/alive"
);
publishApplicationReadyEvent
(
factory
,
8080
,
null
);
Application
app
=
factory
.
createApplication
();
...
...
@@ -113,7 +113,7 @@ public class DefaultApplicationFactoryTest {
@Test
public
void
test_preferIpAddress_managementaddress_missing
()
{
instanceProperties
.
setPreferIp
(
true
);
when
(
endpointPathProvider
.
getPath
(
"health"
)).
thenReturn
(
"/application/alive"
);
when
(
pathMappedEndpoints
.
getPath
(
"health"
)).
thenReturn
(
"/application/alive"
);
publishApplicationReadyEvent
(
factory
,
8080
,
8081
);
Application
app
=
factory
.
createApplication
();
...
...
@@ -125,7 +125,7 @@ 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
(
"/actuator/health"
);
when
(
pathMappedEndpoints
.
getPath
(
"health"
)).
thenReturn
(
"/actuator/health"
);
publishApplicationReadyEvent
(
factory
,
8080
,
8081
);
Application
app
=
factory
.
createApplication
();
...
...
@@ -151,7 +151,7 @@ public class DefaultApplicationFactoryTest {
instanceProperties
.
setManagementBaseUrl
(
"http://management:8090"
);
instanceProperties
.
setServiceBaseUrl
(
"http://service:80"
);
webEndpoint
.
setBasePath
(
"/admin"
);
when
(
endpointPathProvider
.
getPath
(
"health"
)).
thenReturn
(
"/admin/health"
);
when
(
pathMappedEndpoints
.
getPath
(
"health"
)).
thenReturn
(
"/admin/health"
);
Application
app
=
factory
.
createApplication
();
assertThat
(
app
.
getServiceUrl
()).
isEqualTo
(
"http://service:80/"
);
...
...
@@ -163,7 +163,7 @@ public class DefaultApplicationFactoryTest {
public
void
test_service_baseUrl
()
{
instanceProperties
.
setServiceBaseUrl
(
"http://service:80"
);
webEndpoint
.
setBasePath
(
"/admin"
);
when
(
endpointPathProvider
.
getPath
(
"health"
)).
thenReturn
(
"/admin/health"
);
when
(
pathMappedEndpoints
.
getPath
(
"health"
)).
thenReturn
(
"/admin/health"
);
Application
app
=
factory
.
createApplication
();
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");
* you may not use this file except in compliance with the License.
...
...
@@ -22,9 +22,9 @@ import java.net.InetAddress;
import
java.net.UnknownHostException
;
import
org.junit.Before
;
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.web.server.ManagementServerProperties
;
import
org.springframework.boot.actuate.endpoint.web.PathMappedEndpoints
;
import
org.springframework.boot.autoconfigure.web.ServerProperties
;
import
org.springframework.boot.web.context.WebServerInitializedEvent
;
import
org.springframework.boot.web.server.WebServer
;
...
...
@@ -40,10 +40,10 @@ public class ServletApplicationFactoryTest {
private
ServerProperties
server
=
new
ServerProperties
();
private
ManagementServerProperties
management
=
new
ManagementServerProperties
();
private
MockServletContext
servletContext
=
new
MockServletContext
();
private
EndpointPathProvider
endpointPathProvider
=
mock
(
EndpointPathProvider
.
class
);
private
PathMappedEndpoints
pathMappedEndpoints
=
mock
(
PathMappedEndpoints
.
class
);
private
WebEndpointProperties
webEndpoint
=
new
WebEndpointProperties
();
private
ServletApplicationFactory
factory
=
new
ServletApplicationFactory
(
instance
,
management
,
server
,
servletContext
,
endpointPathProvider
,
webEndpoint
);
servletContext
,
pathMappedEndpoints
,
webEndpoint
);
@Before
public
void
setup
()
{
...
...
@@ -54,7 +54,7 @@ public class ServletApplicationFactoryTest {
public
void
test_contextPath_mgmtPath
()
{
servletContext
.
setContextPath
(
"app"
);
webEndpoint
.
setBasePath
(
"/admin"
);
when
(
endpointPathProvider
.
getPath
(
"health"
)).
thenReturn
(
"/admin/health"
);
when
(
pathMappedEndpoints
.
getPath
(
"health"
)).
thenReturn
(
"/admin/health"
);
publishApplicationReadyEvent
(
factory
,
8080
,
null
);
Application
app
=
factory
.
createApplication
();
...
...
@@ -67,7 +67,7 @@ public class ServletApplicationFactoryTest {
public
void
test_contextPath_mgmtPortPath
()
{
servletContext
.
setContextPath
(
"app"
);
webEndpoint
.
setBasePath
(
"/admin"
);
when
(
endpointPathProvider
.
getPath
(
"health"
)).
thenReturn
(
"/admin/health"
);
when
(
pathMappedEndpoints
.
getPath
(
"health"
)).
thenReturn
(
"/admin/health"
);
publishApplicationReadyEvent
(
factory
,
8080
,
8081
);
Application
app
=
factory
.
createApplication
();
...
...
@@ -79,7 +79,7 @@ public class ServletApplicationFactoryTest {
@Test
public
void
test_contextPath
()
{
servletContext
.
setContextPath
(
"app"
);
when
(
endpointPathProvider
.
getPath
(
"health"
)).
thenReturn
(
"/actuator/health"
);
when
(
pathMappedEndpoints
.
getPath
(
"health"
)).
thenReturn
(
"/actuator/health"
);
publishApplicationReadyEvent
(
factory
,
80
,
null
);
Application
app
=
factory
.
createApplication
();
...
...
@@ -92,7 +92,7 @@ public class ServletApplicationFactoryTest {
public
void
test_servletPath
()
{
server
.
getServlet
().
setPath
(
"app"
);
servletContext
.
setContextPath
(
"srv"
);
when
(
endpointPathProvider
.
getPath
(
"health"
)).
thenReturn
(
"/actuator/health"
);
when
(
pathMappedEndpoints
.
getPath
(
"health"
)).
thenReturn
(
"/actuator/health"
);
publishApplicationReadyEvent
(
factory
,
80
,
null
);
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