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
b2bee48a
Commit
b2bee48a
authored
Dec 10, 2016
by
Johannes Edmeier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix test
parent
db292d9c
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
4 deletions
+18
-4
DiscoveryClientConfigurationTest.java
...c/boot/admin/config/DiscoveryClientConfigurationTest.java
+18
-4
No files found.
spring-boot-admin-server/src/test/java/de/codecentric/boot/admin/config/DiscoveryClientConfigurationTest.java
View file @
b2bee48a
...
@@ -6,17 +6,19 @@ import static org.junit.Assert.assertThat;
...
@@ -6,17 +6,19 @@ import static org.junit.Assert.assertThat;
import
org.junit.After
;
import
org.junit.After
;
import
org.junit.Test
;
import
org.junit.Test
;
import
org.mockito.Mockito
;
import
org.springframework.boot.autoconfigure.PropertyPlaceholderAutoConfiguration
;
import
org.springframework.boot.autoconfigure.PropertyPlaceholderAutoConfiguration
;
import
org.springframework.boot.autoconfigure.web.ServerPropertiesAutoConfiguration
;
import
org.springframework.boot.autoconfigure.web.ServerPropertiesAutoConfiguration
;
import
org.springframework.boot.autoconfigure.web.WebClientAutoConfiguration.RestTemplateConfiguration
;
import
org.springframework.boot.autoconfigure.web.WebClientAutoConfiguration.RestTemplateConfiguration
;
import
org.springframework.cloud.client.ServiceInstance
;
import
org.springframework.cloud.client.ServiceInstance
;
import
org.springframework.cloud.client.discovery.DiscoveryClient
;
import
org.springframework.cloud.client.discovery.noop.NoopDiscoveryClientAutoConfiguration
;
import
org.springframework.cloud.client.discovery.noop.NoopDiscoveryClientAutoConfiguration
;
import
org.springframework.cloud.commons.util.UtilAutoConfiguration
;
import
org.springframework.cloud.netflix.eureka.EurekaClientAutoConfiguration
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.web.context.support.AnnotationConfigWebApplicationContext
;
import
org.springframework.web.context.support.AnnotationConfigWebApplicationContext
;
import
com.netflix.discovery.EurekaClient
;
import
de.codecentric.boot.admin.discovery.DefaultServiceInstanceConverter
;
import
de.codecentric.boot.admin.discovery.DefaultServiceInstanceConverter
;
import
de.codecentric.boot.admin.discovery.EurekaServiceInstanceConverter
;
import
de.codecentric.boot.admin.discovery.EurekaServiceInstanceConverter
;
import
de.codecentric.boot.admin.discovery.ServiceInstanceConverter
;
import
de.codecentric.boot.admin.discovery.ServiceInstanceConverter
;
...
@@ -42,7 +44,7 @@ public class DiscoveryClientConfigurationTest {
...
@@ -42,7 +44,7 @@ public class DiscoveryClientConfigurationTest {
@Test
@Test
public
void
eurekaServiceInstanceConverter
()
{
public
void
eurekaServiceInstanceConverter
()
{
load
(
UtilAutoConfiguration
.
class
,
EurekaClientAutoConfiguration
.
class
);
load
(
EurekaClientConfig
.
class
);
assertThat
(
context
.
getBean
(
ServiceInstanceConverter
.
class
),
assertThat
(
context
.
getBean
(
ServiceInstanceConverter
.
class
),
is
(
instanceOf
(
EurekaServiceInstanceConverter
.
class
)));
is
(
instanceOf
(
EurekaServiceInstanceConverter
.
class
)));
}
}
...
@@ -55,7 +57,6 @@ public class DiscoveryClientConfigurationTest {
...
@@ -55,7 +57,6 @@ public class DiscoveryClientConfigurationTest {
is
(
instanceOf
(
CustomServiceInstanceConverter
.
class
)));
is
(
instanceOf
(
CustomServiceInstanceConverter
.
class
)));
}
}
@Configuration
@Configuration
static
class
TestCustomServiceInstanceConverterConfig
{
static
class
TestCustomServiceInstanceConverterConfig
{
@Bean
@Bean
...
@@ -71,6 +72,19 @@ public class DiscoveryClientConfigurationTest {
...
@@ -71,6 +72,19 @@ public class DiscoveryClientConfigurationTest {
}
}
}
}
@Configuration
protected
static
class
EurekaClientConfig
{
@Bean
public
EurekaClient
eurekaClient
()
{
return
Mockito
.
mock
(
EurekaClient
.
class
);
}
@Bean
public
DiscoveryClient
discoveryClient
()
{
return
Mockito
.
mock
(
DiscoveryClient
.
class
);
}
}
private
void
load
(
Class
<?>...
configs
)
{
private
void
load
(
Class
<?>...
configs
)
{
AnnotationConfigWebApplicationContext
applicationContext
=
new
AnnotationConfigWebApplicationContext
();
AnnotationConfigWebApplicationContext
applicationContext
=
new
AnnotationConfigWebApplicationContext
();
for
(
Class
<?>
config
:
configs
)
{
for
(
Class
<?>
config
:
configs
)
{
...
...
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