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
56169156
Commit
56169156
authored
Jul 26, 2017
by
Andy Wilkinson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Polishing
parent
0fc3e3d1
Changes
14
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
63 additions
and
53 deletions
+63
-53
ElasticsearchAutoConfigurationTests.java
...ta/elasticsearch/ElasticsearchAutoConfigurationTests.java
+1
-2
Neo4jDataAutoConfigurationTests.java
...configure/data/neo4j/Neo4jDataAutoConfigurationTests.java
+15
-12
HazelcastAutoConfigurationClientTests.java
...gure/hazelcast/HazelcastAutoConfigurationClientTests.java
+1
-1
InfluxDbAutoConfigurationTests.java
.../autoconfigure/influx/InfluxDbAutoConfigurationTests.java
+13
-11
KafkaAutoConfigurationTests.java
...boot/autoconfigure/kafka/KafkaAutoConfigurationTests.java
+1
-2
RemoteClientConfigurationTests.java
...evtools/remote/client/RemoteClientConfigurationTests.java
+1
-2
AssertProviderApplicationContextInvocationHandler.java
...xt/AssertProviderApplicationContextInvocationHandler.java
+2
-2
HidePackagesClassLoader.java
...gframework/boot/test/context/HidePackagesClassLoader.java
+2
-2
NoUnboundElementsBindHandler.java
...properties/bind/handler/NoUnboundElementsBindHandler.java
+4
-2
UnboundElementsSourceFilter.java
...ontext/properties/source/UnboundElementsSourceFilter.java
+10
-9
JettyReactiveWebServerFactory.java
...oot/web/embedded/jetty/JettyReactiveWebServerFactory.java
+2
-2
UndertowReactiveWebServerFactory.java
...b/embedded/undertow/UndertowReactiveWebServerFactory.java
+2
-1
UndertowServletWebServerFactory.java
...eb/embedded/undertow/UndertowServletWebServerFactory.java
+1
-1
UnboundElementsSourceFilterTests.java
...t/properties/source/UnboundElementsSourceFilterTests.java
+8
-4
No files found.
spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/elasticsearch/ElasticsearchAutoConfigurationTests.java
View file @
56169156
...
...
@@ -62,8 +62,7 @@ public class ElasticsearchAutoConfigurationTests {
PropertyPlaceholderAutoConfiguration
.
class
,
ElasticsearchAutoConfiguration
.
class
);
this
.
context
.
refresh
();
assertThat
(
this
.
context
.
getBeanNamesForType
(
Client
.
class
).
length
)
.
isEqualTo
(
1
);
assertThat
(
this
.
context
.
getBeanNamesForType
(
Client
.
class
).
length
).
isEqualTo
(
1
);
assertThat
(
this
.
context
.
getBean
(
"myClient"
))
.
isSameAs
(
this
.
context
.
getBean
(
Client
.
class
));
}
...
...
spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/neo4j/Neo4jDataAutoConfigurationTests.java
View file @
56169156
...
...
@@ -63,8 +63,8 @@ public class Neo4jDataAutoConfigurationTests {
public
void
defaultConfiguration
()
{
this
.
context
.
withPropertyValues
(
"spring.data.neo4j.uri=http://localhost:8989"
)
.
run
((
loaded
)
->
{
assertThat
(
loaded
)
.
hasSingleBean
(
org
.
neo4j
.
ogm
.
config
.
Configuration
.
class
);
assertThat
(
loaded
)
.
hasSingleBean
(
org
.
neo4j
.
ogm
.
config
.
Configuration
.
class
);
assertThat
(
loaded
).
hasSingleBean
(
SessionFactory
.
class
);
assertThat
(
loaded
).
hasSingleBean
(
Neo4jTransactionManager
.
class
);
assertThat
(
loaded
).
hasSingleBean
(
OpenSessionInViewInterceptor
.
class
);
...
...
@@ -73,13 +73,15 @@ public class Neo4jDataAutoConfigurationTests {
@Test
public
void
customNeo4jTransactionManagerUsingProperties
()
{
this
.
context
.
withPropertyValues
(
"spring.transaction.default-timeout=30"
,
"spring.transaction.rollback-on-commit-failure:true"
).
run
((
loaded
)
->
{
Neo4jTransactionManager
transactionManager
=
loaded
.
getBean
(
Neo4jTransactionManager
.
class
);
assertThat
(
transactionManager
.
getDefaultTimeout
()).
isEqualTo
(
30
);
assertThat
(
transactionManager
.
isRollbackOnCommitFailure
()).
isTrue
();
});
this
.
context
.
withPropertyValues
(
"spring.transaction.default-timeout=30"
,
"spring.transaction.rollback-on-commit-failure:true"
)
.
run
((
loaded
)
->
{
Neo4jTransactionManager
transactionManager
=
loaded
.
getBean
(
Neo4jTransactionManager
.
class
);
assertThat
(
transactionManager
.
getDefaultTimeout
()).
isEqualTo
(
30
);
assertThat
(
transactionManager
.
isRollbackOnCommitFailure
()).
isTrue
();
});
}
@Test
...
...
@@ -121,8 +123,8 @@ public class Neo4jDataAutoConfigurationTests {
@Test
public
void
openSessionInViewInterceptorCanBeDisabled
()
{
this
.
context
.
withPropertyValues
(
"spring.data.neo4j.open-in-view:false"
)
.
run
((
loaded
)
->
assertThat
(
loaded
)
.
doesNotHaveBean
(
OpenSessionInViewInterceptor
.
class
));
.
run
((
loaded
)
->
assertThat
(
loaded
)
.
doesNotHaveBean
(
OpenSessionInViewInterceptor
.
class
));
}
@Test
...
...
@@ -130,7 +132,8 @@ public class Neo4jDataAutoConfigurationTests {
this
.
context
.
withUserConfiguration
(
EventListenerConfiguration
.
class
)
.
run
((
loaded
)
->
{
Session
session
=
loaded
.
getBean
(
SessionFactory
.
class
).
openSession
();
session
.
notifyListeners
(
new
PersistenceEvent
(
null
,
Event
.
TYPE
.
PRE_SAVE
));
session
.
notifyListeners
(
new
PersistenceEvent
(
null
,
Event
.
TYPE
.
PRE_SAVE
));
verify
(
loaded
.
getBean
(
"eventListenerOne"
,
EventListener
.
class
))
.
onPreSave
(
any
(
Event
.
class
));
verify
(
loaded
.
getBean
(
"eventListenerTwo"
,
EventListener
.
class
))
...
...
spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/hazelcast/HazelcastAutoConfigurationClientTests.java
View file @
56169156
...
...
@@ -123,7 +123,7 @@ public class HazelcastAutoConfigurationClientTests {
}
private
Condition
<
HazelcastInstance
>
nameStartingWith
(
String
prefix
)
{
return
new
Condition
<
HazelcastInstance
>((
o
)
->
o
.
getName
().
startsWith
(
prefix
),
return
new
Condition
<>((
o
)
->
o
.
getName
().
startsWith
(
prefix
),
"Name starts with "
+
prefix
);
}
...
...
spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/influx/InfluxDbAutoConfigurationTests.java
View file @
56169156
...
...
@@ -46,16 +46,17 @@ public class InfluxDbAutoConfigurationTests {
@Test
public
void
influxDbRequiresUrl
()
{
this
.
context
.
run
(
(
loaded
)
->
assertThat
(
loaded
.
getBeansOfType
(
InfluxDB
.
class
)).
isEmpty
());
this
.
context
.
run
(
(
loaded
)
->
assertThat
(
loaded
.
getBeansOfType
(
InfluxDB
.
class
)).
isEmpty
());
}
@Test
public
void
influxDbCanBeCustomized
()
{
this
.
context
.
withPropertyValues
(
"spring.influx.url=http://localhost"
,
"spring.influx.password:password"
,
"spring.influx.user:user"
)
.
run
((
loaded
->
assertThat
(
loaded
.
getBeansOfType
(
InfluxDB
.
class
)).
hasSize
(
1
)));
this
.
context
.
withPropertyValues
(
"spring.influx.url=http://localhost"
,
"spring.influx.password:password"
,
"spring.influx.user:user"
)
.
run
((
loaded
->
assertThat
(
loaded
.
getBeansOfType
(
InfluxDB
.
class
))
.
hasSize
(
1
)));
}
@Test
...
...
@@ -71,11 +72,12 @@ public class InfluxDbAutoConfigurationTests {
@Test
public
void
influxDbWithoutCredentialsAndOkHttpClientBuilder
()
{
this
.
context
.
withUserConfiguration
(
CustomOkHttpClientBuilderConfig
.
class
)
.
withPropertyValues
(
"spring.influx.url=http://localhost"
).
run
((
loaded
)
->
{
assertThat
(
loaded
.
getBeansOfType
(
InfluxDB
.
class
)).
hasSize
(
1
);
int
readTimeout
=
getReadTimeoutProperty
(
loaded
);
assertThat
(
readTimeout
).
isEqualTo
(
30_000
);
});
.
withPropertyValues
(
"spring.influx.url=http://localhost"
)
.
run
((
loaded
)
->
{
assertThat
(
loaded
.
getBeansOfType
(
InfluxDB
.
class
)).
hasSize
(
1
);
int
readTimeout
=
getReadTimeoutProperty
(
loaded
);
assertThat
(
readTimeout
).
isEqualTo
(
30_000
);
});
}
@Test
...
...
spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/kafka/KafkaAutoConfigurationTests.java
View file @
56169156
...
...
@@ -126,8 +126,7 @@ public class KafkaAutoConfigurationTests {
public
void
producerProperties
()
{
load
(
"spring.kafka.clientId=cid"
,
"spring.kafka.properties.foo.bar.baz=qux.fiz.buz"
,
"spring.kafka.producer.acks=all"
,
"spring.kafka.producer.batch-size=20"
,
"spring.kafka.producer.acks=all"
,
"spring.kafka.producer.batch-size=20"
,
"spring.kafka.producer.bootstrap-servers=bar:1234"
,
// test override
"spring.kafka.producer.buffer-memory=12345"
,
"spring.kafka.producer.compression-type=gzip"
,
...
...
spring-boot-devtools/src/test/java/org/springframework/boot/devtools/remote/client/RemoteClientConfigurationTests.java
View file @
56169156
...
...
@@ -87,8 +87,7 @@ public class RemoteClientConfigurationTests {
@Test
public
void
warnIfRestartDisabled
()
throws
Exception
{
configure
(
"spring.devtools.remote.restart.enabled:false"
);
assertThat
(
this
.
output
.
toString
())
.
contains
(
"Remote restart is disabled"
);
assertThat
(
this
.
output
.
toString
()).
contains
(
"Remote restart is disabled"
);
}
@Test
...
...
spring-boot-test/src/main/java/org/springframework/boot/test/context/AssertProviderApplicationContextInvocationHandler.java
View file @
56169156
...
...
@@ -134,8 +134,8 @@ class AssertProviderApplicationContextInvocationHandler implements InvocationHan
}
private
Object
getAssertThat
(
Object
proxy
)
{
return
new
ApplicationContextAssert
<
ApplicationContext
>(
(
ApplicationContext
)
proxy
,
this
.
startupFailure
);
return
new
ApplicationContextAssert
<
>((
ApplicationContext
)
proxy
,
this
.
startupFailure
);
}
private
boolean
isCloseMethod
(
Method
method
)
{
...
...
spring-boot-test/src/main/java/org/springframework/boot/test/context/HidePackagesClassLoader.java
View file @
56169156
...
...
@@ -20,8 +20,8 @@ import java.net.URL;
import
java.net.URLClassLoader
;
/**
* Test {@link URLClassLoader} that hides configurable packages. No class
*
in one of those
packages or sub-packages are visible.
* Test {@link URLClassLoader} that hides configurable packages. No class
in one of those
* packages or sub-packages are visible.
*
* @author Andy Wilkinson
* @author Stephane Nicoll
...
...
spring-boot/src/main/java/org/springframework/boot/context/properties/bind/handler/NoUnboundElementsBindHandler.java
View file @
56169156
...
...
@@ -53,7 +53,8 @@ public class NoUnboundElementsBindHandler extends AbstractBindHandler {
this
(
parent
,
(
configurationPropertySource
)
->
true
);
}
public
NoUnboundElementsBindHandler
(
BindHandler
parent
,
Function
<
ConfigurationPropertySource
,
Boolean
>
filter
)
{
public
NoUnboundElementsBindHandler
(
BindHandler
parent
,
Function
<
ConfigurationPropertySource
,
Boolean
>
filter
)
{
super
(
parent
);
this
.
filter
=
filter
;
}
...
...
@@ -77,7 +78,8 @@ public class NoUnboundElementsBindHandler extends AbstractBindHandler {
BindContext
context
)
{
Set
<
ConfigurationProperty
>
unbound
=
new
TreeSet
<>();
for
(
ConfigurationPropertySource
source
:
context
.
getSources
())
{
if
(
source
instanceof
IterableConfigurationPropertySource
&&
this
.
filter
.
apply
(
source
))
{
if
(
source
instanceof
IterableConfigurationPropertySource
&&
this
.
filter
.
apply
(
source
))
{
collectUnbound
(
name
,
unbound
,
(
IterableConfigurationPropertySource
)
source
);
}
...
...
spring-boot/src/main/java/org/springframework/boot/context/properties/source/UnboundElementsSourceFilter.java
View file @
56169156
...
...
@@ -26,19 +26,21 @@ import org.springframework.core.env.PropertySource;
import
org.springframework.core.env.StandardEnvironment
;
/**
* Function used to determine if a {@link ConfigurationPropertySource} should be
*
included when determining unbound elements. If the underlying {@link PropertySource}
*
is a systemEnvironment or systemProperties property source, it will not be considered
*
for
unbound element failures.
* Function used to determine if a {@link ConfigurationPropertySource} should be
included
*
when determining unbound elements. If the underlying {@link PropertySource} is a
*
systemEnvironment or systemProperties property source, it will not be considered for
* unbound element failures.
*
* @author Madhura Bhave
* @since 2.0.0
*/
public
class
UnboundElementsSourceFilter
implements
Function
<
ConfigurationPropertySource
,
Boolean
>
{
public
class
UnboundElementsSourceFilter
implements
Function
<
ConfigurationPropertySource
,
Boolean
>
{
private
static
final
Set
<
String
>
BENIGN_PROPERTY_SOURCE_NAMES
=
Collections
.
unmodifiableSet
(
new
HashSet
<>(
Arrays
.
asList
(
StandardEnvironment
.
SYSTEM_ENVIRONMENT_PROPERTY_SOURCE_NAME
,
StandardEnvironment
.
SYSTEM_PROPERTIES_PROPERTY_SOURCE_NAME
)));
private
static
final
Set
<
String
>
BENIGN_PROPERTY_SOURCE_NAMES
=
Collections
.
unmodifiableSet
(
new
HashSet
<>(
Arrays
.
asList
(
StandardEnvironment
.
SYSTEM_ENVIRONMENT_PROPERTY_SOURCE_NAME
,
StandardEnvironment
.
SYSTEM_PROPERTIES_PROPERTY_SOURCE_NAME
)));
@Override
public
Boolean
apply
(
ConfigurationPropertySource
configurationPropertySource
)
{
...
...
@@ -52,4 +54,3 @@ public class UnboundElementsSourceFilter implements Function<ConfigurationProper
}
}
spring-boot/src/main/java/org/springframework/boot/web/embedded/jetty/JettyReactiveWebServerFactory.java
View file @
56169156
...
...
@@ -156,8 +156,8 @@ public class JettyReactiveWebServerFactory extends AbstractReactiveWebServerFact
}
/**
* Returns a mutable collection of Jetty {@link JettyServerCustomizer}s that will be
applied
* to the {@link Server} before it is created.
* Returns a mutable collection of Jetty {@link JettyServerCustomizer}s that will be
*
applied
to the {@link Server} before it is created.
* @return the Jetty customizers
*/
public
Collection
<
JettyServerCustomizer
>
getServerCustomizers
()
{
...
...
spring-boot/src/main/java/org/springframework/boot/web/embedded/undertow/UndertowReactiveWebServerFactory.java
View file @
56169156
...
...
@@ -117,7 +117,8 @@ public class UndertowReactiveWebServerFactory extends AbstractReactiveWebServerF
/**
* Set {@link UndertowBuilderCustomizer}s that should be applied to the Undertow
* {@link Undertow.Builder}. Calling this method will replace any existing customizers.
* {@link Undertow.Builder}. Calling this method will replace any existing
* customizers.
* @param customizers the customizers to set
*/
public
void
setBuilderCustomizers
(
...
...
spring-boot/src/main/java/org/springframework/boot/web/embedded/undertow/UndertowServletWebServerFactory.java
View file @
56169156
...
...
@@ -482,7 +482,7 @@ public class UndertowServletWebServerFactory extends AbstractServletWebServerFac
File
docBase
=
getCanonicalDocumentRoot
(
root
);
List
<
URL
>
metaInfResourceUrls
=
getUrlsOfJarsWithMetaInfResources
();
List
<
URL
>
resourceJarUrls
=
new
ArrayList
<>();
List
<
ResourceManager
>
resourceManagers
=
new
ArrayList
<
ResourceManager
>();
List
<
ResourceManager
>
resourceManagers
=
new
ArrayList
<>();
ResourceManager
rootResourceManager
=
docBase
.
isDirectory
()
?
new
FileResourceManager
(
docBase
,
0
)
:
new
JarResourceManager
(
docBase
);
resourceManagers
.
add
(
root
==
null
?
rootResourceManager
...
...
spring-boot/src/test/java/org/springframework/boot/context/properties/source/UnboundElementsSourceFilterTests.java
View file @
56169156
...
...
@@ -44,15 +44,19 @@ public class UnboundElementsSourceFilterTests {
}
@Test
public
void
filterWhenSourceIsSystemEnvironmentPropertySourceShouldReturnFalse
()
throws
Exception
{
MockPropertySource
propertySource
=
new
MockPropertySource
(
StandardEnvironment
.
SYSTEM_PROPERTIES_PROPERTY_SOURCE_NAME
);
public
void
filterWhenSourceIsSystemEnvironmentPropertySourceShouldReturnFalse
()
throws
Exception
{
MockPropertySource
propertySource
=
new
MockPropertySource
(
StandardEnvironment
.
SYSTEM_PROPERTIES_PROPERTY_SOURCE_NAME
);
given
(
this
.
source
.
getUnderlyingSource
()).
willReturn
(
propertySource
);
assertThat
(
this
.
filter
.
apply
(
this
.
source
)).
isFalse
();
}
@Test
public
void
filterWhenSourceIsSystemPropertiesPropertySourceShouldReturnTrue
()
throws
Exception
{
MockPropertySource
propertySource
=
new
MockPropertySource
(
StandardEnvironment
.
SYSTEM_ENVIRONMENT_PROPERTY_SOURCE_NAME
);
public
void
filterWhenSourceIsSystemPropertiesPropertySourceShouldReturnTrue
()
throws
Exception
{
MockPropertySource
propertySource
=
new
MockPropertySource
(
StandardEnvironment
.
SYSTEM_ENVIRONMENT_PROPERTY_SOURCE_NAME
);
given
(
this
.
source
.
getUnderlyingSource
()).
willReturn
(
propertySource
);
assertThat
(
this
.
filter
.
apply
(
this
.
source
)).
isFalse
();
}
...
...
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