[BATCH-430] Removed the batch.io.exception package and moved classes to their approved locations

This commit is contained in:
nebhale
2008-03-07 14:18:49 +00:00
parent b2396b3ef4
commit 609ce9d347
94 changed files with 216 additions and 566 deletions

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.batch.io.exception;
package org.springframework.batch.common;
import junit.framework.TestCase;

View File

@@ -1,34 +0,0 @@
/*
* Copyright 2006-2007 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.batch.io.exception;
public class ConfigurationExceptionTests extends AbstractExceptionTests {
public Exception getException(String msg) throws Exception {
return new ConfigurationException(msg);
}
public Exception getException(Throwable t) throws Exception {
return new ConfigurationException(t);
}
public Exception getException(String msg, Throwable t) throws Exception {
return new ConfigurationException(msg, t);
}
}

View File

@@ -1,34 +0,0 @@
/*
* Copyright 2006-2007 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.batch.io.exception;
public class InfrastructureExceptionTests extends AbstractExceptionTests {
public Exception getException(String msg) throws Exception {
return new InfrastructureException(msg);
}
public Exception getException(Throwable t) throws Exception {
return new InfrastructureException(t);
}
public Exception getException(String msg, Throwable t) throws Exception {
return new InfrastructureException(msg, t);
}
}

View File

@@ -1,37 +0,0 @@
/*
* Copyright 2006-2007 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.batch.io.exception;
public class TransactionInvalidExceptionTests extends AbstractExceptionTests {
public Exception getException(String msg) throws Exception {
return new WriteFailureException(msg);
}
public Exception getException(Throwable t) throws Exception {
return new WriteFailureException(t);
}
public Exception getException(String msg, Throwable t) throws Exception {
return new WriteFailureException(msg, t);
}
public void testNothing() throws Exception {
// fool coverage tools...
}
}

View File

@@ -1,37 +0,0 @@
/*
* Copyright 2006-2007 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.batch.io.exception;
public class TransactionValidExceptionTests extends AbstractExceptionTests {
public Exception getException(String msg) throws Exception {
return new ReadFailureException(msg);
}
public Exception getException(Throwable t) throws Exception {
return new ReadFailureException(t);
}
public Exception getException(String msg, Throwable t) throws Exception {
return new ReadFailureException(msg, t);
}
public void testNothing() throws Exception {
// fool coverage tools...
}
}

View File

@@ -16,7 +16,7 @@
package org.springframework.batch.item;
import org.springframework.batch.io.exception.AbstractExceptionTests;
import org.springframework.batch.common.AbstractExceptionTests;
public class ItemStreamExceptionTests extends AbstractExceptionTests {

View File

@@ -16,7 +16,7 @@
package org.springframework.batch.item;
import org.springframework.batch.io.exception.AbstractExceptionTests;
import org.springframework.batch.common.AbstractExceptionTests;
public class MarkFailedExceptionTests extends AbstractExceptionTests {

View File

@@ -16,7 +16,7 @@
package org.springframework.batch.item;
import org.springframework.batch.io.exception.AbstractExceptionTests;
import org.springframework.batch.common.AbstractExceptionTests;
public class ResetFailedExceptionTests extends AbstractExceptionTests {

View File

@@ -3,8 +3,7 @@ package org.springframework.batch.item.adapter;
import java.util.ArrayList;
import java.util.List;
import org.springframework.batch.io.sample.domain.FooService;
import org.springframework.batch.item.adapter.ItemReaderAdapter;
import org.springframework.batch.item.sample.FooService;
import org.springframework.test.AbstractDependencyInjectionSpringContextTests;
/**
@@ -23,8 +22,7 @@ public class ItemReaderAdapterTests extends AbstractDependencyInjectionSpringCon
}
/**
* Regular usage scenario - items are retrieved from the service injected
* invoker points to.
* Regular usage scenario - items are retrieved from the service injected invoker points to.
*/
public void testNext() throws Exception {
List returnedItems = new ArrayList();

View File

@@ -2,10 +2,9 @@ package org.springframework.batch.item.adapter;
import java.util.List;
import org.springframework.batch.io.sample.domain.Foo;
import org.springframework.batch.io.sample.domain.FooService;
import org.springframework.batch.item.ItemWriter;
import org.springframework.batch.item.adapter.ItemWriterAdapter;
import org.springframework.batch.item.sample.Foo;
import org.springframework.batch.item.sample.FooService;
import org.springframework.test.AbstractDependencyInjectionSpringContextTests;
/**
@@ -16,41 +15,39 @@ import org.springframework.test.AbstractDependencyInjectionSpringContextTests;
public class ItemWriterAdapterTests extends AbstractDependencyInjectionSpringContextTests {
private ItemWriter processor;
private FooService fooService;
protected String getConfigPath() {
return "delegating-item-writer.xml";
}
/**
* Regular usage scenario - input object should be passed to
* the service the injected invoker points to.
* Regular usage scenario - input object should be passed to the service the injected invoker points to.
*/
public void testProcess() throws Exception {
Foo foo;
while ((foo = fooService.generateFoo()) != null) {
processor.write(foo);
}
List input = fooService.getGeneratedFoos();
List processed = fooService.getProcessedFoos();
assertEquals(input.size(), processed.size());
assertFalse(fooService.getProcessedFoos().isEmpty());
for (int i = 0; i < input.size(); i++) {
assertSame(input.get(i), processed.get(i));
}
}
//setter for auto-injection
// setter for auto-injection
public void setProcessor(ItemWriter processor) {
this.processor = processor;
}
//setter for auto-injection
// setter for auto-injection
public void setFooService(FooService fooService) {
this.fooService = fooService;
}

View File

@@ -2,9 +2,8 @@ package org.springframework.batch.item.adapter;
import java.util.List;
import org.springframework.batch.io.sample.domain.Foo;
import org.springframework.batch.io.sample.domain.FooService;
import org.springframework.batch.item.adapter.PropertyExtractingDelegatingItemWriter;
import org.springframework.batch.item.sample.Foo;
import org.springframework.batch.item.sample.FooService;
import org.springframework.test.AbstractDependencyInjectionSpringContextTests;
/**
@@ -12,32 +11,31 @@ import org.springframework.test.AbstractDependencyInjectionSpringContextTests;
*
* @author Robert Kasanicky
*/
public class PropertyExtractingDelegatingItemProccessorIntegrationTests
extends AbstractDependencyInjectionSpringContextTests {
public class PropertyExtractingDelegatingItemProccessorIntegrationTests extends
AbstractDependencyInjectionSpringContextTests {
private PropertyExtractingDelegatingItemWriter processor;
private FooService fooService;
protected String getConfigPath() {
return "pe-delegating-item-writer.xml";
}
/**
* Regular usage scenario - input object should be passed to
* the service the injected invoker points to.
* Regular usage scenario - input object should be passed to the service the injected invoker points to.
*/
public void testProcess() throws Exception {
Foo foo;
while ((foo = fooService.generateFoo()) != null) {
processor.write(foo);
}
List input = fooService.getGeneratedFoos();
List processed = fooService.getProcessedFooNameValuePairs();
assertEquals(input.size(), processed.size());
assertFalse(fooService.getProcessedFooNameValuePairs().isEmpty());
for (int i = 0; i < input.size(); i++) {
Foo inputFoo = (Foo) input.get(i);
Foo outputFoo = (Foo) processed.get(i);
@@ -45,7 +43,7 @@ public class PropertyExtractingDelegatingItemProccessorIntegrationTests
assertEquals(inputFoo.getValue(), outputFoo.getValue());
assertEquals(0, outputFoo.getId());
}
}
public void setProcessor(PropertyExtractingDelegatingItemWriter processor) {

View File

@@ -1,10 +1,10 @@
package org.springframework.batch.item.database;
import org.springframework.batch.io.sample.domain.Foo;
import org.springframework.batch.item.ExecutionContext;
import org.springframework.batch.item.ItemReader;
import org.springframework.batch.item.ItemStream;
import org.springframework.batch.item.Skippable;
import org.springframework.batch.item.sample.Foo;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.test.AbstractTransactionalDataSourceSpringContextTests;
import org.springframework.util.Assert;

View File

@@ -1,9 +1,9 @@
package org.springframework.batch.item.database;
import org.springframework.batch.io.sample.domain.Foo;
import org.springframework.batch.item.ExecutionContext;
import org.springframework.batch.item.ItemReader;
import org.springframework.batch.item.ItemStream;
import org.springframework.batch.item.sample.Foo;
import org.springframework.beans.factory.DisposableBean;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.test.AbstractTransactionalDataSourceSpringContextTests;

View File

@@ -27,8 +27,6 @@ import java.util.Map;
import junit.framework.TestCase;
import org.easymock.MockControl;
import org.springframework.batch.item.database.BatchSqlUpdateItemWriter;
import org.springframework.batch.item.database.ItemPreparedStatementSetter;
import org.springframework.batch.repeat.RepeatContext;
import org.springframework.batch.repeat.context.RepeatContextSupport;
import org.springframework.batch.repeat.synch.RepeatSynchronizationManager;

View File

@@ -19,7 +19,7 @@ import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Map;
import org.springframework.batch.io.sample.domain.Foo;
import org.springframework.batch.item.sample.Foo;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.RowMapper;
import org.springframework.jdbc.core.support.JdbcDaoSupport;

View File

@@ -6,13 +6,11 @@ import java.util.Properties;
import junit.framework.TestCase;
import org.springframework.batch.io.sample.domain.Foo;
import org.springframework.batch.item.ExecutionContext;
import org.springframework.batch.item.ItemReader;
import org.springframework.batch.item.ItemStream;
import org.springframework.batch.item.NoWorkFoundException;
import org.springframework.batch.item.database.DrivingQueryItemReader;
import org.springframework.batch.item.database.KeyGenerator;
import org.springframework.batch.item.sample.Foo;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.transaction.support.TransactionSynchronizationManager;
import org.springframework.util.Assert;

View File

@@ -15,7 +15,7 @@
*/
package org.springframework.batch.item.database;
import org.springframework.batch.io.sample.domain.Foo;
import org.springframework.batch.item.sample.Foo;
import org.springframework.jdbc.core.JdbcTemplate;
/**

View File

@@ -3,7 +3,6 @@ package org.springframework.batch.item.database;
import org.springframework.batch.item.ExecutionContext;
import org.springframework.batch.item.ItemReader;
import org.springframework.batch.item.ItemStream;
import org.springframework.batch.item.database.DrivingQueryItemReader;
import org.springframework.beans.factory.DisposableBean;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.jdbc.core.JdbcTemplate;

View File

@@ -3,7 +3,7 @@ package org.springframework.batch.item.database;
import java.sql.ResultSet;
import java.sql.SQLException;
import org.springframework.batch.io.sample.domain.Foo;
import org.springframework.batch.item.sample.Foo;
import org.springframework.jdbc.core.RowMapper;

View File

@@ -25,7 +25,6 @@ import junit.framework.TestCase;
import org.springframework.batch.item.ClearFailedException;
import org.springframework.batch.item.FlushFailedException;
import org.springframework.batch.item.ItemWriter;
import org.springframework.batch.item.database.HibernateAwareItemWriter;
import org.springframework.batch.repeat.context.RepeatContextSupport;
import org.springframework.batch.repeat.synch.RepeatSynchronizationManager;
import org.springframework.dao.DataAccessException;

View File

@@ -4,7 +4,6 @@ import org.hibernate.SessionFactory;
import org.hibernate.StatelessSession;
import org.springframework.batch.item.ExecutionContext;
import org.springframework.batch.item.ItemReader;
import org.springframework.batch.item.database.HibernateCursorItemReader;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource;
import org.springframework.orm.hibernate3.LocalSessionFactoryBean;

View File

@@ -1,7 +1,6 @@
package org.springframework.batch.item.database;
import org.hibernate.Session;
import org.springframework.batch.item.database.HibernateCursorItemReader;
/**
* Tests for {@link HibernateCursorItemReader} using standard hibernate {@link Session}.

View File

@@ -1,7 +1,6 @@
package org.springframework.batch.item.database;
import org.springframework.batch.item.ItemReader;
import org.springframework.batch.item.database.IbatisDrivingQueryItemReader;
import org.springframework.batch.item.database.support.IbatisKeyGenerator;
import org.springframework.core.io.ClassPathResource;
import org.springframework.orm.ibatis.SqlMapClientFactoryBean;

View File

@@ -1,7 +1,6 @@
package org.springframework.batch.item.database;
import org.springframework.batch.item.ItemReader;
import org.springframework.batch.item.database.JdbcCursorItemReader;
/**
* Tests for {@link JdbcCursorItemReader}

View File

@@ -16,7 +16,6 @@
package org.springframework.batch.item.database;
import org.springframework.batch.item.ItemReader;
import org.springframework.batch.item.database.DrivingQueryItemReader;
import org.springframework.batch.item.database.support.MultipleColumnJdbcKeyGenerator;
/**

View File

@@ -1,7 +1,6 @@
package org.springframework.batch.item.database;
import org.springframework.batch.item.ItemReader;
import org.springframework.batch.item.database.DrivingQueryItemReader;
import org.springframework.batch.item.database.support.SingleColumnJdbcKeyGenerator;
public class SingleColumnJdbcDrivingQueryItemReaderIntegrationTests extends AbstractJdbcItemReaderIntegrationTests {

View File

@@ -3,7 +3,7 @@ package org.springframework.batch.item.database;
import java.sql.ResultSet;
import java.sql.SQLException;
import org.springframework.batch.io.sample.domain.Foo;
import org.springframework.batch.item.sample.Foo;
import org.springframework.jdbc.core.RowMapper;
import org.springframework.jdbc.core.support.JdbcDaoSupport;

View File

@@ -12,7 +12,6 @@ import junit.framework.TestCase;
import org.easymock.MockControl;
import org.springframework.batch.item.ExecutionContext;
import org.springframework.batch.item.database.support.ColumnMapExecutionContextRowMapper;
import org.springframework.core.CollectionFactory;
import org.springframework.jdbc.core.PreparedStatementSetter;

View File

@@ -12,9 +12,6 @@ import java.util.Properties;
import java.util.Map.Entry;
import org.springframework.batch.item.ExecutionContext;
import org.springframework.batch.item.database.support.ColumnMapExecutionContextRowMapper;
import org.springframework.batch.item.database.support.ExecutionContextRowMapper;
import org.springframework.batch.item.database.support.MultipleColumnJdbcKeyGenerator;
import org.springframework.core.CollectionFactory;
import org.springframework.jdbc.core.PreparedStatementSetter;
import org.springframework.test.AbstractTransactionalDataSourceSpringContextTests;

View File

@@ -3,7 +3,6 @@ package org.springframework.batch.item.database.support;
import java.util.List;
import org.springframework.batch.item.ExecutionContext;
import org.springframework.batch.item.database.support.SingleColumnJdbcKeyGenerator;
import org.springframework.test.AbstractTransactionalDataSourceSpringContextTests;
/**

View File

@@ -21,7 +21,6 @@ import java.io.InputStream;
import junit.framework.TestCase;
import org.springframework.batch.io.exception.FlatFileParsingException;
import org.springframework.batch.item.ExecutionContext;
import org.springframework.batch.item.ItemStreamException;
import org.springframework.batch.item.ReaderNotOpenException;
@@ -120,7 +119,7 @@ public class FlatFileItemReaderBasicTests extends TestCase {
itemReader.open(executionContext);
itemReader.read();
fail("Expected ParsingException");
} catch (FlatFileParsingException e) {
} catch (FlatFileParseException e) {
assertEquals(e.getInput(), TEST_STRING);
assertEquals(e.getLineNumber(), 1);
}
@@ -137,7 +136,7 @@ public class FlatFileItemReaderBasicTests extends TestCase {
itemReader.open(executionContext);
itemReader.read();
fail("Expected ParsingException");
} catch (FlatFileParsingException e) {
} catch (FlatFileParseException e) {
assertEquals(e.getInput(), TEST_STRING);
assertEquals(e.getLineNumber(), 1);
}

View File

@@ -14,25 +14,23 @@
* limitations under the License.
*/
package org.springframework.batch.io.exception;
package org.springframework.batch.item.file;
import org.springframework.batch.common.AbstractExceptionTests;
public class FlatFileParsingExceptionTests extends AbstractExceptionTests {
public class FlatFileParseExceptionTests extends AbstractExceptionTests {
public Exception getException(String msg) throws Exception {
return new FlatFileParsingException(msg, "bar");
}
public Exception getException(Throwable t) throws Exception {
return new FlatFileParsingException(t, "bar");
return new FlatFileParseException(msg, "bar");
}
public Exception getException(String msg, Throwable t) throws Exception {
return new FlatFileParsingException(msg, t, "bar", 100);
return new FlatFileParseException(msg, t, "bar", 100);
}
public void testMessageInputLineCount() throws Exception {
FlatFileParsingException exception = new FlatFileParsingException("foo", "bar", 100);
FlatFileParseException exception = new FlatFileParseException("foo", "bar", 100);
assertEquals("foo", exception.getMessage());
assertEquals("bar", exception.getInput());
assertEquals(100, exception.getLineNumber());

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.batch.io.sample.domain;
package org.springframework.batch.item.sample;
import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;

View File

@@ -1,4 +1,4 @@
package org.springframework.batch.io.sample.domain;
package org.springframework.batch.item.sample;
import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;

View File

@@ -1,4 +1,4 @@
package org.springframework.batch.io.sample.domain;
package org.springframework.batch.item.sample;
import java.util.ArrayList;
import java.util.List;

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.batch.io.sample.domain;
package org.springframework.batch.item.sample;
import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.batch.io.sample.domain;
package org.springframework.batch.item.sample;
import java.util.Date;
import java.util.List;

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.batch.io.sample.domain;
package org.springframework.batch.item.sample;
import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;

View File

@@ -7,7 +7,6 @@ import java.io.IOException;
import junit.framework.TestCase;
import org.springframework.batch.item.support.FileUtils;
import org.springframework.dao.DataAccessResourceFailureException;
import org.springframework.util.Assert;

View File

@@ -5,8 +5,6 @@ import java.util.ArrayList;
import junit.framework.TestCase;
import org.easymock.MockControl;
import org.springframework.batch.item.transform.CompositeItemTransformer;
import org.springframework.batch.item.transform.ItemTransformer;
/**
* Tests for {@link CompositeItemTransformer}.

View File

@@ -4,8 +4,6 @@ import junit.framework.TestCase;
import org.easymock.MockControl;
import org.springframework.batch.item.ItemWriter;
import org.springframework.batch.item.transform.ItemTransformer;
import org.springframework.batch.item.transform.ItemTransformerItemWriter;
/**
* Tests for {@link ItemTransformerItemWriter}.

View File

@@ -18,7 +18,6 @@ package org.springframework.batch.item.validator;
import junit.framework.TestCase;
import org.springframework.batch.io.exception.ValidationException;
import org.springframework.validation.Errors;
import org.springframework.validation.Validator;

View File

@@ -18,11 +18,8 @@ package org.springframework.batch.item.validator;
import junit.framework.TestCase;
import org.easymock.MockControl;
import org.springframework.batch.io.exception.ValidationException;
import org.springframework.batch.item.AbstractItemReader;
import org.springframework.batch.item.ItemReader;
import org.springframework.batch.item.validator.ValidatingItemReader;
import org.springframework.batch.item.validator.Validator;
/**
* @author Lucas Ward

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.batch.io.exception;
package org.springframework.batch.item.validator;
import org.springframework.batch.repeat.exception.AbstractExceptionTests;

View File

@@ -22,7 +22,6 @@ import java.util.List;
import junit.framework.TestCase;
import org.springframework.batch.io.exception.WriteFailureException;
import org.springframework.batch.repeat.context.RepeatContextSupport;
/**
@@ -45,8 +44,7 @@ public class SimpleLimitExceptionHandlerTests extends TestCase {
}
}
public void testInitializeWithNullContextAndNullException()
throws Exception {
public void testInitializeWithNullContextAndNullException() throws Exception {
try {
handler.handleException(null, null);
} catch (NullPointerException e) {
@@ -55,8 +53,7 @@ public class SimpleLimitExceptionHandlerTests extends TestCase {
}
/**
* Other than nominated exception type should be rethrown, ignoring the
* exception limit.
* Other than nominated exception type should be rethrown, ignoring the exception limit.
*
* @throws Exception
*/
@@ -71,15 +68,13 @@ public class SimpleLimitExceptionHandlerTests extends TestCase {
handler.handleException(new RepeatContextSupport(null), throwable);
fail("Exception swallowed.");
} catch (RuntimeException expected) {
assertTrue("Exception is rethrown, ignoring the exception limit",
true);
assertTrue("Exception is rethrown, ignoring the exception limit", true);
assertSame(expected, throwable);
}
}
/**
* TransactionInvalidException should only be rethrown below the exception
* limit.
* TransactionInvalidException should only be rethrown below the exception limit.
*
* @throws Exception
*/
@@ -89,16 +84,14 @@ public class SimpleLimitExceptionHandlerTests extends TestCase {
handler.setType(RuntimeException.class);
try {
handler.handleException(new RepeatContextSupport(null),
new RuntimeException("foo"));
handler.handleException(new RepeatContextSupport(null), new RuntimeException("foo"));
} catch (RuntimeException expected) {
fail("Unexpected exception.");
}
}
/**
* TransactionInvalidException should only be rethrown below the exception
* limit.
* TransactionInvalidException should only be rethrown below the exception limit.
*
* @throws Exception
*/
@@ -122,13 +115,11 @@ public class SimpleLimitExceptionHandlerTests extends TestCase {
}
/**
* TransactionInvalidException should only be rethrown below the exception
* limit.
* TransactionInvalidException should only be rethrown below the exception limit.
*
* @throws Exception
*/
public void testLimitedExceptionThrownFromSiblingsWhenUsingParent()
throws Exception {
public void testLimitedExceptionThrownFromSiblingsWhenUsingParent() throws Exception {
Throwable throwable = new RuntimeException("foo");
final int MORE_THAN_ZERO = 1;
@@ -150,9 +141,8 @@ public class SimpleLimitExceptionHandlerTests extends TestCase {
}
/**
* TransactionInvalidExceptions are swallowed until the exception limit is
* exceeded. After the limit is exceeded exceptions are rethrown as
* BatchCriticalExceptions
* TransactionInvalidExceptions are swallowed until the exception limit is exceeded. After the limit is exceeded
* exceptions are rethrown as BatchCriticalExceptions
*/
public void testExceptionNotThrownBelowLimit() throws Exception {
@@ -162,7 +152,7 @@ public class SimpleLimitExceptionHandlerTests extends TestCase {
List throwables = new ArrayList() {
{
for (int i = 0; i < (EXCEPTION_LIMIT); i++) {
add(new WriteFailureException("below exception limit"));
add(new RuntimeException("below exception limit"));
}
}
};
@@ -184,9 +174,8 @@ public class SimpleLimitExceptionHandlerTests extends TestCase {
}
/**
* TransactionInvalidExceptions are swallowed until the exception limit is
* exceeded. After the limit is exceeded exceptions are rethrown as
* BatchCriticalExceptions
* TransactionInvalidExceptions are swallowed until the exception limit is exceeded. After the limit is exceeded
* exceptions are rethrown as BatchCriticalExceptions
*/
public void testExceptionThrownAboveLimit() throws Exception {
@@ -196,13 +185,12 @@ public class SimpleLimitExceptionHandlerTests extends TestCase {
List throwables = new ArrayList() {
{
for (int i = 0; i < (EXCEPTION_LIMIT); i++) {
add(new WriteFailureException("below exception limit"));
add(new RuntimeException("below exception limit"));
}
}
};
throwables
.add(new WriteFailureException("above exception limit"));
throwables.add(new RuntimeException("above exception limit"));
RepeatContextSupport context = new RepeatContextSupport(null);
@@ -214,7 +202,7 @@ public class SimpleLimitExceptionHandlerTests extends TestCase {
assertTrue("exceptions up to limit are swallowed", true);
}
} catch (WriteFailureException expected) {
} catch (RuntimeException expected) {
assertEquals("above exception limit", expected.getMessage());
}

View File

@@ -2,9 +2,8 @@ package org.springframework.batch.support;
import junit.framework.TestCase;
import org.springframework.batch.io.exception.DynamicMethodInvocationException;
import org.springframework.batch.io.sample.domain.Foo;
import org.springframework.batch.io.sample.domain.FooService;
import org.springframework.batch.item.sample.Foo;
import org.springframework.batch.item.sample.FooService;
import org.springframework.util.Assert;
/**

View File

@@ -21,8 +21,6 @@ import java.util.Properties;
import junit.framework.TestCase;
import org.springframework.batch.support.DefaultPropertyEditorRegistrar;
import org.springframework.batch.support.IntArrayPropertyEditor;
import org.springframework.beans.BeanWrapperImpl;
import org.springframework.beans.propertyeditors.CustomNumberEditor;
import org.springframework.beans.propertyeditors.PropertiesEditor;