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
a878472a
Unverified
Commit
a878472a
authored
Oct 23, 2017
by
Spencer Gibb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updates to boot 2.0.0 endpoint and properties.
parent
ef508b42
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
39 additions
and
30 deletions
+39
-30
EurekaClientAutoConfigurationTests.java
...ud/netflix/eureka/EurekaClientAutoConfigurationTests.java
+5
-3
FiltersEndpoint.java
...g/springframework/cloud/netflix/zuul/FiltersEndpoint.java
+10
-14
FiltersEndpointTests.java
...ingframework/cloud/netflix/zuul/FiltersEndpointTests.java
+24
-10
RoutesEndpointDetailsTests.java
...mework/cloud/netflix/zuul/RoutesEndpointDetailsTests.java
+0
-3
No files found.
spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/EurekaClientAutoConfigurationTests.java
View file @
a878472a
...
@@ -105,7 +105,10 @@ public class EurekaClientAutoConfigurationTests {
...
@@ -105,7 +105,10 @@ public class EurekaClientAutoConfigurationTests {
@Test
@Test
public
void
securePortUnderscores
()
{
public
void
securePortUnderscores
()
{
testSecurePort
(
"SERVER_PORT"
);
TestPropertyValues
.
of
(
"eureka.instance.secure-port-enabled=true"
).
applyTo
(
this
.
context
);
addSystemEnvironment
(
this
.
context
.
getEnvironment
(),
"SERVER_PORT:8443"
);
setupContext
();
assertEquals
(
8443
,
getInstanceConfig
().
getSecurePort
());
}
}
@Test
@Test
...
@@ -396,8 +399,7 @@ public class EurekaClientAutoConfigurationTests {
...
@@ -396,8 +399,7 @@ public class EurekaClientAutoConfigurationTests {
}
}
private
void
testSecurePort
(
String
propName
)
{
private
void
testSecurePort
(
String
propName
)
{
EnvironmentTestUtils
.
addEnvironment
(
this
.
context
,
"eureka.instance.securePortEnabled=true"
);
TestPropertyValues
.
of
(
"eureka.instance.secure-port-enabled=true"
,
propName
+
":8443"
).
applyTo
(
this
.
context
);
addEnvironment
(
this
.
context
,
propName
+
":8443"
);
setupContext
();
setupContext
();
assertEquals
(
8443
,
getInstanceConfig
().
getSecurePort
());
assertEquals
(
8443
,
getInstanceConfig
().
getSecurePort
());
}
}
...
...
spring-cloud-netflix-
core
/src/main/java/org/springframework/cloud/netflix/zuul/FiltersEndpoint.java
→
spring-cloud-netflix-
zuul
/src/main/java/org/springframework/cloud/netflix/zuul/FiltersEndpoint.java
View file @
a878472a
package
org
.
springframework
.
cloud
.
netflix
.
zuul
;
package
org
.
springframework
.
cloud
.
netflix
.
zuul
;
import
com.netflix.zuul.ZuulFilter
;
import
com.netflix.zuul.filters.FilterRegistry
;
import
org.springframework.boot.actuate.endpoint.AbstractEndpoint
;
import
org.springframework.jmx.export.annotation.ManagedAttribute
;
import
org.springframework.jmx.export.annotation.ManagedResource
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.LinkedHashMap
;
import
java.util.LinkedHashMap
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
import
java.util.TreeMap
;
import
java.util.TreeMap
;
import
org.springframework.boot.actuate.endpoint.annotation.Endpoint
;
import
org.springframework.boot.actuate.endpoint.annotation.ReadOperation
;
import
com.netflix.zuul.ZuulFilter
;
import
com.netflix.zuul.filters.FilterRegistry
;
/**
/**
* Endpoint for listing Zuul filters.
* Endpoint for listing Zuul filters.
*
*
* @author Daryl Robbins
* @author Daryl Robbins
* @author Gregor Zurowski
* @author Gregor Zurowski
*/
*/
@ManagedResource
(
description
=
"List Zuul filters"
)
@Endpoint
(
id
=
"filters"
)
public
class
FiltersEndpoint
extends
AbstractEndpoint
<
Map
<
String
,
List
<
Map
<
String
,
Object
>>>>
{
public
class
FiltersEndpoint
{
private
static
final
String
ID
=
"filters"
;
private
final
FilterRegistry
filterRegistry
;
private
final
FilterRegistry
filterRegistry
;
public
FiltersEndpoint
(
FilterRegistry
filterRegistry
)
{
public
FiltersEndpoint
(
FilterRegistry
filterRegistry
)
{
super
(
ID
,
true
);
this
.
filterRegistry
=
filterRegistry
;
this
.
filterRegistry
=
filterRegistry
;
}
}
@ManagedAttribute
@ReadOperation
@Override
public
Map
<
String
,
List
<
Map
<
String
,
Object
>>>
invoke
()
{
public
Map
<
String
,
List
<
Map
<
String
,
Object
>>>
invoke
()
{
// Map of filters by type
// Map of filters by type
final
Map
<
String
,
List
<
Map
<
String
,
Object
>>>
filterMap
=
new
TreeMap
<>();
final
Map
<
String
,
List
<
Map
<
String
,
Object
>>>
filterMap
=
new
TreeMap
<>();
...
@@ -39,7 +35,7 @@ public class FiltersEndpoint extends AbstractEndpoint<Map<String, List<Map<Strin
...
@@ -39,7 +35,7 @@ public class FiltersEndpoint extends AbstractEndpoint<Map<String, List<Map<Strin
for
(
ZuulFilter
filter
:
this
.
filterRegistry
.
getAllFilters
())
{
for
(
ZuulFilter
filter
:
this
.
filterRegistry
.
getAllFilters
())
{
// Ensure that we have a list to store filters of each type
// Ensure that we have a list to store filters of each type
if
(!
filterMap
.
containsKey
(
filter
.
filterType
()))
{
if
(!
filterMap
.
containsKey
(
filter
.
filterType
()))
{
filterMap
.
put
(
filter
.
filterType
(),
new
ArrayList
<
Map
<
String
,
Object
>
>());
filterMap
.
put
(
filter
.
filterType
(),
new
ArrayList
<>());
}
}
final
Map
<
String
,
Object
>
filterInfo
=
new
LinkedHashMap
<>();
final
Map
<
String
,
Object
>
filterInfo
=
new
LinkedHashMap
<>();
...
...
spring-cloud-netflix-
core
/src/test/java/org/springframework/cloud/netflix/zuul/FiltersEndpointTests.java
→
spring-cloud-netflix-
zuul
/src/test/java/org/springframework/cloud/netflix/zuul/FiltersEndpointTests.java
View file @
a878472a
/*
* Copyright 2013-2017 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.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org
.
springframework
.
cloud
.
netflix
.
zuul
;
package
org
.
springframework
.
cloud
.
netflix
.
zuul
;
import
com.netflix.zuul.ZuulFilter
;
import
java.util.List
;
import
java.util.Map
;
import
org.junit.Test
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.junit.runner.RunWith
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.boot.SpringBootConfiguration
;
import
org.springframework.boot.autoconfigure.EnableAutoConfiguration
;
import
org.springframework.boot.autoconfigure.EnableAutoConfiguration
;
import
org.springframework.boot.test.context.SpringBootTest
;
import
org.springframework.boot.test.context.SpringBootTest
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.test.context.junit4.SpringJUnit4ClassRunner
;
import
org.springframework.test.context.junit4.SpringJUnit4ClassRunner
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.List
;
import
com.netflix.zuul.ZuulFilter
;
import
java.util.Map
;
import
static
org
.
hibernate
.
validator
.
internal
.
util
.
Contracts
.
assertTrue
;
import
static
org
.
hibernate
.
validator
.
internal
.
util
.
Contracts
.
assertTrue
;
import
static
org
.
junit
.
Assert
.
assertEquals
;
import
static
org
.
junit
.
Assert
.
assertEquals
;
import
static
org
.
springframework
.
boot
.
test
.
context
.
SpringBootTest
.
WebEnvironment
.
RANDOM_PORT
;
/**
/**
* Tests for Filters endpoint
* Tests for Filters endpoint
*/
*/
@RunWith
(
SpringJUnit4ClassRunner
.
class
)
@RunWith
(
SpringJUnit4ClassRunner
.
class
)
@SpringBootTest
(
classes
=
FiltersEndpointApplication
.
class
,
@SpringBootTest
(
webEnvironment
=
RANDOM_PORT
)
webEnvironment
=
SpringBootTest
.
WebEnvironment
.
RANDOM_PORT
,
value
=
{
"server.contextPath: /app"
})
public
class
FiltersEndpointTests
{
public
class
FiltersEndpointTests
{
@Autowired
@Autowired
...
@@ -53,9 +68,8 @@ public class FiltersEndpointTests {
...
@@ -53,9 +68,8 @@ public class FiltersEndpointTests {
}
}
@Configuration
@
SpringBoot
Configuration
@EnableAutoConfiguration
@EnableAutoConfiguration
@RestController
@EnableZuulProxy
@EnableZuulProxy
class
FiltersEndpointApplication
{
class
FiltersEndpointApplication
{
...
...
spring-cloud-netflix-zuul/src/test/java/org/springframework/cloud/netflix/zuul/RoutesEndpointDetailsTests.java
View file @
a878472a
...
@@ -31,9 +31,6 @@ import org.junit.runner.RunWith;
...
@@ -31,9 +31,6 @@ import org.junit.runner.RunWith;
import
org.mockito.Mock
;
import
org.mockito.Mock
;
import
org.mockito.junit.MockitoJUnitRunner
;
import
org.mockito.junit.MockitoJUnitRunner
;
import
org.springframework.boot.test.context.SpringBootTest
;
import
org.springframework.boot.test.context.SpringBootTest
;
import
org.springframework.cloud.netflix.zuul.RoutesEndpoint
;
import
org.springframework.cloud.netflix.zuul.RoutesRefreshedEvent
;
import
org.springframework.cloud.netflix.zuul.RoutesMvcEndpoint
;
import
org.springframework.cloud.netflix.zuul.filters.Route
;
import
org.springframework.cloud.netflix.zuul.filters.Route
;
import
org.springframework.cloud.netflix.zuul.filters.RouteLocator
;
import
org.springframework.cloud.netflix.zuul.filters.RouteLocator
;
import
org.springframework.context.ApplicationEventPublisher
;
import
org.springframework.context.ApplicationEventPublisher
;
...
...
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