Skip to content

Commit facb1fb

Browse files
committed
Polish "Add Java InfoContributor"
See spring-projectsgh-28136
1 parent 9564657 commit facb1fb

File tree

10 files changed

+184
-199
lines changed

10 files changed

+184
-199
lines changed

spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/info/InfoContributorAutoConfiguration.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2019 the original author or authors.
2+
* Copyright 2012-2021 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -20,7 +20,7 @@
2020
import org.springframework.boot.actuate.info.EnvironmentInfoContributor;
2121
import org.springframework.boot.actuate.info.GitInfoContributor;
2222
import org.springframework.boot.actuate.info.InfoContributor;
23-
import org.springframework.boot.actuate.info.java.JavaInfoContributor;
23+
import org.springframework.boot.actuate.info.JavaInfoContributor;
2424
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
2525
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
2626
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
@@ -82,7 +82,7 @@ public InfoContributor buildInfoContributor(BuildProperties buildProperties) {
8282
@Bean
8383
@ConditionalOnEnabledInfoContributor("java")
8484
@Order(DEFAULT_ORDER)
85-
public InfoContributor javaInfoContributor() {
85+
public JavaInfoContributor javaInfoContributor() {
8686
return new JavaInfoContributor();
8787
}
8888

spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/info/InfoContributorAutoConfigurationTests.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2019 the original author or authors.
2+
* Copyright 2012-2021 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -27,10 +27,10 @@
2727
import org.springframework.boot.actuate.info.GitInfoContributor;
2828
import org.springframework.boot.actuate.info.Info;
2929
import org.springframework.boot.actuate.info.InfoContributor;
30-
import org.springframework.boot.actuate.info.java.JavaInfo;
31-
import org.springframework.boot.actuate.info.java.JavaInfoContributor;
30+
import org.springframework.boot.actuate.info.JavaInfoContributor;
3231
import org.springframework.boot.info.BuildProperties;
3332
import org.springframework.boot.info.GitProperties;
33+
import org.springframework.boot.info.JavaInfo;
3434
import org.springframework.boot.test.util.TestPropertyValues;
3535
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
3636
import org.springframework.context.annotation.Bean;
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2021-2021 the original author or authors.
2+
* Copyright 2012-2021 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -14,10 +14,10 @@
1414
* limitations under the License.
1515
*/
1616

17-
package org.springframework.boot.actuate.info.java;
17+
package org.springframework.boot.actuate.info;
1818

1919
import org.springframework.boot.actuate.info.Info.Builder;
20-
import org.springframework.boot.actuate.info.InfoContributor;
20+
import org.springframework.boot.info.JavaInfo;
2121

2222
/**
2323
* An {@link InfoContributor} that exposes {@link JavaInfo}.

spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/info/java/JavaInfo.java

Lines changed: 0 additions & 59 deletions
This file was deleted.

spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/info/java/JreInfo.java

Lines changed: 0 additions & 45 deletions
This file was deleted.

spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/info/java/VmInfo.java

Lines changed: 0 additions & 52 deletions
This file was deleted.

spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/info/java/package-info.java

Lines changed: 0 additions & 20 deletions
This file was deleted.
Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2021-2021 the original author or authors.
2+
* Copyright 2012-2021 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -14,11 +14,11 @@
1414
* limitations under the License.
1515
*/
1616

17-
package org.springframework.boot.actuate.info.java;
17+
package org.springframework.boot.actuate.info;
1818

1919
import org.junit.jupiter.api.Test;
2020

21-
import org.springframework.boot.actuate.info.Info;
21+
import org.springframework.boot.info.JavaInfo;
2222

2323
import static org.assertj.core.api.Assertions.assertThat;
2424

@@ -34,17 +34,8 @@ void javaInfoShouldBeAdded() {
3434
JavaInfoContributor javaInfoContributor = new JavaInfoContributor();
3535
Info.Builder builder = new Info.Builder();
3636
javaInfoContributor.contribute(builder);
37-
38-
assertThat(builder.build().getDetails().get("java")).isInstanceOf(JavaInfo.class);
39-
JavaInfo javaInfo = (JavaInfo) builder.build().getDetails().get("java");
40-
41-
assertThat(javaInfo.getVendor()).isEqualTo(System.getProperty("java.vendor"));
42-
assertThat(javaInfo.getVersion()).isEqualTo(System.getProperty("java.version"));
43-
assertThat(javaInfo.getRuntime().getName()).isEqualTo(System.getProperty("java.runtime.name"));
44-
assertThat(javaInfo.getRuntime().getVersion()).isEqualTo(System.getProperty("java.runtime.version"));
45-
assertThat(javaInfo.getVm().getName()).isEqualTo(System.getProperty("java.vm.name"));
46-
assertThat(javaInfo.getVm().getVendor()).isEqualTo(System.getProperty("java.vm.vendor"));
47-
assertThat(javaInfo.getVm().getVersion()).isEqualTo(System.getProperty("java.vm.version"));
37+
Info info = builder.build();
38+
assertThat(info.getDetails().get("java")).isInstanceOf(JavaInfo.class);
4839
}
4940

5041
}

0 commit comments

Comments
 (0)