Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
爱吃血肠
spring-framework
提交
a07ce8eb
S
spring-framework
项目概览
爱吃血肠
/
spring-framework
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
S
spring-framework
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
a07ce8eb
编写于
8月 22, 2019
作者:
S
Sam Brannen
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Polishing
上级
3e2b977d
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
85 addition
and
90 deletion
+85
-90
spring-aspects/src/test/java/org/springframework/cache/aspectj/AspectJCacheAnnotationTests.java
...gframework/cache/aspectj/AspectJCacheAnnotationTests.java
+1
-1
spring-aspects/src/test/java/org/springframework/scheduling/aspectj/AnnotationAsyncExecutionAspectTests.java
...heduling/aspectj/AnnotationAsyncExecutionAspectTests.java
+3
-6
spring-aspects/src/test/java/org/springframework/transaction/aspectj/JtaTransactionAspectsTests.java
...ework/transaction/aspectj/JtaTransactionAspectsTests.java
+2
-5
spring-context/src/test/java/org/springframework/cache/config/AbstractCacheAnnotationTests.java
...gframework/cache/config/AbstractCacheAnnotationTests.java
+32
-33
spring-context/src/test/java/org/springframework/context/support/StaticMessageSourceTests.java
...ngframework/context/support/StaticMessageSourceTests.java
+2
-2
spring-jms/src/test/java/org/springframework/jms/annotation/AbstractJmsAnnotationDrivenTests.java
...work/jms/annotation/AbstractJmsAnnotationDrivenTests.java
+17
-18
spring-jms/src/test/java/org/springframework/jms/annotation/AnnotationDrivenNamespaceTests.java
...mework/jms/annotation/AnnotationDrivenNamespaceTests.java
+11
-10
spring-jms/src/test/java/org/springframework/jms/annotation/EnableJmsTests.java
...va/org/springframework/jms/annotation/EnableJmsTests.java
+17
-15
未找到文件。
spring-aspects/src/test/java/org/springframework/cache/aspectj/AspectJCacheAnnotationTests.java
浏览文件 @
a07ce8eb
...
...
@@ -45,7 +45,7 @@ public class AspectJCacheAnnotationTests extends AbstractCacheAnnotationTests {
}
@Override
p
ublic
void
testMultiEvict
(
CacheableService
<?>
service
)
{
p
rotected
void
testMultiEvict
(
CacheableService
<?>
service
)
{
Object
o1
=
new
Object
();
Object
r1
=
service
.
multiCache
(
o1
);
...
...
spring-aspects/src/test/java/org/springframework/scheduling/aspectj/AnnotationAsyncExecutionAspectTests.java
浏览文件 @
a07ce8eb
...
...
@@ -33,12 +33,12 @@ import org.springframework.core.task.SimpleAsyncTaskExecutor;
import
org.springframework.scheduling.annotation.Async
;
import
org.springframework.scheduling.annotation.AsyncResult
;
import
org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor
;
import
org.springframework.tests.Assume
;
import
org.springframework.tests.TestGroup
;
import
org.springframework.tests.EnabledForTestGroups
;
import
org.springframework.util.ReflectionUtils
;
import
org.springframework.util.concurrent.ListenableFuture
;
import
static
org
.
assertj
.
core
.
api
.
Assertions
.
assertThat
;
import
static
org
.
springframework
.
tests
.
TestGroup
.
PERFORMANCE
;
/**
* Unit tests for {@link AnnotationAsyncExecutionAspect}.
...
...
@@ -46,6 +46,7 @@ import static org.assertj.core.api.Assertions.assertThat;
* @author Ramnivas Laddad
* @author Stephane Nicoll
*/
@EnabledForTestGroups
(
PERFORMANCE
)
public
class
AnnotationAsyncExecutionAspectTests
{
private
static
final
long
WAIT_TIME
=
1000
;
//milliseconds
...
...
@@ -57,8 +58,6 @@ public class AnnotationAsyncExecutionAspectTests {
@BeforeEach
public
void
setUp
()
{
Assume
.
group
(
TestGroup
.
PERFORMANCE
);
executor
=
new
CountingExecutor
();
AnnotationAsyncExecutionAspect
.
aspectOf
().
setExecutor
(
executor
);
}
...
...
@@ -96,8 +95,6 @@ public class AnnotationAsyncExecutionAspectTests {
@Test
public
void
voidMethodInAsyncClassGetsRoutedAsynchronously
()
{
Assume
.
group
(
TestGroup
.
PERFORMANCE
);
ClassWithAsyncAnnotation
obj
=
new
ClassWithAsyncAnnotation
();
obj
.
increment
();
executor
.
waitForCompletion
();
...
...
spring-aspects/src/test/java/org/springframework/transaction/aspectj/JtaTransactionAspectsTests.java
浏览文件 @
a07ce8eb
...
...
@@ -21,13 +21,11 @@ import javax.transaction.Transactional;
import
org.junit.jupiter.api.BeforeEach
;
import
org.junit.jupiter.api.Test
;
import
org.junit.jupiter.api.extension.ExtendWith
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.test.context.ContextConfiguration
;
import
org.springframework.test.context.junit.jupiter.SpringExtension
;
import
org.springframework.test.context.junit.jupiter.SpringJUnitConfig
;
import
org.springframework.tests.transaction.CallCountingTransactionManager
;
import
static
org
.
assertj
.
core
.
api
.
Assertions
.
assertThat
;
...
...
@@ -37,8 +35,7 @@ import static org.assertj.core.api.Assertions.assertThatIOException;
/**
* @author Stephane Nicoll
*/
@ExtendWith
(
SpringExtension
.
class
)
@ContextConfiguration
(
classes
=
JtaTransactionAspectsTests
.
Config
.
class
)
@SpringJUnitConfig
(
JtaTransactionAspectsTests
.
Config
.
class
)
public
class
JtaTransactionAspectsTests
{
@Autowired
...
...
spring-context/src/test/java/org/springframework/cache/config/AbstractCacheAnnotationTests.java
浏览文件 @
a07ce8eb
...
...
@@ -79,7 +79,7 @@ public abstract class AbstractCacheAnnotationTests {
}
p
ublic
void
testCacheable
(
CacheableService
<?>
service
)
{
p
rotected
void
testCacheable
(
CacheableService
<?>
service
)
{
Object
o1
=
new
Object
();
Object
r1
=
service
.
cache
(
o1
);
...
...
@@ -90,7 +90,7 @@ public abstract class AbstractCacheAnnotationTests {
assertThat
(
r3
).
isSameAs
(
r1
);
}
p
ublic
void
testCacheableNull
(
CacheableService
<?>
service
)
{
p
rotected
void
testCacheableNull
(
CacheableService
<?>
service
)
{
Object
o1
=
new
Object
();
assertThat
(
this
.
cm
.
getCache
(
"testCache"
).
get
(
o1
)).
isNull
();
...
...
@@ -105,7 +105,7 @@ public abstract class AbstractCacheAnnotationTests {
assertThat
(
r3
).
as
(
"Cached value should be null"
).
isNull
();
}
p
ublic
void
testCacheableSync
(
CacheableService
<?>
service
)
{
p
rotected
void
testCacheableSync
(
CacheableService
<?>
service
)
{
Object
o1
=
new
Object
();
Object
r1
=
service
.
cacheSync
(
o1
);
...
...
@@ -116,7 +116,7 @@ public abstract class AbstractCacheAnnotationTests {
assertThat
(
r3
).
isSameAs
(
r1
);
}
p
ublic
void
testCacheableSyncNull
(
CacheableService
<?>
service
)
{
p
rotected
void
testCacheableSyncNull
(
CacheableService
<?>
service
)
{
Object
o1
=
new
Object
();
assertThat
(
this
.
cm
.
getCache
(
"testCache"
).
get
(
o1
)).
isNull
();
...
...
@@ -131,7 +131,7 @@ public abstract class AbstractCacheAnnotationTests {
assertThat
(
r3
).
as
(
"Cached value should be null"
).
isNull
();
}
p
ublic
void
testEvict
(
CacheableService
<?>
service
,
boolean
successExpected
)
{
p
rotected
void
testEvict
(
CacheableService
<?>
service
,
boolean
successExpected
)
{
Cache
cache
=
this
.
cm
.
getCache
(
"testCache"
);
Object
o1
=
new
Object
();
...
...
@@ -155,7 +155,7 @@ public abstract class AbstractCacheAnnotationTests {
}
}
p
ublic
void
testEvictEarly
(
CacheableService
<?>
service
)
{
p
rotected
void
testEvictEarly
(
CacheableService
<?>
service
)
{
Cache
cache
=
this
.
cm
.
getCache
(
"testCache"
);
Object
o1
=
new
Object
();
...
...
@@ -174,7 +174,7 @@ public abstract class AbstractCacheAnnotationTests {
assertThat
(
r2
).
isNotSameAs
(
r1
);
}
p
ublic
void
testEvictException
(
CacheableService
<?>
service
)
{
p
rotected
void
testEvictException
(
CacheableService
<?>
service
)
{
Object
o1
=
new
Object
();
Object
r1
=
service
.
cache
(
o1
);
...
...
@@ -189,7 +189,7 @@ public abstract class AbstractCacheAnnotationTests {
assertThat
(
r2
).
isSameAs
(
r1
);
}
p
ublic
void
testEvictWithKey
(
CacheableService
<?>
service
)
{
p
rotected
void
testEvictWithKey
(
CacheableService
<?>
service
)
{
Object
o1
=
new
Object
();
Object
r1
=
service
.
cache
(
o1
);
...
...
@@ -198,7 +198,7 @@ public abstract class AbstractCacheAnnotationTests {
assertThat
(
r2
).
isNotSameAs
(
r1
);
}
p
ublic
void
testEvictWithKeyEarly
(
CacheableService
<?>
service
)
{
p
rotected
void
testEvictWithKeyEarly
(
CacheableService
<?>
service
)
{
Object
o1
=
new
Object
();
Object
r1
=
service
.
cache
(
o1
);
...
...
@@ -212,7 +212,7 @@ public abstract class AbstractCacheAnnotationTests {
assertThat
(
r2
).
isNotSameAs
(
r1
);
}
p
ublic
void
testEvictAll
(
CacheableService
<?>
service
,
boolean
successExpected
)
{
p
rotected
void
testEvictAll
(
CacheableService
<?>
service
,
boolean
successExpected
)
{
Cache
cache
=
this
.
cm
.
getCache
(
"testCache"
);
Object
o1
=
new
Object
();
...
...
@@ -246,7 +246,7 @@ public abstract class AbstractCacheAnnotationTests {
}
}
p
ublic
void
testEvictAllEarly
(
CacheableService
<?>
service
)
{
p
rotected
void
testEvictAllEarly
(
CacheableService
<?>
service
)
{
Cache
cache
=
this
.
cm
.
getCache
(
"testCache"
);
Object
o1
=
new
Object
();
...
...
@@ -273,7 +273,7 @@ public abstract class AbstractCacheAnnotationTests {
assertThat
(
r4
).
isNotSameAs
(
r2
);
}
p
ublic
void
testConditionalExpression
(
CacheableService
<?>
service
)
{
p
rotected
void
testConditionalExpression
(
CacheableService
<?>
service
)
{
Object
r1
=
service
.
conditional
(
4
);
Object
r2
=
service
.
conditional
(
4
);
...
...
@@ -285,7 +285,7 @@ public abstract class AbstractCacheAnnotationTests {
assertThat
(
r4
).
isSameAs
(
r3
);
}
p
ublic
void
testConditionalExpressionSync
(
CacheableService
<?>
service
)
{
p
rotected
void
testConditionalExpressionSync
(
CacheableService
<?>
service
)
{
Object
r1
=
service
.
conditionalSync
(
4
);
Object
r2
=
service
.
conditionalSync
(
4
);
...
...
@@ -297,7 +297,7 @@ public abstract class AbstractCacheAnnotationTests {
assertThat
(
r4
).
isSameAs
(
r3
);
}
p
ublic
void
testUnlessExpression
(
CacheableService
<?>
service
)
{
p
rotected
void
testUnlessExpression
(
CacheableService
<?>
service
)
{
Cache
cache
=
this
.
cm
.
getCache
(
"testCache"
);
cache
.
clear
();
service
.
unless
(
10
);
...
...
@@ -306,7 +306,7 @@ public abstract class AbstractCacheAnnotationTests {
assertThat
(
cache
.
get
(
11
)).
isNull
();
}
p
ublic
void
testKeyExpression
(
CacheableService
<?>
service
)
{
p
rotected
void
testKeyExpression
(
CacheableService
<?>
service
)
{
Object
r1
=
service
.
key
(
5
,
1
);
Object
r2
=
service
.
key
(
5
,
2
);
...
...
@@ -318,7 +318,7 @@ public abstract class AbstractCacheAnnotationTests {
assertThat
(
r4
).
isNotSameAs
(
r3
);
}
p
ublic
void
testVarArgsKey
(
CacheableService
<?>
service
)
{
p
rotected
void
testVarArgsKey
(
CacheableService
<?>
service
)
{
Object
r1
=
service
.
varArgsKey
(
1
,
2
,
3
);
Object
r2
=
service
.
varArgsKey
(
1
,
2
,
3
);
...
...
@@ -330,8 +330,7 @@ public abstract class AbstractCacheAnnotationTests {
assertThat
(
r4
).
isNotSameAs
(
r3
);
}
public
void
testNullValue
(
CacheableService
<?>
service
)
{
protected
void
testNullValue
(
CacheableService
<?>
service
)
{
Object
key
=
new
Object
();
assertThat
(
service
.
nullValue
(
key
)).
isNull
();
int
nr
=
service
.
nullInvocations
().
intValue
();
...
...
@@ -341,7 +340,7 @@ public abstract class AbstractCacheAnnotationTests {
assertThat
(
service
.
nullInvocations
().
intValue
()).
isEqualTo
(
nr
+
1
);
}
p
ublic
void
testMethodName
(
CacheableService
<?>
service
,
String
keyName
)
{
p
rotected
void
testMethodName
(
CacheableService
<?>
service
,
String
keyName
)
{
Object
key
=
new
Object
();
Object
r1
=
service
.
name
(
key
);
assertThat
(
service
.
name
(
key
)).
isSameAs
(
r1
);
...
...
@@ -350,7 +349,7 @@ public abstract class AbstractCacheAnnotationTests {
assertThat
(
cache
.
get
(
keyName
)).
isNotNull
();
}
p
ublic
void
testRootVars
(
CacheableService
<?>
service
)
{
p
rotected
void
testRootVars
(
CacheableService
<?>
service
)
{
Object
key
=
new
Object
();
Object
r1
=
service
.
rootVars
(
key
);
assertThat
(
service
.
rootVars
(
key
)).
isSameAs
(
r1
);
...
...
@@ -360,38 +359,38 @@ public abstract class AbstractCacheAnnotationTests {
assertThat
(
cache
.
get
(
expectedKey
)).
isNotNull
();
}
p
ublic
void
testCheckedThrowable
(
CacheableService
<?>
service
)
{
p
rotected
void
testCheckedThrowable
(
CacheableService
<?>
service
)
{
String
arg
=
UUID
.
randomUUID
().
toString
();
assertThatIOException
().
isThrownBy
(()
->
service
.
throwChecked
(
arg
))
.
withMessage
(
arg
);
}
p
ublic
void
testUncheckedThrowable
(
CacheableService
<?>
service
)
{
p
rotected
void
testUncheckedThrowable
(
CacheableService
<?>
service
)
{
assertThatExceptionOfType
(
UnsupportedOperationException
.
class
).
isThrownBy
(()
->
service
.
throwUnchecked
(
1L
))
.
withMessage
(
"1"
);
}
p
ublic
void
testCheckedThrowableSync
(
CacheableService
<?>
service
)
{
p
rotected
void
testCheckedThrowableSync
(
CacheableService
<?>
service
)
{
String
arg
=
UUID
.
randomUUID
().
toString
();
assertThatIOException
().
isThrownBy
(()
->
service
.
throwCheckedSync
(
arg
))
.
withMessage
(
arg
);
}
p
ublic
void
testUncheckedThrowableSync
(
CacheableService
<?>
service
)
{
p
rotected
void
testUncheckedThrowableSync
(
CacheableService
<?>
service
)
{
assertThatExceptionOfType
(
UnsupportedOperationException
.
class
).
isThrownBy
(()
->
service
.
throwUncheckedSync
(
1L
))
.
withMessage
(
"1"
);
}
p
ublic
void
testNullArg
(
CacheableService
<?>
service
)
{
p
rotected
void
testNullArg
(
CacheableService
<?>
service
)
{
Object
r1
=
service
.
cache
(
null
);
assertThat
(
service
.
cache
(
null
)).
isSameAs
(
r1
);
}
p
ublic
void
testCacheUpdate
(
CacheableService
<?>
service
)
{
p
rotected
void
testCacheUpdate
(
CacheableService
<?>
service
)
{
Object
o
=
new
Object
();
Cache
cache
=
this
.
cm
.
getCache
(
"testCache"
);
assertThat
(
cache
.
get
(
o
)).
isNull
();
...
...
@@ -404,7 +403,7 @@ public abstract class AbstractCacheAnnotationTests {
assertThat
(
cache
.
get
(
o
).
get
()).
isSameAs
(
r2
);
}
p
ublic
void
testConditionalCacheUpdate
(
CacheableService
<?>
service
)
{
p
rotected
void
testConditionalCacheUpdate
(
CacheableService
<?>
service
)
{
Integer
one
=
1
;
Integer
three
=
3
;
...
...
@@ -416,7 +415,7 @@ public abstract class AbstractCacheAnnotationTests {
assertThat
((
int
)
Integer
.
valueOf
(
cache
.
get
(
three
).
get
().
toString
())).
isEqualTo
((
int
)
three
);
}
p
ublic
void
testMultiCache
(
CacheableService
<?>
service
)
{
p
rotected
void
testMultiCache
(
CacheableService
<?>
service
)
{
Object
o1
=
new
Object
();
Object
o2
=
new
Object
();
...
...
@@ -442,7 +441,7 @@ public abstract class AbstractCacheAnnotationTests {
assertThat
(
secondary
.
get
(
o2
).
get
()).
isSameAs
(
r4
);
}
p
ublic
void
testMultiEvict
(
CacheableService
<?>
service
)
{
p
rotected
void
testMultiEvict
(
CacheableService
<?>
service
)
{
Object
o1
=
new
Object
();
Object
o2
=
o1
.
toString
()
+
"A"
;
...
...
@@ -472,7 +471,7 @@ public abstract class AbstractCacheAnnotationTests {
assertThat
(
secondary
.
get
(
o1
).
get
()).
isSameAs
(
r4
);
}
p
ublic
void
testMultiPut
(
CacheableService
<?>
service
)
{
p
rotected
void
testMultiPut
(
CacheableService
<?>
service
)
{
Object
o
=
1
;
Cache
primary
=
this
.
cm
.
getCache
(
"primary"
);
...
...
@@ -492,7 +491,7 @@ public abstract class AbstractCacheAnnotationTests {
assertThat
(
secondary
.
get
(
o
).
get
()).
isSameAs
(
r2
);
}
p
ublic
void
testPutRefersToResult
(
CacheableService
<?>
service
)
{
p
rotected
void
testPutRefersToResult
(
CacheableService
<?>
service
)
{
Long
id
=
Long
.
MIN_VALUE
;
TestEntity
entity
=
new
TestEntity
();
Cache
primary
=
this
.
cm
.
getCache
(
"primary"
);
...
...
@@ -502,7 +501,7 @@ public abstract class AbstractCacheAnnotationTests {
assertThat
(
primary
.
get
(
id
).
get
()).
isSameAs
(
entity
);
}
p
ublic
void
testMultiCacheAndEvict
(
CacheableService
<?>
service
)
{
p
rotected
void
testMultiCacheAndEvict
(
CacheableService
<?>
service
)
{
String
methodName
=
"multiCacheAndEvict"
;
Cache
primary
=
this
.
cm
.
getCache
(
"primary"
);
...
...
@@ -523,7 +522,7 @@ public abstract class AbstractCacheAnnotationTests {
assertThat
(
secondary
.
get
(
key
)).
isNull
();
}
p
ublic
void
testMultiConditionalCacheAndEvict
(
CacheableService
<?>
service
)
{
p
rotected
void
testMultiConditionalCacheAndEvict
(
CacheableService
<?>
service
)
{
Cache
primary
=
this
.
cm
.
getCache
(
"primary"
);
Cache
secondary
=
this
.
cm
.
getCache
(
"secondary"
);
Object
key
=
1
;
...
...
spring-context/src/test/java/org/springframework/context/support/StaticMessageSourceTests.java
浏览文件 @
a07ce8eb
...
...
@@ -21,6 +21,7 @@ import java.util.HashMap;
import
java.util.Locale
;
import
java.util.Map
;
import
org.junit.jupiter.api.Disabled
;
import
org.junit.jupiter.api.Test
;
import
org.springframework.beans.MutablePropertyValues
;
...
...
@@ -64,9 +65,8 @@ public class StaticMessageSourceTests extends AbstractApplicationContextTests {
@Test
@Override
@Disabled
(
"Do nothing here since super is looking for errorCodes we do NOT have in the Context"
)
public
void
messageSource
()
throws
NoSuchMessageException
{
// Do nothing here since super is looking for errorCodes we
// do NOT have in the Context
}
@Test
...
...
spring-jms/src/test/java/org/springframework/jms/annotation/AbstractJmsAnnotationDrivenTests.java
浏览文件 @
a07ce8eb
...
...
@@ -43,44 +43,43 @@ import static org.assertj.core.api.Assertions.assertThat;
import
static
org
.
mockito
.
Mockito
.
mock
;
/**
*
* @author Stephane Nicoll
*/
public
abstract
class
AbstractJmsAnnotationDrivenTests
{
abstract
class
AbstractJmsAnnotationDrivenTests
{
@Test
public
abstract
void
sampleConfiguration
();
abstract
void
sampleConfiguration
();
@Test
public
abstract
void
fullConfiguration
();
abstract
void
fullConfiguration
();
@Test
public
abstract
void
fullConfigurableConfiguration
();
abstract
void
fullConfigurableConfiguration
();
@Test
public
abstract
void
customConfiguration
();
abstract
void
customConfiguration
();
@Test
public
abstract
void
explicitContainerFactory
();
abstract
void
explicitContainerFactory
();
@Test
public
abstract
void
defaultContainerFactory
();
abstract
void
defaultContainerFactory
();
@Test
public
abstract
void
jmsHandlerMethodFactoryConfiguration
()
throws
JMSException
;
abstract
void
jmsHandlerMethodFactoryConfiguration
()
throws
JMSException
;
@Test
public
abstract
void
jmsListenerIsRepeatable
();
abstract
void
jmsListenerIsRepeatable
();
@Test
public
abstract
void
jmsListeners
();
abstract
void
jmsListeners
();
/**
* Test for {@link SampleBean} discovery. If a factory with the default name
* is set, an endpoint will use it automatically
*/
p
ublic
void
testSampleConfiguration
(
ApplicationContext
context
)
{
p
rotected
void
testSampleConfiguration
(
ApplicationContext
context
)
{
JmsListenerContainerTestFactory
defaultFactory
=
context
.
getBean
(
"jmsListenerContainerFactory"
,
JmsListenerContainerTestFactory
.
class
);
JmsListenerContainerTestFactory
simpleFactory
=
...
...
@@ -94,7 +93,7 @@ public abstract class AbstractJmsAnnotationDrivenTests {
* all endpoints provide a default registry. This shows that the default factory
* is only retrieved if it needs to be.
*/
p
ublic
void
testFullConfiguration
(
ApplicationContext
context
)
{
p
rotected
void
testFullConfiguration
(
ApplicationContext
context
)
{
JmsListenerContainerTestFactory
simpleFactory
=
context
.
getBean
(
"simpleFactory"
,
JmsListenerContainerTestFactory
.
class
);
assertThat
(
simpleFactory
.
getListenerContainers
().
size
()).
isEqualTo
(
1
);
...
...
@@ -117,7 +116,7 @@ public abstract class AbstractJmsAnnotationDrivenTests {
* with "myCustomEndpointId". The custom endpoint does not provide
* any factory so it's registered with the default one
*/
p
ublic
void
testCustomConfiguration
(
ApplicationContext
context
)
{
p
rotected
void
testCustomConfiguration
(
ApplicationContext
context
)
{
JmsListenerContainerTestFactory
defaultFactory
=
context
.
getBean
(
"jmsListenerContainerFactory"
,
JmsListenerContainerTestFactory
.
class
);
JmsListenerContainerTestFactory
customFactory
=
...
...
@@ -141,7 +140,7 @@ public abstract class AbstractJmsAnnotationDrivenTests {
* factory to use as a default is registered with an explicit
* default.
*/
p
ublic
void
testExplicitContainerFactoryConfiguration
(
ApplicationContext
context
)
{
p
rotected
void
testExplicitContainerFactoryConfiguration
(
ApplicationContext
context
)
{
JmsListenerContainerTestFactory
defaultFactory
=
context
.
getBean
(
"simpleFactory"
,
JmsListenerContainerTestFactory
.
class
);
assertThat
(
defaultFactory
.
getListenerContainers
().
size
()).
isEqualTo
(
1
);
...
...
@@ -151,7 +150,7 @@ public abstract class AbstractJmsAnnotationDrivenTests {
* Test for {@link DefaultBean} that does not define the container
* factory to use as a default is registered with the default name.
*/
p
ublic
void
testDefaultContainerFactoryConfiguration
(
ApplicationContext
context
)
{
p
rotected
void
testDefaultContainerFactoryConfiguration
(
ApplicationContext
context
)
{
JmsListenerContainerTestFactory
defaultFactory
=
context
.
getBean
(
"jmsListenerContainerFactory"
,
JmsListenerContainerTestFactory
.
class
);
assertThat
(
defaultFactory
.
getListenerContainers
().
size
()).
isEqualTo
(
1
);
...
...
@@ -163,7 +162,7 @@ public abstract class AbstractJmsAnnotationDrivenTests {
*
* The test should throw a {@link org.springframework.jms.listener.adapter.ListenerExecutionFailedException}
*/
p
ublic
void
testJmsHandlerMethodFactoryConfiguration
(
ApplicationContext
context
)
throws
JMSException
{
p
rotected
void
testJmsHandlerMethodFactoryConfiguration
(
ApplicationContext
context
)
throws
JMSException
{
JmsListenerContainerTestFactory
simpleFactory
=
context
.
getBean
(
"defaultFactory"
,
JmsListenerContainerTestFactory
.
class
);
assertThat
(
simpleFactory
.
getListenerContainers
().
size
()).
isEqualTo
(
1
);
...
...
@@ -180,7 +179,7 @@ public abstract class AbstractJmsAnnotationDrivenTests {
* Test for {@link JmsListenerRepeatableBean} and {@link JmsListenersBean} that validates that the
* {@code @JmsListener} annotation is repeatable and generate one specific container per annotation.
*/
p
ublic
void
testJmsListenerRepeatable
(
ApplicationContext
context
)
{
p
rotected
void
testJmsListenerRepeatable
(
ApplicationContext
context
)
{
JmsListenerContainerTestFactory
simpleFactory
=
context
.
getBean
(
"jmsListenerContainerFactory"
,
JmsListenerContainerTestFactory
.
class
);
assertThat
(
simpleFactory
.
getListenerContainers
().
size
()).
isEqualTo
(
2
);
...
...
spring-jms/src/test/java/org/springframework/jms/annotation/AnnotationDrivenNamespaceTests.java
浏览文件 @
a07ce8eb
...
...
@@ -32,12 +32,13 @@ import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
/**
* @author Stephane Nicoll
* @author Sam Brannen
*/
public
class
AnnotationDrivenNamespaceTests
extends
AbstractJmsAnnotationDrivenTests
{
class
AnnotationDrivenNamespaceTests
extends
AbstractJmsAnnotationDrivenTests
{
@Override
@Test
public
void
sampleConfiguration
()
{
void
sampleConfiguration
()
{
ApplicationContext
context
=
new
ClassPathXmlApplicationContext
(
"annotation-driven-sample-config.xml"
,
getClass
());
testSampleConfiguration
(
context
);
...
...
@@ -45,7 +46,7 @@ public class AnnotationDrivenNamespaceTests extends AbstractJmsAnnotationDrivenT
@Override
@Test
public
void
fullConfiguration
()
{
void
fullConfiguration
()
{
ApplicationContext
context
=
new
ClassPathXmlApplicationContext
(
"annotation-driven-full-config.xml"
,
getClass
());
testFullConfiguration
(
context
);
...
...
@@ -53,7 +54,7 @@ public class AnnotationDrivenNamespaceTests extends AbstractJmsAnnotationDrivenT
@Override
@Test
public
void
fullConfigurableConfiguration
()
{
void
fullConfigurableConfiguration
()
{
ApplicationContext
context
=
new
ClassPathXmlApplicationContext
(
"annotation-driven-full-configurable-config.xml"
,
getClass
());
testFullConfiguration
(
context
);
...
...
@@ -61,7 +62,7 @@ public class AnnotationDrivenNamespaceTests extends AbstractJmsAnnotationDrivenT
@Override
@Test
public
void
customConfiguration
()
{
void
customConfiguration
()
{
ApplicationContext
context
=
new
ClassPathXmlApplicationContext
(
"annotation-driven-custom-registry.xml"
,
getClass
());
testCustomConfiguration
(
context
);
...
...
@@ -69,7 +70,7 @@ public class AnnotationDrivenNamespaceTests extends AbstractJmsAnnotationDrivenT
@Override
@Test
public
void
explicitContainerFactory
()
{
void
explicitContainerFactory
()
{
ApplicationContext
context
=
new
ClassPathXmlApplicationContext
(
"annotation-driven-custom-container-factory.xml"
,
getClass
());
testExplicitContainerFactoryConfiguration
(
context
);
...
...
@@ -77,7 +78,7 @@ public class AnnotationDrivenNamespaceTests extends AbstractJmsAnnotationDrivenT
@Override
@Test
public
void
defaultContainerFactory
()
{
void
defaultContainerFactory
()
{
ApplicationContext
context
=
new
ClassPathXmlApplicationContext
(
"annotation-driven-default-container-factory.xml"
,
getClass
());
testDefaultContainerFactoryConfiguration
(
context
);
...
...
@@ -85,7 +86,7 @@ public class AnnotationDrivenNamespaceTests extends AbstractJmsAnnotationDrivenT
@Override
@Test
public
void
jmsHandlerMethodFactoryConfiguration
()
throws
JMSException
{
void
jmsHandlerMethodFactoryConfiguration
()
throws
JMSException
{
ApplicationContext
context
=
new
ClassPathXmlApplicationContext
(
"annotation-driven-custom-handler-method-factory.xml"
,
getClass
());
...
...
@@ -96,7 +97,7 @@ public class AnnotationDrivenNamespaceTests extends AbstractJmsAnnotationDrivenT
@Override
@Test
public
void
jmsListenerIsRepeatable
()
{
void
jmsListenerIsRepeatable
()
{
ApplicationContext
context
=
new
ClassPathXmlApplicationContext
(
"annotation-driven-jms-listener-repeatable.xml"
,
getClass
());
testJmsListenerRepeatable
(
context
);
...
...
@@ -104,7 +105,7 @@ public class AnnotationDrivenNamespaceTests extends AbstractJmsAnnotationDrivenT
@Override
@Test
public
void
jmsListeners
()
{
void
jmsListeners
()
{
ApplicationContext
context
=
new
ClassPathXmlApplicationContext
(
"annotation-driven-jms-listeners.xml"
,
getClass
());
testJmsListenerRepeatable
(
context
);
...
...
spring-jms/src/test/java/org/springframework/jms/annotation/EnableJmsTests.java
浏览文件 @
a07ce8eb
...
...
@@ -52,11 +52,11 @@ import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
* @author Stephane Nicoll
* @author Sam Brannen
*/
public
class
EnableJmsTests
extends
AbstractJmsAnnotationDrivenTests
{
class
EnableJmsTests
extends
AbstractJmsAnnotationDrivenTests
{
@Override
@Test
public
void
sampleConfiguration
()
{
void
sampleConfiguration
()
{
ConfigurableApplicationContext
context
=
new
AnnotationConfigApplicationContext
(
EnableJmsSampleConfig
.
class
,
SampleBean
.
class
);
testSampleConfiguration
(
context
);
...
...
@@ -64,7 +64,7 @@ public class EnableJmsTests extends AbstractJmsAnnotationDrivenTests {
@Override
@Test
public
void
fullConfiguration
()
{
void
fullConfiguration
()
{
ConfigurableApplicationContext
context
=
new
AnnotationConfigApplicationContext
(
EnableJmsFullConfig
.
class
,
FullBean
.
class
);
testFullConfiguration
(
context
);
...
...
@@ -72,7 +72,7 @@ public class EnableJmsTests extends AbstractJmsAnnotationDrivenTests {
@Override
@Test
public
void
fullConfigurableConfiguration
()
{
void
fullConfigurableConfiguration
()
{
ConfigurableApplicationContext
context
=
new
AnnotationConfigApplicationContext
(
EnableJmsFullConfigurableConfig
.
class
,
FullConfigurableBean
.
class
);
testFullConfiguration
(
context
);
...
...
@@ -80,7 +80,7 @@ public class EnableJmsTests extends AbstractJmsAnnotationDrivenTests {
@Override
@Test
public
void
customConfiguration
()
{
void
customConfiguration
()
{
ConfigurableApplicationContext
context
=
new
AnnotationConfigApplicationContext
(
EnableJmsCustomConfig
.
class
,
CustomBean
.
class
);
testCustomConfiguration
(
context
);
...
...
@@ -88,7 +88,7 @@ public class EnableJmsTests extends AbstractJmsAnnotationDrivenTests {
@Override
@Test
public
void
explicitContainerFactory
()
{
void
explicitContainerFactory
()
{
ConfigurableApplicationContext
context
=
new
AnnotationConfigApplicationContext
(
EnableJmsCustomContainerFactoryConfig
.
class
,
DefaultBean
.
class
);
testExplicitContainerFactoryConfiguration
(
context
);
...
...
@@ -96,14 +96,15 @@ public class EnableJmsTests extends AbstractJmsAnnotationDrivenTests {
@Override
@Test
public
void
defaultContainerFactory
()
{
void
defaultContainerFactory
()
{
ConfigurableApplicationContext
context
=
new
AnnotationConfigApplicationContext
(
EnableJmsDefaultContainerFactoryConfig
.
class
,
DefaultBean
.
class
);
testDefaultContainerFactoryConfiguration
(
context
);
}
@Test
public
void
containerAreStartedByDefault
()
{
@SuppressWarnings
(
"resource"
)
void
containerAreStartedByDefault
()
{
ConfigurableApplicationContext
context
=
new
AnnotationConfigApplicationContext
(
EnableJmsDefaultContainerFactoryConfig
.
class
,
DefaultBean
.
class
);
JmsListenerContainerTestFactory
factory
=
...
...
@@ -114,7 +115,8 @@ public class EnableJmsTests extends AbstractJmsAnnotationDrivenTests {
}
@Test
public
void
containerCanBeStarterViaTheRegistry
()
{
@SuppressWarnings
(
"resource"
)
void
containerCanBeStarterViaTheRegistry
()
{
ConfigurableApplicationContext
context
=
new
AnnotationConfigApplicationContext
(
EnableJmsAutoStartupFalseConfig
.
class
,
DefaultBean
.
class
);
JmsListenerContainerTestFactory
factory
=
...
...
@@ -129,7 +131,7 @@ public class EnableJmsTests extends AbstractJmsAnnotationDrivenTests {
@Override
@Test
public
void
jmsHandlerMethodFactoryConfiguration
()
throws
JMSException
{
void
jmsHandlerMethodFactoryConfiguration
()
throws
JMSException
{
ConfigurableApplicationContext
context
=
new
AnnotationConfigApplicationContext
(
EnableJmsHandlerMethodFactoryConfig
.
class
,
ValidationBean
.
class
);
...
...
@@ -140,7 +142,7 @@ public class EnableJmsTests extends AbstractJmsAnnotationDrivenTests {
@Override
@Test
public
void
jmsListenerIsRepeatable
()
{
void
jmsListenerIsRepeatable
()
{
ConfigurableApplicationContext
context
=
new
AnnotationConfigApplicationContext
(
EnableJmsDefaultContainerFactoryConfig
.
class
,
JmsListenerRepeatableBean
.
class
);
testJmsListenerRepeatable
(
context
);
...
...
@@ -148,14 +150,14 @@ public class EnableJmsTests extends AbstractJmsAnnotationDrivenTests {
@Override
@Test
public
void
jmsListeners
()
{
void
jmsListeners
()
{
ConfigurableApplicationContext
context
=
new
AnnotationConfigApplicationContext
(
EnableJmsDefaultContainerFactoryConfig
.
class
,
JmsListenersBean
.
class
);
testJmsListenerRepeatable
(
context
);
}
@Test
public
void
composedJmsListeners
()
{
void
composedJmsListeners
()
{
try
(
ConfigurableApplicationContext
context
=
new
AnnotationConfigApplicationContext
(
EnableJmsDefaultContainerFactoryConfig
.
class
,
ComposedJmsListenersBean
.
class
))
{
JmsListenerContainerTestFactory
simpleFactory
=
context
.
getBean
(
"jmsListenerContainerFactory"
,
...
...
@@ -178,7 +180,7 @@ public class EnableJmsTests extends AbstractJmsAnnotationDrivenTests {
@Test
@SuppressWarnings
(
"resource"
)
public
void
unknownFactory
()
{
void
unknownFactory
()
{
// not found
assertThatExceptionOfType
(
BeanCreationException
.
class
).
isThrownBy
(()
->
new
AnnotationConfigApplicationContext
(
EnableJmsSampleConfig
.
class
,
CustomBean
.
class
))
...
...
@@ -186,7 +188,7 @@ public class EnableJmsTests extends AbstractJmsAnnotationDrivenTests {
}
@Test
public
void
lazyComponent
()
{
void
lazyComponent
()
{
ConfigurableApplicationContext
context
=
new
AnnotationConfigApplicationContext
(
EnableJmsDefaultContainerFactoryConfig
.
class
,
LazyBean
.
class
);
JmsListenerContainerTestFactory
defaultFactory
=
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录