Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
spring-boot-admin
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-boot-admin
Commits
976619f4
Commit
976619f4
authored
Mar 05, 2018
by
Johannes Edmeier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix: use application_id from VCAP
parent
80eaf615
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
6 additions
and
5 deletions
+6
-5
CloudFoundryApplicationProperties.java
...dmin/client/config/CloudFoundryApplicationProperties.java
+1
-1
CloudFoundryMetadataContributor.java
...egistration/metadata/CloudFoundryMetadataContributor.java
+2
-2
SpringBootAdminClientCloudFoundryAutoConfigurationTest.java
...ringBootAdminClientCloudFoundryAutoConfigurationTest.java
+2
-1
CloudFoundryMetadataContributorTest.java
...tration/metadata/CloudFoundryMetadataContributorTest.java
+1
-1
No files found.
spring-boot-admin-client/src/main/java/de/codecentric/boot/admin/client/config/CloudFoundryApplicationProperties.java
View file @
976619f4
...
...
@@ -23,7 +23,7 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
@lombok
.
Data
@ConfigurationProperties
(
"vcap.application"
)
public
class
CloudFoundryApplicationProperties
{
private
String
instance
Id
;
private
String
application
Id
;
private
String
instanceIndex
;
private
List
<
String
>
uris
=
new
ArrayList
<>();
}
spring-boot-admin-client/src/main/java/de/codecentric/boot/admin/client/registration/metadata/CloudFoundryMetadataContributor.java
View file @
976619f4
...
...
@@ -32,10 +32,10 @@ public class CloudFoundryMetadataContributor implements MetadataContributor {
@Override
public
Map
<
String
,
String
>
getMetadata
()
{
if
(
StringUtils
.
hasText
(
this
.
cfApplicationProperties
.
get
Instance
Id
())
&&
if
(
StringUtils
.
hasText
(
this
.
cfApplicationProperties
.
get
Application
Id
())
&&
StringUtils
.
hasText
(
this
.
cfApplicationProperties
.
getInstanceIndex
()))
{
Map
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"applicationId"
,
this
.
cfApplicationProperties
.
get
Instance
Id
());
map
.
put
(
"applicationId"
,
this
.
cfApplicationProperties
.
get
Application
Id
());
map
.
put
(
"instanceId"
,
this
.
cfApplicationProperties
.
getInstanceIndex
());
return
map
;
}
...
...
spring-boot-admin-client/src/test/java/de/codecentric/boot/admin/client/config/SpringBootAdminClientCloudFoundryAutoConfigurationTest.java
View file @
976619f4
...
...
@@ -55,6 +55,7 @@ public class SpringBootAdminClientCloudFoundryAutoConfigurationTest {
@Test
public
void
cloudfoundry
()
{
String
vcap
=
"VCAP_APPLICATION:{\"application_users\":[],"
+
"\"application_id\":\"9958288f-9842-4ddc-93dd-1ea3c90634cd\","
+
"\"instance_id\":\"bb7935245adf3e650dfb7c58a06e9ece\","
+
"\"instance_index\":0,\"version\":\"3464e092-1c13-462e-a47c-807c30318a50\","
+
"\"name\":\"foo\",\"uris\":[\"foo.cfapps.io\"],"
+
...
...
@@ -70,7 +71,7 @@ public class SpringBootAdminClientCloudFoundryAutoConfigurationTest {
load
(
"spring.boot.admin.client.url:http://localhost:8081"
,
vcap
);
ApplicationFactory
factory
=
context
.
getBean
(
ApplicationFactory
.
class
);
CloudFoundryMetadataContributor
contributor
=
context
.
getBean
(
CloudFoundryMetadataContributor
.
class
);
assertThat
(
contributor
.
getMetadata
()).
containsEntry
(
"applicationId"
,
"
bb7935245adf3e650dfb7c58a06e9ece
"
)
assertThat
(
contributor
.
getMetadata
()).
containsEntry
(
"applicationId"
,
"
9958288f-9842-4ddc-93dd-1ea3c90634cd
"
)
.
containsEntry
(
"instanceId"
,
"0"
);
assertThat
(
factory
).
isInstanceOf
(
CloudFoundryApplicationFactory
.
class
);
assertThat
(
factory
.
createApplication
().
getServiceUrl
()).
isEqualTo
(
"http://dsyerenv.cfapps.io/"
);
...
...
spring-boot-admin-client/src/test/java/de/codecentric/boot/admin/client/registration/metadata/CloudFoundryMetadataContributorTest.java
View file @
976619f4
...
...
@@ -34,7 +34,7 @@ public class CloudFoundryMetadataContributorTest {
@Test
public
void
should_return_metadata
()
{
CloudFoundryApplicationProperties
cfApplicationProperties
=
new
CloudFoundryApplicationProperties
();
cfApplicationProperties
.
set
Instance
Id
(
"appId"
);
cfApplicationProperties
.
set
Application
Id
(
"appId"
);
cfApplicationProperties
.
setInstanceIndex
(
"1"
);
CloudFoundryMetadataContributor
contributor
=
new
CloudFoundryMetadataContributor
(
cfApplicationProperties
);
assertThat
(
contributor
.
getMetadata
()).
containsEntry
(
"applicationId"
,
"appId"
).
containsEntry
(
"instanceId"
,
"1"
);
...
...
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