Commit da16d6d3 authored by Johnny Lim's avatar Johnny Lim Committed by Stephane Nicoll

Polishing

Closes gh-4503
parent d4a7c09b
...@@ -17,4 +17,4 @@ Example HTTP response: ...@@ -17,4 +17,4 @@ Example HTTP response:
include::{generated}/health/http-response.adoc[] include::{generated}/health/http-response.adoc[]
Example HTTP response with `endpoints.health.sensitive=false`: Example HTTP response with `endpoints.health.sensitive=false`:
include::{generated}/health/unsensitive/http-response.adoc[] include::{generated}/health/insensitive/http-response.adoc[]
...@@ -37,7 +37,7 @@ include::{generated}/logfile/http-response.adoc[] ...@@ -37,7 +37,7 @@ include::{generated}/logfile/http-response.adoc[]
=== /docs === /docs
This endpoint (if available) contains HTML documemtation for the other endpoints. Its path This endpoint (if available) contains HTML documentation for the other endpoints. Its path
can be "/docs" (if there is an existing home page) or "/" (otherwise, including if the can be "/docs" (if there is an existing home page) or "/" (otherwise, including if the
HAL browser is not active). HAL browser is not active).
......
...@@ -64,7 +64,7 @@ public class HealthEndpointDocumentation { ...@@ -64,7 +64,7 @@ public class HealthEndpointDocumentation {
@Test @Test
public void health() throws Exception { public void health() throws Exception {
this.mockMvc.perform(get("/health").accept(MediaType.APPLICATION_JSON)) this.mockMvc.perform(get("/health").accept(MediaType.APPLICATION_JSON))
.andExpect(status().isOk()).andDo(document("health/unsensitive")); .andExpect(status().isOk()).andDo(document("health/insensitive"));
} }
} }
...@@ -25,7 +25,7 @@ import org.springframework.boot.actuate.metrics.repository.MultiMetricRepository ...@@ -25,7 +25,7 @@ import org.springframework.boot.actuate.metrics.repository.MultiMetricRepository
/** /**
* A {@link RichGaugeReader} that works by reading metric values from a * A {@link RichGaugeReader} that works by reading metric values from a
* {@link MultiMetricRepository} where the group name is the RichGauge name. The format * {@link MultiMetricRepository} where the group name is the RichGauge name. The format
* used matches that in he RichGaugeExporter, so this reader can be used on a store that * used matches that in the RichGaugeExporter, so this reader can be used on a store that
* has been populated using that exporter. * has been populated using that exporter.
* *
* @author Dave Syer * @author Dave Syer
......
...@@ -286,7 +286,7 @@ public class HealthIndicatorAutoConfigurationTests { ...@@ -286,7 +286,7 @@ public class HealthIndicatorAutoConfigurationTests {
} }
@Test @Test
public void solrHeathIndicator() { public void solrHealthIndicator() {
this.context.register(SolrAutoConfiguration.class, this.context.register(SolrAutoConfiguration.class,
ManagementServerProperties.class, HealthIndicatorAutoConfiguration.class); ManagementServerProperties.class, HealthIndicatorAutoConfiguration.class);
EnvironmentTestUtils.addEnvironment(this.context, EnvironmentTestUtils.addEnvironment(this.context,
...@@ -300,7 +300,7 @@ public class HealthIndicatorAutoConfigurationTests { ...@@ -300,7 +300,7 @@ public class HealthIndicatorAutoConfigurationTests {
} }
@Test @Test
public void notSolrHeathIndicator() { public void notSolrHealthIndicator() {
this.context.register(SolrAutoConfiguration.class, this.context.register(SolrAutoConfiguration.class,
ManagementServerProperties.class, HealthIndicatorAutoConfiguration.class); ManagementServerProperties.class, HealthIndicatorAutoConfiguration.class);
EnvironmentTestUtils.addEnvironment(this.context, EnvironmentTestUtils.addEnvironment(this.context,
......
...@@ -270,7 +270,7 @@ public class ShellPropertiesTests { ...@@ -270,7 +270,7 @@ public class ShellPropertiesTests {
} }
@Test @Test
public void testDefaultPasswordAutogeneratedIfUnresolovedPlaceholder() { public void testDefaultPasswordAutogeneratedIfUnresolvedPlaceholder() {
SimpleAuthenticationProperties security = new SimpleAuthenticationProperties(); SimpleAuthenticationProperties security = new SimpleAuthenticationProperties();
RelaxedDataBinder binder = new RelaxedDataBinder(security, "security"); RelaxedDataBinder binder = new RelaxedDataBinder(security, "security");
binder.bind(new MutablePropertyValues(Collections binder.bind(new MutablePropertyValues(Collections
......
...@@ -88,10 +88,10 @@ public class EndpointMBeanExporterTests { ...@@ -88,10 +88,10 @@ public class EndpointMBeanExporterTests {
this.context = new GenericApplicationContext(); this.context = new GenericApplicationContext();
this.context.registerBeanDefinition("endpointMbeanExporter", this.context.registerBeanDefinition("endpointMbeanExporter",
new RootBeanDefinition(EndpointMBeanExporter.class)); new RootBeanDefinition(EndpointMBeanExporter.class));
MutablePropertyValues mvp = new MutablePropertyValues(); MutablePropertyValues mpv = new MutablePropertyValues();
mvp.add("enabled", Boolean.FALSE); mpv.add("enabled", Boolean.FALSE);
this.context.registerBeanDefinition("endpoint1", this.context.registerBeanDefinition("endpoint1",
new RootBeanDefinition(TestEndpoint.class, null, mvp)); new RootBeanDefinition(TestEndpoint.class, null, mpv));
this.context.refresh(); this.context.refresh();
MBeanExporter mbeanExporter = this.context.getBean(EndpointMBeanExporter.class); MBeanExporter mbeanExporter = this.context.getBean(EndpointMBeanExporter.class);
assertFalse(mbeanExporter.getServer() assertFalse(mbeanExporter.getServer()
...@@ -103,10 +103,10 @@ public class EndpointMBeanExporterTests { ...@@ -103,10 +103,10 @@ public class EndpointMBeanExporterTests {
this.context = new GenericApplicationContext(); this.context = new GenericApplicationContext();
this.context.registerBeanDefinition("endpointMbeanExporter", this.context.registerBeanDefinition("endpointMbeanExporter",
new RootBeanDefinition(EndpointMBeanExporter.class)); new RootBeanDefinition(EndpointMBeanExporter.class));
MutablePropertyValues mvp = new MutablePropertyValues(); MutablePropertyValues mpv = new MutablePropertyValues();
mvp.add("enabled", Boolean.TRUE); mpv.add("enabled", Boolean.TRUE);
this.context.registerBeanDefinition("endpoint1", this.context.registerBeanDefinition("endpoint1",
new RootBeanDefinition(TestEndpoint.class, null, mvp)); new RootBeanDefinition(TestEndpoint.class, null, mpv));
this.context.refresh(); this.context.refresh();
MBeanExporter mbeanExporter = this.context.getBean(EndpointMBeanExporter.class); MBeanExporter mbeanExporter = this.context.getBean(EndpointMBeanExporter.class);
assertTrue(mbeanExporter.getServer() assertTrue(mbeanExporter.getServer()
......
...@@ -168,7 +168,7 @@ public class HealthMvcEndpointTests { ...@@ -168,7 +168,7 @@ public class HealthMvcEndpointTests {
} }
@Test @Test
public void unsecureAnonymousAccessUnrestricted() { public void insecureAnonymousAccessUnrestricted() {
this.mvc = new HealthMvcEndpoint(this.endpoint, false); this.mvc = new HealthMvcEndpoint(this.endpoint, false);
this.mvc.setEnvironment(this.environment); this.mvc.setEnvironment(this.environment);
given(this.endpoint.invoke()) given(this.endpoint.invoke())
...@@ -180,7 +180,7 @@ public class HealthMvcEndpointTests { ...@@ -180,7 +180,7 @@ public class HealthMvcEndpointTests {
} }
@Test @Test
public void unsensitiveAnonymousAccessRestricted() { public void insensitiveAnonymousAccessRestricted() {
this.environment.getPropertySources().addLast(NON_SENSITIVE); this.environment.getPropertySources().addLast(NON_SENSITIVE);
given(this.endpoint.invoke()) given(this.endpoint.invoke())
.willReturn(new Health.Builder().up().withDetail("foo", "bar").build()); .willReturn(new Health.Builder().up().withDetail("foo", "bar").build());
...@@ -191,7 +191,7 @@ public class HealthMvcEndpointTests { ...@@ -191,7 +191,7 @@ public class HealthMvcEndpointTests {
} }
@Test @Test
public void unsecureUnsensitiveAnonymousAccessUnrestricted() { public void insecureInsensitiveAnonymousAccessUnrestricted() {
this.mvc = new HealthMvcEndpoint(this.endpoint, false); this.mvc = new HealthMvcEndpoint(this.endpoint, false);
this.mvc.setEnvironment(this.environment); this.mvc.setEnvironment(this.environment);
this.environment.getPropertySources().addLast(NON_SENSITIVE); this.environment.getPropertySources().addLast(NON_SENSITIVE);
......
...@@ -85,8 +85,8 @@ public class MailHealthIndicatorTests { ...@@ -85,8 +85,8 @@ public class MailHealthIndicatorTests {
public static class SuccessTransport extends Transport { public static class SuccessTransport extends Transport {
public SuccessTransport(Session session, URLName urlname) { public SuccessTransport(Session session, URLName urlName) {
super(session, urlname); super(session, urlName);
} }
@Override @Override
......
...@@ -72,14 +72,14 @@ public class DropwizardMetricServicesTests { ...@@ -72,14 +72,14 @@ public class DropwizardMetricServicesTests {
} }
@Test @Test
public void setPredfinedTimer() { public void setPredefinedTimer() {
this.writer.submit("timer.foo", 200); this.writer.submit("timer.foo", 200);
this.writer.submit("timer.foo", 300); this.writer.submit("timer.foo", 300);
assertEquals(2, this.registry.timer("timer.foo").getCount()); assertEquals(2, this.registry.timer("timer.foo").getCount());
} }
@Test @Test
public void setPredfinedHistogram() { public void setPredefinedHistogram() {
this.writer.submit("histogram.foo", 2.1); this.writer.submit("histogram.foo", 2.1);
this.writer.submit("histogram.foo", 2.3); this.writer.submit("histogram.foo", 2.3);
assertEquals(2, this.registry.histogram("histogram.foo").getCount()); assertEquals(2, this.registry.histogram("histogram.foo").getCount());
...@@ -94,7 +94,7 @@ public class DropwizardMetricServicesTests { ...@@ -94,7 +94,7 @@ public class DropwizardMetricServicesTests {
* @throws Exception if an error occurs * @throws Exception if an error occurs
*/ */
@Test @Test
public void testParallism() throws Exception { public void testParallelism() throws Exception {
List<WriterThread> threads = new ArrayList<WriterThread>(); List<WriterThread> threads = new ArrayList<WriterThread>();
ThreadGroup group = new ThreadGroup("threads"); ThreadGroup group = new ThreadGroup("threads");
for (int i = 0; i < 10; i++) { for (int i = 0; i < 10; i++) {
...@@ -139,9 +139,9 @@ public class DropwizardMetricServicesTests { ...@@ -139,9 +139,9 @@ public class DropwizardMetricServicesTests {
this.writer.submit("histogram.test.service", this.index); this.writer.submit("histogram.test.service", this.index);
this.writer.submit("gauge.test.service", this.index); this.writer.submit("gauge.test.service", this.index);
} }
catch (IllegalArgumentException iae) { catch (IllegalArgumentException ex) {
this.failed = true; this.failed = true;
throw iae; throw ex;
} }
} }
} }
......
...@@ -60,7 +60,7 @@ public class OpenTsdbGaugeWriterTests { ...@@ -60,7 +60,7 @@ public class OpenTsdbGaugeWriterTests {
} }
@Test @Test
public void flushAutomaticlly() { public void flushAutomatically() {
given(this.restTemplate.postForEntity(anyString(), any(Object.class), anyMap())) given(this.restTemplate.postForEntity(anyString(), any(Object.class), anyMap()))
.willReturn(emptyResponse()); .willReturn(emptyResponse());
this.writer.setBufferSize(0); this.writer.setBufferSize(0);
......
...@@ -90,7 +90,7 @@ public class StatsdMetricWriterTests { ...@@ -90,7 +90,7 @@ public class StatsdMetricWriterTests {
} }
@Test @Test
public void perioPrefix() throws Exception { public void periodPrefix() throws Exception {
this.writer = new StatsdMetricWriter("my.", "localhost", this.port); this.writer = new StatsdMetricWriter("my.", "localhost", this.port);
this.writer.set(new Metric<Long>("gauge.foo", 3L)); this.writer.set(new Metric<Long>("gauge.foo", 3L));
this.server.waitForMessage(); this.server.waitForMessage();
......
...@@ -49,7 +49,7 @@ public class DefaultCounterServiceTests { ...@@ -49,7 +49,7 @@ public class DefaultCounterServiceTests {
} }
@Test @Test
public void incrementWithExistingNearlyCounter() { public void incrementWithExistingNearCounter() {
this.service.increment("counter-foo"); this.service.increment("counter-foo");
verify(this.repository).increment(this.captor.capture()); verify(this.repository).increment(this.captor.capture());
assertEquals("counter.counter-foo", this.captor.getValue().getName()); assertEquals("counter.counter-foo", this.captor.getValue().getName());
......
...@@ -92,7 +92,7 @@ public class SecurityPropertiesTests { ...@@ -92,7 +92,7 @@ public class SecurityPropertiesTests {
} }
@Test @Test
public void testDefaultPasswordAutogeneratedIfUnresolovedPlaceholder() { public void testDefaultPasswordAutogeneratedIfUnresolvedPlaceholder() {
this.binder.bind(new MutablePropertyValues( this.binder.bind(new MutablePropertyValues(
Collections.singletonMap("security.user.password", "${ADMIN_PASSWORD}"))); Collections.singletonMap("security.user.password", "${ADMIN_PASSWORD}")));
assertFalse(this.binder.getBindingResult().hasErrors()); assertFalse(this.binder.getBindingResult().hasErrors());
......
...@@ -21,7 +21,7 @@ class SpringIntegrationExample implements CommandLineRunner { ...@@ -21,7 +21,7 @@ class SpringIntegrationExample implements CommandLineRunner {
* Since this is a simple application that we want to exit right away, * Since this is a simple application that we want to exit right away,
* close the context. For an active integration application, with pollers * close the context. For an active integration application, with pollers
* etc, you can either suspend the main thread here (e.g. with System.in.read()), * etc, you can either suspend the main thread here (e.g. with System.in.read()),
* or exit the run() method without closing he context, and stop the * or exit the run() method without closing the context, and stop the
* application later using some other technique (kill, JMX etc). * application later using some other technique (kill, JMX etc).
*/ */
context.close() context.close()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment