RESOLVED - issue BATCH-1391: Tidy up skip sample

Fix broken samples
This commit is contained in:
dsyer
2009-09-04 11:10:22 +00:00
parent 201985e925
commit fba4cfd62f
5 changed files with 8 additions and 5 deletions

View File

@@ -38,7 +38,7 @@ public class TradeRowMapper implements RowMapper {
trade.setQuantity(rs.getLong(QUANTITY_COLUMN));
trade.setPrice(rs.getBigDecimal(PRICE_COLUMN));
trade.setCustomer(rs.getString(CUSTOMER_COLUMN));
trade.setVersion(rs.getLong(VERSION_COLUMN));
trade.setVersion(rs.getInt(VERSION_COLUMN));
return trade;
}

View File

@@ -47,7 +47,7 @@
<bean id="tradeSqlItemReader" class="org.springframework.batch.item.database.JdbcCursorItemReader">
<property name="dataSource" ref="dataSource" />
<property name="sql" value="SELECT id, quantity, price, customer from TRADE" />
<property name="sql" value="SELECT isin, quantity, price, customer, id, version from TRADE" />
<property name="rowMapper">
<bean class="org.springframework.batch.sample.domain.trade.internal.TradeRowMapper" />
</property>

View File

@@ -43,7 +43,7 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
@ContextConfiguration()
public class TradeJobFunctionalTests extends AbstractValidatingBatchLauncherTests {
private static final String GET_TRADES = "select ISIN, QUANTITY, PRICE, CUSTOMER from TRADE order by ISIN";
private static final String GET_TRADES = "select ISIN, QUANTITY, PRICE, CUSTOMER, ID, VERSION from TRADE order by ISIN";
private static final String GET_CUSTOMERS = "select NAME, CREDIT from CUSTOMER order by NAME";
private List<Customer> customers;

View File

@@ -1,6 +1,6 @@
package org.springframework.batch.sample.domain.trade.internal;
import static org.easymock.EasyMock.*;
import static org.easymock.EasyMock.expect;
import java.math.BigDecimal;
import java.sql.ResultSet;
@@ -31,10 +31,12 @@ public class TradeRowMapperTests extends AbstractRowMapperTests {
}
protected void setUpResultSetMock(ResultSet rs) throws SQLException {
expect(rs.getLong(TradeRowMapper.ID_COLUMN)).andReturn(12L);
expect(rs.getString(TradeRowMapper.ISIN_COLUMN)).andReturn(ISIN);
expect(rs.getLong(TradeRowMapper.QUANTITY_COLUMN)).andReturn(QUANTITY);
expect(rs.getBigDecimal(TradeRowMapper.PRICE_COLUMN)).andReturn(PRICE);
expect(rs.getString(TradeRowMapper.CUSTOMER_COLUMN)).andReturn(CUSTOMER);
expect(rs.getInt(TradeRowMapper.VERSION_COLUMN)).andReturn(0);
}
}

View File

@@ -18,6 +18,7 @@ package org.springframework.batch.sample.support;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.fail;
import java.io.IOException;
import java.util.Arrays;
import org.junit.Test;
@@ -58,7 +59,7 @@ public class ItemTrackingItemWriterTests {
writer.write(Arrays.asList(a, b, c));
fail("Expected Write Failure Exception");
}
catch (RuntimeException e) {
catch (IOException e) {
// expected
}
// the failed item is removed