Merge branch '1.5.x'

pull/3480/head
Phillip Webb 8 years ago
commit 53f50eda39

@ -183,14 +183,15 @@ public class EndpointWebMvcManagementContextConfiguration {
AnnotatedTypeMetadata metadata) { AnnotatedTypeMetadata metadata) {
Environment environment = context.getEnvironment(); Environment environment = context.getEnvironment();
String config = environment.resolvePlaceholders("${logging.file:}"); String config = environment.resolvePlaceholders("${logging.file:}");
ConditionMessage.Builder message = ConditionMessage ConditionMessage.Builder message = ConditionMessage.forCondition("Log File");
.forCondition("Log File");
if (StringUtils.hasText(config)) { if (StringUtils.hasText(config)) {
return ConditionOutcome.match(message.found("logging.file").items(config)); return ConditionOutcome
.match(message.found("logging.file").items(config));
} }
config = environment.resolvePlaceholders("${logging.path:}"); config = environment.resolvePlaceholders("${logging.path:}");
if (StringUtils.hasText(config)) { if (StringUtils.hasText(config)) {
return ConditionOutcome.match(message.found("logging.path").items(config)); return ConditionOutcome
.match(message.found("logging.path").items(config));
} }
config = new RelaxedPropertyResolver(environment, "endpoints.logfile.") config = new RelaxedPropertyResolver(environment, "endpoints.logfile.")
.getProperty("external-file"); .getProperty("external-file");

@ -98,7 +98,8 @@ import org.springframework.mail.javamail.JavaMailSenderImpl;
MongoDataAutoConfiguration.class, RabbitAutoConfiguration.class, MongoDataAutoConfiguration.class, RabbitAutoConfiguration.class,
RedisAutoConfiguration.class, SolrAutoConfiguration.class }) RedisAutoConfiguration.class, SolrAutoConfiguration.class })
@EnableConfigurationProperties({ HealthIndicatorProperties.class }) @EnableConfigurationProperties({ HealthIndicatorProperties.class })
@Import({ ElasticsearchHealthIndicatorConfiguration.ElasticsearchClientHealthIndicatorConfiguration.class, @Import({
ElasticsearchHealthIndicatorConfiguration.ElasticsearchClientHealthIndicatorConfiguration.class,
ElasticsearchHealthIndicatorConfiguration.ElasticsearchJestHealthIndicatorConfiguration.class }) ElasticsearchHealthIndicatorConfiguration.ElasticsearchJestHealthIndicatorConfiguration.class })
public class HealthIndicatorAutoConfiguration { public class HealthIndicatorAutoConfiguration {

@ -34,7 +34,6 @@ public class InfoContributorProperties {
return this.git; return this.git;
} }
public static class Git { public static class Git {
/** /**

@ -98,8 +98,7 @@ public class JolokiaAutoConfiguration {
public ConditionOutcome getMatchOutcome(ConditionContext context, public ConditionOutcome getMatchOutcome(ConditionContext context,
AnnotatedTypeMetadata metadata) { AnnotatedTypeMetadata metadata) {
boolean endpointsEnabled = isEnabled(context, "endpoints.", true); boolean endpointsEnabled = isEnabled(context, "endpoints.", true);
ConditionMessage.Builder message = ConditionMessage ConditionMessage.Builder message = ConditionMessage.forCondition("Jolokia");
.forCondition("Jolokia");
if (isEnabled(context, "endpoints.jolokia.", endpointsEnabled)) { if (isEnabled(context, "endpoints.jolokia.", endpointsEnabled)) {
return ConditionOutcome.match(message.because("enabled")); return ConditionOutcome.match(message.because("enabled"));
} }

@ -17,8 +17,7 @@
package org.springframework.boot.actuate.autoconfigure; package org.springframework.boot.actuate.autoconfigure;
import java.net.InetAddress; import java.net.InetAddress;
import java.util.ArrayList; import java.util.Arrays;
import java.util.Collections;
import java.util.List; import java.util.List;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
@ -179,7 +178,7 @@ public class ManagementServerProperties implements SecurityPrerequisite {
/** /**
* Comma-separated list of roles that can access the management endpoint. * Comma-separated list of roles that can access the management endpoint.
*/ */
private List<String> roles = new ArrayList<String>(Collections.singletonList("ADMIN")); private List<String> roles = Arrays.asList("ADMIN");
/** /**
* Session creating policy to use (always, never, if_required, stateless). * Session creating policy to use (always, never, if_required, stateless).

@ -398,9 +398,9 @@ public class HealthIndicatorAutoConfigurationTests {
EnvironmentTestUtils.addEnvironment(this.context, EnvironmentTestUtils.addEnvironment(this.context,
"spring.data.elasticsearch.properties.path.home:target", "spring.data.elasticsearch.properties.path.home:target",
"management.health.diskspace.enabled:false"); "management.health.diskspace.enabled:false");
this.context.register(JestClientConfiguration.class, this.context.register(JestClientConfiguration.class, JestAutoConfiguration.class,
JestAutoConfiguration.class, ElasticsearchAutoConfiguration.class, ElasticsearchAutoConfiguration.class, ManagementServerProperties.class,
ManagementServerProperties.class, HealthIndicatorAutoConfiguration.class); HealthIndicatorAutoConfiguration.class);
this.context.refresh(); this.context.refresh();
Map<String, HealthIndicator> beans = this.context Map<String, HealthIndicator> beans = this.context
@ -414,9 +414,8 @@ public class HealthIndicatorAutoConfigurationTests {
public void elasticsearchJestHealthIndicator() { public void elasticsearchJestHealthIndicator() {
EnvironmentTestUtils.addEnvironment(this.context, EnvironmentTestUtils.addEnvironment(this.context,
"management.health.diskspace.enabled:false"); "management.health.diskspace.enabled:false");
this.context.register(JestClientConfiguration.class, this.context.register(JestClientConfiguration.class, JestAutoConfiguration.class,
JestAutoConfiguration.class, ManagementServerProperties.class, ManagementServerProperties.class, HealthIndicatorAutoConfiguration.class);
HealthIndicatorAutoConfiguration.class);
this.context.refresh(); this.context.refresh();
Map<String, HealthIndicator> beans = this.context Map<String, HealthIndicator> beans = this.context
@ -432,9 +431,9 @@ public class HealthIndicatorAutoConfigurationTests {
"management.health.elasticsearch.enabled:false", "management.health.elasticsearch.enabled:false",
"spring.data.elasticsearch.properties.path.home:target", "spring.data.elasticsearch.properties.path.home:target",
"management.health.diskspace.enabled:false"); "management.health.diskspace.enabled:false");
this.context.register(JestClientConfiguration.class, this.context.register(JestClientConfiguration.class, JestAutoConfiguration.class,
JestAutoConfiguration.class, ElasticsearchAutoConfiguration.class, ElasticsearchAutoConfiguration.class, ManagementServerProperties.class,
ManagementServerProperties.class, HealthIndicatorAutoConfiguration.class); HealthIndicatorAutoConfiguration.class);
this.context.refresh(); this.context.refresh();
Map<String, HealthIndicator> beans = this.context Map<String, HealthIndicator> beans = this.context

@ -82,8 +82,7 @@ public class ManagementServerPropertiesAutoConfigurationTests {
@Test @Test
public void managementRolesAllowsIndexedAccess() { public void managementRolesAllowsIndexedAccess() {
ManagementServerProperties properties = load( ManagementServerProperties properties = load("management.security.roles[0]=FOO");
"management.security.roles[0]=FOO");
assertThat(properties.getSecurity().getRoles()).containsOnly("FOO"); assertThat(properties.getSecurity().getRoles()).containsOnly("FOO");
} }

@ -73,8 +73,8 @@ public class AuthorizationAuditListenerTests {
@Test @Test
public void testDetailsAreIncludedInAuditEvent() throws Exception { public void testDetailsAreIncludedInAuditEvent() throws Exception {
Object details = new Object(); Object details = new Object();
UsernamePasswordAuthenticationToken authentication = UsernamePasswordAuthenticationToken authentication = new UsernamePasswordAuthenticationToken(
new UsernamePasswordAuthenticationToken("user", "password"); "user", "password");
authentication.setDetails(details); authentication.setDetails(details);
this.listener.onApplicationEvent(new AuthorizationFailureEvent(this, this.listener.onApplicationEvent(new AuthorizationFailureEvent(this,
Arrays.<ConfigAttribute>asList(new SecurityConfig("USER")), Arrays.<ConfigAttribute>asList(new SecurityConfig("USER")),

@ -178,8 +178,7 @@ class JCacheCacheConfiguration {
@Override @Override
public ConditionOutcome getMatchOutcome(ConditionContext context, public ConditionOutcome getMatchOutcome(ConditionContext context,
AnnotatedTypeMetadata metadata) { AnnotatedTypeMetadata metadata) {
ConditionMessage.Builder message = ConditionMessage ConditionMessage.Builder message = ConditionMessage.forCondition("JCache");
.forCondition("JCache");
RelaxedPropertyResolver resolver = new RelaxedPropertyResolver( RelaxedPropertyResolver resolver = new RelaxedPropertyResolver(
context.getEnvironment(), "spring.cache.jcache."); context.getEnvironment(), "spring.cache.jcache.");
if (resolver.containsProperty("provider")) { if (resolver.containsProperty("provider")) {

@ -375,8 +375,8 @@ public final class ConditionMessage {
/** /**
* Indicate the items with a {@link Style}. For example * Indicate the items with a {@link Style}. For example
* {@code didNotFind("bean", "beans").items(Style.QUOTE, Collections.singleton("x")} results in * {@code didNotFind("bean", "beans").items(Style.QUOTE, Collections.singleton("x")}
* the message "did not find bean 'x'". * results in the message "did not find bean 'x'".
* @param style the render style * @param style the render style
* @param items the source of the items (may be {@code null}) * @param items the source of the items (may be {@code null})
* @return a built {@link ConditionMessage} * @return a built {@link ConditionMessage}

@ -24,8 +24,8 @@ import org.springframework.data.rest.webmvc.config.RepositoryRestConfigurerAdapt
import org.springframework.http.converter.json.Jackson2ObjectMapperBuilder; import org.springframework.http.converter.json.Jackson2ObjectMapperBuilder;
/** /**
* A {@code RepositoryRestConfigurer} that applies configuration items from * A {@code RepositoryRestConfigurer} that applies configuration items from the
* the {@code spring.data.rest} namespace to Spring Data REST. Also, if a * {@code spring.data.rest} namespace to Spring Data REST. Also, if a
* {@link Jackson2ObjectMapperBuilder} is available, it is used to configure Spring Data * {@link Jackson2ObjectMapperBuilder} is available, it is used to configure Spring Data
* REST's {@link ObjectMapper ObjectMappers}. * REST's {@link ObjectMapper ObjectMappers}.
* *

@ -16,8 +16,7 @@
package org.springframework.boot.autoconfigure.elasticsearch.jest; package org.springframework.boot.autoconfigure.elasticsearch.jest;
import java.util.ArrayList; import java.util.Arrays;
import java.util.Collections;
import java.util.List; import java.util.List;
import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.boot.context.properties.ConfigurationProperties;
@ -34,8 +33,7 @@ public class JestProperties {
/** /**
* Comma-separated list of the Elasticsearch instances to use. * Comma-separated list of the Elasticsearch instances to use.
*/ */
private List<String> uris = new ArrayList<String>(Collections.singletonList( private List<String> uris = Arrays.asList("http://localhost:9200");
"http://localhost:9200"));
/** /**
* Login user. * Login user.

@ -108,7 +108,8 @@ public class ProjectInfoAutoConfiguration {
ConditionMessage.Builder message = ConditionMessage ConditionMessage.Builder message = ConditionMessage
.forCondition("GitResource"); .forCondition("GitResource");
if (loader.getResource(location).exists()) { if (loader.getResource(location).exists()) {
return ConditionOutcome.match(message.found("git info at").items(location)); return ConditionOutcome
.match(message.found("git info at").items(location));
} }
return ConditionOutcome return ConditionOutcome
.noMatch(message.didNotFind("git info at").items(location)); .noMatch(message.didNotFind("git info at").items(location));

@ -232,8 +232,8 @@ public class DataSourceAutoConfiguration {
} }
if (anyMatches(context, metadata, this.pooledCondition, if (anyMatches(context, metadata, this.pooledCondition,
this.embeddedCondition)) { this.embeddedCondition)) {
return ConditionOutcome return ConditionOutcome.match(message
.match(message.foundExactly("existing auto-configured data source bean")); .foundExactly("existing auto-configured data source bean"));
} }
return ConditionOutcome return ConditionOutcome
.noMatch(message.didNotFind("any existing data source bean").atAll()); .noMatch(message.didNotFind("any existing data source bean").atAll());

@ -205,8 +205,8 @@ public class MongoProperties {
try { try {
if (hasCustomAddress() || hasCustomCredentials()) { if (hasCustomAddress() || hasCustomCredentials()) {
if (this.uri != null) { if (this.uri != null) {
throw new IllegalStateException("Invalid mongo configuration, " + throw new IllegalStateException("Invalid mongo configuration, "
"either uri or host/port/credentials must be specified"); + "either uri or host/port/credentials must be specified");
} }
if (options == null) { if (options == null) {
options = MongoClientOptions.builder().build(); options = MongoClientOptions.builder().build();

@ -132,8 +132,8 @@ public class OAuth2ResourceServerConfiguration {
if (ClassUtils.isPresent(AUTHORIZATION_ANNOTATION, null)) { if (ClassUtils.isPresent(AUTHORIZATION_ANNOTATION, null)) {
if (AuthorizationServerEndpointsConfigurationBeanCondition if (AuthorizationServerEndpointsConfigurationBeanCondition
.matches(context)) { .matches(context)) {
return ConditionOutcome return ConditionOutcome.match(
.match(message.found("class").items(AUTHORIZATION_ANNOTATION)); message.found("class").items(AUTHORIZATION_ANNOTATION));
} }
} }
return ConditionOutcome.noMatch( return ConditionOutcome.noMatch(

@ -58,8 +58,8 @@ class SessionCondition extends SpringBootCondition {
return ConditionOutcome.match(message return ConditionOutcome.match(message
.found("spring.session.store-type property").items(sessionStoreType)); .found("spring.session.store-type property").items(sessionStoreType));
} }
return ConditionOutcome return ConditionOutcome.noMatch(
.noMatch(message.found("spring.session.store-type property").items(value)); message.found("spring.session.store-type property").items(value));
} }
} }

@ -50,8 +50,7 @@ class OnEnabledResourceChainCondition extends SpringBootCondition {
ConditionMessage.Builder message = ConditionMessage ConditionMessage.Builder message = ConditionMessage
.forCondition(ConditionalOnEnabledResourceChain.class); .forCondition(ConditionalOnEnabledResourceChain.class);
if (match == null) { if (match == null) {
if (ClassUtils.isPresent(WEBJAR_ASSET_LOCATOR, if (ClassUtils.isPresent(WEBJAR_ASSET_LOCATOR, getClass().getClassLoader())) {
getClass().getClassLoader())) {
return ConditionOutcome return ConditionOutcome
.match(message.found("class").items(WEBJAR_ASSET_LOCATOR)); .match(message.found("class").items(WEBJAR_ASSET_LOCATOR));
} }

@ -92,8 +92,9 @@ public class BatchAutoConfigurationTests {
this.context.refresh(); this.context.refresh();
assertThat(this.context.getBean(JobLauncher.class)).isNotNull(); assertThat(this.context.getBean(JobLauncher.class)).isNotNull();
assertThat(this.context.getBean(JobExplorer.class)).isNotNull(); assertThat(this.context.getBean(JobExplorer.class)).isNotNull();
assertThat(this.context.getBean(BatchProperties.class) assertThat(
.getInitializer().isEnabled()).isTrue(); this.context.getBean(BatchProperties.class).getInitializer().isEnabled())
.isTrue();
assertThat(new JdbcTemplate(this.context.getBean(DataSource.class)) assertThat(new JdbcTemplate(this.context.getBean(DataSource.class))
.queryForList("select * from BATCH_JOB_EXECUTION")).isEmpty(); .queryForList("select * from BATCH_JOB_EXECUTION")).isEmpty();
} }
@ -193,8 +194,9 @@ public class BatchAutoConfigurationTests {
PropertyPlaceholderAutoConfiguration.class); PropertyPlaceholderAutoConfiguration.class);
this.context.refresh(); this.context.refresh();
assertThat(this.context.getBean(JobLauncher.class)).isNotNull(); assertThat(this.context.getBean(JobLauncher.class)).isNotNull();
assertThat(this.context.getBean(BatchProperties.class) assertThat(
.getInitializer().isEnabled()).isFalse(); this.context.getBean(BatchProperties.class).getInitializer().isEnabled())
.isFalse();
this.expected.expect(BadSqlGrammarException.class); this.expected.expect(BadSqlGrammarException.class);
new JdbcTemplate(this.context.getBean(DataSource.class)) new JdbcTemplate(this.context.getBean(DataSource.class))
.queryForList("select * from BATCH_JOB_EXECUTION"); .queryForList("select * from BATCH_JOB_EXECUTION");
@ -233,8 +235,9 @@ public class BatchAutoConfigurationTests {
PropertyPlaceholderAutoConfiguration.class); PropertyPlaceholderAutoConfiguration.class);
this.context.refresh(); this.context.refresh();
assertThat(this.context.getBean(JobLauncher.class)).isNotNull(); assertThat(this.context.getBean(JobLauncher.class)).isNotNull();
assertThat(this.context.getBean(BatchProperties.class) assertThat(
.getInitializer().isEnabled()).isTrue(); this.context.getBean(BatchProperties.class).getInitializer().isEnabled())
.isTrue();
assertThat(new JdbcTemplate(this.context.getBean(DataSource.class)) assertThat(new JdbcTemplate(this.context.getBean(DataSource.class))
.queryForList("select * from PREFIX_JOB_EXECUTION")).isEmpty(); .queryForList("select * from PREFIX_JOB_EXECUTION")).isEmpty();
JobExplorer jobExplorer = this.context.getBean(JobExplorer.class); JobExplorer jobExplorer = this.context.getBean(JobExplorer.class);
@ -245,19 +248,20 @@ public class BatchAutoConfigurationTests {
} }
@Test @Test
public void testCustomTablePrefixWithDefaultSchemaDisablesInitializer() throws Exception { public void testCustomTablePrefixWithDefaultSchemaDisablesInitializer()
throws Exception {
this.context = new AnnotationConfigApplicationContext(); this.context = new AnnotationConfigApplicationContext();
EnvironmentTestUtils.addEnvironment(this.context, EnvironmentTestUtils.addEnvironment(this.context,
"spring.datasource.name:batchtest", "spring.datasource.name:batchtest", "spring.batch.tablePrefix:PREFIX_");
"spring.batch.tablePrefix:PREFIX_");
this.context.register(TestConfiguration.class, this.context.register(TestConfiguration.class,
EmbeddedDataSourceConfiguration.class, EmbeddedDataSourceConfiguration.class,
HibernateJpaAutoConfiguration.class, BatchAutoConfiguration.class, HibernateJpaAutoConfiguration.class, BatchAutoConfiguration.class,
PropertyPlaceholderAutoConfiguration.class); PropertyPlaceholderAutoConfiguration.class);
this.context.refresh(); this.context.refresh();
assertThat(this.context.getBean(JobLauncher.class)).isNotNull(); assertThat(this.context.getBean(JobLauncher.class)).isNotNull();
assertThat(this.context.getBean(BatchProperties.class) assertThat(
.getInitializer().isEnabled()).isFalse(); this.context.getBean(BatchProperties.class).getInitializer().isEnabled())
.isFalse();
this.expected.expect(BadSqlGrammarException.class); this.expected.expect(BadSqlGrammarException.class);
new JdbcTemplate(this.context.getBean(DataSource.class)) new JdbcTemplate(this.context.getBean(DataSource.class))
.queryForList("select * from BATCH_JOB_EXECUTION"); .queryForList("select * from BATCH_JOB_EXECUTION");

@ -107,8 +107,8 @@ public class IntegrationAutoConfigurationTests {
public void primaryExporterIsAllowed() { public void primaryExporterIsAllowed() {
load(CustomMBeanExporter.class); load(CustomMBeanExporter.class);
assertThat(this.context.getBeansOfType(MBeanExporter.class)).hasSize(2); assertThat(this.context.getBeansOfType(MBeanExporter.class)).hasSize(2);
assertThat(this.context.getBean(MBeanExporter.class)).isSameAs( assertThat(this.context.getBean(MBeanExporter.class))
this.context.getBean("myMBeanExporter")); .isSameAs(this.context.getBean("myMBeanExporter"));
} }
private static void assertDomains(MBeanServer mBeanServer, boolean expected, private static void assertDomains(MBeanServer mBeanServer, boolean expected,

@ -134,8 +134,8 @@ public class MongoPropertiesTests {
properties.setUsername("user"); properties.setUsername("user");
properties.setPassword("secret".toCharArray()); properties.setPassword("secret".toCharArray());
this.thrown.expect(IllegalStateException.class); this.thrown.expect(IllegalStateException.class);
this.thrown.expectMessage("Invalid mongo configuration, " + this.thrown.expectMessage("Invalid mongo configuration, "
"either uri or host/port/credentials must be specified"); + "either uri or host/port/credentials must be specified");
properties.createMongoClient(null, null); properties.createMongoClient(null, null);
} }
@ -146,8 +146,8 @@ public class MongoPropertiesTests {
properties.setHost("localhost"); properties.setHost("localhost");
properties.setPort(4567); properties.setPort(4567);
this.thrown.expect(IllegalStateException.class); this.thrown.expect(IllegalStateException.class);
this.thrown.expectMessage("Invalid mongo configuration, " + this.thrown.expectMessage("Invalid mongo configuration, "
"either uri or host/port/credentials must be specified"); + "either uri or host/port/credentials must be specified");
properties.createMongoClient(null, null); properties.createMongoClient(null, null);
} }

@ -54,8 +54,8 @@ public class SessionAutoConfigurationJdbcTests
JdbcOperationsSessionRepository.class); JdbcOperationsSessionRepository.class);
assertThat(new DirectFieldAccessor(repository).getPropertyValue("tableName")) assertThat(new DirectFieldAccessor(repository).getPropertyValue("tableName"))
.isEqualTo("SPRING_SESSION"); .isEqualTo("SPRING_SESSION");
assertThat(this.context.getBean(SessionProperties.class) assertThat(this.context.getBean(SessionProperties.class).getJdbc()
.getJdbc().getInitializer().isEnabled()).isTrue(); .getInitializer().isEnabled()).isTrue();
assertThat(this.context.getBean(JdbcOperations.class) assertThat(this.context.getBean(JdbcOperations.class)
.queryForList("select * from SPRING_SESSION")).isEmpty(); .queryForList("select * from SPRING_SESSION")).isEmpty();
} }
@ -70,8 +70,8 @@ public class SessionAutoConfigurationJdbcTests
JdbcOperationsSessionRepository.class); JdbcOperationsSessionRepository.class);
assertThat(new DirectFieldAccessor(repository).getPropertyValue("tableName")) assertThat(new DirectFieldAccessor(repository).getPropertyValue("tableName"))
.isEqualTo("SPRING_SESSION"); .isEqualTo("SPRING_SESSION");
assertThat(this.context.getBean(SessionProperties.class) assertThat(this.context.getBean(SessionProperties.class).getJdbc()
.getJdbc().getInitializer().isEnabled()).isFalse(); .getInitializer().isEnabled()).isFalse();
this.thrown.expect(BadSqlGrammarException.class); this.thrown.expect(BadSqlGrammarException.class);
assertThat(this.context.getBean(JdbcOperations.class) assertThat(this.context.getBean(JdbcOperations.class)
.queryForList("select * from SPRING_SESSION")).isEmpty(); .queryForList("select * from SPRING_SESSION")).isEmpty();
@ -88,8 +88,8 @@ public class SessionAutoConfigurationJdbcTests
JdbcOperationsSessionRepository.class); JdbcOperationsSessionRepository.class);
assertThat(new DirectFieldAccessor(repository).getPropertyValue("tableName")) assertThat(new DirectFieldAccessor(repository).getPropertyValue("tableName"))
.isEqualTo("FOO_BAR"); .isEqualTo("FOO_BAR");
assertThat(this.context.getBean(SessionProperties.class) assertThat(this.context.getBean(SessionProperties.class).getJdbc()
.getJdbc().getInitializer().isEnabled()).isTrue(); .getInitializer().isEnabled()).isTrue();
assertThat(this.context.getBean(JdbcOperations.class) assertThat(this.context.getBean(JdbcOperations.class)
.queryForList("select * from FOO_BAR")).isEmpty(); .queryForList("select * from FOO_BAR")).isEmpty();
} }
@ -104,8 +104,8 @@ public class SessionAutoConfigurationJdbcTests
JdbcOperationsSessionRepository.class); JdbcOperationsSessionRepository.class);
assertThat(new DirectFieldAccessor(repository).getPropertyValue("tableName")) assertThat(new DirectFieldAccessor(repository).getPropertyValue("tableName"))
.isEqualTo("FOO_BAR"); .isEqualTo("FOO_BAR");
assertThat(this.context.getBean(SessionProperties.class) assertThat(this.context.getBean(SessionProperties.class).getJdbc()
.getJdbc().getInitializer().isEnabled()).isFalse(); .getInitializer().isEnabled()).isFalse();
this.thrown.expect(BadSqlGrammarException.class); this.thrown.expect(BadSqlGrammarException.class);
assertThat(this.context.getBean(JdbcOperations.class) assertThat(this.context.getBean(JdbcOperations.class)
.queryForList("select * from SPRING_SESSION")).isEmpty(); .queryForList("select * from SPRING_SESSION")).isEmpty();

@ -50,7 +50,8 @@ public class SessionAutoConfigurationRedisTests
public void redisSessionStoreIsTheDefault() { public void redisSessionStoreIsTheDefault() {
load(Collections.<Class<?>>singletonList(RedisAutoConfiguration.class)); load(Collections.<Class<?>>singletonList(RedisAutoConfiguration.class));
validateSpringSessionUsesRedis(); validateSpringSessionUsesRedis();
this.output.expect(containsString("Spring Session store type is mandatory: set 'spring.session.store-type=redis' in your configuration")); this.output.expect(containsString(
"Spring Session store type is mandatory: set 'spring.session.store-type=redis' in your configuration"));
} }
@Test @Test
@ -58,7 +59,8 @@ public class SessionAutoConfigurationRedisTests
load(Collections.<Class<?>>singletonList(RedisAutoConfiguration.class), load(Collections.<Class<?>>singletonList(RedisAutoConfiguration.class),
"spring.session.store-type=redis"); "spring.session.store-type=redis");
validateSpringSessionUsesRedis(); validateSpringSessionUsesRedis();
this.output.expect(not(containsString("Spring Session store type is mandatory: set 'spring.session.store-type=redis' in your configuration"))); this.output.expect(not(containsString(
"Spring Session store type is mandatory: set 'spring.session.store-type=redis' in your configuration")));
} }
private void validateSpringSessionUsesRedis() { private void validateSpringSessionUsesRedis() {

@ -81,6 +81,7 @@
<module>spring-boot-sample-session-redis</module> <module>spring-boot-sample-session-redis</module>
<module>spring-boot-sample-simple</module> <module>spring-boot-sample-simple</module>
<module>spring-boot-sample-test</module> <module>spring-boot-sample-test</module>
<module>spring-boot-sample-test-nomockito</module>
<module>spring-boot-sample-testng</module> <module>spring-boot-sample-testng</module>
<module>spring-boot-sample-tomcat</module> <module>spring-boot-sample-tomcat</module>
<module>spring-boot-sample-tomcat-jsp</module> <module>spring-boot-sample-tomcat-jsp</module>
@ -182,6 +183,25 @@
<configuration> <configuration>
<lifecycleMappingMetadata> <lifecycleMappingMetadata>
<pluginExecutions> <pluginExecutions>
<pluginExecution>
<pluginExecutionFilter>
<groupId>
org.apache.maven.plugins
</groupId>
<artifactId>
maven-enforcer-plugin
</artifactId>
<versionRange>
[1.3.1,)
</versionRange>
<goals>
<goal>enforce</goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore />
</action>
</pluginExecution>
<pluginExecution> <pluginExecution>
<pluginExecutionFilter> <pluginExecutionFilter>
<groupId> <groupId>

@ -3,7 +3,6 @@
*/ */
package sample.jooq.domain; package sample.jooq.domain;
import java.sql.Date; import java.sql.Date;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
@ -18,123 +17,123 @@ import org.jooq.TableField;
import org.jooq.UniqueKey; import org.jooq.UniqueKey;
import org.jooq.impl.TableImpl; import org.jooq.impl.TableImpl;
/** /**
* This class is generated by jOOQ. * This class is generated by jOOQ.
*/ */
@Generated( @Generated(value = { "http://www.jooq.org",
value = { "jOOQ version:3.8.2" }, comments = "This class is generated by jOOQ")
"http://www.jooq.org",
"jOOQ version:3.8.2"
},
comments = "This class is generated by jOOQ"
)
@SuppressWarnings({ "all", "unchecked", "rawtypes" }) @SuppressWarnings({ "all", "unchecked", "rawtypes" })
public class Author extends TableImpl<Record> { public class Author extends TableImpl<Record> {
private static final long serialVersionUID = 1187406915; private static final long serialVersionUID = 1187406915;
/** /**
* The reference instance of <code>PUBLIC.AUTHOR</code> * The reference instance of <code>PUBLIC.AUTHOR</code>
*/ */
public static final Author AUTHOR = new Author(); public static final Author AUTHOR = new Author();
/** /**
* The class holding records for this type * The class holding records for this type
*/ */
@Override @Override
public Class<Record> getRecordType() { public Class<Record> getRecordType() {
return Record.class; return Record.class;
} }
/** /**
* The column <code>PUBLIC.AUTHOR.ID</code>. * The column <code>PUBLIC.AUTHOR.ID</code>.
*/ */
public final TableField<Record, Integer> ID = createField("ID", org.jooq.impl.SQLDataType.INTEGER.nullable(false), this, ""); public final TableField<Record, Integer> ID = createField("ID",
org.jooq.impl.SQLDataType.INTEGER.nullable(false), this, "");
/**
* The column <code>PUBLIC.AUTHOR.FIRST_NAME</code>. /**
*/ * The column <code>PUBLIC.AUTHOR.FIRST_NAME</code>.
public final TableField<Record, String> FIRST_NAME = createField("FIRST_NAME", org.jooq.impl.SQLDataType.VARCHAR.length(50), this, ""); */
public final TableField<Record, String> FIRST_NAME = createField("FIRST_NAME",
/** org.jooq.impl.SQLDataType.VARCHAR.length(50), this, "");
* The column <code>PUBLIC.AUTHOR.LAST_NAME</code>.
*/ /**
public final TableField<Record, String> LAST_NAME = createField("LAST_NAME", org.jooq.impl.SQLDataType.VARCHAR.length(50).nullable(false), this, ""); * The column <code>PUBLIC.AUTHOR.LAST_NAME</code>.
*/
/** public final TableField<Record, String> LAST_NAME = createField("LAST_NAME",
* The column <code>PUBLIC.AUTHOR.DATE_OF_BIRTH</code>. org.jooq.impl.SQLDataType.VARCHAR.length(50).nullable(false), this, "");
*/
public final TableField<Record, Date> DATE_OF_BIRTH = createField("DATE_OF_BIRTH", org.jooq.impl.SQLDataType.DATE, this, ""); /**
* The column <code>PUBLIC.AUTHOR.DATE_OF_BIRTH</code>.
/** */
* The column <code>PUBLIC.AUTHOR.YEAR_OF_BIRTH</code>. public final TableField<Record, Date> DATE_OF_BIRTH = createField("DATE_OF_BIRTH",
*/ org.jooq.impl.SQLDataType.DATE, this, "");
public final TableField<Record, Integer> YEAR_OF_BIRTH = createField("YEAR_OF_BIRTH", org.jooq.impl.SQLDataType.INTEGER, this, "");
/**
/** * The column <code>PUBLIC.AUTHOR.YEAR_OF_BIRTH</code>.
* The column <code>PUBLIC.AUTHOR.DISTINGUISHED</code>. */
*/ public final TableField<Record, Integer> YEAR_OF_BIRTH = createField("YEAR_OF_BIRTH",
public final TableField<Record, Byte> DISTINGUISHED = createField("DISTINGUISHED", org.jooq.impl.SQLDataType.TINYINT, this, ""); org.jooq.impl.SQLDataType.INTEGER, this, "");
/** /**
* Create a <code>PUBLIC.AUTHOR</code> table reference * The column <code>PUBLIC.AUTHOR.DISTINGUISHED</code>.
*/ */
public Author() { public final TableField<Record, Byte> DISTINGUISHED = createField("DISTINGUISHED",
this("AUTHOR", null); org.jooq.impl.SQLDataType.TINYINT, this, "");
}
/**
/** * Create a <code>PUBLIC.AUTHOR</code> table reference
* Create an aliased <code>PUBLIC.AUTHOR</code> table reference */
*/ public Author() {
public Author(String alias) { this("AUTHOR", null);
this(alias, AUTHOR); }
}
/**
private Author(String alias, Table<Record> aliased) { * Create an aliased <code>PUBLIC.AUTHOR</code> table reference
this(alias, aliased, null); */
} public Author(String alias) {
this(alias, AUTHOR);
private Author(String alias, Table<Record> aliased, Field<?>[] parameters) { }
super(alias, null, aliased, parameters, "");
} private Author(String alias, Table<Record> aliased) {
this(alias, aliased, null);
/** }
* {@inheritDoc}
*/ private Author(String alias, Table<Record> aliased, Field<?>[] parameters) {
@Override super(alias, null, aliased, parameters, "");
public Schema getSchema() { }
return Public.PUBLIC;
} /**
* {@inheritDoc}
/** */
* {@inheritDoc} @Override
*/ public Schema getSchema() {
@Override return Public.PUBLIC;
public UniqueKey<Record> getPrimaryKey() { }
return Keys.CONSTRAINT_7;
} /**
* {@inheritDoc}
/** */
* {@inheritDoc} @Override
*/ public UniqueKey<Record> getPrimaryKey() {
@Override return Keys.CONSTRAINT_7;
public List<UniqueKey<Record>> getKeys() { }
return Arrays.<UniqueKey<Record>>asList(Keys.CONSTRAINT_7);
} /**
* {@inheritDoc}
/** */
* {@inheritDoc} @Override
*/ public List<UniqueKey<Record>> getKeys() {
@Override return Arrays.<UniqueKey<Record>>asList(Keys.CONSTRAINT_7);
public Author as(String alias) { }
return new Author(alias, this);
} /**
* {@inheritDoc}
/** */
* Rename this table @Override
*/ public Author as(String alias) {
public Author rename(String name) { return new Author(alias, this);
return new Author(name, null); }
}
/**
* Rename this table
*/
public Author rename(String name) {
return new Author(name, null);
}
} }

@ -3,7 +3,6 @@
*/ */
package sample.jooq.domain; package sample.jooq.domain;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
@ -18,126 +17,126 @@ import org.jooq.TableField;
import org.jooq.UniqueKey; import org.jooq.UniqueKey;
import org.jooq.impl.TableImpl; import org.jooq.impl.TableImpl;
/** /**
* This class is generated by jOOQ. * This class is generated by jOOQ.
*/ */
@Generated( @Generated(value = { "http://www.jooq.org",
value = { "jOOQ version:3.8.2" }, comments = "This class is generated by jOOQ")
"http://www.jooq.org",
"jOOQ version:3.8.2"
},
comments = "This class is generated by jOOQ"
)
@SuppressWarnings({ "all", "unchecked", "rawtypes" }) @SuppressWarnings({ "all", "unchecked", "rawtypes" })
public class Book extends TableImpl<Record> { public class Book extends TableImpl<Record> {
private static final long serialVersionUID = 1176189796; private static final long serialVersionUID = 1176189796;
/** /**
* The reference instance of <code>PUBLIC.BOOK</code> * The reference instance of <code>PUBLIC.BOOK</code>
*/ */
public static final Book BOOK = new Book(); public static final Book BOOK = new Book();
/** /**
* The class holding records for this type * The class holding records for this type
*/ */
@Override @Override
public Class<Record> getRecordType() { public Class<Record> getRecordType() {
return Record.class; return Record.class;
} }
/** /**
* The column <code>PUBLIC.BOOK.ID</code>. * The column <code>PUBLIC.BOOK.ID</code>.
*/ */
public final TableField<Record, Integer> ID = createField("ID", org.jooq.impl.SQLDataType.INTEGER.nullable(false), this, ""); public final TableField<Record, Integer> ID = createField("ID",
org.jooq.impl.SQLDataType.INTEGER.nullable(false), this, "");
/**
* The column <code>PUBLIC.BOOK.AUTHOR_ID</code>. /**
*/ * The column <code>PUBLIC.BOOK.AUTHOR_ID</code>.
public final TableField<Record, Integer> AUTHOR_ID = createField("AUTHOR_ID", org.jooq.impl.SQLDataType.INTEGER.nullable(false), this, ""); */
public final TableField<Record, Integer> AUTHOR_ID = createField("AUTHOR_ID",
/** org.jooq.impl.SQLDataType.INTEGER.nullable(false), this, "");
* The column <code>PUBLIC.BOOK.TITLE</code>.
*/ /**
public final TableField<Record, String> TITLE = createField("TITLE", org.jooq.impl.SQLDataType.VARCHAR.length(400).nullable(false), this, ""); * The column <code>PUBLIC.BOOK.TITLE</code>.
*/
/** public final TableField<Record, String> TITLE = createField("TITLE",
* The column <code>PUBLIC.BOOK.PUBLISHED_IN</code>. org.jooq.impl.SQLDataType.VARCHAR.length(400).nullable(false), this, "");
*/
public final TableField<Record, Integer> PUBLISHED_IN = createField("PUBLISHED_IN", org.jooq.impl.SQLDataType.INTEGER.nullable(false), this, ""); /**
* The column <code>PUBLIC.BOOK.PUBLISHED_IN</code>.
/** */
* The column <code>PUBLIC.BOOK.LANGUAGE_ID</code>. public final TableField<Record, Integer> PUBLISHED_IN = createField("PUBLISHED_IN",
*/ org.jooq.impl.SQLDataType.INTEGER.nullable(false), this, "");
public final TableField<Record, Integer> LANGUAGE_ID = createField("LANGUAGE_ID", org.jooq.impl.SQLDataType.INTEGER.nullable(false), this, "");
/**
/** * The column <code>PUBLIC.BOOK.LANGUAGE_ID</code>.
* Create a <code>PUBLIC.BOOK</code> table reference */
*/ public final TableField<Record, Integer> LANGUAGE_ID = createField("LANGUAGE_ID",
public Book() { org.jooq.impl.SQLDataType.INTEGER.nullable(false), this, "");
this("BOOK", null);
} /**
* Create a <code>PUBLIC.BOOK</code> table reference
/** */
* Create an aliased <code>PUBLIC.BOOK</code> table reference public Book() {
*/ this("BOOK", null);
public Book(String alias) { }
this(alias, BOOK);
} /**
* Create an aliased <code>PUBLIC.BOOK</code> table reference
private Book(String alias, Table<Record> aliased) { */
this(alias, aliased, null); public Book(String alias) {
} this(alias, BOOK);
}
private Book(String alias, Table<Record> aliased, Field<?>[] parameters) {
super(alias, null, aliased, parameters, ""); private Book(String alias, Table<Record> aliased) {
} this(alias, aliased, null);
}
/**
* {@inheritDoc} private Book(String alias, Table<Record> aliased, Field<?>[] parameters) {
*/ super(alias, null, aliased, parameters, "");
@Override }
public Schema getSchema() {
return Public.PUBLIC; /**
} * {@inheritDoc}
*/
/** @Override
* {@inheritDoc} public Schema getSchema() {
*/ return Public.PUBLIC;
@Override }
public UniqueKey<Record> getPrimaryKey() {
return Keys.CONSTRAINT_1; /**
} * {@inheritDoc}
*/
/** @Override
* {@inheritDoc} public UniqueKey<Record> getPrimaryKey() {
*/ return Keys.CONSTRAINT_1;
@Override }
public List<UniqueKey<Record>> getKeys() {
return Arrays.<UniqueKey<Record>>asList(Keys.CONSTRAINT_1); /**
} * {@inheritDoc}
*/
/** @Override
* {@inheritDoc} public List<UniqueKey<Record>> getKeys() {
*/ return Arrays.<UniqueKey<Record>>asList(Keys.CONSTRAINT_1);
@Override }
public List<ForeignKey<Record, ?>> getReferences() {
return Arrays.<ForeignKey<Record, ?>>asList(Keys.FK_BOOK_AUTHOR, Keys.FK_BOOK_LANGUAGE); /**
} * {@inheritDoc}
*/
/** @Override
* {@inheritDoc} public List<ForeignKey<Record, ?>> getReferences() {
*/ return Arrays.<ForeignKey<Record, ?>>asList(Keys.FK_BOOK_AUTHOR,
@Override Keys.FK_BOOK_LANGUAGE);
public Book as(String alias) { }
return new Book(alias, this);
} /**
* {@inheritDoc}
/** */
* Rename this table @Override
*/ public Book as(String alias) {
public Book rename(String name) { return new Book(alias, this);
return new Book(name, null); }
}
/**
* Rename this table
*/
public Book rename(String name) {
return new Book(name, null);
}
} }

@ -3,7 +3,6 @@
*/ */
package sample.jooq.domain; package sample.jooq.domain;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
@ -17,90 +16,85 @@ import org.jooq.TableField;
import org.jooq.UniqueKey; import org.jooq.UniqueKey;
import org.jooq.impl.TableImpl; import org.jooq.impl.TableImpl;
/** /**
* This class is generated by jOOQ. * This class is generated by jOOQ.
*/ */
@Generated( @Generated(value = { "http://www.jooq.org",
value = { "jOOQ version:3.8.2" }, comments = "This class is generated by jOOQ")
"http://www.jooq.org",
"jOOQ version:3.8.2"
},
comments = "This class is generated by jOOQ"
)
@SuppressWarnings({ "all", "unchecked", "rawtypes" }) @SuppressWarnings({ "all", "unchecked", "rawtypes" })
public class BookStore extends TableImpl<Record> { public class BookStore extends TableImpl<Record> {
private static final long serialVersionUID = -2132596210; private static final long serialVersionUID = -2132596210;
/** /**
* The reference instance of <code>PUBLIC.BOOK_STORE</code> * The reference instance of <code>PUBLIC.BOOK_STORE</code>
*/ */
public static final BookStore BOOK_STORE = new BookStore(); public static final BookStore BOOK_STORE = new BookStore();
/** /**
* The class holding records for this type * The class holding records for this type
*/ */
@Override @Override
public Class<Record> getRecordType() { public Class<Record> getRecordType() {
return Record.class; return Record.class;
} }
/** /**
* The column <code>PUBLIC.BOOK_STORE.NAME</code>. * The column <code>PUBLIC.BOOK_STORE.NAME</code>.
*/ */
public final TableField<Record, String> NAME = createField("NAME", org.jooq.impl.SQLDataType.VARCHAR.length(400).nullable(false), this, ""); public final TableField<Record, String> NAME = createField("NAME",
org.jooq.impl.SQLDataType.VARCHAR.length(400).nullable(false), this, "");
/**
* Create a <code>PUBLIC.BOOK_STORE</code> table reference /**
*/ * Create a <code>PUBLIC.BOOK_STORE</code> table reference
public BookStore() { */
this("BOOK_STORE", null); public BookStore() {
} this("BOOK_STORE", null);
}
/**
* Create an aliased <code>PUBLIC.BOOK_STORE</code> table reference /**
*/ * Create an aliased <code>PUBLIC.BOOK_STORE</code> table reference
public BookStore(String alias) { */
this(alias, BOOK_STORE); public BookStore(String alias) {
} this(alias, BOOK_STORE);
}
private BookStore(String alias, Table<Record> aliased) {
this(alias, aliased, null); private BookStore(String alias, Table<Record> aliased) {
} this(alias, aliased, null);
}
private BookStore(String alias, Table<Record> aliased, Field<?>[] parameters) {
super(alias, null, aliased, parameters, ""); private BookStore(String alias, Table<Record> aliased, Field<?>[] parameters) {
} super(alias, null, aliased, parameters, "");
}
/**
* {@inheritDoc} /**
*/ * {@inheritDoc}
@Override */
public Schema getSchema() { @Override
return Public.PUBLIC; public Schema getSchema() {
} return Public.PUBLIC;
}
/**
* {@inheritDoc} /**
*/ * {@inheritDoc}
@Override */
public List<UniqueKey<Record>> getKeys() { @Override
return Arrays.<UniqueKey<Record>>asList(Keys.CONSTRAINT_F); public List<UniqueKey<Record>> getKeys() {
} return Arrays.<UniqueKey<Record>>asList(Keys.CONSTRAINT_F);
}
/**
* {@inheritDoc} /**
*/ * {@inheritDoc}
@Override */
public BookStore as(String alias) { @Override
return new BookStore(alias, this); public BookStore as(String alias) {
} return new BookStore(alias, this);
}
/**
* Rename this table /**
*/ * Rename this table
public BookStore rename(String name) { */
return new BookStore(name, null); public BookStore rename(String name) {
} return new BookStore(name, null);
}
} }

@ -3,7 +3,6 @@
*/ */
package sample.jooq.domain; package sample.jooq.domain;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
@ -18,116 +17,114 @@ import org.jooq.TableField;
import org.jooq.UniqueKey; import org.jooq.UniqueKey;
import org.jooq.impl.TableImpl; import org.jooq.impl.TableImpl;
/** /**
* This class is generated by jOOQ. * This class is generated by jOOQ.
*/ */
@Generated( @Generated(value = { "http://www.jooq.org",
value = { "jOOQ version:3.8.2" }, comments = "This class is generated by jOOQ")
"http://www.jooq.org",
"jOOQ version:3.8.2"
},
comments = "This class is generated by jOOQ"
)
@SuppressWarnings({ "all", "unchecked", "rawtypes" }) @SuppressWarnings({ "all", "unchecked", "rawtypes" })
public class BookToBookStore extends TableImpl<Record> { public class BookToBookStore extends TableImpl<Record> {
private static final long serialVersionUID = -1360744633; private static final long serialVersionUID = -1360744633;
/** /**
* The reference instance of <code>PUBLIC.BOOK_TO_BOOK_STORE</code> * The reference instance of <code>PUBLIC.BOOK_TO_BOOK_STORE</code>
*/ */
public static final BookToBookStore BOOK_TO_BOOK_STORE = new BookToBookStore(); public static final BookToBookStore BOOK_TO_BOOK_STORE = new BookToBookStore();
/** /**
* The class holding records for this type * The class holding records for this type
*/ */
@Override @Override
public Class<Record> getRecordType() { public Class<Record> getRecordType() {
return Record.class; return Record.class;
} }
/** /**
* The column <code>PUBLIC.BOOK_TO_BOOK_STORE.NAME</code>. * The column <code>PUBLIC.BOOK_TO_BOOK_STORE.NAME</code>.
*/ */
public final TableField<Record, String> NAME = createField("NAME", org.jooq.impl.SQLDataType.VARCHAR.length(400).nullable(false), this, ""); public final TableField<Record, String> NAME = createField("NAME",
org.jooq.impl.SQLDataType.VARCHAR.length(400).nullable(false), this, "");
/**
* The column <code>PUBLIC.BOOK_TO_BOOK_STORE.BOOK_ID</code>. /**
*/ * The column <code>PUBLIC.BOOK_TO_BOOK_STORE.BOOK_ID</code>.
public final TableField<Record, Integer> BOOK_ID = createField("BOOK_ID", org.jooq.impl.SQLDataType.INTEGER.nullable(false), this, ""); */
public final TableField<Record, Integer> BOOK_ID = createField("BOOK_ID",
/** org.jooq.impl.SQLDataType.INTEGER.nullable(false), this, "");
* The column <code>PUBLIC.BOOK_TO_BOOK_STORE.STOCK</code>.
*/ /**
public final TableField<Record, Integer> STOCK = createField("STOCK", org.jooq.impl.SQLDataType.INTEGER, this, ""); * The column <code>PUBLIC.BOOK_TO_BOOK_STORE.STOCK</code>.
*/
/** public final TableField<Record, Integer> STOCK = createField("STOCK",
* Create a <code>PUBLIC.BOOK_TO_BOOK_STORE</code> table reference org.jooq.impl.SQLDataType.INTEGER, this, "");
*/
public BookToBookStore() { /**
this("BOOK_TO_BOOK_STORE", null); * Create a <code>PUBLIC.BOOK_TO_BOOK_STORE</code> table reference
} */
public BookToBookStore() {
/** this("BOOK_TO_BOOK_STORE", null);
* Create an aliased <code>PUBLIC.BOOK_TO_BOOK_STORE</code> table reference }
*/
public BookToBookStore(String alias) { /**
this(alias, BOOK_TO_BOOK_STORE); * Create an aliased <code>PUBLIC.BOOK_TO_BOOK_STORE</code> table reference
} */
public BookToBookStore(String alias) {
private BookToBookStore(String alias, Table<Record> aliased) { this(alias, BOOK_TO_BOOK_STORE);
this(alias, aliased, null); }
}
private BookToBookStore(String alias, Table<Record> aliased) {
private BookToBookStore(String alias, Table<Record> aliased, Field<?>[] parameters) { this(alias, aliased, null);
super(alias, null, aliased, parameters, ""); }
}
private BookToBookStore(String alias, Table<Record> aliased, Field<?>[] parameters) {
/** super(alias, null, aliased, parameters, "");
* {@inheritDoc} }
*/
@Override /**
public Schema getSchema() { * {@inheritDoc}
return Public.PUBLIC; */
} @Override
public Schema getSchema() {
/** return Public.PUBLIC;
* {@inheritDoc} }
*/
@Override /**
public UniqueKey<Record> getPrimaryKey() { * {@inheritDoc}
return Keys.CONSTRAINT_2; */
} @Override
public UniqueKey<Record> getPrimaryKey() {
/** return Keys.CONSTRAINT_2;
* {@inheritDoc} }
*/
@Override /**
public List<UniqueKey<Record>> getKeys() { * {@inheritDoc}
return Arrays.<UniqueKey<Record>>asList(Keys.CONSTRAINT_2); */
} @Override
public List<UniqueKey<Record>> getKeys() {
/** return Arrays.<UniqueKey<Record>>asList(Keys.CONSTRAINT_2);
* {@inheritDoc} }
*/
@Override /**
public List<ForeignKey<Record, ?>> getReferences() { * {@inheritDoc}
return Arrays.<ForeignKey<Record, ?>>asList(Keys.FK_B2BS_BOOK_STORE, Keys.FK_B2BS_BOOK); */
} @Override
public List<ForeignKey<Record, ?>> getReferences() {
/** return Arrays.<ForeignKey<Record, ?>>asList(Keys.FK_B2BS_BOOK_STORE,
* {@inheritDoc} Keys.FK_B2BS_BOOK);
*/ }
@Override
public BookToBookStore as(String alias) { /**
return new BookToBookStore(alias, this); * {@inheritDoc}
} */
@Override
/** public BookToBookStore as(String alias) {
* Rename this table return new BookToBookStore(alias, this);
*/ }
public BookToBookStore rename(String name) {
return new BookToBookStore(name, null); /**
} * Rename this table
*/
public BookToBookStore rename(String name) {
return new BookToBookStore(name, null);
}
} }

@ -3,7 +3,6 @@
*/ */
package sample.jooq.domain; package sample.jooq.domain;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
@ -13,48 +12,41 @@ import javax.annotation.Generated;
import org.jooq.Schema; import org.jooq.Schema;
import org.jooq.impl.CatalogImpl; import org.jooq.impl.CatalogImpl;
/** /**
* This class is generated by jOOQ. * This class is generated by jOOQ.
*/ */
@Generated( @Generated(value = { "http://www.jooq.org",
value = { "jOOQ version:3.8.2" }, comments = "This class is generated by jOOQ")
"http://www.jooq.org",
"jOOQ version:3.8.2"
},
comments = "This class is generated by jOOQ"
)
@SuppressWarnings({ "all", "unchecked", "rawtypes" }) @SuppressWarnings({ "all", "unchecked", "rawtypes" })
public class DefaultCatalog extends CatalogImpl { public class DefaultCatalog extends CatalogImpl {
private static final long serialVersionUID = -1557925562; private static final long serialVersionUID = -1557925562;
/** /**
* The reference instance of <code></code> * The reference instance of <code></code>
*/ */
public static final DefaultCatalog DEFAULT_CATALOG = new DefaultCatalog(); public static final DefaultCatalog DEFAULT_CATALOG = new DefaultCatalog();
/** /**
* The schema <code>PUBLIC</code>. * The schema <code>PUBLIC</code>.
*/ */
public final Public PUBLIC = sample.jooq.domain.Public.PUBLIC; public final Public PUBLIC = sample.jooq.domain.Public.PUBLIC;
/** /**
* No further instances allowed * No further instances allowed
*/ */
private DefaultCatalog() { private DefaultCatalog() {
super(""); super("");
} }
@Override @Override
public final List<Schema> getSchemas() { public final List<Schema> getSchemas() {
List result = new ArrayList(); List result = new ArrayList();
result.addAll(getSchemas0()); result.addAll(getSchemas0());
return result; return result;
} }
private final List<Schema> getSchemas0() { private final List<Schema> getSchemas0() {
return Arrays.<Schema>asList( return Arrays.<Schema>asList(Public.PUBLIC);
Public.PUBLIC); }
}
} }

@ -3,7 +3,6 @@
*/ */
package sample.jooq.domain; package sample.jooq.domain;
import javax.annotation.Generated; import javax.annotation.Generated;
import org.jooq.ForeignKey; import org.jooq.ForeignKey;
@ -11,61 +10,69 @@ import org.jooq.Record;
import org.jooq.UniqueKey; import org.jooq.UniqueKey;
import org.jooq.impl.AbstractKeys; import org.jooq.impl.AbstractKeys;
/** /**
* A class modelling foreign key relationships between tables of the <code>PUBLIC</code> * A class modelling foreign key relationships between tables of the <code>PUBLIC</code>
* schema * schema
*/ */
@Generated( @Generated(value = { "http://www.jooq.org",
value = { "jOOQ version:3.8.2" }, comments = "This class is generated by jOOQ")
"http://www.jooq.org",
"jOOQ version:3.8.2"
},
comments = "This class is generated by jOOQ"
)
@SuppressWarnings({ "all", "unchecked", "rawtypes" }) @SuppressWarnings({ "all", "unchecked", "rawtypes" })
public class Keys { public class Keys {
// ------------------------------------------------------------------------- // -------------------------------------------------------------------------
// IDENTITY definitions // IDENTITY definitions
// ------------------------------------------------------------------------- // -------------------------------------------------------------------------
// ------------------------------------------------------------------------- // -------------------------------------------------------------------------
// UNIQUE and PRIMARY KEY definitions // UNIQUE and PRIMARY KEY definitions
// ------------------------------------------------------------------------- // -------------------------------------------------------------------------
public static final UniqueKey<Record> CONSTRAINT_C = UniqueKeys0.CONSTRAINT_C; public static final UniqueKey<Record> CONSTRAINT_C = UniqueKeys0.CONSTRAINT_C;
public static final UniqueKey<Record> CONSTRAINT_7 = UniqueKeys0.CONSTRAINT_7; public static final UniqueKey<Record> CONSTRAINT_7 = UniqueKeys0.CONSTRAINT_7;
public static final UniqueKey<Record> CONSTRAINT_1 = UniqueKeys0.CONSTRAINT_1; public static final UniqueKey<Record> CONSTRAINT_1 = UniqueKeys0.CONSTRAINT_1;
public static final UniqueKey<Record> CONSTRAINT_F = UniqueKeys0.CONSTRAINT_F; public static final UniqueKey<Record> CONSTRAINT_F = UniqueKeys0.CONSTRAINT_F;
public static final UniqueKey<Record> CONSTRAINT_2 = UniqueKeys0.CONSTRAINT_2; public static final UniqueKey<Record> CONSTRAINT_2 = UniqueKeys0.CONSTRAINT_2;
// ------------------------------------------------------------------------- // -------------------------------------------------------------------------
// FOREIGN KEY definitions // FOREIGN KEY definitions
// ------------------------------------------------------------------------- // -------------------------------------------------------------------------
public static final ForeignKey<Record, Record> FK_BOOK_AUTHOR = ForeignKeys0.FK_BOOK_AUTHOR; public static final ForeignKey<Record, Record> FK_BOOK_AUTHOR = ForeignKeys0.FK_BOOK_AUTHOR;
public static final ForeignKey<Record, Record> FK_BOOK_LANGUAGE = ForeignKeys0.FK_BOOK_LANGUAGE; public static final ForeignKey<Record, Record> FK_BOOK_LANGUAGE = ForeignKeys0.FK_BOOK_LANGUAGE;
public static final ForeignKey<Record, Record> FK_B2BS_BOOK_STORE = ForeignKeys0.FK_B2BS_BOOK_STORE; public static final ForeignKey<Record, Record> FK_B2BS_BOOK_STORE = ForeignKeys0.FK_B2BS_BOOK_STORE;
public static final ForeignKey<Record, Record> FK_B2BS_BOOK = ForeignKeys0.FK_B2BS_BOOK; public static final ForeignKey<Record, Record> FK_B2BS_BOOK = ForeignKeys0.FK_B2BS_BOOK;
// ------------------------------------------------------------------------- // -------------------------------------------------------------------------
// [#1459] distribute members to avoid static initialisers > 64kb // [#1459] distribute members to avoid static initialisers > 64kb
// ------------------------------------------------------------------------- // -------------------------------------------------------------------------
private static class UniqueKeys0 extends AbstractKeys { private static class UniqueKeys0 extends AbstractKeys {
public static final UniqueKey<Record> CONSTRAINT_C = createUniqueKey(Language.LANGUAGE, "CONSTRAINT_C", Language.LANGUAGE.ID); public static final UniqueKey<Record> CONSTRAINT_C = createUniqueKey(
public static final UniqueKey<Record> CONSTRAINT_7 = createUniqueKey(Author.AUTHOR, "CONSTRAINT_7", Author.AUTHOR.ID); Language.LANGUAGE, "CONSTRAINT_C", Language.LANGUAGE.ID);
public static final UniqueKey<Record> CONSTRAINT_1 = createUniqueKey(Book.BOOK, "CONSTRAINT_1", Book.BOOK.ID); public static final UniqueKey<Record> CONSTRAINT_7 = createUniqueKey(
public static final UniqueKey<Record> CONSTRAINT_F = createUniqueKey(BookStore.BOOK_STORE, "CONSTRAINT_F", BookStore.BOOK_STORE.NAME); Author.AUTHOR, "CONSTRAINT_7", Author.AUTHOR.ID);
public static final UniqueKey<Record> CONSTRAINT_2 = createUniqueKey(BookToBookStore.BOOK_TO_BOOK_STORE, "CONSTRAINT_2", BookToBookStore.BOOK_TO_BOOK_STORE.NAME, BookToBookStore.BOOK_TO_BOOK_STORE.BOOK_ID); public static final UniqueKey<Record> CONSTRAINT_1 = createUniqueKey(Book.BOOK,
} "CONSTRAINT_1", Book.BOOK.ID);
public static final UniqueKey<Record> CONSTRAINT_F = createUniqueKey(
BookStore.BOOK_STORE, "CONSTRAINT_F", BookStore.BOOK_STORE.NAME);
public static final UniqueKey<Record> CONSTRAINT_2 = createUniqueKey(
BookToBookStore.BOOK_TO_BOOK_STORE, "CONSTRAINT_2",
BookToBookStore.BOOK_TO_BOOK_STORE.NAME,
BookToBookStore.BOOK_TO_BOOK_STORE.BOOK_ID);
}
private static class ForeignKeys0 extends AbstractKeys { private static class ForeignKeys0 extends AbstractKeys {
public static final ForeignKey<Record, Record> FK_BOOK_AUTHOR = createForeignKey(sample.jooq.domain.Keys.CONSTRAINT_7, Book.BOOK, "FK_BOOK_AUTHOR", Book.BOOK.AUTHOR_ID); public static final ForeignKey<Record, Record> FK_BOOK_AUTHOR = createForeignKey(
public static final ForeignKey<Record, Record> FK_BOOK_LANGUAGE = createForeignKey(sample.jooq.domain.Keys.CONSTRAINT_C, Book.BOOK, "FK_BOOK_LANGUAGE", Book.BOOK.LANGUAGE_ID); sample.jooq.domain.Keys.CONSTRAINT_7, Book.BOOK, "FK_BOOK_AUTHOR",
public static final ForeignKey<Record, Record> FK_B2BS_BOOK_STORE = createForeignKey(sample.jooq.domain.Keys.CONSTRAINT_F, BookToBookStore.BOOK_TO_BOOK_STORE, "FK_B2BS_BOOK_STORE", BookToBookStore.BOOK_TO_BOOK_STORE.NAME); Book.BOOK.AUTHOR_ID);
public static final ForeignKey<Record, Record> FK_B2BS_BOOK = createForeignKey(sample.jooq.domain.Keys.CONSTRAINT_1, BookToBookStore.BOOK_TO_BOOK_STORE, "FK_B2BS_BOOK", BookToBookStore.BOOK_TO_BOOK_STORE.BOOK_ID); public static final ForeignKey<Record, Record> FK_BOOK_LANGUAGE = createForeignKey(
} sample.jooq.domain.Keys.CONSTRAINT_C, Book.BOOK, "FK_BOOK_LANGUAGE",
Book.BOOK.LANGUAGE_ID);
public static final ForeignKey<Record, Record> FK_B2BS_BOOK_STORE = createForeignKey(
sample.jooq.domain.Keys.CONSTRAINT_F, BookToBookStore.BOOK_TO_BOOK_STORE,
"FK_B2BS_BOOK_STORE", BookToBookStore.BOOK_TO_BOOK_STORE.NAME);
public static final ForeignKey<Record, Record> FK_B2BS_BOOK = createForeignKey(
sample.jooq.domain.Keys.CONSTRAINT_1, BookToBookStore.BOOK_TO_BOOK_STORE,
"FK_B2BS_BOOK", BookToBookStore.BOOK_TO_BOOK_STORE.BOOK_ID);
}
} }

@ -3,7 +3,6 @@
*/ */
package sample.jooq.domain; package sample.jooq.domain;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
@ -17,108 +16,105 @@ import org.jooq.TableField;
import org.jooq.UniqueKey; import org.jooq.UniqueKey;
import org.jooq.impl.TableImpl; import org.jooq.impl.TableImpl;
/** /**
* This class is generated by jOOQ. * This class is generated by jOOQ.
*/ */
@Generated( @Generated(value = { "http://www.jooq.org",
value = { "jOOQ version:3.8.2" }, comments = "This class is generated by jOOQ")
"http://www.jooq.org",
"jOOQ version:3.8.2"
},
comments = "This class is generated by jOOQ"
)
@SuppressWarnings({ "all", "unchecked", "rawtypes" }) @SuppressWarnings({ "all", "unchecked", "rawtypes" })
public class Language extends TableImpl<Record> { public class Language extends TableImpl<Record> {
private static final long serialVersionUID = -1890716744; private static final long serialVersionUID = -1890716744;
/** /**
* The reference instance of <code>PUBLIC.LANGUAGE</code> * The reference instance of <code>PUBLIC.LANGUAGE</code>
*/ */
public static final Language LANGUAGE = new Language(); public static final Language LANGUAGE = new Language();
/** /**
* The class holding records for this type * The class holding records for this type
*/ */
@Override @Override
public Class<Record> getRecordType() { public Class<Record> getRecordType() {
return Record.class; return Record.class;
} }
/** /**
* The column <code>PUBLIC.LANGUAGE.ID</code>. * The column <code>PUBLIC.LANGUAGE.ID</code>.
*/ */
public final TableField<Record, Integer> ID = createField("ID", org.jooq.impl.SQLDataType.INTEGER.nullable(false), this, ""); public final TableField<Record, Integer> ID = createField("ID",
org.jooq.impl.SQLDataType.INTEGER.nullable(false), this, "");
/**
* The column <code>PUBLIC.LANGUAGE.CD</code>. /**
*/ * The column <code>PUBLIC.LANGUAGE.CD</code>.
public final TableField<Record, String> CD = createField("CD", org.jooq.impl.SQLDataType.CHAR.length(2).nullable(false), this, ""); */
public final TableField<Record, String> CD = createField("CD",
/** org.jooq.impl.SQLDataType.CHAR.length(2).nullable(false), this, "");
* The column <code>PUBLIC.LANGUAGE.DESCRIPTION</code>.
*/ /**
public final TableField<Record, String> DESCRIPTION = createField("DESCRIPTION", org.jooq.impl.SQLDataType.VARCHAR.length(50), this, ""); * The column <code>PUBLIC.LANGUAGE.DESCRIPTION</code>.
*/
/** public final TableField<Record, String> DESCRIPTION = createField("DESCRIPTION",
* Create a <code>PUBLIC.LANGUAGE</code> table reference org.jooq.impl.SQLDataType.VARCHAR.length(50), this, "");
*/
public Language() { /**
this("LANGUAGE", null); * Create a <code>PUBLIC.LANGUAGE</code> table reference
} */
public Language() {
/** this("LANGUAGE", null);
* Create an aliased <code>PUBLIC.LANGUAGE</code> table reference }
*/
public Language(String alias) { /**
this(alias, LANGUAGE); * Create an aliased <code>PUBLIC.LANGUAGE</code> table reference
} */
public Language(String alias) {
private Language(String alias, Table<Record> aliased) { this(alias, LANGUAGE);
this(alias, aliased, null); }
}
private Language(String alias, Table<Record> aliased) {
private Language(String alias, Table<Record> aliased, Field<?>[] parameters) { this(alias, aliased, null);
super(alias, null, aliased, parameters, ""); }
}
private Language(String alias, Table<Record> aliased, Field<?>[] parameters) {
/** super(alias, null, aliased, parameters, "");
* {@inheritDoc} }
*/
@Override /**
public Schema getSchema() { * {@inheritDoc}
return Public.PUBLIC; */
} @Override
public Schema getSchema() {
/** return Public.PUBLIC;
* {@inheritDoc} }
*/
@Override /**
public UniqueKey<Record> getPrimaryKey() { * {@inheritDoc}
return Keys.CONSTRAINT_C; */
} @Override
public UniqueKey<Record> getPrimaryKey() {
/** return Keys.CONSTRAINT_C;
* {@inheritDoc} }
*/
@Override /**
public List<UniqueKey<Record>> getKeys() { * {@inheritDoc}
return Arrays.<UniqueKey<Record>>asList(Keys.CONSTRAINT_C); */
} @Override
public List<UniqueKey<Record>> getKeys() {
/** return Arrays.<UniqueKey<Record>>asList(Keys.CONSTRAINT_C);
* {@inheritDoc} }
*/
@Override /**
public Language as(String alias) { * {@inheritDoc}
return new Language(alias, this); */
} @Override
public Language as(String alias) {
/** return new Language(alias, this);
* Rename this table }
*/
public Language rename(String name) { /**
return new Language(name, null); * Rename this table
} */
public Language rename(String name) {
return new Language(name, null);
}
} }

@ -3,7 +3,6 @@
*/ */
package sample.jooq.domain; package sample.jooq.domain;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
@ -14,81 +13,70 @@ import org.jooq.Catalog;
import org.jooq.Table; import org.jooq.Table;
import org.jooq.impl.SchemaImpl; import org.jooq.impl.SchemaImpl;
/** /**
* This class is generated by jOOQ. * This class is generated by jOOQ.
*/ */
@Generated( @Generated(value = { "http://www.jooq.org",
value = { "jOOQ version:3.8.2" }, comments = "This class is generated by jOOQ")
"http://www.jooq.org",
"jOOQ version:3.8.2"
},
comments = "This class is generated by jOOQ"
)
@SuppressWarnings({ "all", "unchecked", "rawtypes" }) @SuppressWarnings({ "all", "unchecked", "rawtypes" })
public class Public extends SchemaImpl { public class Public extends SchemaImpl {
private static final long serialVersionUID = 217498103; private static final long serialVersionUID = 217498103;
/** /**
* The reference instance of <code>PUBLIC</code> * The reference instance of <code>PUBLIC</code>
*/ */
public static final Public PUBLIC = new Public(); public static final Public PUBLIC = new Public();
/** /**
* The table <code>PUBLIC.LANGUAGE</code>. * The table <code>PUBLIC.LANGUAGE</code>.
*/ */
public final Language LANGUAGE = sample.jooq.domain.Language.LANGUAGE; public final Language LANGUAGE = sample.jooq.domain.Language.LANGUAGE;
/** /**
* The table <code>PUBLIC.AUTHOR</code>. * The table <code>PUBLIC.AUTHOR</code>.
*/ */
public final Author AUTHOR = sample.jooq.domain.Author.AUTHOR; public final Author AUTHOR = sample.jooq.domain.Author.AUTHOR;
/** /**
* The table <code>PUBLIC.BOOK</code>. * The table <code>PUBLIC.BOOK</code>.
*/ */
public final Book BOOK = sample.jooq.domain.Book.BOOK; public final Book BOOK = sample.jooq.domain.Book.BOOK;
/** /**
* The table <code>PUBLIC.BOOK_STORE</code>. * The table <code>PUBLIC.BOOK_STORE</code>.
*/ */
public final BookStore BOOK_STORE = sample.jooq.domain.BookStore.BOOK_STORE; public final BookStore BOOK_STORE = sample.jooq.domain.BookStore.BOOK_STORE;
/** /**
* The table <code>PUBLIC.BOOK_TO_BOOK_STORE</code>. * The table <code>PUBLIC.BOOK_TO_BOOK_STORE</code>.
*/ */
public final BookToBookStore BOOK_TO_BOOK_STORE = sample.jooq.domain.BookToBookStore.BOOK_TO_BOOK_STORE; public final BookToBookStore BOOK_TO_BOOK_STORE = sample.jooq.domain.BookToBookStore.BOOK_TO_BOOK_STORE;
/** /**
* No further instances allowed * No further instances allowed
*/ */
private Public() { private Public() {
super("PUBLIC", null); super("PUBLIC", null);
} }
/**
/** * {@inheritDoc}
* {@inheritDoc} */
*/ @Override
@Override public Catalog getCatalog() {
public Catalog getCatalog() { return DefaultCatalog.DEFAULT_CATALOG;
return DefaultCatalog.DEFAULT_CATALOG; }
}
@Override
@Override public final List<Table<?>> getTables() {
public final List<Table<?>> getTables() { List result = new ArrayList();
List result = new ArrayList(); result.addAll(getTables0());
result.addAll(getTables0()); return result;
return result; }
}
private final List<Table<?>> getTables0() {
private final List<Table<?>> getTables0() { return Arrays.<Table<?>>asList(Language.LANGUAGE, Author.AUTHOR, Book.BOOK,
return Arrays.<Table<?>>asList( BookStore.BOOK_STORE, BookToBookStore.BOOK_TO_BOOK_STORE);
Language.LANGUAGE, }
Author.AUTHOR,
Book.BOOK,
BookStore.BOOK_STORE,
BookToBookStore.BOOK_TO_BOOK_STORE);
}
} }

@ -3,45 +3,38 @@
*/ */
package sample.jooq.domain; package sample.jooq.domain;
import javax.annotation.Generated; import javax.annotation.Generated;
/** /**
* Convenience access to all tables in PUBLIC * Convenience access to all tables in PUBLIC
*/ */
@Generated( @Generated(value = { "http://www.jooq.org",
value = { "jOOQ version:3.8.2" }, comments = "This class is generated by jOOQ")
"http://www.jooq.org",
"jOOQ version:3.8.2"
},
comments = "This class is generated by jOOQ"
)
@SuppressWarnings({ "all", "unchecked", "rawtypes" }) @SuppressWarnings({ "all", "unchecked", "rawtypes" })
public class Tables { public class Tables {
/** /**
* The table <code>PUBLIC.LANGUAGE</code>. * The table <code>PUBLIC.LANGUAGE</code>.
*/ */
public static final Language LANGUAGE = sample.jooq.domain.Language.LANGUAGE; public static final Language LANGUAGE = sample.jooq.domain.Language.LANGUAGE;
/** /**
* The table <code>PUBLIC.AUTHOR</code>. * The table <code>PUBLIC.AUTHOR</code>.
*/ */
public static final Author AUTHOR = sample.jooq.domain.Author.AUTHOR; public static final Author AUTHOR = sample.jooq.domain.Author.AUTHOR;
/** /**
* The table <code>PUBLIC.BOOK</code>. * The table <code>PUBLIC.BOOK</code>.
*/ */
public static final Book BOOK = sample.jooq.domain.Book.BOOK; public static final Book BOOK = sample.jooq.domain.Book.BOOK;
/** /**
* The table <code>PUBLIC.BOOK_STORE</code>. * The table <code>PUBLIC.BOOK_STORE</code>.
*/ */
public static final BookStore BOOK_STORE = sample.jooq.domain.BookStore.BOOK_STORE; public static final BookStore BOOK_STORE = sample.jooq.domain.BookStore.BOOK_STORE;
/** /**
* The table <code>PUBLIC.BOOK_TO_BOOK_STORE</code>. * The table <code>PUBLIC.BOOK_TO_BOOK_STORE</code>.
*/ */
public static final BookToBookStore BOOK_TO_BOOK_STORE = sample.jooq.domain.BookToBookStore.BOOK_TO_BOOK_STORE; public static final BookToBookStore BOOK_TO_BOOK_STORE = sample.jooq.domain.BookToBookStore.BOOK_TO_BOOK_STORE;
} }

@ -43,8 +43,7 @@ import static org.assertj.core.api.Assertions.assertThat;
* @author Dave Syer * @author Dave Syer
*/ */
@RunWith(SpringRunner.class) @RunWith(SpringRunner.class)
@SpringBootTest(classes = { SampleSecureApplication.class, @SpringBootTest(classes = { SampleSecureApplication.class, TestConfiguration.class })
TestConfiguration.class })
public class SampleSecureApplicationTests { public class SampleSecureApplicationTests {
@Autowired @Autowired

@ -0,0 +1,54 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<!-- Your own application should inherit from spring-boot-starter-parent -->
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-samples</artifactId>
<version>1.4.2.BUILD-SNAPSHOT</version>
</parent>
<artifactId>spring-boot-sample-test-nomockito</artifactId>
<name>Spring Boot Test Sample No Mockito</name>
<description>Spring Boot Test Sample No Mockito</description>
<url>http://projects.spring.io/spring-boot/</url>
<organization>
<name>Pivotal Software, Inc.</name>
<url>http://www.spring.io</url>
</organization>
<properties>
<main.basedir>${basedir}/../..</main.basedir>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>

@ -0,0 +1,13 @@
package sample.testnomockito;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class SampleTestNoMockitoApplication {
public static void main(String[] args) {
SpringApplication.run(SampleTestNoMockitoApplication.class);
}
}

@ -0,0 +1,32 @@
package sample.testnomockito;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.test.context.junit4.SpringRunner;
import static org.assertj.core.api.Assertions.assertThat;
/**
* Tests that {code ResetMocksTestExecutionListener} and
* {@code MockitoTestExecutionListener} gracefully degrade when Mockito is not on the
* classpath.
*
* @author Madhura Bhave
*/
@RunWith(SpringRunner.class)
public class SampleTestNoMockitoApplicationTest {
// gh-7065
@Autowired
private ApplicationContext context;
@Test
public void contextLoads() throws Exception {
assertThat(this.context).isNotNull();
}
}

@ -26,6 +26,7 @@ import org.mockito.listeners.MethodInvocationReport;
import org.mockito.mock.MockCreationSettings; import org.mockito.mock.MockCreationSettings;
import org.springframework.util.Assert; import org.springframework.util.Assert;
import org.springframework.util.ClassUtils;
/** /**
* Reset strategy used on a mock bean. Usually applied to a mock via the * Reset strategy used on a mock bean. Usually applied to a mock via the
@ -53,8 +54,6 @@ public enum MockReset {
*/ */
NONE; NONE;
private static final MockUtil util = new MockUtil();
/** /**
* Create {@link MockSettings settings} to be used with mocks where reset should occur * Create {@link MockSettings settings} to be used with mocks where reset should occur
* before each test method runs. * before each test method runs.
@ -105,12 +104,15 @@ public enum MockReset {
@SuppressWarnings("rawtypes") @SuppressWarnings("rawtypes")
static MockReset get(Object mock) { static MockReset get(Object mock) {
MockReset reset = MockReset.NONE; MockReset reset = MockReset.NONE;
if (util.isMock(mock)) { if (ClassUtils.isPresent("org.mockito.internal.util.MockUtil", null)) {
MockCreationSettings settings = util.getMockSettings(mock); MockUtil mockUtil = new MockUtil();
List listeners = settings.getInvocationListeners(); if (mockUtil.isMock(mock)) {
for (Object listener : listeners) { MockCreationSettings settings = mockUtil.getMockSettings(mock);
if (listener instanceof ResetInvocationListener) { List listeners = settings.getInvocationListeners();
reset = ((ResetInvocationListener) listener).getReset(); for (Object listener : listeners) {
if (listener instanceof ResetInvocationListener) {
reset = ((ResetInvocationListener) listener).getReset();
}
} }
} }
} }

@ -19,7 +19,8 @@ package org.springframework.boot.test.context.bootstrap;
import org.springframework.boot.SpringBootConfiguration; import org.springframework.boot.SpringBootConfiguration;
/** /**
* Example configuration used in {@link SpringBootTestContextBootstrapperIntegrationTests}. * Example configuration used in
* {@link SpringBootTestContextBootstrapperIntegrationTests}.
* *
* @author Phillip Webb * @author Phillip Webb
*/ */

@ -19,8 +19,7 @@ package org.springframework.boot.configurationsample.specific;
import org.springframework.boot.configurationsample.ConfigurationProperties; import org.springframework.boot.configurationsample.ConfigurationProperties;
/** /**
* Test that compilation fails if the same type is registered twice with the * Test that compilation fails if the same type is registered twice with the same prefix.
* same prefix.
* *
* @author Stephane Nicoll * @author Stephane Nicoll
*/ */

@ -28,9 +28,9 @@ import org.springframework.core.env.ConfigurableEnvironment;
/** /**
* {@link SpringApplicationRunListener} to publish {@link SpringApplicationEvent}s. * {@link SpringApplicationRunListener} to publish {@link SpringApplicationEvent}s.
* * <p>
* <p>Uses an internal {@link ApplicationEventMulticaster} for the events that are * Uses an internal {@link ApplicationEventMulticaster} for the events that are fired
* fired before the context is actually refreshed. * before the context is actually refreshed.
* *
* @author Phillip Webb * @author Phillip Webb
* @author Stephane Nicoll * @author Stephane Nicoll
@ -59,8 +59,8 @@ public class EventPublishingRunListener implements SpringApplicationRunListener,
@Override @Override
public void started() { public void started() {
this.initialMulticaster.multicastEvent(new ApplicationStartedEvent( this.initialMulticaster
this.application, this.args)); .multicastEvent(new ApplicationStartedEvent(this.application, this.args));
} }
@Override @Override
@ -82,8 +82,8 @@ public class EventPublishingRunListener implements SpringApplicationRunListener,
} }
context.addApplicationListener(listener); context.addApplicationListener(listener);
} }
this.initialMulticaster.multicastEvent(new ApplicationPreparedEvent( this.initialMulticaster.multicastEvent(
this.application, this.args, context)); new ApplicationPreparedEvent(this.application, this.args, context));
} }
@Override @Override

@ -23,15 +23,15 @@ import org.springframework.core.env.Environment;
/** /**
* Allows for customization of the application's {@link Environment} prior to the * Allows for customization of the application's {@link Environment} prior to the
* application context being refreshed. * application context being refreshed.
* * <p>
* <p>EnvironmentPostProcessor implementations have to be registered in * EnvironmentPostProcessor implementations have to be registered in
* {@code META-INF/spring.factories}, using the fully qualified name of this * {@code META-INF/spring.factories}, using the fully qualified name of this class as the
* class as the key. * key.
* * <p>
* <p>{@code EnvironmentPostProcessor} processors are encouraged to detect * {@code EnvironmentPostProcessor} processors are encouraged to detect whether Spring's
* whether Spring's {@link org.springframework.core.Ordered Ordered} interface has been * {@link org.springframework.core.Ordered Ordered} interface has been implemented or if
* implemented or if the @{@link org.springframework.core.annotation.Order Order} * the @{@link org.springframework.core.annotation.Order Order} annotation is present and
* annotation is present and to sort instances accordingly if so prior to invocation. * to sort instances accordingly if so prior to invocation.
* *
* @author Andy Wilkinson * @author Andy Wilkinson
* @author Stephane Nicoll * @author Stephane Nicoll

@ -67,7 +67,8 @@ public class SpringPhysicalNamingStrategy implements PhysicalNamingStrategy {
} }
StringBuilder text = new StringBuilder(name.getText().replace('.', '_')); StringBuilder text = new StringBuilder(name.getText().replace('.', '_'));
for (int i = 1; i < text.length() - 1; i++) { for (int i = 1; i < text.length() - 1; i++) {
if (isUnderscoreRequired(text.charAt(i - 1), text.charAt(i), text.charAt(i + 1))) { if (isUnderscoreRequired(text.charAt(i - 1), text.charAt(i),
text.charAt(i + 1))) {
text.insert(i++, '_'); text.insert(i++, '_');
} }
} }

@ -826,8 +826,7 @@ public class ConfigFileApplicationListenerTests {
assertThat(environment.containsProperty("customprofile")).isTrue(); assertThat(environment.containsProperty("customprofile")).isTrue();
assertThat(environment.containsProperty("customprofile-specific")).isTrue(); assertThat(environment.containsProperty("customprofile-specific")).isTrue();
assertThat(environment.containsProperty("customprofile-customdefault")).isTrue(); assertThat(environment.containsProperty("customprofile-customdefault")).isTrue();
assertThat(environment.acceptsProfiles("customdefault")) assertThat(environment.acceptsProfiles("customdefault")).isTrue();
.isTrue();
} }
private Condition<ConfigurableEnvironment> matchingPropertySource( private Condition<ConfigurableEnvironment> matchingPropertySource(

Loading…
Cancel
Save