Skip to content

Commit 1b92a2f

Browse files
committed
[SPR-6124] Verified that timed transactional tests fail with the TestNG integration in the TestContext framework.
1 parent 02dfe94 commit 1b92a2f

File tree

2 files changed

+60
-0
lines changed

2 files changed

+60
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xmlns:p="http://www.springframework.org/schema/p"
4+
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
5+
6+
<bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource"
7+
p:driverClassName="org.hsqldb.jdbcDriver" p:url="jdbc:hsqldb:mem:transactional_tests" p:username="sa"
8+
p:password="" />
9+
10+
<bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager"
11+
p:data-source-ref="dataSource" />
12+
13+
</beans>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
/*
2+
* Copyright 2009 the original author or authors.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package org.springframework.test.context.testng;
18+
19+
import static org.springframework.test.transaction.TransactionTestUtils.assertInTransaction;
20+
21+
import org.springframework.test.context.ContextConfiguration;
22+
import org.testng.annotations.Test;
23+
24+
/**
25+
* Timed integration tests for
26+
* {@link AbstractTransactionalTestNGSpringContextTests}; used to verify claim
27+
* raised in <a href="http://jira.springframework.org/browse/SPR-6124"
28+
* target="_blank">SPR-6124</a>.
29+
*
30+
* @author Sam Brannen
31+
* @since 3.0
32+
*/
33+
@ContextConfiguration
34+
public class TimedTransactionalTestNGSpringContextTests extends AbstractTransactionalTestNGSpringContextTests {
35+
36+
@Test
37+
public void testWithoutTimeout() {
38+
assertInTransaction(true);
39+
}
40+
41+
// TODO Enable TestNG test with timeout once we have a solution.
42+
@Test(timeOut = 10000, enabled = false)
43+
public void testWithTimeout() {
44+
assertInTransaction(true);
45+
}
46+
47+
}

0 commit comments

Comments
 (0)