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
45e9a620
Commit
45e9a620
authored
Dec 04, 2014
by
Spencer Gibb
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of github.com:jlouns/spring-cloud-netflix into jlouns-master
parents
5964d160
51f7dbd7
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
2 deletions
+33
-2
ProxyRouteLocator.java
...springframework/cloud/netflix/zuul/ProxyRouteLocator.java
+2
-2
ProxyRouteLocatorTests.java
...gframework/cloud/netflix/zuul/ProxyRouteLocatorTests.java
+31
-0
No files found.
spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/zuul/ProxyRouteLocator.java
View file @
45e9a620
...
@@ -121,10 +121,10 @@ public class ProxyRouteLocator {
...
@@ -121,10 +121,10 @@ public class ProxyRouteLocator {
}
}
if
(
routesMap
.
get
(
DEFAULT_ROUTE
)
!=
null
)
{
if
(
routesMap
.
get
(
DEFAULT_ROUTE
)
!=
null
)
{
String
defaultServiceId
=
routesMap
.
get
(
DEFAULT_ROUTE
).
getServiceId
(
);
ZuulRoute
defaultRoute
=
routesMap
.
get
(
DEFAULT_ROUTE
);
// Move the defaultServiceId to the end
// Move the defaultServiceId to the end
routesMap
.
remove
(
DEFAULT_ROUTE
);
routesMap
.
remove
(
DEFAULT_ROUTE
);
routesMap
.
put
(
DEFAULT_ROUTE
,
new
ZuulRoute
(
defaultServiceId
)
);
routesMap
.
put
(
DEFAULT_ROUTE
,
defaultRoute
);
}
}
LinkedHashMap
<
String
,
ZuulRoute
>
values
=
new
LinkedHashMap
<>();
LinkedHashMap
<
String
,
ZuulRoute
>
values
=
new
LinkedHashMap
<>();
...
...
spring-cloud-netflix-core/src/test/java/org/springframework/cloud/netflix/zuul/ProxyRouteLocatorTests.java
View file @
45e9a620
...
@@ -144,6 +144,30 @@ public class ProxyRouteLocatorTests {
...
@@ -144,6 +144,30 @@ public class ProxyRouteLocatorTests {
}
}
@Test
@Test
public
void
testGetDefaultRoute
()
{
ProxyRouteLocator
routeLocator
=
new
ProxyRouteLocator
(
this
.
discovery
,
this
.
properties
);
this
.
properties
.
getRoutes
().
put
(
ASERVICE
,
new
ZuulRoute
(
"/"
,
ASERVICE
));
Map
<
String
,
String
>
routesMap
=
routeLocator
.
getRoutes
();
assertNotNull
(
"routesMap was null"
,
routesMap
);
assertFalse
(
"routesMap was empty"
,
routesMap
.
isEmpty
());
assertDefaultMapping
(
routesMap
,
ASERVICE
);
}
@Test
public
void
testGetDefaultPhysicalRoute
()
{
ProxyRouteLocator
routeLocator
=
new
ProxyRouteLocator
(
this
.
discovery
,
this
.
properties
);
this
.
properties
.
getRoutes
().
put
(
ASERVICE
,
new
ZuulRoute
(
"/"
,
"http://"
+
ASERVICE
));
Map
<
String
,
String
>
routesMap
=
routeLocator
.
getRoutes
();
assertNotNull
(
"routesMap was null"
,
routesMap
);
assertFalse
(
"routesMap was empty"
,
routesMap
.
isEmpty
());
assertDefaultMapping
(
routesMap
,
"http://"
+
ASERVICE
);
}
@Test
public
void
testIgnoreRoutes
()
{
public
void
testIgnoreRoutes
()
{
ProxyRouteLocator
routeLocator
=
new
ProxyRouteLocator
(
this
.
discovery
,
this
.
properties
);
ProxyRouteLocator
routeLocator
=
new
ProxyRouteLocator
(
this
.
discovery
,
this
.
properties
);
this
.
properties
.
setIgnoredServices
(
Lists
.
newArrayList
(
IGNOREDSERVICE
));
this
.
properties
.
setIgnoredServices
(
Lists
.
newArrayList
(
IGNOREDSERVICE
));
...
@@ -199,4 +223,11 @@ public class ProxyRouteLocatorTests {
...
@@ -199,4 +223,11 @@ public class ProxyRouteLocatorTests {
private
String
getMapping
(
String
serviceId
)
{
private
String
getMapping
(
String
serviceId
)
{
return
"/"
+
serviceId
+
"/**"
;
return
"/"
+
serviceId
+
"/**"
;
}
}
protected
void
assertDefaultMapping
(
Map
<
String
,
String
>
routesMap
,
String
expectedRoute
)
{
String
mapping
=
"/"
;
String
route
=
routesMap
.
get
(
mapping
);
assertEquals
(
"routesMap had wrong value for "
+
mapping
,
expectedRoute
,
route
);
}
}
}
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