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
7b2b8dc4
Commit
7b2b8dc4
authored
Jul 24, 2017
by
Phillip Webb
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch '1.5.x'
parents
2ae39fce
dca463c7
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
170 additions
and
128 deletions
+170
-128
ImportAutoConfiguration.java
...framework/boot/autoconfigure/ImportAutoConfiguration.java
+0
-1
ActiveMQConnectionFactoryConfiguration.java
.../jms/activemq/ActiveMQConnectionFactoryConfiguration.java
+10
-10
ActiveMQProperties.java
...k/boot/autoconfigure/jms/activemq/ActiveMQProperties.java
+4
-3
ActiveMQXAConnectionFactoryConfiguration.java
...ms/activemq/ActiveMQXAConnectionFactoryConfiguration.java
+3
-3
ImportAutoConfigurationImportSelectorTests.java
...configure/ImportAutoConfigurationImportSelectorTests.java
+14
-1
ActiveMQAutoConfigurationTests.java
...onfigure/jms/activemq/ActiveMQAutoConfigurationTests.java
+107
-92
ActiveMQPropertiesTests.java
...t/autoconfigure/jms/activemq/ActiveMQPropertiesTests.java
+13
-11
ImportsContextCustomizerFactoryWithAutoConfigurationTests.java
...tsContextCustomizerFactoryWithAutoConfigurationTests.java
+5
-3
Handler.java
...ain/java/org/springframework/boot/loader/jar/Handler.java
+14
-4
No files found.
spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/ImportAutoConfiguration.java
View file @
7b2b8dc4
...
...
@@ -46,7 +46,6 @@ import org.springframework.core.annotation.AliasFor;
@Retention
(
RetentionPolicy
.
RUNTIME
)
@Documented
@Inherited
@AutoConfigurationPackage
@Import
(
ImportAutoConfigurationImportSelector
.
class
)
public
@interface
ImportAutoConfiguration
{
...
...
spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jms/activemq/ActiveMQConnectionFactoryConfiguration.java
View file @
7b2b8dc4
...
...
@@ -49,8 +49,8 @@ class ActiveMQConnectionFactoryConfiguration {
public
ActiveMQConnectionFactory
jmsConnectionFactory
(
ActiveMQProperties
properties
,
ObjectProvider
<
List
<
ActiveMQConnectionFactoryCustomizer
>>
factoryCustomizers
)
{
return
new
ActiveMQConnectionFactoryFactory
(
properties
,
factoryCustomizers
.
getIfAvailable
())
.
createConnectionFactory
(
ActiveMQConnectionFactory
.
class
);
factoryCustomizers
.
getIfAvailable
())
.
createConnectionFactory
(
ActiveMQConnectionFactory
.
class
);
}
@ConditionalOnClass
(
PooledConnectionFactory
.
class
)
...
...
@@ -67,21 +67,21 @@ class ActiveMQConnectionFactoryConfiguration {
ActiveMQConnectionFactory
.
class
));
ActiveMQProperties
.
Pool
pool
=
properties
.
getPool
();
pooledConnectionFactory
.
setBlockIfSessionPoolIsFull
(
pool
.
isBlockIfFull
());
pooledConnectionFactory
.
setBlockIfSessionPoolIsFullTimeout
(
pool
.
getBlockIfFullTimeout
());
pooledConnectionFactory
.
setCreateConnectionOnStartup
(
pool
.
isCreateConnectionOnStartup
());
pooledConnectionFactory
.
setBlockIfSessionPoolIsFullTimeout
(
pool
.
getBlockIfFullTimeout
());
pooledConnectionFactory
.
setCreateConnectionOnStartup
(
pool
.
isCreateConnectionOnStartup
());
pooledConnectionFactory
.
setExpiryTimeout
(
pool
.
getExpiryTimeout
());
pooledConnectionFactory
.
setIdleTimeout
(
pool
.
getIdleTimeout
());
pooledConnectionFactory
.
setMaxConnections
(
pool
.
getMaxConnections
());
pooledConnectionFactory
.
setMaximumActiveSessionPerConnection
(
pool
.
getMaximumActiveSessionPerConnection
());
pooledConnectionFactory
.
setReconnectOnException
(
pool
.
isReconnectOnException
());
pooledConnectionFactory
.
setReconnectOnException
(
pool
.
isReconnectOnException
());
pooledConnectionFactory
.
setTimeBetweenExpirationCheckMillis
(
pool
.
getTimeBetweenExpirationCheck
());
pooledConnectionFactory
.
setUseAnonymousProducers
(
pool
.
isUseAnonymousProducers
());
pooledConnectionFactory
.
setUseAnonymousProducers
(
pool
.
isUseAnonymousProducers
());
return
pooledConnectionFactory
;
}
...
...
spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jms/activemq/ActiveMQProperties.java
View file @
7b2b8dc4
...
...
@@ -158,8 +158,8 @@ public class ActiveMQProperties {
private
boolean
blockIfFull
=
true
;
/**
* Blocking period, in milliseconds, before throwing an exception if the pool
*
is
still full.
* Blocking period, in milliseconds, before throwing an exception if the pool
is
* still full.
*/
private
long
blockIfFullTimeout
=
-
1
;
...
...
@@ -265,7 +265,8 @@ public class ActiveMQProperties {
return
this
.
maximumActiveSessionPerConnection
;
}
public
void
setMaximumActiveSessionPerConnection
(
int
maximumActiveSessionPerConnection
)
{
public
void
setMaximumActiveSessionPerConnection
(
int
maximumActiveSessionPerConnection
)
{
this
.
maximumActiveSessionPerConnection
=
maximumActiveSessionPerConnection
;
}
...
...
spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jms/activemq/ActiveMQXAConnectionFactoryConfiguration.java
View file @
7b2b8dc4
...
...
@@ -54,7 +54,7 @@ class ActiveMQXAConnectionFactoryConfiguration {
XAConnectionFactoryWrapper
wrapper
)
throws
Exception
{
ActiveMQXAConnectionFactory
connectionFactory
=
new
ActiveMQConnectionFactoryFactory
(
properties
,
factoryCustomizers
.
getIfAvailable
())
.
createConnectionFactory
(
ActiveMQXAConnectionFactory
.
class
);
.
createConnectionFactory
(
ActiveMQXAConnectionFactory
.
class
);
return
wrapper
.
wrapConnectionFactory
(
connectionFactory
);
}
...
...
@@ -64,8 +64,8 @@ class ActiveMQXAConnectionFactoryConfiguration {
ActiveMQProperties
properties
,
ObjectProvider
<
List
<
ActiveMQConnectionFactoryCustomizer
>>
factoryCustomizers
)
{
return
new
ActiveMQConnectionFactoryFactory
(
properties
,
factoryCustomizers
.
getIfAvailable
())
.
createConnectionFactory
(
ActiveMQConnectionFactory
.
class
);
factoryCustomizers
.
getIfAvailable
())
.
createConnectionFactory
(
ActiveMQConnectionFactory
.
class
);
}
}
spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/ImportAutoConfigurationImportSelectorTests.java
View file @
7b2b8dc4
...
...
@@ -37,6 +37,7 @@ import org.springframework.core.env.Environment;
import
org.springframework.core.io.DefaultResourceLoader
;
import
org.springframework.core.type.AnnotationMetadata
;
import
org.springframework.core.type.classreading.SimpleMetadataReaderFactory
;
import
org.springframework.util.ClassUtils
;
import
static
org
.
assertj
.
core
.
api
.
Assertions
.
assertThat
;
import
static
org
.
mockito
.
Mockito
.
verifyZeroInteractions
;
...
...
@@ -125,7 +126,6 @@ public class ImportAutoConfigurationImportSelectorTests {
public
void
exclusionsAliasesAreApplied
()
throws
Exception
{
AnnotationMetadata
annotationMetadata
=
getAnnotationMetadata
(
ImportWithSelfAnnotatingAnnotationExclude
.
class
);
String
[]
imports
=
this
.
importSelector
.
selectImports
(
annotationMetadata
);
assertThat
(
imports
).
isEmpty
();
}
...
...
@@ -182,6 +182,19 @@ public class ImportAutoConfigurationImportSelectorTests {
assertThat
(
set1
).
isNotEqualTo
(
set2
);
}
@Test
public
void
determineImportsShouldNotSetPackageImport
()
throws
Exception
{
Class
<?>
packageImportClass
=
ClassUtils
.
resolveClassName
(
"org.springframework.boot.autoconfigure.AutoConfigurationPackages.PackageImport"
,
null
);
Set
<
Object
>
selectedImports
=
this
.
importSelector
.
determineImports
(
getAnnotationMetadata
(
ImportMetaAutoConfigurationExcludeWithUnrelatedOne
.
class
));
for
(
Object
selectedImport
:
selectedImports
)
{
assertThat
(
selectedImport
).
isNotInstanceOf
(
packageImportClass
);
}
}
private
AnnotationMetadata
getAnnotationMetadata
(
Class
<?>
source
)
throws
IOException
{
return
new
SimpleMetadataReaderFactory
().
getMetadataReader
(
source
.
getName
())
.
getAnnotationMetadata
();
...
...
spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jms/activemq/ActiveMQAutoConfigurationTests.java
View file @
7b2b8dc4
...
...
@@ -67,116 +67,131 @@ public class ActiveMQAutoConfigurationTests {
@Test
public
void
defaultsConnectionFactoryAreApplied
()
{
this
.
context
.
withUserConfiguration
(
EmptyConfiguration
.
class
)
.
withPropertyValues
(
"spring.activemq.pool.enabled=false"
).
run
((
loaded
)
->
{
assertThat
(
loaded
.
getBeansOfType
(
ActiveMQConnectionFactory
.
class
)).
hasSize
(
1
);
ActiveMQConnectionFactory
connectionFactory
=
loaded
.
getBean
(
ActiveMQConnectionFactory
.
class
);
ActiveMQConnectionFactory
defaultFactory
=
new
ActiveMQConnectionFactory
(
"vm://localhost?broker.persistent=false"
);
assertThat
(
connectionFactory
.
getUserName
()).
isEqualTo
(
defaultFactory
.
getUserName
());
assertThat
(
connectionFactory
.
getPassword
()).
isEqualTo
(
defaultFactory
.
getPassword
());
assertThat
(
connectionFactory
.
getCloseTimeout
()).
isEqualTo
(
defaultFactory
.
getCloseTimeout
());
assertThat
(
connectionFactory
.
isNonBlockingRedelivery
()).
isEqualTo
(
defaultFactory
.
isNonBlockingRedelivery
());
assertThat
(
connectionFactory
.
getSendTimeout
()).
isEqualTo
(
defaultFactory
.
getSendTimeout
());
assertThat
(
connectionFactory
.
isTrustAllPackages
()).
isEqualTo
(
defaultFactory
.
isTrustAllPackages
());
assertThat
(
connectionFactory
.
getTrustedPackages
()).
containsExactly
(
defaultFactory
.
getTrustedPackages
().
toArray
(
new
String
[]
{}));
});
.
withPropertyValues
(
"spring.activemq.pool.enabled=false"
)
.
run
((
loaded
)
->
{
assertThat
(
loaded
.
getBeansOfType
(
ActiveMQConnectionFactory
.
class
))
.
hasSize
(
1
);
ActiveMQConnectionFactory
connectionFactory
=
loaded
.
getBean
(
ActiveMQConnectionFactory
.
class
);
ActiveMQConnectionFactory
defaultFactory
=
new
ActiveMQConnectionFactory
(
"vm://localhost?broker.persistent=false"
);
assertThat
(
connectionFactory
.
getUserName
())
.
isEqualTo
(
defaultFactory
.
getUserName
());
assertThat
(
connectionFactory
.
getPassword
())
.
isEqualTo
(
defaultFactory
.
getPassword
());
assertThat
(
connectionFactory
.
getCloseTimeout
())
.
isEqualTo
(
defaultFactory
.
getCloseTimeout
());
assertThat
(
connectionFactory
.
isNonBlockingRedelivery
())
.
isEqualTo
(
defaultFactory
.
isNonBlockingRedelivery
());
assertThat
(
connectionFactory
.
getSendTimeout
())
.
isEqualTo
(
defaultFactory
.
getSendTimeout
());
assertThat
(
connectionFactory
.
isTrustAllPackages
())
.
isEqualTo
(
defaultFactory
.
isTrustAllPackages
());
assertThat
(
connectionFactory
.
getTrustedPackages
()).
containsExactly
(
defaultFactory
.
getTrustedPackages
().
toArray
(
new
String
[]
{}));
});
}
@Test
public
void
customConnectionFactoryAreApplied
()
{
this
.
context
.
withUserConfiguration
(
EmptyConfiguration
.
class
)
.
withPropertyValues
(
"spring.activemq.pool.enabled=false"
,
"spring.activemq.brokerUrl=vm://localhost?useJmx=false&broker.persistent=false"
,
"spring.activemq.user=foo"
,
"spring.activemq.password=bar"
,
"spring.activemq.closeTimeout=500"
,
"spring.activemq.nonBlockingRedelivery=true"
,
"spring.activemq.sendTimeout=1000"
,
"spring.activemq.packages.trust-all=false"
,
"spring.activemq.packages.trusted=com.example.acme"
).
run
((
loaded
)
->
{
assertThat
(
loaded
.
getBeansOfType
(
ActiveMQConnectionFactory
.
class
)).
hasSize
(
1
);
ActiveMQConnectionFactory
connectionFactory
=
loaded
.
getBean
(
ActiveMQConnectionFactory
.
class
);
assertThat
(
connectionFactory
.
getUserName
()).
isEqualTo
(
"foo"
);
assertThat
(
connectionFactory
.
getPassword
()).
isEqualTo
(
"bar"
);
assertThat
(
connectionFactory
.
getCloseTimeout
()).
isEqualTo
(
500
);
assertThat
(
connectionFactory
.
isNonBlockingRedelivery
()).
isEqualTo
(
true
);
assertThat
(
connectionFactory
.
getSendTimeout
()).
isEqualTo
(
1000
);
assertThat
(
connectionFactory
.
isTrustAllPackages
()).
isFalse
();
assertThat
(
connectionFactory
.
getTrustedPackages
()).
containsExactly
(
"com.example.acme"
);
});
"spring.activemq.brokerUrl=vm://localhost?useJmx=false&broker.persistent=false"
,
"spring.activemq.user=foo"
,
"spring.activemq.password=bar"
,
"spring.activemq.closeTimeout=500"
,
"spring.activemq.nonBlockingRedelivery=true"
,
"spring.activemq.sendTimeout=1000"
,
"spring.activemq.packages.trust-all=false"
,
"spring.activemq.packages.trusted=com.example.acme"
)
.
run
((
loaded
)
->
{
assertThat
(
loaded
.
getBeansOfType
(
ActiveMQConnectionFactory
.
class
))
.
hasSize
(
1
);
ActiveMQConnectionFactory
connectionFactory
=
loaded
.
getBean
(
ActiveMQConnectionFactory
.
class
);
assertThat
(
connectionFactory
.
getUserName
()).
isEqualTo
(
"foo"
);
assertThat
(
connectionFactory
.
getPassword
()).
isEqualTo
(
"bar"
);
assertThat
(
connectionFactory
.
getCloseTimeout
()).
isEqualTo
(
500
);
assertThat
(
connectionFactory
.
isNonBlockingRedelivery
())
.
isEqualTo
(
true
);
assertThat
(
connectionFactory
.
getSendTimeout
()).
isEqualTo
(
1000
);
assertThat
(
connectionFactory
.
isTrustAllPackages
()).
isFalse
();
assertThat
(
connectionFactory
.
getTrustedPackages
())
.
containsExactly
(
"com.example.acme"
);
});
}
@Test
public
void
defaultsPooledConnectionFactoryAreApplied
()
{
this
.
context
.
withUserConfiguration
(
EmptyConfiguration
.
class
)
.
withPropertyValues
(
"spring.activemq.pool.enabled=true"
).
run
((
loaded
)
->
{
assertThat
(
loaded
.
getBeansOfType
(
PooledConnectionFactory
.
class
)).
hasSize
(
1
);
PooledConnectionFactory
connectionFactory
=
loaded
.
getBean
(
PooledConnectionFactory
.
class
);
PooledConnectionFactory
defaultFactory
=
new
PooledConnectionFactory
();
assertThat
(
connectionFactory
.
isBlockIfSessionPoolIsFull
()).
isEqualTo
(
defaultFactory
.
isBlockIfSessionPoolIsFull
());
assertThat
(
connectionFactory
.
getBlockIfSessionPoolIsFullTimeout
()).
isEqualTo
(
defaultFactory
.
getBlockIfSessionPoolIsFullTimeout
());
assertThat
(
connectionFactory
.
isCreateConnectionOnStartup
()).
isEqualTo
(
defaultFactory
.
isCreateConnectionOnStartup
());
assertThat
(
connectionFactory
.
getExpiryTimeout
()).
isEqualTo
(
defaultFactory
.
getExpiryTimeout
());
assertThat
(
connectionFactory
.
getIdleTimeout
()).
isEqualTo
(
defaultFactory
.
getIdleTimeout
());
assertThat
(
connectionFactory
.
getMaxConnections
()).
isEqualTo
(
defaultFactory
.
getMaxConnections
());
assertThat
(
connectionFactory
.
getMaximumActiveSessionPerConnection
()).
isEqualTo
(
defaultFactory
.
getMaximumActiveSessionPerConnection
());
assertThat
(
connectionFactory
.
isReconnectOnException
()).
isEqualTo
(
defaultFactory
.
isReconnectOnException
());
assertThat
(
connectionFactory
.
getTimeBetweenExpirationCheckMillis
()).
isEqualTo
(
defaultFactory
.
getTimeBetweenExpirationCheckMillis
());
assertThat
(
connectionFactory
.
isUseAnonymousProducers
()).
isEqualTo
(
defaultFactory
.
isUseAnonymousProducers
());
});
assertThat
(
loaded
.
getBeansOfType
(
PooledConnectionFactory
.
class
))
.
hasSize
(
1
);
PooledConnectionFactory
connectionFactory
=
loaded
.
getBean
(
PooledConnectionFactory
.
class
);
PooledConnectionFactory
defaultFactory
=
new
PooledConnectionFactory
();
assertThat
(
connectionFactory
.
isBlockIfSessionPoolIsFull
())
.
isEqualTo
(
defaultFactory
.
isBlockIfSessionPoolIsFull
());
assertThat
(
connectionFactory
.
getBlockIfSessionPoolIsFullTimeout
())
.
isEqualTo
(
defaultFactory
.
getBlockIfSessionPoolIsFullTimeout
());
assertThat
(
connectionFactory
.
isCreateConnectionOnStartup
())
.
isEqualTo
(
defaultFactory
.
isCreateConnectionOnStartup
());
assertThat
(
connectionFactory
.
getExpiryTimeout
())
.
isEqualTo
(
defaultFactory
.
getExpiryTimeout
());
assertThat
(
connectionFactory
.
getIdleTimeout
())
.
isEqualTo
(
defaultFactory
.
getIdleTimeout
());
assertThat
(
connectionFactory
.
getMaxConnections
())
.
isEqualTo
(
defaultFactory
.
getMaxConnections
());
assertThat
(
connectionFactory
.
getMaximumActiveSessionPerConnection
())
.
isEqualTo
(
defaultFactory
.
getMaximumActiveSessionPerConnection
());
assertThat
(
connectionFactory
.
isReconnectOnException
())
.
isEqualTo
(
defaultFactory
.
isReconnectOnException
());
assertThat
(
connectionFactory
.
getTimeBetweenExpirationCheckMillis
())
.
isEqualTo
(
defaultFactory
.
getTimeBetweenExpirationCheckMillis
());
assertThat
(
connectionFactory
.
isUseAnonymousProducers
())
.
isEqualTo
(
defaultFactory
.
isUseAnonymousProducers
());
});
}
@Test
public
void
customPooledConnectionFactoryAreApplied
()
{
this
.
context
.
withUserConfiguration
(
EmptyConfiguration
.
class
)
.
withPropertyValues
(
"spring.activemq.pool.enabled=true"
,
"spring.activemq.pool.blockIfFull=false"
,
"spring.activemq.pool.blockIfFullTimeout=64"
,
"spring.activemq.pool.createConnectionOnStartup=false"
,
"spring.activemq.pool.expiryTimeout=4096"
,
"spring.activemq.pool.idleTimeout=512"
,
"spring.activemq.pool.maxConnections=256"
,
"spring.activemq.pool.maximumActiveSessionPerConnection=1024"
,
"spring.activemq.pool.reconnectOnException=false"
,
"spring.activemq.pool.timeBetweenExpirationCheck=2048"
,
"spring.activemq.pool.useAnonymousProducers=false"
).
run
((
loaded
)
->
{
assertThat
(
loaded
.
getBeansOfType
(
PooledConnectionFactory
.
class
)).
hasSize
(
1
);
PooledConnectionFactory
connectionFactory
=
loaded
.
getBean
(
PooledConnectionFactory
.
class
);
assertThat
(
connectionFactory
.
isBlockIfSessionPoolIsFull
()).
isEqualTo
(
false
);
assertThat
(
connectionFactory
.
getBlockIfSessionPoolIsFullTimeout
()).
isEqualTo
(
64
);
assertThat
(
connectionFactory
.
isCreateConnectionOnStartup
()).
isEqualTo
(
false
);
assertThat
(
connectionFactory
.
getExpiryTimeout
()).
isEqualTo
(
4096
);
assertThat
(
connectionFactory
.
getIdleTimeout
()).
isEqualTo
(
512
);
assertThat
(
connectionFactory
.
getMaxConnections
()).
isEqualTo
(
256
);
assertThat
(
connectionFactory
.
getMaximumActiveSessionPerConnection
())
.
isEqualTo
(
1024
);
assertThat
(
connectionFactory
.
isReconnectOnException
()).
isEqualTo
(
false
);
assertThat
(
connectionFactory
.
getTimeBetweenExpirationCheckMillis
())
.
isEqualTo
(
2048
);
assertThat
(
connectionFactory
.
isUseAnonymousProducers
()).
isEqualTo
(
false
);
});
"spring.activemq.pool.blockIfFull=false"
,
"spring.activemq.pool.blockIfFullTimeout=64"
,
"spring.activemq.pool.createConnectionOnStartup=false"
,
"spring.activemq.pool.expiryTimeout=4096"
,
"spring.activemq.pool.idleTimeout=512"
,
"spring.activemq.pool.maxConnections=256"
,
"spring.activemq.pool.maximumActiveSessionPerConnection=1024"
,
"spring.activemq.pool.reconnectOnException=false"
,
"spring.activemq.pool.timeBetweenExpirationCheck=2048"
,
"spring.activemq.pool.useAnonymousProducers=false"
)
.
run
((
loaded
)
->
{
assertThat
(
loaded
.
getBeansOfType
(
PooledConnectionFactory
.
class
))
.
hasSize
(
1
);
PooledConnectionFactory
connectionFactory
=
loaded
.
getBean
(
PooledConnectionFactory
.
class
);
assertThat
(
connectionFactory
.
isBlockIfSessionPoolIsFull
())
.
isEqualTo
(
false
);
assertThat
(
connectionFactory
.
getBlockIfSessionPoolIsFullTimeout
())
.
isEqualTo
(
64
);
assertThat
(
connectionFactory
.
isCreateConnectionOnStartup
())
.
isEqualTo
(
false
);
assertThat
(
connectionFactory
.
getExpiryTimeout
()).
isEqualTo
(
4096
);
assertThat
(
connectionFactory
.
getIdleTimeout
()).
isEqualTo
(
512
);
assertThat
(
connectionFactory
.
getMaxConnections
()).
isEqualTo
(
256
);
assertThat
(
connectionFactory
.
getMaximumActiveSessionPerConnection
())
.
isEqualTo
(
1024
);
assertThat
(
connectionFactory
.
isReconnectOnException
())
.
isEqualTo
(
false
);
assertThat
(
connectionFactory
.
getTimeBetweenExpirationCheckMillis
())
.
isEqualTo
(
2048
);
assertThat
(
connectionFactory
.
isUseAnonymousProducers
())
.
isEqualTo
(
false
);
});
}
@Test
...
...
spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jms/activemq/ActiveMQPropertiesTests.java
View file @
7b2b8dc4
...
...
@@ -40,37 +40,38 @@ public class ActiveMQPropertiesTests {
@Test
public
void
getBrokerUrlIsInMemoryByDefault
()
{
assertThat
(
createFactory
(
this
.
properties
).
determineBrokerUrl
())
.
isEqualTo
(
DEFAULT_EMBEDDED_BROKER_URL
);
assertThat
(
createFactory
(
this
.
properties
).
determineBrokerUrl
())
.
isEqualTo
(
DEFAULT_EMBEDDED_BROKER_URL
);
}
@Test
public
void
getBrokerUrlUseExplicitBrokerUrl
()
{
this
.
properties
.
setBrokerUrl
(
"vm://foo-bar"
);
assertThat
(
createFactory
(
this
.
properties
).
determineBrokerUrl
())
.
isEqualTo
(
"vm://foo-bar"
);
assertThat
(
createFactory
(
this
.
properties
).
determineBrokerUrl
())
.
isEqualTo
(
"vm://foo-bar"
);
}
@Test
public
void
getBrokerUrlWithInMemorySetToFalse
()
{
this
.
properties
.
setInMemory
(
false
);
assertThat
(
createFactory
(
this
.
properties
).
determineBrokerUrl
())
.
isEqualTo
(
DEFAULT_NETWORK_BROKER_URL
);
assertThat
(
createFactory
(
this
.
properties
).
determineBrokerUrl
())
.
isEqualTo
(
DEFAULT_NETWORK_BROKER_URL
);
}
@Test
public
void
getExplicitBrokerUrlAlwaysWins
()
{
this
.
properties
.
setBrokerUrl
(
"vm://foo-bar"
);
this
.
properties
.
setInMemory
(
false
);
assertThat
(
createFactory
(
this
.
properties
).
determineBrokerUrl
())
.
isEqualTo
(
"vm://foo-bar"
);
assertThat
(
createFactory
(
this
.
properties
).
determineBrokerUrl
())
.
isEqualTo
(
"vm://foo-bar"
);
}
@Test
public
void
setTrustAllPackages
()
{
this
.
properties
.
getPackages
().
setTrustAll
(
true
);
assertThat
(
createFactory
(
this
.
properties
).
createConnectionFactory
(
ActiveMQConnectionFactory
.
class
).
isTrustAllPackages
()).
isEqualTo
(
true
);
assertThat
(
createFactory
(
this
.
properties
)
.
createConnectionFactory
(
ActiveMQConnectionFactory
.
class
)
.
isTrustAllPackages
()).
isEqualTo
(
true
);
}
@Test
...
...
@@ -84,7 +85,8 @@ public class ActiveMQPropertiesTests {
assertThat
(
factory
.
getTrustedPackages
().
get
(
0
)).
isEqualTo
(
"trusted.package"
);
}
private
ActiveMQConnectionFactoryFactory
createFactory
(
ActiveMQProperties
properties
)
{
private
ActiveMQConnectionFactoryFactory
createFactory
(
ActiveMQProperties
properties
)
{
return
new
ActiveMQConnectionFactoryFactory
(
properties
,
Collections
.<
ActiveMQConnectionFactoryCustomizer
>
emptyList
());
}
...
...
spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/cache/ImportsContextCustomizerFactoryWithAutoConfigurationTests.java
View file @
7b2b8dc4
...
...
@@ -24,6 +24,7 @@ import org.junit.runner.notification.RunNotifier;
import
org.junit.runners.model.InitializationError
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.boot.autoconfigure.AutoConfigurationPackage
;
import
org.springframework.boot.autoconfigure.ImportAutoConfiguration
;
import
org.springframework.boot.autoconfigure.domain.EntityScan
;
import
org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest
;
...
...
@@ -94,8 +95,8 @@ public class ImportsContextCustomizerFactoryWithAutoConfigurationTests {
}
@ContextConfiguration
(
classes
=
EmptyConfig
.
class
)
@DataJpaTest
@ContextConfiguration
(
classes
=
EmptyConfig
.
class
)
@Unrelated2
public
static
class
DataJpaTest2
{
...
...
@@ -109,8 +110,8 @@ public class ImportsContextCustomizerFactoryWithAutoConfigurationTests {
}
@ContextConfiguration
(
classes
=
EmptyConfig
.
class
)
@DataJpaTest
@ContextConfiguration
(
classes
=
EmptyConfig
.
class
)
@Unrelated1
public
static
class
DataJpaTest3
{
...
...
@@ -124,8 +125,8 @@ public class ImportsContextCustomizerFactoryWithAutoConfigurationTests {
}
@ContextConfiguration
(
classes
=
EmptyConfig
.
class
)
@DataJpaTest
(
showSql
=
false
)
@ContextConfiguration
(
classes
=
EmptyConfig
.
class
)
@Unrelated1
public
static
class
DataJpaTest4
{
...
...
@@ -151,6 +152,7 @@ public class ImportsContextCustomizerFactoryWithAutoConfigurationTests {
@Configuration
@EntityScan
(
basePackageClasses
=
ExampleEntity
.
class
)
@AutoConfigurationPackage
static
class
EmptyConfig
{
}
...
...
spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/Handler.java
View file @
7b2b8dc4
...
...
@@ -71,8 +71,6 @@ public class Handler extends URLStreamHandler {
rootFileCache
=
new
SoftReference
<>(
null
);
}
private
final
Logger
logger
=
Logger
.
getLogger
(
getClass
().
getName
());
private
final
JarFile
jarFile
;
private
URLStreamHandler
fallbackHandler
;
...
...
@@ -105,10 +103,10 @@ public class Handler extends URLStreamHandler {
}
catch
(
Exception
ex
)
{
if
(
reason
instanceof
IOException
)
{
this
.
logger
.
log
(
Level
.
FINEST
,
"Unable to open fallback handler"
,
ex
);
log
(
false
,
"Unable to open fallback handler"
,
ex
);
throw
(
IOException
)
reason
;
}
this
.
logger
.
log
(
Level
.
WARNING
,
"Unable to open fallback handler"
,
ex
);
log
(
true
,
"Unable to open fallback handler"
,
ex
);
if
(
reason
instanceof
RuntimeException
)
{
throw
(
RuntimeException
)
reason
;
}
...
...
@@ -116,6 +114,18 @@ public class Handler extends URLStreamHandler {
}
}
private
void
log
(
boolean
warning
,
String
message
,
Exception
cause
)
{
try
{
Logger
.
getLogger
(
getClass
().
getName
())
.
log
((
warning
?
Level
.
WARNING
:
Level
.
FINEST
),
message
,
cause
);
}
catch
(
Exception
ex
)
{
if
(
warning
)
{
System
.
err
.
println
(
"WARNING: "
+
message
);
}
}
}
private
URLStreamHandler
getFallbackHandler
()
{
if
(
this
.
fallbackHandler
!=
null
)
{
return
this
.
fallbackHandler
;
...
...
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