Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
S
spring-boot
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
DEMO
spring-boot
Commits
991314c6
Commit
991314c6
authored
Jun 16, 2017
by
Andy Wilkinson
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch '1.5.x'
parents
57300716
59122358
Changes
36
Hide whitespace changes
Inline
Side-by-side
Showing
36 changed files
with
109 additions
and
111 deletions
+109
-111
CassandraDataAutoConfiguration.java
...figure/data/cassandra/CassandraDataAutoConfiguration.java
+1
-2
CassandraReactiveRepositoriesAutoConfigurationTests.java
.../CassandraReactiveRepositoriesAutoConfigurationTests.java
+3
-3
CassandraRepositoriesAutoConfigurationTests.java
...assandra/CassandraRepositoriesAutoConfigurationTests.java
+3
-3
DataSourceAutoConfigurationTests.java
.../autoconfigure/jdbc/DataSourceAutoConfigurationTests.java
+6
-9
KafkaAutoConfigurationTests.java
...boot/autoconfigure/kafka/KafkaAutoConfigurationTests.java
+4
-4
QuartzAutoConfigurationTests.java
...ot/autoconfigure/quartz/QuartzAutoConfigurationTests.java
+0
-3
ClassLoaderFilesResourcePatternResolver.java
...ools/restart/ClassLoaderFilesResourcePatternResolver.java
+6
-6
AbstractDevToolsDataSourceAutoConfigurationTests.java
...ure/AbstractDevToolsDataSourceAutoConfigurationTests.java
+3
-2
ClassLoaderFilesResourcePatternResolverTests.java
...restart/ClassLoaderFilesResourcePatternResolverTests.java
+3
-4
SampleHypermediaUiSecureApplicationTests.java
...a/ui/secure/SampleHypermediaUiSecureApplicationTests.java
+4
-4
Tag.java
...-boot-sample-jpa/src/main/java/sample/jpa/domain/Tag.java
+1
-2
SampleJob.java
...-sample-quartz/src/main/java/sample/quartz/SampleJob.java
+1
-1
SampleSecureOAuth2ActuatorApplicationTests.java
.../actuator/SampleSecureOAuth2ActuatorApplicationTests.java
+2
-1
OverrideAutoConfigurationContextCustomizerFactory.java
...re/OverrideAutoConfigurationContextCustomizerFactory.java
+3
-2
AutoConfigureDataLdap.java
...t/test/autoconfigure/data/ldap/AutoConfigureDataLdap.java
+3
-3
DataLdapTest.java
...ework/boot/test/autoconfigure/data/ldap/DataLdapTest.java
+2
-2
DataLdapTypeExcludeFilter.java
...st/autoconfigure/data/ldap/DataLdapTypeExcludeFilter.java
+6
-6
DataNeo4jTypeExcludeFilter.java
.../autoconfigure/data/neo4j/DataNeo4jTypeExcludeFilter.java
+6
-6
DataRedisTypeExcludeFilter.java
.../autoconfigure/data/redis/DataRedisTypeExcludeFilter.java
+6
-6
DataLdapTestIntegrationTests.java
...autoconfigure/data/ldap/DataLdapTestIntegrationTests.java
+7
-6
DataLdapTestWithIncludeFilterIntegrationTests.java
...a/ldap/DataLdapTestWithIncludeFilterIntegrationTests.java
+2
-2
DataNeo4jTestWithIncludeFilterIntegrationTests.java
...neo4j/DataNeo4jTestWithIncludeFilterIntegrationTests.java
+1
-1
Neo4jTestServer.java
...k/boot/test/autoconfigure/data/neo4j/Neo4jTestServer.java
+3
-2
DataRedisTestIntegrationTests.java
...toconfigure/data/redis/DataRedisTestIntegrationTests.java
+2
-1
ExampleService.java
...rk/boot/test/autoconfigure/data/redis/ExampleService.java
+2
-2
ExampleException.java
...t/autoconfigure/web/servlet/mockmvc/ExampleException.java
+1
-0
SpringBootContextLoader.java
...gframework/boot/test/context/SpringBootContextLoader.java
+4
-2
SpringBootTestReactiveWebEnvironmentUserDefinedTestRestTemplateTests.java
...activeWebEnvironmentUserDefinedTestRestTemplateTests.java
+4
-4
EnvironmentTestUtilsTests.java
...ngframework/boot/test/util/EnvironmentTestUtilsTests.java
+1
-0
ItemDeprecation.java
...boot/configurationprocessor/metadata/ItemDeprecation.java
+2
-2
ConfigurationMetadataAnnotationProcessorTests.java
...cessor/ConfigurationMetadataAnnotationProcessorTests.java
+6
-8
RedisTestServer.java
...pringframework/boot/testsupport/rule/RedisTestServer.java
+3
-6
JsonComponentModule.java
...org/springframework/boot/jackson/JsonComponentModule.java
+2
-2
SpringApplicationTests.java
...java/org/springframework/boot/SpringApplicationTests.java
+1
-1
CloudPlatformTests.java
...va/org/springframework/boot/cloud/CloudPlatformTests.java
+3
-2
JsonComponentModuleTests.java
...pringframework/boot/jackson/JsonComponentModuleTests.java
+2
-1
No files found.
spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/cassandra/CassandraDataAutoConfiguration.java
View file @
991314c6
...
...
@@ -42,7 +42,6 @@ import org.springframework.data.cassandra.core.CassandraAdminOperations;
import
org.springframework.data.cassandra.core.CassandraTemplate
;
import
org.springframework.data.cassandra.core.convert.CassandraConverter
;
import
org.springframework.data.cassandra.core.convert.MappingCassandraConverter
;
import
org.springframework.data.cassandra.core.mapping.BasicCassandraMappingContext
;
import
org.springframework.data.cassandra.core.mapping.CassandraMappingContext
;
import
org.springframework.data.cassandra.core.mapping.SimpleUserTypeResolver
;
import
org.springframework.util.StringUtils
;
...
...
@@ -81,7 +80,7 @@ public class CassandraDataAutoConfiguration {
@Bean
@ConditionalOnMissingBean
public
CassandraMappingContext
cassandraMapping
()
throws
ClassNotFoundException
{
BasicCassandraMappingContext
context
=
new
Basic
CassandraMappingContext
();
CassandraMappingContext
context
=
new
CassandraMappingContext
();
List
<
String
>
packages
=
EntityScanPackages
.
get
(
this
.
beanFactory
)
.
getPackageNames
();
if
(
packages
.
isEmpty
()
&&
AutoConfigurationPackages
.
has
(
this
.
beanFactory
))
{
...
...
spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/cassandra/CassandraReactiveRepositoriesAutoConfigurationTests.java
View file @
991314c6
...
...
@@ -36,7 +36,7 @@ import org.springframework.context.annotation.ComponentScan;
import
org.springframework.context.annotation.ComponentScan.Filter
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.context.annotation.FilterType
;
import
org.springframework.data.cassandra.core.mapping.
Basic
CassandraMappingContext
;
import
org.springframework.data.cassandra.core.mapping.CassandraMappingContext
;
import
org.springframework.data.cassandra.repository.config.EnableReactiveCassandraRepositories
;
import
org.springframework.data.cql.core.session.ReactiveSession
;
import
org.springframework.test.util.ReflectionTestUtils
;
...
...
@@ -87,8 +87,8 @@ public class CassandraReactiveRepositoriesAutoConfigurationTests {
@SuppressWarnings
(
"unchecked"
)
private
Set
<
Class
<?>>
getInitialEntitySet
()
{
Basic
CassandraMappingContext
mappingContext
=
this
.
context
.
getBean
(
Basic
CassandraMappingContext
.
class
);
CassandraMappingContext
mappingContext
=
this
.
context
.
getBean
(
CassandraMappingContext
.
class
);
return
(
Set
<
Class
<?>>)
ReflectionTestUtils
.
getField
(
mappingContext
,
"initialEntitySet"
);
}
...
...
spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/cassandra/CassandraRepositoriesAutoConfigurationTests.java
View file @
991314c6
...
...
@@ -36,7 +36,7 @@ import org.springframework.context.annotation.Bean;
import
org.springframework.context.annotation.ComponentScan
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.context.annotation.FilterType
;
import
org.springframework.data.cassandra.core.mapping.
Basic
CassandraMappingContext
;
import
org.springframework.data.cassandra.core.mapping.CassandraMappingContext
;
import
org.springframework.data.cassandra.repository.config.EnableCassandraRepositories
;
import
org.springframework.test.util.ReflectionTestUtils
;
...
...
@@ -88,8 +88,8 @@ public class CassandraRepositoriesAutoConfigurationTests {
@SuppressWarnings
(
"unchecked"
)
private
Set
<
Class
<?>>
getInitialEntitySet
()
{
Basic
CassandraMappingContext
mappingContext
=
this
.
context
.
getBean
(
Basic
CassandraMappingContext
.
class
);
CassandraMappingContext
mappingContext
=
this
.
context
.
getBean
(
CassandraMappingContext
.
class
);
return
(
Set
<
Class
<?>>)
ReflectionTestUtils
.
getField
(
mappingContext
,
"initialEntitySet"
);
}
...
...
spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/DataSourceAutoConfigurationTests.java
View file @
991314c6
...
...
@@ -210,19 +210,16 @@ public class DataSourceAutoConfigurationTests {
@Test
public
void
testExplicitDriverClassClearsUsername
()
throws
Exception
{
TestPropertyValues
.
of
(
"spring.datasource.driverClassName:"
+
"org.springframework.boot.autoconfigure.jdbc."
+
"DataSourceAutoConfigurationTests$DatabaseTestDriver"
,
"spring.datasource.driverClassName:"
+
DatabaseTestDriver
.
class
.
getName
(),
"spring.datasource.url:jdbc:foo://localhost"
).
applyTo
(
this
.
context
);
this
.
context
.
register
(
DataSourceAutoConfiguration
.
class
,
PropertyPlaceholderAutoConfiguration
.
class
);
this
.
context
.
refresh
();
DataSource
bean
=
this
.
context
.
getBean
(
DataSource
.
class
);
assertThat
(
bean
).
isNotNull
();
HikariDataSource
pool
=
(
HikariDataSource
)
bean
;
assertThat
(
pool
.
getDriverClassName
()).
isEqualTo
(
"org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfigurationTests$DatabaseTestDriver"
);
assertThat
(
pool
.
getUsername
()).
isNull
();
DataSource
dataSource
=
this
.
context
.
getBean
(
DataSource
.
class
);
assertThat
(
dataSource
).
isNotNull
();
assertThat
(((
HikariDataSource
)
dataSource
).
getDriverClassName
())
.
isEqualTo
(
DatabaseTestDriver
.
class
.
getName
());
assertThat
(((
HikariDataSource
)
dataSource
).
getUsername
()).
isNull
();
}
@Test
...
...
spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/kafka/KafkaAutoConfigurationTests.java
View file @
991314c6
...
...
@@ -168,6 +168,7 @@ public class KafkaAutoConfigurationTests {
.
isEmpty
();
}
@SuppressWarnings
(
"unchecked"
)
@Test
public
void
listenerProperties
()
{
load
(
"spring.kafka.template.default-topic=testTopic"
,
...
...
@@ -176,8 +177,8 @@ public class KafkaAutoConfigurationTests {
"spring.kafka.listener.ack-time=456"
,
"spring.kafka.listener.concurrency=3"
,
"spring.kafka.listener.poll-timeout=2000"
,
"spring.kafka.listener.type=batch"
,
"spring.kafka.jaas.
enabled=true"
,
"spring.kafka.jaas.
login-module=foo"
,
"spring.kafka.listener.type=batch"
,
"spring.kafka.jaas.enabled=true"
,
"spring.kafka.jaas.login-module=foo"
,
"spring.kafka.jaas.control-flag=REQUISITE"
,
"spring.kafka.jaas.options.useKeyTab=true"
);
DefaultKafkaProducerFactory
<?,
?>
producerFactory
=
this
.
context
...
...
@@ -199,8 +200,7 @@ public class KafkaAutoConfigurationTests {
assertThat
(
dfa
.
getPropertyValue
(
"concurrency"
)).
isEqualTo
(
3
);
assertThat
(
dfa
.
getPropertyValue
(
"containerProperties.pollTimeout"
))
.
isEqualTo
(
2000L
);
assertThat
(
dfa
.
getPropertyValue
(
"batchListener"
))
.
isEqualTo
(
true
);
assertThat
(
dfa
.
getPropertyValue
(
"batchListener"
)).
isEqualTo
(
true
);
assertThat
(
this
.
context
.
getBeansOfType
(
KafkaJaasLoginModuleInitializer
.
class
))
.
hasSize
(
1
);
KafkaJaasLoginModuleInitializer
jaas
=
this
.
context
...
...
spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/quartz/QuartzAutoConfigurationTests.java
View file @
991314c6
...
...
@@ -354,11 +354,8 @@ public class QuartzAutoConfigurationTests {
public
static
class
ComponentThatUsesScheduler
{
private
Scheduler
scheduler
;
public
ComponentThatUsesScheduler
(
Scheduler
scheduler
)
{
Assert
.
notNull
(
scheduler
,
"Scheduler must not be null"
);
this
.
scheduler
=
scheduler
;
}
}
...
...
spring-boot-devtools/src/main/java/org/springframework/boot/devtools/restart/ClassLoaderFilesResourcePatternResolver.java
View file @
991314c6
...
...
@@ -216,8 +216,8 @@ final class ClassLoaderFilesResourcePatternResolver implements ResourcePatternRe
ApplicationContext
applicationContext
)
{
DefaultResourceLoader
resourceLoader
=
new
DefaultResourceLoader
();
if
(
applicationContext
instanceof
DefaultResourceLoader
)
{
Collection
<
ProtocolResolver
>
protocolResolvers
=
((
DefaultResourceLoader
)
applicationContext
)
.
getProtocolResolvers
();
Collection
<
ProtocolResolver
>
protocolResolvers
=
((
DefaultResourceLoader
)
applicationContext
)
.
getProtocolResolvers
();
for
(
ProtocolResolver
protocolResolver
:
protocolResolvers
)
{
resourceLoader
.
addProtocolResolver
(
protocolResolver
);
}
...
...
@@ -247,11 +247,11 @@ final class ClassLoaderFilesResourcePatternResolver implements ResourcePatternRe
private
ResourceLoader
createResourceLoader
(
WebApplicationContext
applicationContext
)
{
WebApplicationContextResourceLoader
resourceLoader
=
new
WebApplicationContextResourceLoader
(
applicationContext
);
WebApplicationContextResourceLoader
resourceLoader
=
new
WebApplicationContextResourceLoader
(
applicationContext
);
if
(
applicationContext
instanceof
DefaultResourceLoader
)
{
Collection
<
ProtocolResolver
>
protocolResolvers
=
((
DefaultResourceLoader
)
applicationContext
)
.
getProtocolResolvers
();
Collection
<
ProtocolResolver
>
protocolResolvers
=
((
DefaultResourceLoader
)
applicationContext
)
.
getProtocolResolvers
();
for
(
ProtocolResolver
protocolResolver
:
protocolResolvers
)
{
resourceLoader
.
addProtocolResolver
(
protocolResolver
);
}
...
...
spring-boot-devtools/src/test/java/org/springframework/boot/devtools/autoconfigure/AbstractDevToolsDataSourceAutoConfigurationTests.java
View file @
991314c6
...
...
@@ -110,8 +110,9 @@ public abstract class AbstractDevToolsDataSourceAutoConfigurationTests {
context
.
register
(
classes
);
context
.
register
(
DevToolsDataSourceAutoConfiguration
.
class
);
if
(
driverClassName
!=
null
)
{
TestPropertyValues
.
of
(
"spring.datasource.driver-class-name:"
+
driverClassName
).
applyTo
(
context
);
TestPropertyValues
.
of
(
"spring.datasource.driver-class-name:"
+
driverClassName
)
.
applyTo
(
context
);
}
if
(
url
!=
null
)
{
TestPropertyValues
.
of
(
"spring.datasource.url:"
+
url
).
applyTo
(
context
);
...
...
spring-boot-devtools/src/test/java/org/springframework/boot/devtools/restart/ClassLoaderFilesResourcePatternResolverTests.java
View file @
991314c6
...
...
@@ -39,9 +39,9 @@ import org.springframework.web.context.support.GenericWebApplicationContext;
import
org.springframework.web.context.support.ServletContextResource
;
import
static
org
.
assertj
.
core
.
api
.
Assertions
.
assertThat
;
import
static
org
.
mockito
.
ArgumentMatchers
.
any
;
import
static
org
.
mockito
.
ArgumentMatchers
.
eq
;
import
static
org
.
mockito
.
BDDMockito
.
given
;
import
static
org
.
mockito
.
Matchers
.
any
;
import
static
org
.
mockito
.
Matchers
.
eq
;
import
static
org
.
mockito
.
Mockito
.
mock
;
import
static
org
.
mockito
.
Mockito
.
verify
;
...
...
@@ -168,8 +168,7 @@ public class ClassLoaderFilesResourcePatternResolverTests {
private
ProtocolResolver
mockProtocolResolver
(
String
path
,
Resource
resource
)
{
ProtocolResolver
resolver
=
mock
(
ProtocolResolver
.
class
);
given
(
resolver
.
resolve
(
eq
(
path
),
any
(
ResourceLoader
.
class
)))
.
willReturn
(
resource
);
given
(
resolver
.
resolve
(
eq
(
path
),
any
(
ResourceLoader
.
class
))).
willReturn
(
resource
);
return
resolver
;
}
...
...
spring-boot-samples/spring-boot-sample-hypermedia-ui-secure/src/test/java/sample/hypermedia/ui/secure/SampleHypermediaUiSecureApplicationTests.java
View file @
991314c6
...
...
@@ -47,16 +47,16 @@ public class SampleHypermediaUiSecureApplicationTests {
ResponseEntity
<
String
>
entity
=
this
.
restTemplate
.
getForEntity
(
"/application/env"
,
String
.
class
);
assertThat
(
entity
.
getStatusCode
()).
isEqualTo
(
HttpStatus
.
OK
);
ResponseEntity
<
String
>
user
=
this
.
restTemplate
.
getForEntity
(
"/application/env/foo"
,
String
.
class
);
ResponseEntity
<
String
>
user
=
this
.
restTemplate
.
getForEntity
(
"/application/env/foo"
,
String
.
class
);
assertThat
(
user
.
getStatusCode
()).
isEqualTo
(
HttpStatus
.
OK
);
assertThat
(
user
.
getBody
()).
contains
(
"{\"foo\":"
);
}
@Test
public
void
testSecurePath
()
throws
Exception
{
ResponseEntity
<
String
>
entity
=
this
.
restTemplate
.
getForEntity
(
"/application/metrics"
,
String
.
class
);
ResponseEntity
<
String
>
entity
=
this
.
restTemplate
.
getForEntity
(
"/application/metrics"
,
String
.
class
);
assertThat
(
entity
.
getStatusCode
()).
isEqualTo
(
HttpStatus
.
UNAUTHORIZED
);
}
}
spring-boot-samples/spring-boot-sample-jpa/src/main/java/sample/jpa/domain/Tag.java
View file @
991314c6
...
...
@@ -20,7 +20,6 @@ import java.util.List;
import
javax.persistence.Entity
;
import
javax.persistence.GeneratedValue
;
import
javax.persistence.GenerationType
;
import
javax.persistence.Id
;
import
javax.persistence.ManyToMany
;
import
javax.persistence.SequenceGenerator
;
...
...
@@ -29,7 +28,7 @@ import javax.persistence.SequenceGenerator;
public
class
Tag
{
@Id
@SequenceGenerator
(
name
=
"tag_generator"
,
sequenceName
=
"tag_sequence"
,
initialValue
=
4
)
@SequenceGenerator
(
name
=
"tag_generator"
,
sequenceName
=
"tag_sequence"
,
initialValue
=
4
)
@GeneratedValue
(
generator
=
"tag_generator"
)
private
long
id
;
...
...
spring-boot-samples/spring-boot-sample-quartz/src/main/java/sample/quartz/SampleJob.java
View file @
991314c6
...
...
@@ -22,7 +22,7 @@ import org.quartz.JobExecutionException;
import
org.springframework.scheduling.quartz.QuartzJobBean
;
public
class
SampleJob
extends
QuartzJobBean
{
private
String
name
;
// Invoked if a Job data map entry with that name
...
...
spring-boot-samples/spring-boot-sample-secure-oauth2-actuator/src/test/java/sample/secure/oauth2/actuator/SampleSecureOAuth2ActuatorApplicationTests.java
View file @
991314c6
...
...
@@ -70,7 +70,8 @@ public class SampleSecureOAuth2ActuatorApplicationTests {
@Test
public
void
healthAvailable
()
throws
Exception
{
this
.
mvc
.
perform
(
get
(
"/application/health"
)).
andExpect
(
status
().
isOk
()).
andDo
(
print
());
this
.
mvc
.
perform
(
get
(
"/application/health"
)).
andExpect
(
status
().
isOk
())
.
andDo
(
print
());
}
@Test
...
...
spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/OverrideAutoConfigurationContextCustomizerFactory.java
View file @
991314c6
...
...
@@ -56,8 +56,9 @@ class OverrideAutoConfigurationContextCustomizerFactory
@Override
public
void
customizeContext
(
ConfigurableApplicationContext
context
,
MergedContextConfiguration
mergedConfig
)
{
TestPropertyValues
.
of
(
EnableAutoConfiguration
.
ENABLED_OVERRIDE_PROPERTY
+
"=false"
).
applyTo
(
context
);
TestPropertyValues
.
of
(
EnableAutoConfiguration
.
ENABLED_OVERRIDE_PROPERTY
+
"=false"
)
.
applyTo
(
context
);
}
@Override
...
...
spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/data/ldap/AutoConfigureDataLdap.java
View file @
991314c6
...
...
@@ -26,9 +26,9 @@ import java.lang.annotation.Target;
import
org.springframework.boot.autoconfigure.ImportAutoConfiguration
;
/**
* {@link ImportAutoConfiguration Auto-configuration imports} for typical Data LDAP
*
tests. Most tests should consider using {@link DataLdapTest @DataLdapTest} rather
* th
an using th
is annotation directly.
* {@link ImportAutoConfiguration Auto-configuration imports} for typical Data LDAP
tests.
*
Most tests should consider using {@link DataLdapTest @DataLdapTest} rather than using
* this annotation directly.
*
* @author Eddú Meléndez
* @since 2.0.0
...
...
spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/data/ldap/DataLdapTest.java
View file @
991314c6
...
...
@@ -35,8 +35,8 @@ import org.springframework.test.context.BootstrapWith;
/**
* Annotation that can be used in combination with {@code @RunWith(SpringRunner.class)}
* for a typical LDAP test. Can be used when a test focuses <strong>only</strong> on
*
LDAP
components.
* for a typical LDAP test. Can be used when a test focuses <strong>only</strong> on
LDAP
* components.
* <p>
* Using this annotation will disable full auto-configuration and instead apply only
* configuration relevant to LDAP tests.
...
...
spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/data/ldap/DataLdapTypeExcludeFilter.java
View file @
991314c6
...
...
@@ -46,12 +46,12 @@ class DataLdapTypeExcludeFilter extends AnnotationCustomizableTypeExcludeFilter
@Override
protected
Filter
[]
getFilters
(
FilterType
type
)
{
switch
(
type
)
{
case
INCLUDE:
return
this
.
annotation
.
includeFilters
();
case
EXCLUDE:
return
this
.
annotation
.
excludeFilters
();
default
:
throw
new
IllegalStateException
(
"Unsupported type "
+
type
);
case
INCLUDE:
return
this
.
annotation
.
includeFilters
();
case
EXCLUDE:
return
this
.
annotation
.
excludeFilters
();
default
:
throw
new
IllegalStateException
(
"Unsupported type "
+
type
);
}
}
...
...
spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/data/neo4j/DataNeo4jTypeExcludeFilter.java
View file @
991314c6
...
...
@@ -46,12 +46,12 @@ class DataNeo4jTypeExcludeFilter extends AnnotationCustomizableTypeExcludeFilter
@Override
protected
Filter
[]
getFilters
(
FilterType
type
)
{
switch
(
type
)
{
case
INCLUDE:
return
this
.
annotation
.
includeFilters
();
case
EXCLUDE:
return
this
.
annotation
.
excludeFilters
();
default
:
throw
new
IllegalStateException
(
"Unsupported type "
+
type
);
case
INCLUDE:
return
this
.
annotation
.
includeFilters
();
case
EXCLUDE:
return
this
.
annotation
.
excludeFilters
();
default
:
throw
new
IllegalStateException
(
"Unsupported type "
+
type
);
}
}
...
...
spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/data/redis/DataRedisTypeExcludeFilter.java
View file @
991314c6
...
...
@@ -46,12 +46,12 @@ class DataRedisTypeExcludeFilter extends AnnotationCustomizableTypeExcludeFilter
@Override
protected
Filter
[]
getFilters
(
FilterType
type
)
{
switch
(
type
)
{
case
INCLUDE:
return
this
.
annotation
.
includeFilters
();
case
EXCLUDE:
return
this
.
annotation
.
excludeFilters
();
default
:
throw
new
IllegalStateException
(
"Unsupported type "
+
type
);
case
INCLUDE:
return
this
.
annotation
.
includeFilters
();
case
EXCLUDE:
return
this
.
annotation
.
excludeFilters
();
default
:
throw
new
IllegalStateException
(
"Unsupported type "
+
type
);
}
}
...
...
spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/data/ldap/DataLdapTestIntegrationTests.java
View file @
991314c6
...
...
@@ -42,8 +42,8 @@ import static org.assertj.core.api.Assertions.assertThat;
*/
@RunWith
(
SpringRunner
.
class
)
@DataLdapTest
@TestPropertySource
(
properties
=
{
"spring.ldap.embedded.base-dn=dc=spring,dc=org"
,
"spring.ldap.embedded.ldif=classpath:org/springframework/boot/test/autoconfigure/data/ldap/schema.ldif"
})
@TestPropertySource
(
properties
=
{
"spring.ldap.embedded.base-dn=dc=spring,dc=org"
,
"spring.ldap.embedded.ldif=classpath:org/springframework/boot/test/autoconfigure/data/ldap/schema.ldif"
})
public
class
DataLdapTestIntegrationTests
{
@Rule
...
...
@@ -63,10 +63,11 @@ public class DataLdapTestIntegrationTests {
LdapQuery
ldapQuery
=
LdapQueryBuilder
.
query
().
where
(
"cn"
).
is
(
"Bob Smith"
);
Optional
<
ExampleEntry
>
entry
=
this
.
exampleRepository
.
findOne
(
ldapQuery
);
assertThat
(
entry
.
isPresent
());
assertThat
(
entry
.
get
().
getDn
())
.
isEqualTo
(
LdapUtils
.
newLdapName
(
"cn=Bob Smith,ou=company1,c=Sweden,dc=spring,dc=org"
));
assertThat
(
this
.
ldapTemplate
.
findOne
(
ldapQuery
,
ExampleEntry
.
class
)
.
getDn
())
.
isEqualTo
(
LdapUtils
.
newLdapName
(
"cn=Bob Smith,ou=company1,c=Sweden,dc=spring,dc=org"
));
assertThat
(
entry
.
get
().
getDn
()).
isEqualTo
(
LdapUtils
.
newLdapName
(
"cn=Bob Smith,ou=company1,c=Sweden,dc=spring,dc=org"
));
assertThat
(
this
.
ldapTemplate
.
findOne
(
ldapQuery
,
ExampleEntry
.
class
).
getDn
())
.
isEqualTo
(
LdapUtils
.
newLdapName
(
"cn=Bob Smith,ou=company1,c=Sweden,dc=spring,dc=org"
));
}
@Test
...
...
spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/data/ldap/DataLdapTestWithIncludeFilterIntegrationTests.java
View file @
991314c6
...
...
@@ -36,8 +36,8 @@ import static org.assertj.core.api.Assertions.assertThat;
*/
@RunWith
(
SpringRunner
.
class
)
@DataLdapTest
(
includeFilters
=
@Filter
(
Service
.
class
))
@TestPropertySource
(
properties
=
{
"spring.ldap.embedded.base-dn=dc=spring,dc=org"
,
"spring.ldap.embedded.ldif=classpath:org/springframework/boot/test/autoconfigure/data/ldap/schema.ldif"
})
@TestPropertySource
(
properties
=
{
"spring.ldap.embedded.base-dn=dc=spring,dc=org"
,
"spring.ldap.embedded.ldif=classpath:org/springframework/boot/test/autoconfigure/data/ldap/schema.ldif"
})
public
class
DataLdapTestWithIncludeFilterIntegrationTests
{
@Autowired
...
...
spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/data/neo4j/DataNeo4jTestWithIncludeFilterIntegrationTests.java
View file @
991314c6
...
...
@@ -38,7 +38,7 @@ public class DataNeo4jTestWithIncludeFilterIntegrationTests {
@Rule
public
Neo4jTestServer
server
=
new
Neo4jTestServer
(
new
String
[]
{
"org.springframework.boot.test.autoconfigure.data.neo4j"
});
new
String
[]
{
"org.springframework.boot.test.autoconfigure.data.neo4j"
});
@Autowired
private
ExampleService
service
;
...
...
spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/data/neo4j/Neo4jTestServer.java
View file @
991314c6
...
...
@@ -104,8 +104,9 @@ public class Neo4jTestServer implements TestRule {
@Override
public
void
evaluate
()
throws
Throwable
{
Assume
.
assumeTrue
(
"Skipping test due to Neo4j SessionFactory"
+
" not being available"
,
false
);
Assume
.
assumeTrue
(
"Skipping test due to Neo4j SessionFactory"
+
" not being available"
,
false
);
}
}
...
...
spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/data/redis/DataRedisTestIntegrationTests.java
View file @
991314c6
...
...
@@ -66,7 +66,8 @@ public class DataRedisTestIntegrationTests {
assertThat
(
personHash
.
getId
()).
isNull
();
PersonHash
savedEntity
=
this
.
exampleRepository
.
save
(
personHash
);
assertThat
(
savedEntity
.
getId
()).
isNotNull
();
assertThat
(
this
.
operations
.
execute
((
RedisConnection
connection
)
->
connection
.
exists
((
"persons:"
+
savedEntity
.
getId
()).
getBytes
(
CHARSET
)))).
isTrue
();
assertThat
(
this
.
operations
.
execute
((
RedisConnection
connection
)
->
connection
.
exists
((
"persons:"
+
savedEntity
.
getId
()).
getBytes
(
CHARSET
)))).
isTrue
();
this
.
exampleRepository
.
deleteAll
();
}
...
...
spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/data/redis/ExampleService.java
View file @
991314c6
...
...
@@ -39,8 +39,8 @@ public class ExampleService {
}
public
boolean
hasRecord
(
PersonHash
personHash
)
{
return
this
.
operations
.
execute
((
RedisConnection
connection
)
->
connection
.
exists
((
"persons:"
+
personHash
.
getId
()).
getBytes
(
CHARSET
)));
return
this
.
operations
.
execute
((
RedisConnection
connection
)
->
connection
.
exists
((
"persons:"
+
personHash
.
getId
()).
getBytes
(
CHARSET
)));
}
}
spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/web/servlet/mockmvc/ExampleException.java
View file @
991314c6
...
...
@@ -17,6 +17,7 @@
package
org
.
springframework
.
boot
.
test
.
autoconfigure
.
web
.
servlet
.
mockmvc
;
import
org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest
;
/**
* Example exception used in {@link WebMvcTest} tests.
*
...
...
spring-boot-test/src/main/java/org/springframework/boot/test/context/SpringBootContextLoader.java
View file @
991314c6
...
...
@@ -150,8 +150,10 @@ public class SpringBootContextLoader extends AbstractContextLoader {
private
void
setActiveProfiles
(
ConfigurableEnvironment
environment
,
String
[]
profiles
)
{
TestPropertyValues
.
of
(
"spring.profiles.active="
+
StringUtils
.
arrayToCommaDelimitedString
(
profiles
)).
applyTo
(
environment
);
TestPropertyValues
.
of
(
"spring.profiles.active="
+
StringUtils
.
arrayToCommaDelimitedString
(
profiles
))
.
applyTo
(
environment
);
}
protected
String
[]
getInlinedProperties
(
MergedContextConfiguration
config
)
{
...
...
spring-boot-test/src/test/java/org/springframework/boot/test/context/SpringBootTestReactiveWebEnvironmentUserDefinedTestRestTemplateTests.java
View file @
991314c6
...
...
@@ -31,15 +31,15 @@ import org.springframework.web.reactive.config.EnableWebFlux;
import
static
org
.
assertj
.
core
.
api
.
Assertions
.
assertThat
;
/**
* Tests for {@link SpringBootTest} in a reactive environment configured with
*
a
user-defined {@link RestTemplate} that is named {@code testRestTemplate}.
* Tests for {@link SpringBootTest} in a reactive environment configured with
a
* user-defined {@link RestTemplate} that is named {@code testRestTemplate}.
*
* @author Madhura Bhave
*/
@RunWith
(
SpringRunner
.
class
)
@DirtiesContext
@SpringBootTest
(
webEnvironment
=
WebEnvironment
.
RANDOM_PORT
,
properties
=
{
"spring.main.web-application-type=reactive"
,
"value=123"
})
@SpringBootTest
(
webEnvironment
=
WebEnvironment
.
RANDOM_PORT
,
properties
=
{
"spring.main.web-application-type=reactive"
,
"value=123"
})
public
class
SpringBootTestReactiveWebEnvironmentUserDefinedTestRestTemplateTests
extends
AbstractSpringBootTestEmbeddedReactiveWebEnvironmentTests
{
...
...
spring-boot-test/src/test/java/org/springframework/boot/test/util/EnvironmentTestUtilsTests.java
View file @
991314c6
...
...
@@ -32,6 +32,7 @@ import static org.assertj.core.api.Assertions.assertThat;
*
* @author Stephane Nicoll
*/
@Deprecated
public
class
EnvironmentTestUtilsTests
{
private
final
ConfigurableEnvironment
environment
=
new
StandardEnvironment
();
...
...
spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/metadata/ItemDeprecation.java
View file @
991314c6
...
...
@@ -71,8 +71,8 @@ public class ItemDeprecation {
@Override
public
String
toString
()
{
return
"ItemDeprecation{"
+
"reason='"
+
this
.
reason
+
'\''
+
", "
+
"replacement='"
+
this
.
replacement
+
'\''
+
", "
+
"level='"
+
this
.
level
+
'\''
+
'}'
;
+
"replacement='"
+
this
.
replacement
+
'\''
+
", "
+
"level='"
+
this
.
level
+
'\''
+
'}'
;
}
@Override
...
...
spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationprocessor/ConfigurationMetadataAnnotationProcessorTests.java
View file @
991314c6
...
...
@@ -556,16 +556,14 @@ public class ConfigurationMetadataAnnotationProcessorTests {
@Test
public
void
mergeExistingPropertyDeprecation
()
throws
Exception
{
ItemMetadata
property
=
ItemMetadata
.
newProperty
(
"simple"
,
"comparator"
,
null
,
null
,
null
,
null
,
null
,
new
ItemDeprecation
(
"Don't use this."
,
"simple.complex-comparator"
,
"error"
));
null
,
null
,
null
,
null
,
new
ItemDeprecation
(
"Don't use this."
,
"simple.complex-comparator"
,
"error"
));
writeAdditionalMetadata
(
property
);
ConfigurationMetadata
metadata
=
compile
(
SimpleProperties
.
class
);
assertThat
(
metadata
)
.
has
(
Metadata
.
withProperty
(
"simple.comparator"
,
"java.util.Comparator<?>"
)
.
fromSource
(
SimpleProperties
.
class
)
.
withDeprecation
(
"Don't use this."
,
"simple.complex-comparator"
,
"error"
));
.
fromSource
(
SimpleProperties
.
class
).
withDeprecation
(
"Don't use this."
,
"simple.complex-comparator"
,
"error"
));
assertThat
(
metadata
.
getItems
()).
hasSize
(
4
);
}
...
...
@@ -591,8 +589,8 @@ public class ConfigurationMetadataAnnotationProcessorTests {
ConfigurationMetadata
metadata
=
compile
(
DeprecatedSingleProperty
.
class
);
assertThat
(
metadata
).
has
(
Metadata
.
withProperty
(
"singledeprecated.name"
,
String
.
class
.
getName
())
.
fromSource
(
DeprecatedSingleProperty
.
class
)
.
withDeprecation
(
"renamed"
,
"singledeprecated.new-name"
,
"error"
));
.
fromSource
(
DeprecatedSingleProperty
.
class
)
.
withDeprecation
(
"renamed"
,
"singledeprecated.new-name"
,
"error"
));
assertThat
(
metadata
.
getItems
()).
hasSize
(
3
);
}
...
...
spring-boot-tools/spring-boot-test-support/src/main/java/org/springframework/boot/testsupport/rule/RedisTestServer.java
View file @
991314c6
...
...
@@ -63,12 +63,10 @@ public class RedisTestServer implements TestRule {
ClassLoader
classLoader
=
RedisTestServer
.
class
.
getClassLoader
();
RedisConnectionFactory
cf
;
if
(
ClassUtils
.
isPresent
(
"redis.clients.jedis.Jedis"
,
classLoader
))
{
cf
=
new
JedisConnectionFactoryConfiguration
()
.
createConnectionFactory
();
cf
=
new
JedisConnectionFactoryConfiguration
().
createConnectionFactory
();
}
else
{
cf
=
new
LettuceConnectionFactoryConfiguration
()
.
createConnectionFactory
();
cf
=
new
LettuceConnectionFactoryConfiguration
().
createConnectionFactory
();
}
testConnection
(
cf
);
...
...
@@ -142,8 +140,7 @@ public class RedisTestServer implements TestRule {
RedisConnectionFactory
createConnectionFactory
()
{
LettuceClientConfiguration
config
=
LettuceClientConfiguration
.
builder
()
.
shutdownTimeout
(
Duration
.
ofMillis
(
0
))
.
build
();
.
shutdownTimeout
(
Duration
.
ofMillis
(
0
)).
build
();
LettuceConnectionFactory
connectionFactory
=
new
LettuceConnectionFactory
(
new
RedisStandaloneConfiguration
(),
config
);
connectionFactory
.
afterPropertiesSet
();
...
...
spring-boot/src/main/java/org/springframework/boot/jackson/JsonComponentModule.java
View file @
991314c6
...
...
@@ -79,8 +79,8 @@ public class JsonComponentModule extends SimpleModule implements BeanFactoryAwar
addDeserializerWithDeducedType
((
JsonDeserializer
<?>)
bean
);
}
for
(
Class
<?>
innerClass
:
bean
.
getClass
().
getDeclaredClasses
())
{
if
(!
Modifier
.
isAbstract
(
innerClass
.
getModifiers
())
&&
(
JsonSerializer
.
class
.
isAssignableFrom
(
innerClass
)
if
(!
Modifier
.
isAbstract
(
innerClass
.
getModifiers
())
&&
(
JsonSerializer
.
class
.
isAssignableFrom
(
innerClass
)
||
JsonDeserializer
.
class
.
isAssignableFrom
(
innerClass
)))
{
try
{
addJsonBean
(
innerClass
.
newInstance
());
...
...
spring-boot/src/test/java/org/springframework/boot/SpringApplicationTests.java
View file @
991314c6
...
...
@@ -987,7 +987,7 @@ public class SpringApplicationTests {
public
void
run
()
{
SpringApplication
application
=
new
SpringApplication
(
FailingConfig
.
class
);
application
.
setWeb
Environment
(
false
);
application
.
setWeb
ApplicationType
(
WebApplicationType
.
NONE
);
application
.
run
();
};
};
...
...
spring-boot/src/test/java/org/springframework/boot/cloud/CloudPlatformTests.java
View file @
991314c6
/*
* Copyright 2012-201
6
the original author or authors.
* Copyright 2012-201
7
the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
...
...
@@ -73,7 +73,8 @@ public class CloudPlatformTests {
@Test
public
void
getActiveWhenHasHcLandscapeShouldReturnHcp
()
throws
Exception
{
Environment
environment
=
new
MockEnvironment
().
withProperty
(
"HC_LANDSCAPE"
,
"---"
);
Environment
environment
=
new
MockEnvironment
().
withProperty
(
"HC_LANDSCAPE"
,
"---"
);
CloudPlatform
platform
=
CloudPlatform
.
getActive
(
environment
);
assertThat
(
platform
).
isEqualTo
(
CloudPlatform
.
HCP
);
assertThat
(
platform
.
isActive
(
environment
)).
isTrue
();
...
...
spring-boot/src/test/java/org/springframework/boot/jackson/JsonComponentModuleTests.java
View file @
991314c6
...
...
@@ -109,7 +109,8 @@ public class JsonComponentModuleTests {
@JsonComponent
static
class
ComponentWithInnerAbstractClass
{
private
static
abstract
class
AbstractSerializer
extends
NameAndAgeJsonComponent
.
Serializer
{
private
static
abstract
class
AbstractSerializer
extends
NameAndAgeJsonComponent
.
Serializer
{
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment