IN PROGRESS - BATCH-672: removed redundant casts and boxing/unboxing, converted to for each loops, general cleanup
This commit is contained in:
@@ -20,11 +20,11 @@ public class ConfigurableSystemProcessExitCodeMapper implements SystemProcessExi
|
||||
private Map<Object, ExitStatus> mappings;
|
||||
|
||||
public ExitStatus getExitStatus(int exitCode) {
|
||||
ExitStatus exitStatus = (ExitStatus) mappings.get(new Integer(exitCode));
|
||||
ExitStatus exitStatus = mappings.get(exitCode);
|
||||
if (exitStatus != null) {
|
||||
return exitStatus;
|
||||
} else {
|
||||
return (ExitStatus) mappings.get(ELSE_KEY);
|
||||
return mappings.get(ELSE_KEY);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -41,13 +41,13 @@ public final class FieldSetResultSetExtractor {
|
||||
* Processes single row in ResultSet and returns its FieldSet representation.
|
||||
* @param rs ResultSet ResultSet to extract data from.
|
||||
* @return FieldSet representation of current row in ResultSet
|
||||
* @throws SQLException
|
||||
* @throws SQLException thrown during processing
|
||||
*/
|
||||
public static FieldSet getFieldSet(ResultSet rs) throws SQLException {
|
||||
ResultSetMetaData metaData = rs.getMetaData();
|
||||
int columnCount = metaData.getColumnCount();
|
||||
|
||||
FieldSet fs = null;
|
||||
FieldSet fs;
|
||||
|
||||
List<String> tokens = new ArrayList<String>();
|
||||
List<String> names = new ArrayList<String>();
|
||||
@@ -57,7 +57,7 @@ public final class FieldSetResultSetExtractor {
|
||||
names.add(metaData.getColumnName(i));
|
||||
}
|
||||
|
||||
fs = new DefaultFieldSet((String[])tokens.toArray(new String[0]), (String[])names.toArray(new String[0]));
|
||||
fs = new DefaultFieldSet(tokens.toArray(new String[0]), names.toArray(new String[0]));
|
||||
|
||||
return fs;
|
||||
}
|
||||
|
||||
@@ -31,22 +31,22 @@ public class LogAdvice {
|
||||
|
||||
private static Log log = LogFactory.getLog(LogAdvice.class);
|
||||
|
||||
/**
|
||||
/*
|
||||
* Wraps original method and adds logging both before and after method
|
||||
*/
|
||||
public void doBasicLogging(JoinPoint pjp) throws Throwable {
|
||||
Object[] args = pjp.getArgs();
|
||||
StringBuffer output = new StringBuffer();
|
||||
|
||||
output.append(pjp.getTarget().getClass().getName()+": ");
|
||||
output.append(pjp.toShortString()+": ");
|
||||
|
||||
for(int i = 0; i < args.length; i++){
|
||||
output.append(args[i] + " ");
|
||||
}
|
||||
|
||||
|
||||
log.info("Basic: " + output.toString());
|
||||
output.append(pjp.getTarget().getClass().getName()).append(": ");
|
||||
output.append(pjp.toShortString()).append(": ");
|
||||
|
||||
for (Object arg : args) {
|
||||
output.append(arg).append(" ");
|
||||
}
|
||||
|
||||
|
||||
log.info("Basic: " + output.toString());
|
||||
}
|
||||
|
||||
public void doStronglyTypedLogging(Object item){
|
||||
|
||||
@@ -72,7 +72,7 @@ public class StagingItemWriter<T> extends JdbcDaoSupport implements StepExecutio
|
||||
*/
|
||||
public void write(T data) {
|
||||
final long id = incrementer.nextLongValue();
|
||||
final long jobId = stepExecution.getJobExecution().getJobId().longValue();
|
||||
final long jobId = stepExecution.getJobExecution().getJobId();
|
||||
final byte[] blob = SerializationUtils.serialize((Serializable) data);
|
||||
getJdbcTemplate().update("INSERT into BATCH_STAGING (ID, JOB_ID, VALUE, PROCESSED) values (?,?,?,?)",
|
||||
new PreparedStatementSetter() {
|
||||
|
||||
@@ -64,7 +64,7 @@ public class OrderItemReader extends AbstractItemReader<Order> {
|
||||
recordFinished = false;
|
||||
|
||||
while (!recordFinished) {
|
||||
process((FieldSet) fieldSetReader.read());
|
||||
process(fieldSetReader.read());
|
||||
}
|
||||
|
||||
log.info("Mapped: " + order);
|
||||
|
||||
@@ -71,7 +71,7 @@ public class OrderTransformer implements ItemTransformer<Order, List<String>> {
|
||||
}
|
||||
|
||||
private LineAggregator getAggregator(String name) {
|
||||
return (LineAggregator) aggregators.get(name);
|
||||
return aggregators.get(name);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -27,11 +27,7 @@ import org.springmodules.validation.valang.functions.Function;
|
||||
* @author peter.zozom
|
||||
*/
|
||||
public class FutureDateFunction extends AbstractFunction {
|
||||
/**
|
||||
* @param arguments
|
||||
* @param line
|
||||
* @param column
|
||||
*/
|
||||
|
||||
public FutureDateFunction(Function[] arguments, int line, int column) {
|
||||
super(arguments, line, column);
|
||||
definedExactNumberOfArguments(1);
|
||||
@@ -44,7 +40,7 @@ public class FutureDateFunction extends AbstractFunction {
|
||||
//get argument
|
||||
final Object value = getArguments()[0].getResult(target);
|
||||
|
||||
Boolean result = Boolean.FALSE;
|
||||
Boolean result;
|
||||
|
||||
if (value instanceof Date) {
|
||||
final Date now = new Date(System.currentTimeMillis());
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
|
||||
package org.springframework.batch.sample.domain.order.internal.valang;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.batch.sample.domain.order.LineItem;
|
||||
@@ -41,7 +40,7 @@ public class TotalOrderItemsFunction extends AbstractFunction {
|
||||
@SuppressWarnings("unchecked")
|
||||
protected Object doGetResult(Object target) throws Exception {
|
||||
//get arguments
|
||||
int count = ((Integer) getArguments()[0].getResult(target)).intValue();
|
||||
int count = (Integer) getArguments()[0].getResult(target);
|
||||
Object value = getArguments()[1].getResult(target);
|
||||
|
||||
Boolean result;
|
||||
@@ -50,11 +49,11 @@ public class TotalOrderItemsFunction extends AbstractFunction {
|
||||
if (value instanceof List) {
|
||||
int totalItems = 0;
|
||||
|
||||
for (Iterator<LineItem> i = ((List<LineItem>) value).iterator(); i.hasNext();) {
|
||||
totalItems += i.next().getQuantity();
|
||||
}
|
||||
for (LineItem lineItem : ((List<LineItem>) value)) {
|
||||
totalItems += lineItem.getQuantity();
|
||||
}
|
||||
|
||||
result = (totalItems == count) ? Boolean.TRUE : Boolean.FALSE;
|
||||
result = (totalItems == count) ? Boolean.TRUE : Boolean.FALSE;
|
||||
} else {
|
||||
throw new Exception("No list for validation");
|
||||
}
|
||||
|
||||
@@ -62,7 +62,7 @@ public class PersonService {
|
||||
return person;
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* Badly designed method signature which accepts multiple implicitly related
|
||||
* arguments instead of a single Person argument.
|
||||
*/
|
||||
|
||||
@@ -27,13 +27,9 @@ public class PersonWriter extends AbstractItemWriter<Person> {
|
||||
private static Log log = LogFactory.getLog(PersonWriter.class);
|
||||
|
||||
public void write(Person data) {
|
||||
if (!(data instanceof Person)) {
|
||||
log.warn("PersonProcessor can process only Person objects, skipping record");
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
log.debug("Processing: " + data);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ package org.springframework.batch.sample.domain.trade;
|
||||
* @author Robert Kasanicky
|
||||
*/
|
||||
public interface TradeDao {
|
||||
/**
|
||||
/*
|
||||
* Write a trade object to some kind of output, different implementations
|
||||
* can write to file, database etc.
|
||||
*/
|
||||
|
||||
@@ -61,7 +61,6 @@ public class JobExecutionNotificationPublisher implements ApplicationListener, N
|
||||
logger.info(message);
|
||||
publish(message);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -10,10 +10,6 @@ public class SimpleMessageApplicationEvent extends ApplicationEvent {
|
||||
|
||||
private String message;
|
||||
|
||||
/**
|
||||
* @param source
|
||||
* @param message
|
||||
*/
|
||||
public SimpleMessageApplicationEvent(Object source, String message) {
|
||||
super(source);
|
||||
this.message = message;
|
||||
|
||||
@@ -55,13 +55,9 @@ public class StepExecutionApplicationEventAdvice implements ApplicationEventPubl
|
||||
publish(jp.getTarget(), msg);
|
||||
}
|
||||
|
||||
/**
|
||||
* Publish a {@link RepeatOperationsApplicationEvent} with the given
|
||||
/*
|
||||
* Publish a {@link SimpleMessageApplicationEvent} with the given
|
||||
* parameters.
|
||||
*
|
||||
* @param context the current batch context
|
||||
* @param message the message to publish
|
||||
* @param type the type of event to publish
|
||||
*/
|
||||
private void publish(Object source, String message) {
|
||||
applicationEventPublisher.publishEvent(new SimpleMessageApplicationEvent(source, message));
|
||||
|
||||
@@ -37,7 +37,7 @@ public class DefaultJobLoader implements JobLoader, ApplicationContextAware {
|
||||
Map<String, String> result = new HashMap<String, String>(configurations);
|
||||
for (String jobName : registry.getJobNames()) {
|
||||
try {
|
||||
Job configuration = (Job) registry.getJob(jobName);
|
||||
Job configuration = registry.getJob(jobName);
|
||||
String name = configuration.getName();
|
||||
if (!configurations.containsKey(name)) {
|
||||
result.put(name, "<unknown path>: " + configuration);
|
||||
@@ -54,8 +54,7 @@ public class DefaultJobLoader implements JobLoader, ApplicationContextAware {
|
||||
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(new String[] { path },
|
||||
applicationContext);
|
||||
String[] names = context.getBeanNamesForType(Job.class);
|
||||
for (int i = 0; i < names.length; i++) {
|
||||
String name = names[i];
|
||||
for (String name : names) {
|
||||
configurations.put(name, path);
|
||||
}
|
||||
}
|
||||
@@ -88,8 +87,7 @@ public class DefaultJobLoader implements JobLoader, ApplicationContextAware {
|
||||
String name = path.substring(0, index);
|
||||
Object bean = getJobConfiguration(name);
|
||||
Assert.notNull(bean, "No JobConfiguration exists with name=" + name);
|
||||
BeanWrapperImpl wrapper = new BeanWrapperImpl(bean);
|
||||
return wrapper;
|
||||
return new BeanWrapperImpl(bean);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -76,7 +76,7 @@ public class JobLauncherDetails extends QuartzJobBean {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* Copy parameters that are of the correct type over to
|
||||
* {@link JobParameters}, ignoring jobName.
|
||||
*
|
||||
@@ -93,10 +93,10 @@ public class JobLauncherDetails extends QuartzJobBean {
|
||||
builder.addString(key, (String) value);
|
||||
}
|
||||
else if (value instanceof Float || value instanceof Double) {
|
||||
builder.addDouble(key, (Double) value);
|
||||
builder.addDouble(key, ((Number) value).doubleValue());
|
||||
}
|
||||
else if (value instanceof Integer || value instanceof Long) {
|
||||
builder.addLong(key, (Long) value);
|
||||
builder.addLong(key, ((Number)value).longValue());
|
||||
}
|
||||
else if (value instanceof Date) {
|
||||
builder.addDate(key, (Date) value);
|
||||
|
||||
@@ -24,10 +24,10 @@ public class FileDeletingTasklet implements Tasklet, InitializingBean {
|
||||
Assert.state(dir.isDirectory());
|
||||
|
||||
File[] files = dir.listFiles();
|
||||
for (int i = 0; i < files.length; i++) {
|
||||
boolean deleted = files[i].delete();
|
||||
for (File file : files) {
|
||||
boolean deleted = file.delete();
|
||||
if (!deleted) {
|
||||
throw new UnexpectedJobExecutionException("Could not delete file " + files[i].getPath());
|
||||
throw new UnexpectedJobExecutionException("Could not delete file " + file.getPath());
|
||||
}
|
||||
}
|
||||
return ExitStatus.FINISHED;
|
||||
|
||||
@@ -22,7 +22,7 @@ public class TaskletJobFunctionalTests extends AbstractValidatingBatchLauncherTe
|
||||
@Autowired
|
||||
private Resource directory;
|
||||
|
||||
/**
|
||||
/*
|
||||
* Create the directory and some files in it.
|
||||
*/
|
||||
@Before
|
||||
|
||||
@@ -8,7 +8,6 @@ import java.util.Map;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.springframework.batch.repeat.ExitStatus;
|
||||
import org.springframework.batch.sample.common.ConfigurableSystemProcessExitCodeMapper;
|
||||
|
||||
/**
|
||||
* Tests for {@link ConfigurableSystemProcessExitCodeMapper}
|
||||
|
||||
@@ -4,7 +4,6 @@ import static org.junit.Assert.assertEquals;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.springframework.batch.repeat.ExitStatus;
|
||||
import org.springframework.batch.sample.common.SimpleSystemProcessExitCodeMapper;
|
||||
|
||||
/**
|
||||
* Tests for {@link SimpleSystemProcessExitCodeMapper}.
|
||||
|
||||
@@ -16,9 +16,6 @@ import org.springframework.batch.core.JobInterruptedException;
|
||||
import org.springframework.batch.core.JobParameters;
|
||||
import org.springframework.batch.core.StepExecution;
|
||||
import org.springframework.batch.repeat.ExitStatus;
|
||||
import org.springframework.batch.sample.common.SystemCommandException;
|
||||
import org.springframework.batch.sample.common.SystemCommandTasklet;
|
||||
import org.springframework.batch.sample.common.SystemProcessExitCodeMapper;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
|
||||
@@ -26,7 +26,6 @@ import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.batch.sample.domain.football.Game;
|
||||
import org.springframework.batch.sample.domain.football.internal.JdbcGameDao;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.jdbc.core.simple.ParameterizedRowMapper;
|
||||
import org.springframework.jdbc.core.simple.SimpleJdbcTemplate;
|
||||
|
||||
@@ -3,7 +3,6 @@ package org.springframework.batch.sample.domain.order;
|
||||
import org.springframework.batch.item.file.mapping.DefaultFieldSet;
|
||||
import org.springframework.batch.item.file.mapping.FieldSet;
|
||||
import org.springframework.batch.item.file.mapping.FieldSetMapper;
|
||||
import org.springframework.batch.sample.domain.order.Address;
|
||||
import org.springframework.batch.sample.domain.order.internal.AddressFieldSetMapper;
|
||||
import org.springframework.batch.sample.support.AbstractFieldSetMapperTests;
|
||||
|
||||
|
||||
@@ -3,7 +3,6 @@ package org.springframework.batch.sample.domain.order;
|
||||
import org.springframework.batch.item.file.mapping.DefaultFieldSet;
|
||||
import org.springframework.batch.item.file.mapping.FieldSet;
|
||||
import org.springframework.batch.item.file.mapping.FieldSetMapper;
|
||||
import org.springframework.batch.sample.domain.order.BillingInfo;
|
||||
import org.springframework.batch.sample.domain.order.internal.BillingFieldSetMapper;
|
||||
import org.springframework.batch.sample.support.AbstractFieldSetMapperTests;
|
||||
|
||||
|
||||
@@ -3,7 +3,6 @@ package org.springframework.batch.sample.domain.order;
|
||||
import org.springframework.batch.item.file.mapping.DefaultFieldSet;
|
||||
import org.springframework.batch.item.file.mapping.FieldSet;
|
||||
import org.springframework.batch.item.file.mapping.FieldSetMapper;
|
||||
import org.springframework.batch.sample.domain.order.Customer;
|
||||
import org.springframework.batch.sample.domain.order.internal.CustomerFieldSetMapper;
|
||||
import org.springframework.batch.sample.support.AbstractFieldSetMapperTests;
|
||||
|
||||
|
||||
@@ -32,11 +32,6 @@ import org.springframework.batch.item.file.transform.LineAggregator;
|
||||
import org.springframework.batch.item.support.AbstractItemWriter;
|
||||
import org.springframework.batch.item.transform.ItemTransformerItemWriter;
|
||||
import org.springframework.batch.sample.StubLineAggregator;
|
||||
import org.springframework.batch.sample.domain.order.Address;
|
||||
import org.springframework.batch.sample.domain.order.BillingInfo;
|
||||
import org.springframework.batch.sample.domain.order.Customer;
|
||||
import org.springframework.batch.sample.domain.order.LineItem;
|
||||
import org.springframework.batch.sample.domain.order.Order;
|
||||
import org.springframework.batch.sample.domain.order.internal.OrderTransformer;
|
||||
|
||||
public class FlatFileOrderWriterTests {
|
||||
|
||||
@@ -5,7 +5,6 @@ import java.util.Calendar;
|
||||
import org.springframework.batch.item.file.mapping.DefaultFieldSet;
|
||||
import org.springframework.batch.item.file.mapping.FieldSet;
|
||||
import org.springframework.batch.item.file.mapping.FieldSetMapper;
|
||||
import org.springframework.batch.sample.domain.order.Order;
|
||||
import org.springframework.batch.sample.domain.order.internal.HeaderFieldSetMapper;
|
||||
import org.springframework.batch.sample.support.AbstractFieldSetMapperTests;
|
||||
|
||||
|
||||
@@ -5,7 +5,6 @@ import java.math.BigDecimal;
|
||||
import org.springframework.batch.item.file.mapping.DefaultFieldSet;
|
||||
import org.springframework.batch.item.file.mapping.FieldSet;
|
||||
import org.springframework.batch.item.file.mapping.FieldSetMapper;
|
||||
import org.springframework.batch.sample.domain.order.LineItem;
|
||||
import org.springframework.batch.sample.domain.order.internal.OrderItemFieldSetMapper;
|
||||
import org.springframework.batch.sample.support.AbstractFieldSetMapperTests;
|
||||
|
||||
|
||||
@@ -18,12 +18,6 @@ import org.springframework.batch.item.ItemReader;
|
||||
import org.springframework.batch.item.file.mapping.DefaultFieldSet;
|
||||
import org.springframework.batch.item.file.mapping.FieldSet;
|
||||
import org.springframework.batch.item.file.mapping.FieldSetMapper;
|
||||
import org.springframework.batch.sample.domain.order.Address;
|
||||
import org.springframework.batch.sample.domain.order.BillingInfo;
|
||||
import org.springframework.batch.sample.domain.order.Customer;
|
||||
import org.springframework.batch.sample.domain.order.LineItem;
|
||||
import org.springframework.batch.sample.domain.order.Order;
|
||||
import org.springframework.batch.sample.domain.order.ShippingInfo;
|
||||
import org.springframework.batch.sample.domain.order.internal.OrderItemReader;
|
||||
|
||||
public class OrderItemReaderTests {
|
||||
|
||||
@@ -26,11 +26,6 @@ import java.util.HashMap;
|
||||
import org.junit.Test;
|
||||
import org.springframework.batch.item.file.transform.DelimitedLineAggregator;
|
||||
import org.springframework.batch.item.file.transform.LineAggregator;
|
||||
import org.springframework.batch.sample.domain.order.Address;
|
||||
import org.springframework.batch.sample.domain.order.BillingInfo;
|
||||
import org.springframework.batch.sample.domain.order.Customer;
|
||||
import org.springframework.batch.sample.domain.order.LineItem;
|
||||
import org.springframework.batch.sample.domain.order.Order;
|
||||
import org.springframework.batch.sample.domain.order.internal.OrderTransformer;
|
||||
|
||||
/**
|
||||
|
||||
@@ -3,7 +3,6 @@ package org.springframework.batch.sample.domain.order;
|
||||
import org.springframework.batch.item.file.mapping.DefaultFieldSet;
|
||||
import org.springframework.batch.item.file.mapping.FieldSet;
|
||||
import org.springframework.batch.item.file.mapping.FieldSetMapper;
|
||||
import org.springframework.batch.sample.domain.order.ShippingInfo;
|
||||
import org.springframework.batch.sample.domain.order.internal.ShippingFieldSetMapper;
|
||||
import org.springframework.batch.sample.support.AbstractFieldSetMapperTests;
|
||||
|
||||
|
||||
@@ -11,7 +11,6 @@ import java.util.Date;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.springframework.batch.sample.domain.order.internal.valang.FutureDateFunction;
|
||||
import org.springmodules.validation.valang.functions.Function;
|
||||
|
||||
public class FutureDateFunctionTests {
|
||||
|
||||
@@ -13,7 +13,6 @@ import java.util.List;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.springframework.batch.sample.domain.order.LineItem;
|
||||
import org.springframework.batch.sample.domain.order.internal.valang.TotalOrderItemsFunction;
|
||||
import org.springmodules.validation.valang.functions.Function;
|
||||
|
||||
public class TotalOrderItemsFunctionTests {
|
||||
|
||||
@@ -13,7 +13,6 @@ import java.util.List;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.springframework.batch.sample.domain.order.LineItem;
|
||||
import org.springframework.batch.sample.domain.order.internal.valang.ValidateDiscountsFunction;
|
||||
import org.springmodules.validation.valang.functions.Function;
|
||||
|
||||
public class ValidateDiscountsFunctionTests {
|
||||
|
||||
@@ -13,7 +13,6 @@ import java.util.List;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.springframework.batch.sample.domain.order.LineItem;
|
||||
import org.springframework.batch.sample.domain.order.internal.valang.ValidateHandlingPricesFunction;
|
||||
import org.springmodules.validation.valang.functions.Function;
|
||||
|
||||
public class ValidateHandlingPricesFunctionTests {
|
||||
|
||||
@@ -12,7 +12,6 @@ import java.util.List;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.springframework.batch.sample.domain.order.LineItem;
|
||||
import org.springframework.batch.sample.domain.order.internal.valang.ValidateIdsFunction;
|
||||
import org.springmodules.validation.valang.functions.Function;
|
||||
|
||||
public class ValidateIdsFunctionTests {
|
||||
|
||||
@@ -13,7 +13,6 @@ import java.util.List;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.springframework.batch.sample.domain.order.LineItem;
|
||||
import org.springframework.batch.sample.domain.order.internal.valang.ValidatePricesFunction;
|
||||
import org.springmodules.validation.valang.functions.Function;
|
||||
|
||||
public class ValidatePricesFunctionTests {
|
||||
|
||||
@@ -12,7 +12,6 @@ import java.util.List;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.springframework.batch.sample.domain.order.LineItem;
|
||||
import org.springframework.batch.sample.domain.order.internal.valang.ValidateQuantitiesFunction;
|
||||
import org.springmodules.validation.valang.functions.Function;
|
||||
|
||||
public class ValidateQuantitiesFunctionTests {
|
||||
|
||||
@@ -13,7 +13,6 @@ import java.util.List;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.springframework.batch.sample.domain.order.LineItem;
|
||||
import org.springframework.batch.sample.domain.order.internal.valang.ValidateShippingPricesFunction;
|
||||
import org.springmodules.validation.valang.functions.Function;
|
||||
|
||||
public class ValidateShippingPricesFunctionTests {
|
||||
|
||||
@@ -14,7 +14,6 @@ import java.util.List;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.springframework.batch.sample.domain.order.LineItem;
|
||||
import org.springframework.batch.sample.domain.order.internal.valang.ValidateTotalPricesFunction;
|
||||
import org.springmodules.validation.valang.functions.Function;
|
||||
|
||||
public class ValidateTotalPricesFunctionTests {
|
||||
|
||||
@@ -7,7 +7,6 @@ import java.math.BigDecimal;
|
||||
import org.junit.Test;
|
||||
import org.springframework.batch.sample.domain.trade.CustomerCredit;
|
||||
import org.springframework.batch.sample.domain.trade.CustomerCreditDao;
|
||||
import org.springframework.batch.sample.domain.trade.internal.CustomerCreditIncreaseWriter;
|
||||
|
||||
/**
|
||||
* Tests for {@link CustomerCreditIncreaseWriter}.
|
||||
@@ -18,7 +17,7 @@ public class CustomerCreditIncreaseProcessorTests {
|
||||
|
||||
private CustomerCreditIncreaseWriter writer = new CustomerCreditIncreaseWriter();
|
||||
|
||||
/**
|
||||
/*
|
||||
* Increases customer's credit by fixed value
|
||||
*/
|
||||
@Test
|
||||
|
||||
@@ -23,7 +23,6 @@ import org.easymock.EasyMock;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.springframework.batch.sample.domain.trade.CustomerCredit;
|
||||
import org.springframework.batch.sample.domain.trade.internal.CustomerCreditUpdatePreparedStatementSetter;
|
||||
|
||||
/**
|
||||
* @author Dave Syer
|
||||
@@ -46,9 +45,8 @@ public class CustomerCreditUpdatePreparedStatementSetterTests {
|
||||
credit.setName("foo");
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* Test method for {@link org.springframework.batch.sample.domain.trade.internal.CustomerCreditUpdatePreparedStatementSetter#setValues(CustomerCredit, PreparedStatement) }
|
||||
* @throws SQLException
|
||||
*/
|
||||
@Test
|
||||
public void testSetValues() throws SQLException {
|
||||
|
||||
@@ -8,7 +8,6 @@ import org.junit.Test;
|
||||
import org.springframework.batch.sample.domain.trade.CustomerDebit;
|
||||
import org.springframework.batch.sample.domain.trade.CustomerDebitDao;
|
||||
import org.springframework.batch.sample.domain.trade.Trade;
|
||||
import org.springframework.batch.sample.domain.trade.internal.CustomerUpdateWriter;
|
||||
|
||||
public class CustomerUpdateProcessorTests {
|
||||
|
||||
|
||||
@@ -3,7 +3,6 @@ package org.springframework.batch.sample.domain.trade.internal;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.springframework.batch.sample.domain.trade.internal.GeneratingTradeItemReader;
|
||||
|
||||
/**
|
||||
* Tests for {@link GeneratingTradeItemReader}.
|
||||
@@ -14,7 +13,7 @@ public class GeneratingItemReaderTests {
|
||||
|
||||
private GeneratingTradeItemReader reader = new GeneratingTradeItemReader();
|
||||
|
||||
/**
|
||||
/*
|
||||
* Generates a given number of not-null records,
|
||||
* consecutive calls return null.
|
||||
*/
|
||||
|
||||
@@ -26,7 +26,6 @@ import javax.sql.DataSource;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.batch.sample.domain.trade.CustomerDebit;
|
||||
import org.springframework.batch.sample.domain.trade.internal.JdbcCustomerDebitDao;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.jdbc.core.RowCallbackHandler;
|
||||
import org.springframework.jdbc.core.simple.SimpleJdbcTemplate;
|
||||
|
||||
@@ -38,8 +38,7 @@ public class TradeFieldSetMapperTests extends AbstractFieldSetMapperTests {
|
||||
}
|
||||
|
||||
protected FieldSetMapper<Trade> fieldSetMapper() {
|
||||
FieldSetMapper<Trade> mapper = new TradeFieldSetMapper();
|
||||
return mapper;
|
||||
return new TradeFieldSetMapper();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -24,8 +24,6 @@ import java.util.List;
|
||||
import javax.management.Notification;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.springframework.batch.sample.jmx.JobExecutionNotificationPublisher;
|
||||
import org.springframework.batch.sample.jmx.SimpleMessageApplicationEvent;
|
||||
import org.springframework.jmx.export.notification.NotificationPublisher;
|
||||
import org.springframework.jmx.export.notification.UnableToSendNotificationException;
|
||||
|
||||
|
||||
@@ -46,8 +46,6 @@ public class RemoteLauncherTests {
|
||||
|
||||
private static List<Exception> errors = new ArrayList<Exception>();
|
||||
|
||||
private static Thread thread;
|
||||
|
||||
private static ExportedJobLauncher launcher;
|
||||
|
||||
private static JobLoader loader;
|
||||
@@ -89,7 +87,7 @@ public class RemoteLauncherTests {
|
||||
return;
|
||||
}
|
||||
System.setProperty("com.sun.management.jmxremote", "");
|
||||
thread = new Thread(new Runnable() {
|
||||
Thread thread = new Thread(new Runnable() {
|
||||
public void run() {
|
||||
try {
|
||||
JobRegistryBackgroundJobRunner.main("adhoc-job-launcher-context.xml", "jobs/adhocLoopJob.xml");
|
||||
@@ -106,14 +104,10 @@ public class RemoteLauncherTests {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws Exception
|
||||
*
|
||||
*/
|
||||
private static boolean isConnected() throws Exception {
|
||||
boolean connected = false;
|
||||
if (!JobRegistryBackgroundJobRunner.getErrors().isEmpty()) {
|
||||
throw (RuntimeException) JobRegistryBackgroundJobRunner.getErrors().get(0);
|
||||
throw JobRegistryBackgroundJobRunner.getErrors().get(0);
|
||||
}
|
||||
if (launcher == null) {
|
||||
MBeanServerConnectionFactoryBean connectionFactory = new MBeanServerConnectionFactoryBean();
|
||||
@@ -138,12 +132,6 @@ public class RemoteLauncherTests {
|
||||
return connected;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param connectionFactory
|
||||
* @param objectName
|
||||
* @param interfaceType
|
||||
* @throws MalformedObjectNameException
|
||||
*/
|
||||
private static Object getMBean(MBeanServerConnectionFactoryBean connectionFactory, String objectName, Class<?> interfaceType)
|
||||
throws MalformedObjectNameException {
|
||||
MBeanProxyFactoryBean factory = new MBeanProxyFactoryBean();
|
||||
|
||||
@@ -56,7 +56,7 @@ public class JobSupport implements BeanNameAware, Job {
|
||||
* Convenience constructor to immediately add name (which is mandatory but
|
||||
* not final).
|
||||
*
|
||||
* @param name
|
||||
* @param name the name
|
||||
*/
|
||||
public JobSupport(String name) {
|
||||
super();
|
||||
@@ -83,6 +83,7 @@ public class JobSupport implements BeanNameAware, Job {
|
||||
* is a Spring bean.
|
||||
*
|
||||
* @see #setBeanName(java.lang.String)
|
||||
* @param name the name
|
||||
*/
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
@@ -104,6 +105,10 @@ public class JobSupport implements BeanNameAware, Job {
|
||||
this.steps.add(step);
|
||||
}
|
||||
|
||||
public List<Step> getSteps() {
|
||||
return steps;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.springframework.batch.core.domain.IJob#getStartLimit()
|
||||
*/
|
||||
|
||||
@@ -4,7 +4,6 @@ import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.fail;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.springframework.batch.sample.support.RetrySampleItemWriter;
|
||||
|
||||
/**
|
||||
* Tests for {@link RetrySampleItemWriter}.
|
||||
@@ -15,7 +14,7 @@ public class RetrySampleItemWriterTests {
|
||||
|
||||
private RetrySampleItemWriter<Object> processor = new RetrySampleItemWriter<Object>();
|
||||
|
||||
/**
|
||||
/*
|
||||
* Processing throws exception on 2nd and 3rd call.
|
||||
*/
|
||||
@Test
|
||||
|
||||
@@ -43,9 +43,6 @@ public class StepSupport implements Step, BeanNameAware {
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string
|
||||
*/
|
||||
public StepSupport(String string) {
|
||||
super();
|
||||
this.name = string;
|
||||
@@ -68,11 +65,6 @@ public class StepSupport implements Step, BeanNameAware {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the name property. Always overrides the default value if this object is a Spring bean.
|
||||
*
|
||||
* @see #setBeanName(java.lang.String)
|
||||
*/
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user