일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 | 31 |
- 단축키
- web.xml
- xargs
- Eclipse
- import
- 네트워크
- find
- bash
- resource
- grep
- port
- JavaScript
- netsh
- lsof
- maVen
- ssh
- context
- Source
- 줄바꿈 문자
- plugin
- Mac
- GIT
- Windows
- profile
- VirtualBox
- Quartz
- IntelliJ
- tomcat
- Windows 10
- vscode
- Today
- Total
develog
[JUnit] JUnit Transaction Rollback 본문
import java.sql.Connection; import java.sql.PreparedStatement; import javax.sql.DataSource; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.jdbc.datasource.DataSourceUtils; import org.springframework.test.annotation.Rollback; import org.springframework.test.context.ContextConfiguration; import org.springframework.transaction.annotation.Transactional; import common.ExtSpringJUnit4ClassRunner; @RunWith(ExtSpringJUnit4ClassRunner.class) @ContextConfiguration(locations = { "classpath:spring-application.xml" }) public class Test_트랜잭션 {
@Qualifier("dataSource") @Autowired private DataSource dataSource;
@Test @Transactional // @Rollback(false) public void tranTest() throws Exception { Connection conn = DataSourceUtils.getConnection(dataSource); String sql = "INSERT INTO AATEST (SEQ, TITLE, REG_TS) VALUES (1, 2, SYSTIMESTAMP)"; PreparedStatement pstmt = conn.prepareStatement(sql); pstmt.executeUpdate(); }
} |
'Dev > junit' 카테고리의 다른 글
[junit] spring junit 설정2 (0) | 2019.08.02 |
---|---|
[junit] spring junit 설정1 (0) | 2019.08.02 |
JUnit 에서 ApplicationContext 접근 (0) | 2013.12.11 |
[junit] ExtSpringJUnit4ClassRunner (0) | 2013.12.09 |
JUnit 버전 확인 (0) | 2013.12.09 |