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
a27e145f
Commit
a27e145f
authored
Mar 09, 2020
by
Madhura Bhave
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch '2.1.x' into 2.2.x
Closes gh-20432
parents
1fdb0830
06d870bd
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
0 additions
and
35 deletions
+0
-35
CloudFoundryVcapEnvironmentPostProcessor.java
.../boot/cloud/CloudFoundryVcapEnvironmentPostProcessor.java
+0
-13
CloudFoundryVcapEnvironmentPostProcessorTests.java
...oundry/CloudFoundryVcapEnvironmentPostProcessorTests.java
+0
-22
No files found.
spring-boot-project/spring-boot/src/main/java/org/springframework/boot/cloud/CloudFoundryVcapEnvironmentPostProcessor.java
View file @
a27e145f
...
...
@@ -87,7 +87,6 @@ import org.springframework.util.StringUtils;
*
* @author Dave Syer
* @author Andy Wilkinson
* @author Madhura Bhave
* @since 1.3.0
*/
public
class
CloudFoundryVcapEnvironmentPostProcessor
...
...
@@ -231,19 +230,7 @@ public class CloudFoundryVcapEnvironmentPostProcessor
if
(
key
.
startsWith
(
"["
))
{
return
path
+
key
;
}
if
(
shouldWrap
(
key
))
{
return
path
+
"["
+
key
+
"]"
;
}
return
path
+
"."
+
key
;
}
private
boolean
shouldWrap
(
String
key
)
{
for
(
char
ch
:
key
.
toCharArray
())
{
if
(!
Character
.
isLowerCase
(
ch
)
&&
!
Character
.
isDigit
(
ch
)
&&
ch
!=
'-'
)
{
return
true
;
}
}
return
false
;
}
}
spring-boot-project/spring-boot/src/test/java/org/springframework/boot/cloud/cloudfoundry/CloudFoundryVcapEnvironmentPostProcessorTests.java
View file @
a27e145f
...
...
@@ -30,8 +30,6 @@ import static org.assertj.core.api.Assertions.assertThat;
*
* @author Dave Syer
* @author Andy Wilkinson
* @author Hans Schulz
* @author Madhura Bhave
*/
class
CloudFoundryVcapEnvironmentPostProcessorTests
{
...
...
@@ -118,26 +116,6 @@ class CloudFoundryVcapEnvironmentPostProcessorTests {
assertThat
(
getProperty
(
"vcap.services.mysql.credentials.port"
)).
isEqualTo
(
"3306"
);
}
@Test
void
testServicePropertiesContainingKeysWithDot
()
{
TestPropertySourceUtils
.
addInlinedPropertiesToEnvironment
(
this
.
context
,
"VCAP_SERVICES={\"user-provided\":[{\"name\":\"test\",\"label\":\"test-label\","
+
"\"credentials\":{\"key.with.dots\":\"some-value\"}}]}"
);
this
.
initializer
.
postProcessEnvironment
(
this
.
context
.
getEnvironment
(),
null
);
assertThat
(
getProperty
(
"vcap.services.test.name"
)).
isEqualTo
(
"test"
);
assertThat
(
getProperty
(
"vcap.services.test.credentials[key.with.dots]"
)).
isEqualTo
(
"some-value"
);
}
@Test
void
testServicePropertiesContainingKeysWithUpperCaseAndNonAlphaNumericCharacters
()
{
TestPropertySourceUtils
.
addInlinedPropertiesToEnvironment
(
this
.
context
,
"VCAP_SERVICES={\"user-provided\":[{\"name\":\"test\",\"label\":\"test-label\","
+
"\"credentials\":{\"My-Key\":\"some-value\", \"foo@\":\"bar\"}}]}"
);
this
.
initializer
.
postProcessEnvironment
(
this
.
context
.
getEnvironment
(),
null
);
assertThat
(
getProperty
(
"vcap.services.test.credentials[My-Key]"
)).
isEqualTo
(
"some-value"
);
assertThat
(
getProperty
(
"vcap.services.test.credentials[foo@]"
)).
isEqualTo
(
"bar"
);
}
private
String
getProperty
(
String
key
)
{
return
this
.
context
.
getEnvironment
().
getProperty
(
key
);
}
...
...
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