IN PROGRESS - BATCH-672: removed redundant casts and boxing/unboxing, converted to for each loops, general cleanup

This commit is contained in:
trisberg
2008-08-01 00:50:13 +00:00
parent f9ca0e17c7
commit ccb2467cce
51 changed files with 53 additions and 135 deletions

View File

@@ -22,7 +22,7 @@ public class TaskletJobFunctionalTests extends AbstractValidatingBatchLauncherTe
@Autowired
private Resource directory;
/**
/*
* Create the directory and some files in it.
*/
@Before

View File

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

View File

@@ -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}.

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -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.
*/

View File

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

View File

@@ -38,8 +38,7 @@ public class TradeFieldSetMapperTests extends AbstractFieldSetMapperTests {
}
protected FieldSetMapper<Trade> fieldSetMapper() {
FieldSetMapper<Trade> mapper = new TradeFieldSetMapper();
return mapper;
return new TradeFieldSetMapper();
}
}

View File

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

View File

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

View File

@@ -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()
*/

View File

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

View File

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