Merge pull request #5648 from izeye/polish-20160411
* polish-20160411: Polish
This commit is contained in:
commit
f500d67eaa
|
@ -124,8 +124,8 @@ public class InfoContributorAutoConfigurationTests {
|
||||||
this.context.getBean("buildInfoContributor", InfoContributor.class));
|
this.context.getBean("buildInfoContributor", InfoContributor.class));
|
||||||
Object build = content.get("build");
|
Object build = content.get("build");
|
||||||
assertThat(build).isInstanceOf(Map.class);
|
assertThat(build).isInstanceOf(Map.class);
|
||||||
Map<String, Object> gitInfo = (Map<String, Object>) build;
|
Map<String, Object> buildInfo = (Map<String, Object>) build;
|
||||||
assertThat(gitInfo).containsOnlyKeys("group", "artifact");
|
assertThat(buildInfo).containsOnlyKeys("group", "artifact");
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
|
@ -136,9 +136,9 @@ public class InfoContributorAutoConfigurationTests {
|
||||||
this.context.getBean("buildInfoContributor", InfoContributor.class));
|
this.context.getBean("buildInfoContributor", InfoContributor.class));
|
||||||
Object build = content.get("build");
|
Object build = content.get("build");
|
||||||
assertThat(build).isInstanceOf(Map.class);
|
assertThat(build).isInstanceOf(Map.class);
|
||||||
Map<String, Object> gitInfo = (Map<String, Object>) build;
|
Map<String, Object> buildInfo = (Map<String, Object>) build;
|
||||||
assertThat(gitInfo).containsOnlyKeys("group", "artifact", "foo");
|
assertThat(buildInfo).containsOnlyKeys("group", "artifact", "foo");
|
||||||
assertThat(gitInfo.get("foo")).isEqualTo("bar");
|
assertThat(buildInfo.get("foo")).isEqualTo("bar");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
@ -977,7 +977,7 @@ content into your application; rather pick only the properties that you need.
|
||||||
management.health.solr.enabled=true # Enable Solr health check.
|
management.health.solr.enabled=true # Enable Solr health check.
|
||||||
management.health.status.order=DOWN, OUT_OF_SERVICE, UNKNOWN, UP # Comma-separated list of health statuses in order of severity.
|
management.health.status.order=DOWN, OUT_OF_SERVICE, UNKNOWN, UP # Comma-separated list of health statuses in order of severity.
|
||||||
|
|
||||||
# INFO CONTRIBUTORS
|
# INFO CONTRIBUTORS ({sc-spring-boot-actuator}/autoconfigure/InfoContributorProperties.{sc-ext}[InfoContributorProperties])
|
||||||
management.info.build.enabled=true # Enable build info.
|
management.info.build.enabled=true # Enable build info.
|
||||||
management.info.build.mode=simple # Mode to use to expose build information.
|
management.info.build.mode=simple # Mode to use to expose build information.
|
||||||
management.info.defaults.enabled=true # Enable default info contributors.
|
management.info.defaults.enabled=true # Enable default info contributors.
|
||||||
|
|
|
@ -94,18 +94,18 @@ public class ImageBanner implements Banner {
|
||||||
PropertyResolver properties = new RelaxedPropertyResolver(environment,
|
PropertyResolver properties = new RelaxedPropertyResolver(environment,
|
||||||
"banner.image.");
|
"banner.image.");
|
||||||
int width = properties.getProperty("width", Integer.class, 76);
|
int width = properties.getProperty("width", Integer.class, 76);
|
||||||
int heigth = properties.getProperty("height", Integer.class, 0);
|
int height = properties.getProperty("height", Integer.class, 0);
|
||||||
int margin = properties.getProperty("margin", Integer.class, 2);
|
int margin = properties.getProperty("margin", Integer.class, 2);
|
||||||
boolean invert = properties.getProperty("invert", Boolean.class, false);
|
boolean invert = properties.getProperty("invert", Boolean.class, false);
|
||||||
BufferedImage image = readImage(width, heigth);
|
BufferedImage image = readImage(width, height);
|
||||||
printBanner(image, margin, invert, out);
|
printBanner(image, margin, invert, out);
|
||||||
}
|
}
|
||||||
|
|
||||||
private BufferedImage readImage(int width, int heigth) throws IOException {
|
private BufferedImage readImage(int width, int height) throws IOException {
|
||||||
InputStream inputStream = this.image.getInputStream();
|
InputStream inputStream = this.image.getInputStream();
|
||||||
try {
|
try {
|
||||||
BufferedImage image = ImageIO.read(inputStream);
|
BufferedImage image = ImageIO.read(inputStream);
|
||||||
return resizeImage(image, width, heigth);
|
return resizeImage(image, width, height);
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
inputStream.close();
|
inputStream.close();
|
||||||
|
|
|
@ -157,7 +157,7 @@ public class ImageBannerTests {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void printBannerWhenHasMarginPropertShouldPrintSizedMargin() throws Exception {
|
public void printBannerWhenHasMarginPropertyShouldPrintSizedMargin() throws Exception {
|
||||||
AnsiOutput.setEnabled(AnsiOutput.Enabled.NEVER);
|
AnsiOutput.setEnabled(AnsiOutput.Enabled.NEVER);
|
||||||
String banner = printBanner("large.gif", "banner.image.margin=4");
|
String banner = printBanner("large.gif", "banner.image.margin=4");
|
||||||
String[] lines = banner.split(NEW_LINE);
|
String[] lines = banner.split(NEW_LINE);
|
||||||
|
|
|
@ -1129,7 +1129,7 @@ public class SpringApplicationTests {
|
||||||
@Override
|
@Override
|
||||||
public Resource getResource(String path) {
|
public Resource getResource(String path) {
|
||||||
Resource resource = this.resources.get(path);
|
Resource resource = this.resources.get(path);
|
||||||
return (resource == null ? new ClassPathResource("doesnotexit") : resource);
|
return (resource == null ? new ClassPathResource("doesnotexist") : resource);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in New Issue