This commit is contained in:
Phillip Webb
2015-08-03 11:03:32 -07:00
parent 5c1f700c3a
commit 891dd5a0f6
25 changed files with 139 additions and 129 deletions

View File

@@ -306,7 +306,7 @@ public class RabbitProperties {
private Integer maxConcurrency;
/**
* Number of messages to be handled in a single request. It should be greater than
* Number of messages to be handled in a single request. It should be greater than
* or equal to the transaction size (if used).
*/
private Integer prefetch;
@@ -318,7 +318,7 @@ public class RabbitProperties {
private Integer transactionSize;
public boolean isAutoStartup() {
return autoStartup;
return this.autoStartup;
}
public void setAutoStartup(boolean autoStartup) {

View File

@@ -86,7 +86,8 @@ enum DatabaseDriver {
/**
* SQL Server
*/
SQLSERVER("com.microsoft.sqlserver.jdbc.SQLServerDriver", "com.microsoft.sqlserver.jdbc.SQLServerXADataSource");
SQLSERVER("com.microsoft.sqlserver.jdbc.SQLServerDriver",
"com.microsoft.sqlserver.jdbc.SQLServerXADataSource");
private final String driverClassName;

View File

@@ -58,7 +58,7 @@ public class JmsProperties {
}
public Listener getListener() {
return listener;
return this.listener;
}
public static class Listener {
@@ -69,8 +69,8 @@ public class JmsProperties {
private boolean autoStartup = true;
/**
* Acknowledge mode of the container. By default, the listener is
* transacted with automatic acknowledgment.
* Acknowledge mode of the container. By default, the listener is transacted with
* automatic acknowledgment.
*/
private AcknowledgeMode acknowledgeMode;
@@ -85,7 +85,7 @@ public class JmsProperties {
private Integer maxConcurrency;
public boolean isAutoStartup() {
return autoStartup;
return this.autoStartup;
}
public void setAutoStartup(boolean autoStartup) {
@@ -93,7 +93,7 @@ public class JmsProperties {
}
public AcknowledgeMode getAcknowledgeMode() {
return acknowledgeMode;
return this.acknowledgeMode;
}
public void setAcknowledgeMode(AcknowledgeMode acknowledgeMode) {
@@ -120,16 +120,17 @@ public class JmsProperties {
if (this.concurrency == null) {
return (this.maxConcurrency != null ? "1-" + this.maxConcurrency : null);
}
return (this.maxConcurrency != null ? this.concurrency + "-" +
this.maxConcurrency : String.valueOf(this.concurrency));
return (this.maxConcurrency != null ? this.concurrency + "-"
+ this.maxConcurrency : String.valueOf(this.concurrency));
}
}
/**
* Translate the acknowledge modes defined on the {@link javax.jms.Session}.
*
* <p>{@link javax.jms.Session#SESSION_TRANSACTED} is not defined as we take
* care of this already via a call to {@code setSessionTransacted}.
* <p>
* {@link javax.jms.Session#SESSION_TRANSACTED} is not defined as we take care of this
* already via a call to {@code setSessionTransacted}.
*/
public enum AcknowledgeMode {
@@ -140,8 +141,8 @@ public class JmsProperties {
AUTO(1),
/**
* Messages are acknowledged once the message listener implementation has
* called {@link javax.jms.Message#acknowledge()}. This mode gives the application
* Messages are acknowledged once the message listener implementation has called
* {@link javax.jms.Message#acknowledge()}. This mode gives the application
* (rather than the JMS provider) complete control over message acknowledgement.
*/
CLIENT(2),
@@ -160,7 +161,7 @@ public class JmsProperties {
}
public int getMode() {
return mode;
return this.mode;
}
}

View File

@@ -244,7 +244,7 @@ public class ResourceServerProperties implements Validator, BeanFactoryAware {
}
if (ResourceServerProperties.this.tokenInfoUri != null
&& ResourceServerProperties.this.tokenInfoUri
.endsWith("/check_token")) {
.endsWith("/check_token")) {
return ResourceServerProperties.this.userInfoUri.replace("/check_token",
"/token_key");
}

View File

@@ -74,9 +74,9 @@ public class ThymeleafProperties {
private boolean cache = true;
/**
* Order of the template resolver in the chain. By default, the template resolver
* is first in the chain. Order start at 1 and should only be set if you have
* defined additional "TemplateResolver" beans.
* Order of the template resolver in the chain. By default, the template resolver is
* first in the chain. Order start at 1 and should only be set if you have defined
* additional "TemplateResolver" beans.
*/
private Integer templateResolverOrder;
@@ -160,7 +160,7 @@ public class ThymeleafProperties {
}
public Integer getTemplateResolverOrder() {
return templateResolverOrder;
return this.templateResolverOrder;
}
public void setTemplateResolverOrder(Integer templateResolverOrder) {

View File

@@ -23,7 +23,6 @@ import org.junit.After;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.springframework.amqp.core.AcknowledgeMode;
import org.springframework.amqp.core.AmqpAdmin;
import org.springframework.amqp.rabbit.annotation.EnableRabbit;
@@ -189,8 +188,7 @@ public class RabbitAutoConfigurationTests {
@Test
public void testRabbitListenerContainerFactoryWithCustomSettings() {
load(TestConfiguration.class,
"spring.rabbitmq.listener.autoStartup:false",
load(TestConfiguration.class, "spring.rabbitmq.listener.autoStartup:false",
"spring.rabbitmq.listener.acknowledgeMode:manual",
"spring.rabbitmq.listener.concurrency:5",
"spring.rabbitmq.listener.maxConcurrency:10",
@@ -201,8 +199,7 @@ public class RabbitAutoConfigurationTests {
SimpleRabbitListenerContainerFactory.class);
DirectFieldAccessor dfa = new DirectFieldAccessor(rabbitListenerContainerFactory);
assertEquals(false, dfa.getPropertyValue("autoStartup"));
assertEquals(AcknowledgeMode.MANUAL,
dfa.getPropertyValue("acknowledgeMode"));
assertEquals(AcknowledgeMode.MANUAL, dfa.getPropertyValue("acknowledgeMode"));
assertEquals(5, dfa.getPropertyValue("concurrentConsumers"));
assertEquals(10, dfa.getPropertyValue("maxConcurrentConsumers"));
assertEquals(40, dfa.getPropertyValue("prefetchCount"));

View File

@@ -76,7 +76,7 @@ import static org.mockito.Mockito.mock;
*/
public class JacksonAutoConfigurationTests {
AnnotationConfigApplicationContext context;
private AnnotationConfigApplicationContext context;
@Before
public void setUp() {
@@ -411,8 +411,8 @@ public class JacksonAutoConfigurationTests {
EnvironmentTestUtils.addEnvironment(this.context,
"spring.jackson.date-format:zzzz");
this.context.refresh();
ObjectMapper objectMapper = this.context
.getBean(Jackson2ObjectMapperBuilder.class).build();
ObjectMapper objectMapper = this.context.getBean(
Jackson2ObjectMapperBuilder.class).build();
DateTime dateTime = new DateTime(1436966242231L, DateTimeZone.UTC);
assertEquals("\"Koordinierte Universalzeit\"",

View File

@@ -146,8 +146,7 @@ public class JmsAutoConfigurationTests {
@Test
public void testJmsListenerContainerFactoryWithCustomSettings() {
load(EnableJmsConfiguration.class,
"spring.jms.listener.autoStartup=false",
load(EnableJmsConfiguration.class, "spring.jms.listener.autoStartup=false",
"spring.jms.listener.acknowledgeMode=client",
"spring.jms.listener.concurrency=2",
"spring.jms.listener.maxConcurrency=10");
@@ -155,10 +154,11 @@ public class JmsAutoConfigurationTests {
.getBean("jmsListenerContainerFactory", JmsListenerContainerFactory.class);
assertEquals(DefaultJmsListenerContainerFactory.class,
jmsListenerContainerFactory.getClass());
DefaultMessageListenerContainer listenerContainer = ((DefaultJmsListenerContainerFactory)
jmsListenerContainerFactory).createListenerContainer(mock(JmsListenerEndpoint.class));
DefaultMessageListenerContainer listenerContainer = ((DefaultJmsListenerContainerFactory) jmsListenerContainerFactory)
.createListenerContainer(mock(JmsListenerEndpoint.class));
assertEquals(false, listenerContainer.isAutoStartup());
assertEquals(Session.CLIENT_ACKNOWLEDGE, listenerContainer.getSessionAcknowledgeMode());
assertEquals(Session.CLIENT_ACKNOWLEDGE,
listenerContainer.getSessionAcknowledgeMode());
assertEquals(2, listenerContainer.getConcurrentConsumers());
assertEquals(10, listenerContainer.getMaxConcurrentConsumers());
}

View File

@@ -16,9 +16,6 @@
package org.springframework.boot.autoconfigure.security.oauth2;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.MatcherAssert.assertThat;
import java.net.URI;
import java.util.Arrays;
import java.util.List;
@@ -94,6 +91,9 @@ import org.springframework.web.client.RestTemplate;
import com.fasterxml.jackson.databind.JsonNode;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.MatcherAssert.assertThat;
/**
* Verify Spring Security OAuth2 auto-configuration secures end points properly, accepts
* environmental overrides, and also backs off in the presence of other
@@ -358,9 +358,9 @@ public class OAuth2AutoConfigurationTests {
@Configuration
@Import({ UseFreePortEmbeddedContainerConfiguration.class,
SecurityAutoConfiguration.class, ServerPropertiesAutoConfiguration.class,
DispatcherServletAutoConfiguration.class, OAuth2AutoConfiguration.class,
WebMvcAutoConfiguration.class, HttpMessageConvertersAutoConfiguration.class })
SecurityAutoConfiguration.class, ServerPropertiesAutoConfiguration.class,
DispatcherServletAutoConfiguration.class, OAuth2AutoConfiguration.class,
WebMvcAutoConfiguration.class, HttpMessageConvertersAutoConfiguration.class })
protected static class MinimalSecureWebApplication {
}
@@ -396,7 +396,7 @@ public class OAuth2AutoConfigurationTests {
@EnableResourceServer
@EnableGlobalMethodSecurity(prePostEnabled = true)
protected static class AuthorizationAndResourceServerConfiguration extends
TestSecurityConfiguration {
TestSecurityConfiguration {
}
@@ -419,7 +419,7 @@ public class OAuth2AutoConfigurationTests {
@Configuration
@EnableAuthorizationServer
protected static class AuthorizationServerConfiguration extends
TestSecurityConfiguration {
TestSecurityConfiguration {
}
@@ -474,7 +474,7 @@ public class OAuth2AutoConfigurationTests {
@Override
public void configure(HttpSecurity http) throws Exception {
http.authorizeRequests().anyRequest().authenticated().and().httpBasic().and()
.csrf().disable();
.csrf().disable();
}
}
@@ -482,7 +482,7 @@ public class OAuth2AutoConfigurationTests {
@Configuration
@EnableAuthorizationServer
protected static class CustomAuthorizationServer extends
AuthorizationServerConfigurerAdapter {
AuthorizationServerConfigurerAdapter {
@Autowired
private AuthenticationManager authenticationManager;
@@ -502,9 +502,9 @@ public class OAuth2AutoConfigurationTests {
@Override
public void configure(ClientDetailsServiceConfigurer clients) throws Exception {
clients.inMemory().withClient("client").secret("secret")
.resourceIds("resource-id").authorizedGrantTypes("password")
.authorities("USER").scopes("read")
.redirectUris("http://localhost:8080");
.resourceIds("resource-id").authorizedGrantTypes("password")
.authorities("USER").scopes("read")
.redirectUris("http://localhost:8080");
}
@Override

View File

@@ -181,6 +181,7 @@ public class BasicErrorControllerIntegrationTests {
public NoReasonExpectedException(String message) {
super(message);
}
}
}