RESOLVED - issue BATCH-1391: Tidy up skip sample
Fix broken samples
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user