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
Hide 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
;
package
org
.
springframework
.
cloud
.
netflix
.
eureka
.
server
;
import
static
org
.
junit
.
Assert
.*;
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.HashMap
;
import
java.util.Map
;
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
org.junit.Test
;
import
com.netflix.eureka.util.StatusInfo
;
import
com.netflix.eureka.util.StatusInfo
;
...
@@ -20,6 +32,19 @@ public class EurekaControllerReplicasTest {
...
@@ -20,6 +32,19 @@ public class EurekaControllerReplicasTest {
String
authList2
=
authList1
+
",http://user2:pwd2@test2.com"
;
String
authList2
=
authList1
+
",http://user2:pwd2@test2.com"
;
String
empty
=
new
String
();
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
@Test
public
void
testFilterReplicasNoAuth
()
throws
Exception
{
public
void
testFilterReplicasNoAuth
()
throws
Exception
{
...
...
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;
...
@@ -52,6 +52,7 @@ import static org.mockito.Mockito.when;
public
class
EurekaControllerTest
{
public
class
EurekaControllerTest
{
private
ApplicationInfoManager
infoManager
;
private
ApplicationInfoManager
infoManager
;
private
ApplicationInfoManager
original
;
@Before
@Before
public
void
setup
()
throws
Exception
{
public
void
setup
()
throws
Exception
{
...
@@ -64,6 +65,7 @@ public class EurekaControllerTest {
...
@@ -64,6 +65,7 @@ public class EurekaControllerTest {
.
build
();
.
build
();
this
.
infoManager
=
mock
(
ApplicationInfoManager
.
class
);
this
.
infoManager
=
mock
(
ApplicationInfoManager
.
class
);
this
.
original
=
ApplicationInfoManager
.
getInstance
();
setInstance
(
this
.
infoManager
);
setInstance
(
this
.
infoManager
);
when
(
this
.
infoManager
.
getInfo
()).
thenReturn
(
instanceInfo
);
when
(
this
.
infoManager
.
getInfo
()).
thenReturn
(
instanceInfo
);
...
@@ -90,10 +92,10 @@ public class EurekaControllerTest {
...
@@ -90,10 +92,10 @@ public class EurekaControllerTest {
@After
@After
public
void
teardown
()
throws
Exception
{
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"
);
Field
instance
=
ReflectionUtils
.
findField
(
ApplicationInfoManager
.
class
,
"instance"
);
ReflectionUtils
.
makeAccessible
(
instance
);
ReflectionUtils
.
makeAccessible
(
instance
);
instance
.
set
(
null
,
infoManager
);
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