BATCH-710: added some @Test and removed @Transactional for the ItemReader tests

This commit is contained in:
trisberg
2008-08-07 01:24:50 +00:00
parent 33f4ce174d
commit 134f81655c
3 changed files with 6 additions and 5 deletions

View File

@@ -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;

View File

@@ -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);

View File

@@ -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());