BATCH-710: added some @Test and removed @Transactional for the ItemReader tests
This commit is contained in:
@@ -2,6 +2,7 @@ package org.springframework.batch.item.database;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.Test;
|
||||
|
||||
import org.hibernate.SessionFactory;
|
||||
import org.hibernate.StatelessSession;
|
||||
@@ -53,6 +54,7 @@ public class HibernateCursorItemReaderIntegrationTests extends AbstractDataSourc
|
||||
* {@link HibernateCursorItemReader#setUseStatelessSession(boolean)} can be
|
||||
* called only in uninitialized state.
|
||||
*/
|
||||
@Test
|
||||
public void testSetUseStatelessSession() {
|
||||
HibernateCursorItemReader<Foo> inputSource = (HibernateCursorItemReader<Foo>)reader;
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@ import org.springframework.batch.item.sample.Foo;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* Tests for {@link HibernateCursorItemReader} using standard hibernate {@link Session}.
|
||||
@@ -24,6 +25,7 @@ public class HibernateCursorItemReaderStatefulIntegrationTests extends Hibernate
|
||||
}
|
||||
|
||||
//Ensure close is called on the stateful session correctly.
|
||||
@Test
|
||||
public void testStatfulClose(){
|
||||
|
||||
SessionFactory sessionFactory = createMock(SessionFactory.class);
|
||||
|
||||
@@ -32,15 +32,12 @@ public class HibernateCursorProjectionItemReaderIntegrationTests {
|
||||
|
||||
protected ItemReader<?> reader;
|
||||
|
||||
protected ExecutionContext executionContext;
|
||||
|
||||
@Autowired
|
||||
protected DataSource dataSource;
|
||||
|
||||
@Before
|
||||
public void onSetUpInTransaction() throws Exception {
|
||||
public void onSetUp() throws Exception {
|
||||
reader = createItemReader();
|
||||
executionContext = new ExecutionContext();
|
||||
}
|
||||
|
||||
|
||||
@@ -63,7 +60,7 @@ public class HibernateCursorProjectionItemReaderIntegrationTests {
|
||||
return inputSource;
|
||||
}
|
||||
|
||||
@Transactional @Test
|
||||
@Test
|
||||
public void testNormalProcessing() throws Exception {
|
||||
((InitializingBean) reader).afterPropertiesSet();
|
||||
((ItemStream) reader).open(new ExecutionContext());
|
||||
|
||||
Reference in New Issue
Block a user