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
4a7dcc87
Commit
4a7dcc87
authored
May 10, 2017
by
Phillip Webb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Formatting
parent
ea4e6fea
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
23 additions
and
25 deletions
+23
-25
EnvironmentMvcEndpoint.java
...ork/boot/actuate/endpoint/mvc/EnvironmentMvcEndpoint.java
+2
-1
EnvironmentEndpointTests.java
...ework/boot/actuate/endpoint/EnvironmentEndpointTests.java
+16
-19
EnvironmentMvcEndpointTests.java
...oot/actuate/endpoint/mvc/EnvironmentMvcEndpointTests.java
+2
-3
RabbitAutoConfigurationTests.java
...boot/autoconfigure/amqp/RabbitAutoConfigurationTests.java
+3
-2
No files found.
spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/mvc/EnvironmentMvcEndpoint.java
View file @
4a7dcc87
...
...
@@ -93,7 +93,8 @@ public class EnvironmentMvcEndpoint extends EndpointMvcAdapter
@Override
protected
Object
getOptionalValue
(
Environment
source
,
String
name
)
{
Object
result
=
((
EnvironmentEndpoint
)
getDelegate
()).
getResolver
().
getProperty
(
name
,
Object
.
class
);
Object
result
=
((
EnvironmentEndpoint
)
getDelegate
()).
getResolver
()
.
getProperty
(
name
,
Object
.
class
);
if
(
result
!=
null
)
{
result
=
((
EnvironmentEndpoint
)
getDelegate
()).
sanitize
(
name
,
result
);
}
...
...
spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/EnvironmentEndpointTests.java
View file @
4a7dcc87
...
...
@@ -112,8 +112,9 @@ public class EnvironmentEndpointTests extends AbstractEndpointTests<EnvironmentE
assertThat
(
systemProperties
.
get
(
"my.services.cleardb-free.credentials"
))
.
isEqualTo
(
"******"
);
assertThat
(
systemProperties
.
get
(
"foo.mycredentials.uri"
)).
isEqualTo
(
"******"
);
clearSystemProperties
(
"my.services.amqp-free.credentials.uri"
,
"credentials.http_api_uri"
,
"my.services.cleardb-free.credentials"
,
"foo.mycredentials.uri"
);
clearSystemProperties
(
"my.services.amqp-free.credentials.uri"
,
"credentials.http_api_uri"
,
"my.services.cleardb-free.credentials"
,
"foo.mycredentials.uri"
);
}
@SuppressWarnings
(
"unchecked"
)
...
...
@@ -208,14 +209,13 @@ public class EnvironmentEndpointTests extends AbstractEndpointTests<EnvironmentE
@Test
public
void
propertyWithPlaceholderResolved
()
throws
Exception
{
this
.
context
=
new
AnnotationConfigApplicationContext
();
EnvironmentTestUtils
.
addEnvironment
(
this
.
context
,
"
my.foo: ${bar.blah}"
,
"
bar.blah: hello"
);
EnvironmentTestUtils
.
addEnvironment
(
this
.
context
,
"my.foo: ${bar.blah}"
,
"bar.blah: hello"
);
this
.
context
.
register
(
Config
.
class
);
this
.
context
.
refresh
();
EnvironmentEndpoint
report
=
getEndpointBean
();
Map
<
String
,
Object
>
env
=
report
.
invoke
();
Map
<
String
,
Object
>
testProperties
=
(
Map
<
String
,
Object
>)
env
.
get
(
"test"
);
Map
<
String
,
Object
>
testProperties
=
(
Map
<
String
,
Object
>)
env
.
get
(
"test"
);
assertThat
(
testProperties
.
get
(
"my.foo"
)).
isEqualTo
(
"hello"
);
}
...
...
@@ -223,14 +223,12 @@ public class EnvironmentEndpointTests extends AbstractEndpointTests<EnvironmentE
@Test
public
void
propertyWithPlaceholderNotResolved
()
throws
Exception
{
this
.
context
=
new
AnnotationConfigApplicationContext
();
EnvironmentTestUtils
.
addEnvironment
(
this
.
context
,
"my.foo: ${bar.blah}"
);
EnvironmentTestUtils
.
addEnvironment
(
this
.
context
,
"my.foo: ${bar.blah}"
);
this
.
context
.
register
(
Config
.
class
);
this
.
context
.
refresh
();
EnvironmentEndpoint
report
=
getEndpointBean
();
Map
<
String
,
Object
>
env
=
report
.
invoke
();
Map
<
String
,
Object
>
testProperties
=
(
Map
<
String
,
Object
>)
env
.
get
(
"test"
);
Map
<
String
,
Object
>
testProperties
=
(
Map
<
String
,
Object
>)
env
.
get
(
"test"
);
assertThat
(
testProperties
.
get
(
"my.foo"
)).
isEqualTo
(
"${bar.blah}"
);
}
...
...
@@ -244,8 +242,7 @@ public class EnvironmentEndpointTests extends AbstractEndpointTests<EnvironmentE
this
.
context
.
refresh
();
EnvironmentEndpoint
report
=
getEndpointBean
();
Map
<
String
,
Object
>
env
=
report
.
invoke
();
Map
<
String
,
Object
>
testProperties
=
(
Map
<
String
,
Object
>)
env
.
get
(
"test"
);
Map
<
String
,
Object
>
testProperties
=
(
Map
<
String
,
Object
>)
env
.
get
(
"test"
);
assertThat
(
testProperties
.
get
(
"my.foo"
)).
isEqualTo
(
"http://******://hello"
);
}
...
...
@@ -259,16 +256,17 @@ public class EnvironmentEndpointTests extends AbstractEndpointTests<EnvironmentE
this
.
context
.
refresh
();
EnvironmentEndpoint
report
=
getEndpointBean
();
Map
<
String
,
Object
>
env
=
report
.
invoke
();
Map
<
String
,
Object
>
testProperties
=
(
Map
<
String
,
Object
>)
env
.
get
(
"test"
);
assertThat
(
testProperties
.
get
(
"my.foo"
))
.
isEqualTo
(
"http://${bar.password}://hello"
);
Map
<
String
,
Object
>
testProperties
=
(
Map
<
String
,
Object
>)
env
.
get
(
"test"
);
assertThat
(
testProperties
.
get
(
"my.foo"
))
.
isEqualTo
(
"http://${bar.password}://hello"
);
}
@SuppressWarnings
(
"unchecked"
)
@Test
@SuppressWarnings
(
"unchecked"
)
public
void
propertyWithTypeOtherThanStringShouldNotFail
()
throws
Exception
{
this
.
context
=
new
AnnotationConfigApplicationContext
();
MutablePropertySources
propertySources
=
this
.
context
.
getEnvironment
().
getPropertySources
();
MutablePropertySources
propertySources
=
this
.
context
.
getEnvironment
()
.
getPropertySources
();
Map
<
String
,
Object
>
source
=
new
HashMap
<
String
,
Object
>();
source
.
put
(
"foo"
,
Collections
.
singletonMap
(
"bar"
,
"baz"
));
propertySources
.
addFirst
(
new
MapPropertySource
(
"test"
,
source
));
...
...
@@ -276,8 +274,7 @@ public class EnvironmentEndpointTests extends AbstractEndpointTests<EnvironmentE
this
.
context
.
refresh
();
EnvironmentEndpoint
report
=
getEndpointBean
();
Map
<
String
,
Object
>
env
=
report
.
invoke
();
Map
<
String
,
Object
>
testProperties
=
(
Map
<
String
,
Object
>)
env
.
get
(
"test"
);
Map
<
String
,
Object
>
testProperties
=
(
Map
<
String
,
Object
>)
env
.
get
(
"test"
);
Map
<
String
,
String
>
foo
=
(
Map
<
String
,
String
>)
testProperties
.
get
(
"foo"
);
assertThat
(
foo
.
get
(
"bar"
)).
isEqualTo
(
"baz"
);
}
...
...
spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/EnvironmentMvcEndpointTests.java
View file @
4a7dcc87
...
...
@@ -162,11 +162,10 @@ public class EnvironmentMvcEndpointTests {
.
andExpect
(
content
().
string
(
containsString
(
"\"my.foo\":\"******\""
)));
}
@SuppressWarnings
(
"unchecked"
)
@Test
public
void
propertyWithTypeOtherThanStringShouldNotFail
()
throws
Exception
{
ConfigurableEnvironment
environment
=
(
ConfigurableEnvironment
)
this
.
context
.
getEnvironment
();
MutablePropertySources
propertySources
=
environment
.
getPropertySources
();
MutablePropertySources
propertySources
=
((
ConfigurableEnvironment
)
this
.
context
.
getEnvironment
())
.
getPropertySources
();
Map
<
String
,
Object
>
source
=
new
HashMap
<
String
,
Object
>();
source
.
put
(
"foo"
,
Collections
.
singletonMap
(
"bar"
,
"baz"
));
propertySources
.
addFirst
(
new
MapPropertySource
(
"test"
,
source
));
...
...
spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/amqp/RabbitAutoConfigurationTests.java
View file @
4a7dcc87
...
...
@@ -329,9 +329,10 @@ public class RabbitAutoConfigurationTests {
"spring.rabbitmq.listener.simple.transactionSize:20"
);
}
private
void
testSimpleRabbitListenerContainerFactoryWithCustomSettings
(
String
...
environment
)
{
private
void
testSimpleRabbitListenerContainerFactoryWithCustomSettings
(
String
...
environment
)
{
load
(
new
Class
<?>[]
{
MessageConvertersConfiguration
.
class
,
MessageRecoverersConfiguration
.
class
},
environment
);
MessageRecoverersConfiguration
.
class
},
environment
);
SimpleRabbitListenerContainerFactory
rabbitListenerContainerFactory
=
this
.
context
.
getBean
(
"rabbitListenerContainerFactory"
,
SimpleRabbitListenerContainerFactory
.
class
);
...
...
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