Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
S
spring-boot
Project
Project
Details
Activity
Releases
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
DEMO
spring-boot
Commits
60afbdc8
Commit
60afbdc8
authored
Nov 06, 2017
by
Andy Wilkinson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Polish
parent
871d65d8
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
85 additions
and
77 deletions
+85
-77
CloudFoundryWebFluxEndpointHandlerMapping.java
...y/reactive/CloudFoundryWebFluxEndpointHandlerMapping.java
+14
-11
ReactiveTokenValidator.java
...nfigure/cloudfoundry/reactive/ReactiveTokenValidator.java
+2
-2
ReactiveCloudFoundrySecurityInterceptorTests.java
...eactive/ReactiveCloudFoundrySecurityInterceptorTests.java
+3
-4
ReactiveCloudFoundrySecurityServiceTests.java
...ry/reactive/ReactiveCloudFoundrySecurityServiceTests.java
+36
-38
MetricsRestTemplateCustomizerTests.java
...etrics/web/client/MetricsRestTemplateCustomizerTests.java
+1
-1
DefaultErrorWebExceptionHandler.java
...e/web/reactive/error/DefaultErrorWebExceptionHandler.java
+2
-2
City.java
...ingframework/boot/autoconfigure/data/neo4j/city/City.java
+4
-2
Country.java
...mework/boot/autoconfigure/data/neo4j/country/Country.java
+4
-2
OAuth2WebSecurityConfigurationTests.java
...ty/oauth2/client/OAuth2WebSecurityConfigurationTests.java
+2
-2
ExampleGraph.java
...work/boot/test/autoconfigure/data/neo4j/ExampleGraph.java
+4
-2
LogbackLoggingSystemTests.java
...ework/boot/logging/logback/LogbackLoggingSystemTests.java
+6
-6
Customer.java
...-data-neo4j/src/main/java/sample/data/neo4j/Customer.java
+7
-5
No files found.
spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/reactive/CloudFoundryWebFluxEndpointHandlerMapping.java
View file @
60afbdc8
...
...
@@ -98,17 +98,20 @@ class CloudFoundryWebFluxEndpointHandlerMapping
@ResponseBody
private
Publisher
<
ResponseEntity
<
Object
>>
links
(
ServerWebExchange
exchange
)
{
ServerHttpRequest
request
=
exchange
.
getRequest
();
return
this
.
securityInterceptor
.
preHandle
(
exchange
,
""
).
map
(
securityResponse
->
{
if
(!
securityResponse
.
getStatus
().
equals
(
HttpStatus
.
OK
))
{
return
new
ResponseEntity
<>(
securityResponse
.
getStatus
());
}
AccessLevel
accessLevel
=
exchange
.
getAttribute
(
AccessLevel
.
REQUEST_ATTRIBUTE
);
Map
<
String
,
Link
>
links
=
this
.
endpointLinksResolver
.
resolveLinks
(
getEndpoints
(),
request
.
getURI
().
toString
());
return
new
ResponseEntity
<>(
Collections
.
singletonMap
(
"_links"
,
getAccessibleLinks
(
accessLevel
,
links
)),
HttpStatus
.
OK
);
});
return
this
.
securityInterceptor
.
preHandle
(
exchange
,
""
)
.
map
((
securityResponse
)
->
{
if
(!
securityResponse
.
getStatus
().
equals
(
HttpStatus
.
OK
))
{
return
new
ResponseEntity
<>(
securityResponse
.
getStatus
());
}
AccessLevel
accessLevel
=
exchange
.
getAttribute
(
AccessLevel
.
REQUEST_ATTRIBUTE
);
Map
<
String
,
Link
>
links
=
this
.
endpointLinksResolver
.
resolveLinks
(
getEndpoints
(),
request
.
getURI
().
toString
());
return
new
ResponseEntity
<>(
Collections
.
singletonMap
(
"_links"
,
getAccessibleLinks
(
accessLevel
,
links
)),
HttpStatus
.
OK
);
});
}
private
Map
<
String
,
Link
>
getAccessibleLinks
(
AccessLevel
accessLevel
,
...
...
spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/reactive/ReactiveTokenValidator.java
View file @
60afbdc8
...
...
@@ -68,11 +68,11 @@ class ReactiveTokenValidator {
private
Mono
<
Void
>
validateKeyIdAndSignature
(
Token
token
)
{
String
keyId
=
token
.
getKeyId
();
return
this
.
securityService
.
fetchTokenKeys
()
.
filter
(
tokenKeys
->
tokenKeys
.
containsKey
(
keyId
))
.
filter
(
(
tokenKeys
)
->
tokenKeys
.
containsKey
(
keyId
))
.
switchIfEmpty
(
Mono
.
error
(
new
CloudFoundryAuthorizationException
(
Reason
.
INVALID_KEY_ID
,
"Key Id present in token header does not match"
)))
.
filter
(
tokenKeys
->
hasValidSignature
(
token
,
tokenKeys
.
get
(
keyId
)))
.
filter
(
(
tokenKeys
)
->
hasValidSignature
(
token
,
tokenKeys
.
get
(
keyId
)))
.
switchIfEmpty
(
Mono
.
error
(
new
CloudFoundryAuthorizationException
(
Reason
.
INVALID_SIGNATURE
,
"RSA Signature did not match content"
)))
.
then
();
...
...
spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/reactive/ReactiveCloudFoundrySecurityInterceptorTests.java
View file @
60afbdc8
...
...
@@ -130,10 +130,9 @@ public class ReactiveCloudFoundrySecurityInterceptorTests {
.
header
(
HttpHeaders
.
AUTHORIZATION
,
"bearer "
+
mockAccessToken
())
.
build
());
StepVerifier
.
create
(
this
.
interceptor
.
preHandle
(
request
,
"/a"
))
.
consumeNextWith
((
response
)
->
{
assertThat
(
response
.
getStatus
())
.
isEqualTo
(
Reason
.
ACCESS_DENIED
.
getStatus
());
}).
verifyComplete
();
.
consumeNextWith
((
response
)
->
assertThat
(
response
.
getStatus
())
.
isEqualTo
(
Reason
.
ACCESS_DENIED
.
getStatus
()))
.
verifyComplete
();
}
@Test
...
...
spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/reactive/ReactiveCloudFoundrySecurityServiceTests.java
View file @
60afbdc8
...
...
@@ -70,15 +70,15 @@ public class ReactiveCloudFoundrySecurityServiceTests {
@Test
public
void
getAccessLevelWhenSpaceDeveloperShouldReturnFull
()
throws
Exception
{
String
responseBody
=
"{\"read_sensitive_data\": true,\"read_basic_data\": true}"
;
prepareResponse
(
response
->
response
.
setBody
(
responseBody
)
prepareResponse
(
(
response
)
->
response
.
setBody
(
responseBody
)
.
setHeader
(
"Content-Type"
,
"application/json"
));
StepVerifier
.
create
(
this
.
securityService
.
getAccessLevel
(
"my-access-token"
,
"my-app-id"
))
.
consumeNextWith
(
accessLevel
->
assertThat
(
accessLevel
)
.
consumeNextWith
(
(
accessLevel
)
->
assertThat
(
accessLevel
)
.
isEqualTo
(
AccessLevel
.
FULL
))
.
expectComplete
().
verify
();
expectRequest
(
request
->
{
expectRequest
(
(
request
)
->
{
assertThat
(
request
.
getHeader
(
HttpHeaders
.
AUTHORIZATION
))
.
isEqualTo
(
"bearer my-access-token"
);
assertThat
(
request
.
getPath
()).
isEqualTo
(
CLOUD_CONTROLLER_PERMISSIONS
);
...
...
@@ -89,15 +89,15 @@ public class ReactiveCloudFoundrySecurityServiceTests {
public
void
getAccessLevelWhenNotSpaceDeveloperShouldReturnRestricted
()
throws
Exception
{
String
responseBody
=
"{\"read_sensitive_data\": false,\"read_basic_data\": true}"
;
prepareResponse
(
response
->
response
.
setBody
(
responseBody
)
prepareResponse
(
(
response
)
->
response
.
setBody
(
responseBody
)
.
setHeader
(
"Content-Type"
,
"application/json"
));
StepVerifier
.
create
(
this
.
securityService
.
getAccessLevel
(
"my-access-token"
,
"my-app-id"
))
.
consumeNextWith
(
accessLevel
->
assertThat
(
accessLevel
)
.
consumeNextWith
(
(
accessLevel
)
->
assertThat
(
accessLevel
)
.
isEqualTo
(
AccessLevel
.
RESTRICTED
))
.
expectComplete
().
verify
();
expectRequest
(
request
->
{
expectRequest
(
(
request
)
->
{
assertThat
(
request
.
getHeader
(
HttpHeaders
.
AUTHORIZATION
))
.
isEqualTo
(
"bearer my-access-token"
);
assertThat
(
request
.
getPath
()).
isEqualTo
(
CLOUD_CONTROLLER_PERMISSIONS
);
...
...
@@ -106,17 +106,17 @@ public class ReactiveCloudFoundrySecurityServiceTests {
@Test
public
void
getAccessLevelWhenTokenIsNotValidShouldThrowException
()
throws
Exception
{
prepareResponse
(
response
->
response
.
setResponseCode
(
401
));
prepareResponse
(
(
response
)
->
response
.
setResponseCode
(
401
));
StepVerifier
.
create
(
this
.
securityService
.
getAccessLevel
(
"my-access-token"
,
"my-app-id"
))
.
consumeErrorWith
(
throwable
->
{
.
consumeErrorWith
(
(
throwable
)
->
{
assertThat
(
throwable
)
.
isInstanceOf
(
CloudFoundryAuthorizationException
.
class
);
assertThat
(
((
CloudFoundryAuthorizationException
)
throwable
).
getReason
())
.
isEqualTo
(
Reason
.
INVALID_TOKEN
);
}).
verify
();
expectRequest
(
request
->
{
expectRequest
(
(
request
)
->
{
assertThat
(
request
.
getHeader
(
HttpHeaders
.
AUTHORIZATION
))
.
isEqualTo
(
"bearer my-access-token"
);
assertThat
(
request
.
getPath
()).
isEqualTo
(
CLOUD_CONTROLLER_PERMISSIONS
);
...
...
@@ -125,17 +125,17 @@ public class ReactiveCloudFoundrySecurityServiceTests {
@Test
public
void
getAccessLevelWhenForbiddenShouldThrowException
()
throws
Exception
{
prepareResponse
(
response
->
response
.
setResponseCode
(
403
));
prepareResponse
(
(
response
)
->
response
.
setResponseCode
(
403
));
StepVerifier
.
create
(
this
.
securityService
.
getAccessLevel
(
"my-access-token"
,
"my-app-id"
))
.
consumeErrorWith
(
throwable
->
{
.
consumeErrorWith
(
(
throwable
)
->
{
assertThat
(
throwable
)
.
isInstanceOf
(
CloudFoundryAuthorizationException
.
class
);
assertThat
(
((
CloudFoundryAuthorizationException
)
throwable
).
getReason
())
.
isEqualTo
(
Reason
.
ACCESS_DENIED
);
}).
verify
();
expectRequest
(
request
->
{
expectRequest
(
(
request
)
->
{
assertThat
(
request
.
getHeader
(
HttpHeaders
.
AUTHORIZATION
))
.
isEqualTo
(
"bearer my-access-token"
);
assertThat
(
request
.
getPath
()).
isEqualTo
(
CLOUD_CONTROLLER_PERMISSIONS
);
...
...
@@ -145,17 +145,17 @@ public class ReactiveCloudFoundrySecurityServiceTests {
@Test
public
void
getAccessLevelWhenCloudControllerIsNotReachableThrowsException
()
throws
Exception
{
prepareResponse
(
response
->
response
.
setResponseCode
(
500
));
prepareResponse
(
(
response
)
->
response
.
setResponseCode
(
500
));
StepVerifier
.
create
(
this
.
securityService
.
getAccessLevel
(
"my-access-token"
,
"my-app-id"
))
.
consumeErrorWith
(
throwable
->
{
.
consumeErrorWith
(
(
throwable
)
->
{
assertThat
(
throwable
)
.
isInstanceOf
(
CloudFoundryAuthorizationException
.
class
);
assertThat
(
((
CloudFoundryAuthorizationException
)
throwable
).
getReason
())
.
isEqualTo
(
Reason
.
SERVICE_UNAVAILABLE
);
}).
verify
();
expectRequest
(
request
->
{
expectRequest
(
(
request
)
->
{
assertThat
(
request
.
getHeader
(
HttpHeaders
.
AUTHORIZATION
))
.
isEqualTo
(
"bearer my-access-token"
);
assertThat
(
request
.
getPath
()).
isEqualTo
(
CLOUD_CONTROLLER_PERMISSIONS
);
...
...
@@ -173,78 +173,76 @@ public class ReactiveCloudFoundrySecurityServiceTests {
+
"kqwIn7Glry9n9Suxygbf8g5AzpWcusZgDLIIZ7JTUldBb8qU2a0Dl4mvLZOn4wPo\n"
+
"jfj9Cw2QICsc5+Pwf21fP+hzf+1WSRHbnYv8uanRO0gZ8ekGaghM/2H6gqJbo2nI\n"
+
"JwIDAQAB\n-----END PUBLIC KEY-----"
;
prepareResponse
(
response
->
{
prepareResponse
(
(
response
)
->
{
response
.
setBody
(
"{\"token_endpoint\":\"/my-uaa.com\"}"
);
response
.
setHeader
(
"Content-Type"
,
"application/json"
);
});
String
responseBody
=
"{\"keys\" : [ {\"kid\":\"test-key\",\"value\" : \""
+
tokenKeyValue
.
replace
(
"\n"
,
"\\n"
)
+
"\"} ]}"
;
prepareResponse
(
response
->
{
prepareResponse
(
(
response
)
->
{
response
.
setBody
(
responseBody
);
response
.
setHeader
(
"Content-Type"
,
"application/json"
);
});
StepVerifier
.
create
(
this
.
securityService
.
fetchTokenKeys
())
.
consumeNextWith
(
tokenKeys
->
assertThat
(
tokenKeys
.
get
(
"test-key"
))
.
consumeNextWith
(
(
tokenKeys
)
->
assertThat
(
tokenKeys
.
get
(
"test-key"
))
.
isEqualTo
(
tokenKeyValue
))
.
expectComplete
().
verify
();
expectRequest
(
request
->
assertThat
(
request
.
getPath
())
expectRequest
(
(
request
)
->
assertThat
(
request
.
getPath
())
.
isEqualTo
(
"/my-cloud-controller.com/info"
));
expectRequest
(
request
->
assertThat
(
request
.
getPath
())
expectRequest
(
(
request
)
->
assertThat
(
request
.
getPath
())
.
isEqualTo
(
"/my-uaa.com/token_keys"
));
}
@Test
public
void
fetchTokenKeysWhenNoKeysReturnedFromUAA
()
throws
Exception
{
prepareResponse
(
response
->
{
prepareResponse
(
(
response
)
->
{
response
.
setBody
(
"{\"token_endpoint\":\"/my-uaa.com\"}"
);
response
.
setHeader
(
"Content-Type"
,
"application/json"
);
});
String
responseBody
=
"{\"keys\": []}"
;
prepareResponse
(
response
->
{
prepareResponse
(
(
response
)
->
{
response
.
setBody
(
responseBody
);
response
.
setHeader
(
"Content-Type"
,
"application/json"
);
});
StepVerifier
.
create
(
this
.
securityService
.
fetchTokenKeys
())
.
consumeNextWith
(
tokenKeys
->
assertThat
(
tokenKeys
).
hasSize
(
0
))
.
consumeNextWith
(
(
tokenKeys
)
->
assertThat
(
tokenKeys
).
hasSize
(
0
))
.
expectComplete
().
verify
();
expectRequest
(
request
->
assertThat
(
request
.
getPath
())
expectRequest
(
(
request
)
->
assertThat
(
request
.
getPath
())
.
isEqualTo
(
"/my-cloud-controller.com/info"
));
expectRequest
(
request
->
assertThat
(
request
.
getPath
())
expectRequest
(
(
request
)
->
assertThat
(
request
.
getPath
())
.
isEqualTo
(
"/my-uaa.com/token_keys"
));
}
@Test
public
void
fetchTokenKeysWhenUnsuccessfulShouldThrowException
()
throws
Exception
{
prepareResponse
(
response
->
{
prepareResponse
(
(
response
)
->
{
response
.
setBody
(
"{\"token_endpoint\":\"/my-uaa.com\"}"
);
response
.
setHeader
(
"Content-Type"
,
"application/json"
);
});
prepareResponse
(
response
->
{
response
.
setResponseCode
(
500
);
});
prepareResponse
((
response
)
->
response
.
setResponseCode
(
500
));
StepVerifier
.
create
(
this
.
securityService
.
fetchTokenKeys
())
.
consumeErrorWith
(
throwable
->
assertThat
(
.
consumeErrorWith
(
(
throwable
)
->
assertThat
(
((
CloudFoundryAuthorizationException
)
throwable
).
getReason
())
.
isEqualTo
(
Reason
.
SERVICE_UNAVAILABLE
))
.
verify
();
expectRequest
(
request
->
assertThat
(
request
.
getPath
())
expectRequest
(
(
request
)
->
assertThat
(
request
.
getPath
())
.
isEqualTo
(
"/my-cloud-controller.com/info"
));
expectRequest
(
request
->
assertThat
(
request
.
getPath
())
expectRequest
(
(
request
)
->
assertThat
(
request
.
getPath
())
.
isEqualTo
(
"/my-uaa.com/token_keys"
));
}
@Test
public
void
getUaaUrlShouldCallCloudControllerInfoOnlyOnce
()
throws
Exception
{
prepareResponse
(
response
->
{
prepareResponse
(
(
response
)
->
{
response
.
setBody
(
"{\"token_endpoint\":\""
+
UAA_URL
+
"\"}"
);
response
.
setHeader
(
"Content-Type"
,
"application/json"
);
});
StepVerifier
.
create
(
this
.
securityService
.
getUaaUrl
())
.
consumeNextWith
(
uaaUrl
->
assertThat
(
uaaUrl
).
isEqualTo
(
UAA_URL
))
.
consumeNextWith
(
(
uaaUrl
)
->
assertThat
(
uaaUrl
).
isEqualTo
(
UAA_URL
))
.
expectComplete
().
verify
();
// this.securityService.getUaaUrl().block(); //FIXME subscribe again to check that
// it isn't called again
expectRequest
(
request
->
assertThat
(
request
.
getPath
())
expectRequest
(
(
request
)
->
assertThat
(
request
.
getPath
())
.
isEqualTo
(
CLOUD_CONTROLLER
+
"/info"
));
expectRequestCount
(
1
);
}
...
...
@@ -252,16 +250,16 @@ public class ReactiveCloudFoundrySecurityServiceTests {
@Test
public
void
getUaaUrlWhenCloudControllerUrlIsNotReachableShouldThrowException
()
throws
Exception
{
prepareResponse
(
response
->
response
.
setResponseCode
(
500
));
prepareResponse
(
(
response
)
->
response
.
setResponseCode
(
500
));
StepVerifier
.
create
(
this
.
securityService
.
getUaaUrl
())
.
consumeErrorWith
(
throwable
->
{
.
consumeErrorWith
(
(
throwable
)
->
{
assertThat
(
throwable
)
.
isInstanceOf
(
CloudFoundryAuthorizationException
.
class
);
assertThat
(
((
CloudFoundryAuthorizationException
)
throwable
).
getReason
())
.
isEqualTo
(
Reason
.
SERVICE_UNAVAILABLE
);
}).
verify
();
expectRequest
(
request
->
assertThat
(
request
.
getPath
())
expectRequest
(
(
request
)
->
assertThat
(
request
.
getPath
())
.
isEqualTo
(
CLOUD_CONTROLLER
+
"/info"
));
}
...
...
spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/web/client/MetricsRestTemplateCustomizerTests.java
View file @
60afbdc8
...
...
@@ -60,7 +60,7 @@ public class MetricsRestTemplateCustomizerTests {
String
result
=
restTemplate
.
getForObject
(
"/test/{id}"
,
String
.
class
,
123
);
MockClock
.
clock
(
registry
).
add
(
SimpleConfig
.
DEFAULT_STEP
);
assertThat
(
registry
.
find
(
"http.client.requests"
)
.
meters
()).
anySatisfy
(
m
->
assertThat
(
.
meters
()).
anySatisfy
(
(
m
)
->
assertThat
(
StreamSupport
.
stream
(
m
.
getId
().
getTags
().
spliterator
(),
false
)
.
map
(
Tag:
:
getKey
)).
doesNotContain
(
"bucket"
));
assertThat
(
registry
.
find
(
"http.client.requests"
)
...
...
spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/reactive/error/DefaultErrorWebExceptionHandler.java
View file @
60afbdc8
...
...
@@ -123,7 +123,7 @@ public class DefaultErrorWebExceptionHandler extends AbstractErrorWebExceptionHa
"error/"
+
SERIES_VIEWS
.
get
(
errorStatus
.
series
()),
"error/error"
)
.
flatMap
((
viewName
)
->
renderErrorView
(
viewName
,
response
,
error
))
.
switchIfEmpty
(
renderDefaultErrorView
(
response
,
error
)).
next
()
.
doOnNext
(
resp
->
logError
(
request
,
errorStatus
));
.
doOnNext
(
(
resp
)
->
logError
(
request
,
errorStatus
));
}
/**
...
...
@@ -138,7 +138,7 @@ public class DefaultErrorWebExceptionHandler extends AbstractErrorWebExceptionHa
return
ServerResponse
.
status
(
getHttpStatus
(
error
))
.
contentType
(
MediaType
.
APPLICATION_JSON_UTF8
)
.
body
(
BodyInserters
.
fromObject
(
error
))
.
doOnNext
(
resp
->
logError
(
request
,
errorStatus
));
.
doOnNext
(
(
resp
)
->
logError
(
request
,
errorStatus
));
}
/**
...
...
spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/neo4j/city/City.java
View file @
60afbdc8
...
...
@@ -18,7 +18,8 @@ package org.springframework.boot.autoconfigure.data.neo4j.city;
import
java.io.Serializable
;
import
org.neo4j.ogm.annotation.GraphId
;
import
org.neo4j.ogm.annotation.GeneratedValue
;
import
org.neo4j.ogm.annotation.Id
;
import
org.neo4j.ogm.annotation.NodeEntity
;
import
org.springframework.boot.autoconfigure.data.neo4j.country.Country
;
...
...
@@ -28,7 +29,8 @@ public class City implements Serializable {
private
static
final
long
serialVersionUID
=
1L
;
@GraphId
@Id
@GeneratedValue
private
Long
id
;
private
String
name
;
...
...
spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/neo4j/country/Country.java
View file @
60afbdc8
...
...
@@ -18,7 +18,8 @@ package org.springframework.boot.autoconfigure.data.neo4j.country;
import
java.io.Serializable
;
import
org.neo4j.ogm.annotation.GraphId
;
import
org.neo4j.ogm.annotation.GeneratedValue
;
import
org.neo4j.ogm.annotation.Id
;
import
org.neo4j.ogm.annotation.NodeEntity
;
@NodeEntity
...
...
@@ -26,7 +27,8 @@ public class Country implements Serializable {
private
static
final
long
serialVersionUID
=
1L
;
@GraphId
@Id
@GeneratedValue
private
Long
id
;
private
String
name
;
...
...
spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/oauth2/client/OAuth2WebSecurityConfigurationTests.java
View file @
60afbdc8
...
...
@@ -93,7 +93,7 @@ public class OAuth2WebSecurityConfigurationTests {
@Test
public
void
configurationRegistersAuthorizedClientServiceBean
()
throws
Exception
{
this
.
contextRunner
.
withUserConfiguration
(
ClientRepositoryConfiguration
.
class
,
OAuth2WebSecurityConfiguration
.
class
).
run
(
context
->
{
OAuth2WebSecurityConfiguration
.
class
).
run
(
(
context
)
->
{
OAuth2AuthorizedClientService
bean
=
context
.
getBean
(
OAuth2AuthorizedClientService
.
class
);
OAuth2AuthorizedClientService
authorizedClientService
=
(
OAuth2AuthorizedClientService
)
ReflectionTestUtils
...
...
@@ -108,7 +108,7 @@ public class OAuth2WebSecurityConfigurationTests {
this
.
contextRunner
.
withUserConfiguration
(
OAuth2AuthorizedClientServiceConfiguration
.
class
,
OAuth2WebSecurityConfiguration
.
class
)
.
run
(
context
->
{
.
run
(
(
context
)
->
{
OAuth2AuthorizedClientService
bean
=
context
.
getBean
(
OAuth2AuthorizedClientService
.
class
);
OAuth2AuthorizedClientService
authorizedClientService
=
(
OAuth2AuthorizedClientService
)
ReflectionTestUtils
...
...
spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/data/neo4j/ExampleGraph.java
View file @
60afbdc8
...
...
@@ -16,7 +16,8 @@
package
org
.
springframework
.
boot
.
test
.
autoconfigure
.
data
.
neo4j
;
import
org.neo4j.ogm.annotation.GraphId
;
import
org.neo4j.ogm.annotation.GeneratedValue
;
import
org.neo4j.ogm.annotation.Id
;
import
org.neo4j.ogm.annotation.NodeEntity
;
import
org.neo4j.ogm.annotation.Property
;
...
...
@@ -28,7 +29,8 @@ import org.neo4j.ogm.annotation.Property;
@NodeEntity
public
class
ExampleGraph
{
@GraphId
@Id
@GeneratedValue
private
Long
id
;
@Property
...
...
spring-boot-project/spring-boot/src/test/java/org/springframework/boot/logging/logback/LogbackLoggingSystemTests.java
View file @
60afbdc8
...
...
@@ -460,16 +460,16 @@ public class LogbackLoggingSystemTests extends AbstractLoggingSystemTests {
return
context
.
getLogger
(
org
.
slf4j
.
Logger
.
ROOT_LOGGER_NAME
);
}
private
static
ConsoleAppender
getConsoleAppender
()
{
return
(
ConsoleAppender
)
getRootLogger
().
getAppender
(
"CONSOLE"
);
private
static
ConsoleAppender
<?>
getConsoleAppender
()
{
return
(
ConsoleAppender
<?>
)
getRootLogger
().
getAppender
(
"CONSOLE"
);
}
private
static
RollingFileAppender
getFileAppender
()
{
return
(
RollingFileAppender
)
getRootLogger
().
getAppender
(
"FILE"
);
private
static
RollingFileAppender
<?>
getFileAppender
()
{
return
(
RollingFileAppender
<?>
)
getRootLogger
().
getAppender
(
"FILE"
);
}
private
static
SizeAndTimeBasedRollingPolicy
getRollingPolicy
()
{
return
(
SizeAndTimeBasedRollingPolicy
)
getFileAppender
().
getRollingPolicy
();
private
static
SizeAndTimeBasedRollingPolicy
<?>
getRollingPolicy
()
{
return
(
SizeAndTimeBasedRollingPolicy
<?>
)
getFileAppender
().
getRollingPolicy
();
}
private
String
getLineWithText
(
File
file
,
String
outputSearch
)
throws
Exception
{
...
...
spring-boot-samples/spring-boot-sample-data-neo4j/src/main/java/sample/data/neo4j/Customer.java
View file @
60afbdc8
/*
* Copyright 2012-201
6
the original author or authors.
* Copyright 2012-201
7
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.
...
...
@@ -16,13 +16,15 @@
package
sample
.
data
.
neo4j
;
import
org.neo4j.ogm.annotation.GraphId
;
import
org.neo4j.ogm.annotation.GeneratedValue
;
import
org.neo4j.ogm.annotation.Id
;
import
org.neo4j.ogm.annotation.NodeEntity
;
@NodeEntity
public
class
Customer
{
@GraphId
@Id
@GeneratedValue
private
Long
id
;
private
String
firstName
;
...
...
@@ -38,8 +40,8 @@ public class Customer {
@Override
public
String
toString
()
{
return
String
.
format
(
"Customer[id=%s, firstName='%s', lastName='%s']"
,
id
,
firstName
,
lastName
);
return
String
.
format
(
"Customer[id=%s, firstName='%s', lastName='%s']"
,
this
.
id
,
this
.
firstName
,
this
.
lastName
);
}
}
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