Merge pull request #9729 from izeye:polish-20170711

* pr/9729:
  Polish
pull/9738/head
Stephane Nicoll 7 years ago
commit 8eebb37f2b

@ -66,11 +66,11 @@ final class SqlDialectLookup {
return SQLDialect.DEFAULT; return SQLDialect.DEFAULT;
} }
try { try {
String url = (String) JdbcUtils.extractDatabaseMetaData(dataSource, "getURL"); String url = JdbcUtils.extractDatabaseMetaData(dataSource, "getURL");
DatabaseDriver driver = DatabaseDriver.fromJdbcUrl(url); DatabaseDriver driver = DatabaseDriver.fromJdbcUrl(url);
SQLDialect sQLDialect = LOOKUP.get(driver); SQLDialect sqlDialect = LOOKUP.get(driver);
if (sQLDialect != null) { if (sqlDialect != null) {
return sQLDialect; return sqlDialect;
} }
} }
catch (MetaDataAccessException ex) { catch (MetaDataAccessException ex) {

@ -26,8 +26,7 @@ import org.springframework.util.Assert;
* Subclass of {@link SpringBeanJobFactory} that supports auto-wiring job beans. * Subclass of {@link SpringBeanJobFactory} that supports auto-wiring job beans.
* *
* @author Vedran Pavic * @author Vedran Pavic
* @since 2.0.0 * @see <a href="http://blog.btmatthews.com/?p=40#comment-33797">Inject application
* @see <a href="http://blog.btmatthews.com/?p=40#comment-33797"> Inject application
* context dependencies in Quartz job beans</a> * context dependencies in Quartz job beans</a>
*/ */
class AutowireCapableBeanJobFactory extends SpringBeanJobFactory { class AutowireCapableBeanJobFactory extends SpringBeanJobFactory {

@ -18,7 +18,6 @@ package org.springframework.boot.autoconfigure.data.elasticsearch;
import java.util.List; import java.util.List;
import org.assertj.core.api.Assertions;
import org.elasticsearch.client.Client; import org.elasticsearch.client.Client;
import org.elasticsearch.client.transport.TransportClient; import org.elasticsearch.client.transport.TransportClient;
import org.elasticsearch.cluster.node.DiscoveryNode; import org.elasticsearch.cluster.node.DiscoveryNode;
@ -63,9 +62,9 @@ public class ElasticsearchAutoConfigurationTests {
PropertyPlaceholderAutoConfiguration.class, PropertyPlaceholderAutoConfiguration.class,
ElasticsearchAutoConfiguration.class); ElasticsearchAutoConfiguration.class);
this.context.refresh(); this.context.refresh();
Assertions.assertThat(this.context.getBeanNamesForType(Client.class).length) assertThat(this.context.getBeanNamesForType(Client.class).length)
.isEqualTo(1); .isEqualTo(1);
Assertions.assertThat(this.context.getBean("myClient")) assertThat(this.context.getBean("myClient"))
.isSameAs(this.context.getBean(Client.class)); .isSameAs(this.context.getBean(Client.class));
} }

@ -61,16 +61,16 @@ public class ElasticsearchRepositoriesAutoConfigurationTests {
@Test @Test
public void testNoRepositoryConfiguration() throws Exception { public void testNoRepositoryConfiguration() throws Exception {
new ElasticsearchNodeTemplate().doWithNode((address) -> { new ElasticsearchNodeTemplate().doWithNode((node) -> {
load(EmptyConfiguration.class, address); load(EmptyConfiguration.class, node);
assertThat(this.context.getBean(Client.class)).isNotNull(); assertThat(this.context.getBean(Client.class)).isNotNull();
}); });
} }
@Test @Test
public void doesNotTriggerDefaultRepositoryDetectionIfCustomized() { public void doesNotTriggerDefaultRepositoryDetectionIfCustomized() {
new ElasticsearchNodeTemplate().doWithNode((address) -> { new ElasticsearchNodeTemplate().doWithNode((node) -> {
load(CustomizedConfiguration.class, address); load(CustomizedConfiguration.class, node);
assertThat(this.context.getBean(CityElasticsearchDbRepository.class)) assertThat(this.context.getBean(CityElasticsearchDbRepository.class))
.isNotNull(); .isNotNull();
}); });

@ -16,7 +16,6 @@
package org.springframework.boot.autoconfigure.data.neo4j; package org.springframework.boot.autoconfigure.data.neo4j;
import org.assertj.core.api.Assertions;
import org.junit.After; import org.junit.After;
import org.junit.Test; import org.junit.Test;
import org.neo4j.ogm.session.Session; import org.neo4j.ogm.session.Session;
@ -159,7 +158,7 @@ public class Neo4jDataAutoConfigurationTests {
private static void assertDomainTypesDiscovered(Neo4jMappingContext mappingContext, private static void assertDomainTypesDiscovered(Neo4jMappingContext mappingContext,
Class<?>... types) { Class<?>... types) {
for (Class<?> type : types) { for (Class<?> type : types) {
Assertions.assertThat(mappingContext.getPersistentEntity(type)).isNotNull(); assertThat(mappingContext.getPersistentEntity(type)).isNotNull();
} }
} }

@ -42,7 +42,7 @@ import static org.mockito.Mockito.verify;
* *
* @author Stephane Nicoll * @author Stephane Nicoll
*/ */
public class JooqPropertiesTest { public class JooqPropertiesTests {
private AnnotationConfigApplicationContext context; private AnnotationConfigApplicationContext context;

@ -68,7 +68,7 @@ public class SqlDialectLookupTests {
} }
@Test @Test
public void getSqlDialectWhenOracleShouldReturnOracle() throws Exception { public void getSqlDialectWhenOracleShouldReturnDefault() throws Exception {
testGetSqlDialect("jdbc:oracle:", SQLDialect.DEFAULT); testGetSqlDialect("jdbc:oracle:", SQLDialect.DEFAULT);
} }
@ -78,17 +78,17 @@ public class SqlDialectLookupTests {
} }
@Test @Test
public void getSqlDialectWhenSqlserverShouldReturnSqlserver() throws Exception { public void getSqlDialectWhenSqlserverShouldReturnDefault() throws Exception {
testGetSqlDialect("jdbc:sqlserver:", SQLDialect.DEFAULT); testGetSqlDialect("jdbc:sqlserver:", SQLDialect.DEFAULT);
} }
@Test @Test
public void getSqlDialectWhenDb2ShouldReturnDb2() throws Exception { public void getSqlDialectWhenDb2ShouldReturnDefault() throws Exception {
testGetSqlDialect("jdbc:db2:", SQLDialect.DEFAULT); testGetSqlDialect("jdbc:db2:", SQLDialect.DEFAULT);
} }
@Test @Test
public void getSqlDialectWhenInformixShouldReturnInformix() throws Exception { public void getSqlDialectWhenInformixShouldReturnDefault() throws Exception {
testGetSqlDialect("jdbc:informix-sqli:", SQLDialect.DEFAULT); testGetSqlDialect("jdbc:informix-sqli:", SQLDialect.DEFAULT);
} }

@ -24,7 +24,6 @@ import javax.sql.DataSource;
import org.junit.After; import org.junit.After;
import org.junit.Rule; import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.quartz.Calendar; import org.quartz.Calendar;
import org.quartz.JobBuilder; import org.quartz.JobBuilder;
import org.quartz.JobDetail; import org.quartz.JobDetail;
@ -72,9 +71,6 @@ import static org.hamcrest.CoreMatchers.containsString;
*/ */
public class QuartzAutoConfigurationTests { public class QuartzAutoConfigurationTests {
@Rule
public final ExpectedException thrown = ExpectedException.none();
@Rule @Rule
public OutputCapture output = new OutputCapture(); public OutputCapture output = new OutputCapture();

@ -775,7 +775,7 @@ content into your application; rather pick only the properties that you need.
spring.jta.atomikos.properties.max-timeout=300000 # Maximum timeout (in milliseconds) that can be allowed for transactions. spring.jta.atomikos.properties.max-timeout=300000 # Maximum timeout (in milliseconds) that can be allowed for transactions.
spring.jta.atomikos.properties.recovery.delay=10000 # Delay between two recovery scans. spring.jta.atomikos.properties.recovery.delay=10000 # Delay between two recovery scans.
spring.jta.atomikos.properties.recovery.forget-orphaned-log-entries-delay=86400000 # Delay after which recovery can cleanup pending ('orphaned') log entries. spring.jta.atomikos.properties.recovery.forget-orphaned-log-entries-delay=86400000 # Delay after which recovery can cleanup pending ('orphaned') log entries.
spring.jta.atomikos.properties.recovery.max-retries=5 # Number of retries attempts to commit the transaction before throwing an exception. spring.jta.atomikos.properties.recovery.max-retries=5 # Number of retry attempts to commit the transaction before throwing an exception.
spring.jta.atomikos.properties.recovery.retry-interval=10000 # Delay between retry attempts. spring.jta.atomikos.properties.recovery.retry-interval=10000 # Delay between retry attempts.
spring.jta.atomikos.properties.serial-jta-transactions=true # Specify if sub-transactions should be joined when possible. spring.jta.atomikos.properties.serial-jta-transactions=true # Specify if sub-transactions should be joined when possible.
spring.jta.atomikos.properties.service= # Transaction manager implementation that should be started. spring.jta.atomikos.properties.service= # Transaction manager implementation that should be started.

@ -5470,7 +5470,7 @@ provided with the Quartz library. It is also possible to provide a custom script
`spring.quartz.jdbc.schema` property. `spring.quartz.jdbc.schema` property.
Quartz Scheduler configuration can be customized using Quartz configuration properties (see Quartz Scheduler configuration can be customized using Quartz configuration properties (see
`spring.quartz.properties.*`) and `SchedulerFactoryBeanCustomizer` beans which allows `spring.quartz.properties.*`) and `SchedulerFactoryBeanCustomizer` beans which allow
programmatic `SchedulerFactoryBean` customization. programmatic `SchedulerFactoryBean` customization.
Job can define setters to inject data map properties. Regular beans can also be injected Job can define setters to inject data map properties. Regular beans can also be injected

@ -18,7 +18,6 @@ package sample.data.elasticsearch;
import java.io.File; import java.io.File;
import org.assertj.core.api.Assertions;
import org.elasticsearch.client.transport.NoNodeAvailableException; import org.elasticsearch.client.transport.NoNodeAvailableException;
import org.junit.ClassRule; import org.junit.ClassRule;
import org.junit.Rule; import org.junit.Rule;
@ -30,6 +29,8 @@ import org.junit.runners.model.Statement;
import org.springframework.boot.builder.SpringApplicationBuilder; import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.test.rule.OutputCapture; import org.springframework.boot.test.rule.OutputCapture;
import static org.assertj.core.api.Assertions.assertThat;
/** /**
* Tests for {@link SampleElasticsearchApplication}. * Tests for {@link SampleElasticsearchApplication}.
* *
@ -55,7 +56,7 @@ public class SampleElasticsearchApplicationTests {
throw ex; throw ex;
} }
String output = this.outputCapture.toString(); String output = this.outputCapture.toString();
Assertions.assertThat(output).contains("firstName='Alice', lastName='Smith'"); assertThat(output).contains("firstName='Alice', lastName='Smith'");
} }
private boolean elasticsearchRunning(Exception ex) { private boolean elasticsearchRunning(Exception ex) {

@ -352,7 +352,7 @@ public class AtomikosProperties {
private long delay = 10000; private long delay = 10000;
/** /**
* Number of retries attempts to commit the transaction before throwing an * Number of retry attempts to commit the transaction before throwing an
* exception. * exception.
*/ */
private int maxRetries = 5; private int maxRetries = 5;

Loading…
Cancel
Save