[SPR-6124] Verified that timed transactional tests fail with the TestNG integration in the TestContext framework.

master
Sam Brannen 15 years ago
parent 02dfe94396
commit 1b92a2fae1
  1. 13
      org.springframework.test/src/test/java/org/springframework/test/context/testng/TimedTransactionalTestNGSpringContextTests-context.xml
  2. 47
      org.springframework.test/src/test/java/org/springframework/test/context/testng/TimedTransactionalTestNGSpringContextTests.java

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:p="http://www.springframework.org/schema/p"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
<bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource"
p:driverClassName="org.hsqldb.jdbcDriver" p:url="jdbc:hsqldb:mem:transactional_tests" p:username="sa"
p:password="" />
<bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager"
p:data-source-ref="dataSource" />
</beans>

@ -0,0 +1,47 @@
/*
* Copyright 2009 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.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.test.context.testng;
import static org.springframework.test.transaction.TransactionTestUtils.assertInTransaction;
import org.springframework.test.context.ContextConfiguration;
import org.testng.annotations.Test;
/**
* Timed integration tests for
* {@link AbstractTransactionalTestNGSpringContextTests}; used to verify claim
* raised in <a href="http://jira.springframework.org/browse/SPR-6124"
* target="_blank">SPR-6124</a>.
*
* @author Sam Brannen
* @since 3.0
*/
@ContextConfiguration
public class TimedTransactionalTestNGSpringContextTests extends AbstractTransactionalTestNGSpringContextTests {
@Test
public void testWithoutTimeout() {
assertInTransaction(true);
}
// TODO Enable TestNG test with timeout once we have a solution.
@Test(timeOut = 10000, enabled = false)
public void testWithTimeout() {
assertInTransaction(true);
}
}
Loading…
Cancel
Save