IN PROGRESS - BATCH-672: removed redundant casts and boxing/unboxing, converted to for each loops, general cleanup
This commit is contained in:
@@ -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