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
e19ecf71
Unverified
Commit
e19ecf71
authored
Nov 27, 2017
by
Spencer Gibb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updates for boot 2.0 compatibility
parent
7c62bd88
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
18 additions
and
14 deletions
+18
-14
ApplicationContextTests.java
.../cloud/netflix/eureka/server/ApplicationContextTests.java
+3
-1
ApplicationServletPathTests.java
...ud/netflix/eureka/server/ApplicationServletPathTests.java
+3
-1
ApplicationTests.java
...amework/cloud/netflix/eureka/server/ApplicationTests.java
+3
-1
RoutesEndpointIntegrationTests.java
...rk/cloud/netflix/zuul/RoutesEndpointIntegrationTests.java
+5
-6
ServletPathZuulProxyApplicationTests.java
...ud/netflix/zuul/ServletPathZuulProxyApplicationTests.java
+4
-5
No files found.
spring-cloud-netflix-eureka-server/src/test/java/org/springframework/cloud/netflix/eureka/server/ApplicationContextTests.java
View file @
e19ecf71
...
...
@@ -22,6 +22,7 @@ import java.util.Map;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.springframework.boot.actuate.autoconfigure.endpoint.web.WebEndpointProperties
;
import
org.springframework.boot.autoconfigure.EnableAutoConfiguration
;
import
org.springframework.boot.builder.SpringApplicationBuilder
;
import
org.springframework.boot.test.context.SpringBootTest
;
...
...
@@ -46,6 +47,7 @@ import static org.junit.Assert.assertTrue;
properties
=
{
"spring.application.name=eureka"
,
"server.servlet.context-path=/context"
,
"management.security.enabled=false"
,
"management.endpoints.web.expose=*"
})
public
class
ApplicationContextTests
{
private
static
final
String
BASE_PATH
=
new
WebEndpointProperties
().
getBasePath
();
@LocalServerPort
private
int
port
=
0
;
...
...
@@ -95,7 +97,7 @@ public class ApplicationContextTests {
@SuppressWarnings
(
"rawtypes"
)
ResponseEntity
<
Map
>
entity
=
new
TestRestTemplate
().
exchange
(
"http://localhost:"
+
this
.
port
+
"/context
/application
/env"
,
HttpMethod
.
GET
,
"http://localhost:"
+
this
.
port
+
"/context
"
+
BASE_PATH
+
"
/env"
,
HttpMethod
.
GET
,
new
HttpEntity
<>(
"parameters"
,
headers
),
Map
.
class
);
assertEquals
(
HttpStatus
.
OK
,
entity
.
getStatusCode
());
}
...
...
spring-cloud-netflix-eureka-server/src/test/java/org/springframework/cloud/netflix/eureka/server/ApplicationServletPathTests.java
View file @
e19ecf71
...
...
@@ -21,6 +21,7 @@ import java.util.Map;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.springframework.boot.actuate.autoconfigure.endpoint.web.WebEndpointProperties
;
import
org.springframework.boot.autoconfigure.EnableAutoConfiguration
;
import
org.springframework.boot.builder.SpringApplicationBuilder
;
import
org.springframework.boot.test.context.SpringBootTest
;
...
...
@@ -45,6 +46,7 @@ import static org.springframework.boot.test.context.SpringBootTest.WebEnvironmen
"spring.application.name=eureka"
,
"server.servlet.path=/servlet"
,
"management.security.enabled=false"
,
"management.endpoints.web.expose=*"
})
public
class
ApplicationServletPathTests
{
private
static
final
String
BASE_PATH
=
new
WebEndpointProperties
().
getBasePath
();
@LocalServerPort
private
int
port
=
0
;
...
...
@@ -106,7 +108,7 @@ public class ApplicationServletPathTests {
@SuppressWarnings
(
"rawtypes"
)
ResponseEntity
<
Map
>
entity
=
new
TestRestTemplate
().
exchange
(
"http://localhost:"
+
this
.
port
+
"/servlet
/application
/env"
,
HttpMethod
.
GET
,
"http://localhost:"
+
this
.
port
+
"/servlet
"
+
BASE_PATH
+
"
/env"
,
HttpMethod
.
GET
,
new
HttpEntity
<>(
"parameters"
,
headers
),
Map
.
class
);
assertEquals
(
HttpStatus
.
OK
,
entity
.
getStatusCode
());
}
...
...
spring-cloud-netflix-eureka-server/src/test/java/org/springframework/cloud/netflix/eureka/server/ApplicationTests.java
View file @
e19ecf71
...
...
@@ -22,6 +22,7 @@ import java.util.Map;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.boot.actuate.autoconfigure.endpoint.web.WebEndpointProperties
;
import
org.springframework.boot.autoconfigure.EnableAutoConfiguration
;
import
org.springframework.boot.builder.SpringApplicationBuilder
;
import
org.springframework.boot.test.context.SpringBootTest
;
...
...
@@ -54,6 +55,7 @@ import static org.springframework.boot.test.context.SpringBootTest.WebEnvironmen
@SpringBootTest
(
classes
=
Application
.
class
,
webEnvironment
=
RANDOM_PORT
,
properties
=
{
"spring.jmx.enabled=true"
,
"management.security.enabled=false"
,
"management.endpoints.web.expose=*"
})
public
class
ApplicationTests
{
private
static
final
String
BASE_PATH
=
new
WebEndpointProperties
().
getBasePath
();
@LocalServerPort
private
int
port
=
0
;
...
...
@@ -76,7 +78,7 @@ public class ApplicationTests {
@SuppressWarnings
(
"rawtypes"
)
ResponseEntity
<
Map
>
entity
=
new
TestRestTemplate
().
exchange
(
"http://localhost:"
+
this
.
port
+
"/application
/env"
,
HttpMethod
.
GET
,
"http://localhost:"
+
this
.
port
+
BASE_PATH
+
"
/env"
,
HttpMethod
.
GET
,
new
HttpEntity
<>(
"parameters"
,
headers
),
Map
.
class
);
assertEquals
(
HttpStatus
.
OK
,
entity
.
getStatusCode
());
}
...
...
spring-cloud-netflix-zuul/src/test/java/org/springframework/cloud/netflix/zuul/RoutesEndpointIntegrationTests.java
View file @
e19ecf71
...
...
@@ -22,12 +22,10 @@ import java.util.Map;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.boot.actuate.autoconfigure.endpoint.web.WebEndpointProperties
;
import
org.springframework.boot.autoconfigure.EnableAutoConfiguration
;
import
org.springframework.boot.test.context.SpringBootTest
;
import
org.springframework.boot.test.web.client.TestRestTemplate
;
import
org.springframework.cloud.netflix.zuul.EnableZuulProxy
;
import
org.springframework.cloud.netflix.zuul.RoutesEndpoint
;
import
org.springframework.cloud.netflix.zuul.RoutesRefreshedEvent
;
import
org.springframework.context.ApplicationListener
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.core.ParameterizedTypeReference
;
...
...
@@ -54,6 +52,7 @@ import static org.springframework.boot.test.context.SpringBootTest.WebEnvironmen
value
=
{
"zuul.routes.sslservice.url=https://localhost:8443"
,
"management.security.enabled=false"
,
"management.endpoints.web.expose=*"
})
@DirtiesContext
public
class
RoutesEndpointIntegrationTests
{
private
static
final
String
BASE_PATH
=
new
WebEndpointProperties
().
getBasePath
();
@Autowired
private
TestRestTemplate
restTemplate
;
...
...
@@ -64,14 +63,14 @@ public class RoutesEndpointIntegrationTests {
@Test
@SuppressWarnings
(
"unchecked"
)
public
void
getRoutesTest
()
{
Map
<
String
,
String
>
routes
=
restTemplate
.
getForObject
(
"/application
/routes"
,
Map
.
class
);
Map
<
String
,
String
>
routes
=
restTemplate
.
getForObject
(
BASE_PATH
+
"
/routes"
,
Map
.
class
);
assertEquals
(
"https://localhost:8443"
,
routes
.
get
(
"/sslservice/**"
));
}
@Test
@SuppressWarnings
(
"unchecked"
)
public
void
postRoutesTest
()
{
Map
<
String
,
String
>
routes
=
restTemplate
.
postForObject
(
"/application
/routes"
,
null
,
Map
.
class
);
Map
<
String
,
String
>
routes
=
restTemplate
.
postForObject
(
BASE_PATH
+
"
/routes"
,
null
,
Map
.
class
);
assertEquals
(
"https://localhost:8443"
,
routes
.
get
(
"/sslservice/**"
));
assertTrue
(
refreshListener
.
wasCalled
());
}
...
...
@@ -79,7 +78,7 @@ public class RoutesEndpointIntegrationTests {
@Test
public
void
getRouteDetailsTest
()
{
ResponseEntity
<
Map
<
String
,
RoutesEndpoint
.
RouteDetails
>>
responseEntity
=
restTemplate
.
exchange
(
"/application
/routes/details"
,
HttpMethod
.
GET
,
null
,
new
ParameterizedTypeReference
<
Map
<
String
,
RoutesEndpoint
.
RouteDetails
>>()
{
BASE_PATH
+
"
/routes/details"
,
HttpMethod
.
GET
,
null
,
new
ParameterizedTypeReference
<
Map
<
String
,
RoutesEndpoint
.
RouteDetails
>>()
{
});
assertThat
(
responseEntity
.
getStatusCode
(),
is
(
HttpStatus
.
OK
));
...
...
spring-cloud-netflix-zuul/src/test/java/org/springframework/cloud/netflix/zuul/ServletPathZuulProxyApplicationTests.java
View file @
e19ecf71
...
...
@@ -49,9 +49,10 @@ import org.springframework.web.bind.annotation.RestController;
import
com.netflix.zuul.context.RequestContext
;
import
static
org
.
junit
.
Assert
.
assertEquals
;
import
static
org
.
springframework
.
boot
.
test
.
context
.
SpringBootTest
.
WebEnvironment
.
RANDOM_PORT
;
@RunWith
(
SpringJUnit4ClassRunner
.
class
)
@SpringBootTest
(
classes
=
ServletPathZuulProxyApplicationTests
.
ServletPathZuulProxyApplication
.
class
,
webEnvironment
=
WebEnvironment
.
RANDOM_PORT
,
properties
=
{
@SpringBootTest
(
classes
=
ServletPathZuulProxyApplicationTests
.
ServletPathZuulProxyApplication
.
class
,
webEnvironment
=
RANDOM_PORT
,
properties
=
{
"server.servlet.path: /app"
})
@DirtiesContext
public
class
ServletPathZuulProxyApplicationTests
{
...
...
@@ -99,8 +100,7 @@ public class ServletPathZuulProxyApplicationTests {
HttpHeaders
httpHeaders
=
result
.
getHeaders
();
assertEquals
(
HttpStatus
.
OK
,
result
.
getStatusCode
());
assertEquals
(
"http://localhost:9000"
,
httpHeaders
.
getFirst
(
"Access-Control-Allow-Origin"
));
assertEquals
(
"*"
,
httpHeaders
.
getFirst
(
"Access-Control-Allow-Origin"
));
}
@Test
...
...
@@ -115,8 +115,7 @@ public class ServletPathZuulProxyApplicationTests {
HttpHeaders
httpHeaders
=
result
.
getHeaders
();
assertEquals
(
HttpStatus
.
OK
,
result
.
getStatusCode
());
assertEquals
(
"http://localhost:9000"
,
httpHeaders
.
getFirst
(
"Access-Control-Allow-Origin"
));
assertEquals
(
"*"
,
httpHeaders
.
getFirst
(
"Access-Control-Allow-Origin"
));
}
@Test
...
...
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