Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
spring-cloud-netflix
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-cloud-netflix
Commits
d04df564
Unverified
Commit
d04df564
authored
Aug 29, 2016
by
Spencer Gibb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Try and fix old static wonkiness in test.
parent
5f192dd6
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
2 deletions
+29
-2
EurekaControllerReplicasTest.java
...d/netflix/eureka/server/EurekaControllerReplicasTest.java
+25
-0
EurekaControllerTest.java
...ork/cloud/netflix/eureka/server/EurekaControllerTest.java
+4
-2
No files found.
spring-cloud-netflix-eureka-server/src/test/java/org/springframework/cloud/netflix/eureka/server/EurekaControllerReplicasTest.java
View file @
d04df564
package
org
.
springframework
.
cloud
.
netflix
.
eureka
.
server
;
import
static
org
.
junit
.
Assert
.*;
import
static
org
.
mockito
.
Mockito
.
mock
;
import
static
org
.
mockito
.
Mockito
.
when
;
import
static
org
.
springframework
.
cloud
.
netflix
.
eureka
.
server
.
EurekaControllerTest
.
setInstance
;
import
java.util.Collections
;
import
java.util.HashMap
;
import
java.util.Map
;
import
com.netflix.appinfo.ApplicationInfoManager
;
import
com.netflix.appinfo.DataCenterInfo
;
import
com.netflix.appinfo.InstanceInfo
;
import
com.netflix.appinfo.MyDataCenterInfo
;
import
com.netflix.eureka.cluster.PeerEurekaNode
;
import
com.netflix.eureka.cluster.PeerEurekaNodes
;
import
org.junit.After
;
import
org.junit.Before
;
import
org.junit.Test
;
import
com.netflix.eureka.util.StatusInfo
;
...
...
@@ -21,6 +33,19 @@ public class EurekaControllerReplicasTest {
String
empty
=
new
String
();
private
ApplicationInfoManager
original
;
@Before
public
void
setup
()
throws
Exception
{
this
.
original
=
ApplicationInfoManager
.
getInstance
();
setInstance
(
mock
(
ApplicationInfoManager
.
class
));
}
@After
public
void
teardown
()
throws
Exception
{
setInstance
(
this
.
original
);
}
@Test
public
void
testFilterReplicasNoAuth
()
throws
Exception
{
Map
<
String
,
Object
>
model
=
new
HashMap
<
String
,
Object
>();
...
...
spring-cloud-netflix-eureka-server/src/test/java/org/springframework/cloud/netflix/eureka/server/EurekaControllerTest.java
View file @
d04df564
...
...
@@ -52,6 +52,7 @@ import static org.mockito.Mockito.when;
public
class
EurekaControllerTest
{
private
ApplicationInfoManager
infoManager
;
private
ApplicationInfoManager
original
;
@Before
public
void
setup
()
throws
Exception
{
...
...
@@ -64,6 +65,7 @@ public class EurekaControllerTest {
.
build
();
this
.
infoManager
=
mock
(
ApplicationInfoManager
.
class
);
this
.
original
=
ApplicationInfoManager
.
getInstance
();
setInstance
(
this
.
infoManager
);
when
(
this
.
infoManager
.
getInfo
()).
thenReturn
(
instanceInfo
);
...
...
@@ -90,10 +92,10 @@ public class EurekaControllerTest {
@After
public
void
teardown
()
throws
Exception
{
setInstance
(
nul
l
);
setInstance
(
this
.
origina
l
);
}
void
setInstance
(
ApplicationInfoManager
infoManager
)
throws
IllegalAccessException
{
static
void
setInstance
(
ApplicationInfoManager
infoManager
)
throws
IllegalAccessException
{
Field
instance
=
ReflectionUtils
.
findField
(
ApplicationInfoManager
.
class
,
"instance"
);
ReflectionUtils
.
makeAccessible
(
instance
);
instance
.
set
(
null
,
infoManager
);
...
...
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