Adhoc: Integer in entity objects replaced by int
This commit is contained in:
@@ -112,8 +112,8 @@ public class StepExecution extends Entity {
|
||||
*
|
||||
* @return the current number of commits
|
||||
*/
|
||||
public Integer getCommitCount() {
|
||||
return new Integer(commitCount);
|
||||
public int getCommitCount() {
|
||||
return commitCount;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -148,8 +148,8 @@ public class StepExecution extends Entity {
|
||||
*
|
||||
* @return the current number of items processed for this execution
|
||||
*/
|
||||
public Integer getItemCount() {
|
||||
return new Integer(itemCount);
|
||||
public int getItemCount() {
|
||||
return itemCount;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -166,8 +166,8 @@ public class StepExecution extends Entity {
|
||||
*
|
||||
* @return the current number of rollbacks for this execution
|
||||
*/
|
||||
public Integer getRollbackCount() {
|
||||
return new Integer(rollbackCount);
|
||||
public int getRollbackCount() {
|
||||
return rollbackCount;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -360,12 +360,12 @@ public class StepExecution extends Entity {
|
||||
return jobExecution.getJobInstance().getJobParameters();
|
||||
}
|
||||
|
||||
public Integer getReadSkipCount() {
|
||||
return new Integer(readSkipCount);
|
||||
public int getReadSkipCount() {
|
||||
return readSkipCount;
|
||||
}
|
||||
|
||||
public Integer getWriteSkipCount() {
|
||||
return new Integer(writeSkipCount);
|
||||
public int getWriteSkipCount() {
|
||||
return writeSkipCount;
|
||||
}
|
||||
|
||||
public void setReadSkipCount(int readSkipCount) {
|
||||
|
||||
@@ -29,7 +29,7 @@ import org.springframework.batch.repeat.ExitStatus;
|
||||
public class NoWorkFoundStepExecutionListener extends StepExecutionListenerSupport {
|
||||
|
||||
public ExitStatus afterStep(StepExecution stepExecution) {
|
||||
if (stepExecution.getItemCount().intValue() == 0) {
|
||||
if (stepExecution.getItemCount() == 0) {
|
||||
throw new NoWorkFoundException("Step has not processed any items");
|
||||
}
|
||||
return stepExecution.getExitStatus();
|
||||
|
||||
@@ -107,7 +107,7 @@ public class StepExecutionTests extends TestCase {
|
||||
*/
|
||||
public void testGetCommitCount() {
|
||||
execution.setCommitCount(123);
|
||||
assertEquals(123, execution.getCommitCount().intValue());
|
||||
assertEquals(123, execution.getCommitCount());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -116,7 +116,7 @@ public class StepExecutionTests extends TestCase {
|
||||
*/
|
||||
public void testGetTaskCount() {
|
||||
execution.setItemCount(123);
|
||||
assertEquals(123, execution.getItemCount().intValue());
|
||||
assertEquals(123, execution.getItemCount());
|
||||
}
|
||||
|
||||
public void testGetJobExecution() throws Exception {
|
||||
@@ -127,7 +127,7 @@ public class StepExecutionTests extends TestCase {
|
||||
StepContribution contribution = execution.createStepContribution();
|
||||
contribution.incrementCommitCount();
|
||||
execution.apply(contribution);
|
||||
assertEquals(new Integer(1), execution.getCommitCount());
|
||||
assertEquals(1, execution.getCommitCount());
|
||||
}
|
||||
|
||||
public void testTerminateOnly() throws Exception {
|
||||
|
||||
@@ -82,11 +82,11 @@ public class SkipLimitStepFactoryBeanTests extends TestCase {
|
||||
step.execute(stepExecution);
|
||||
|
||||
assertEquals(2, stepExecution.getSkipCount());
|
||||
assertEquals(1, stepExecution.getReadSkipCount().intValue());
|
||||
assertEquals(1, stepExecution.getWriteSkipCount().intValue());
|
||||
assertEquals(1, stepExecution.getReadSkipCount());
|
||||
assertEquals(1, stepExecution.getWriteSkipCount());
|
||||
|
||||
// only write exception caused rollback
|
||||
assertEquals(1, stepExecution.getRollbackCount().intValue());
|
||||
assertEquals(1, stepExecution.getRollbackCount());
|
||||
|
||||
// writer did not skip "2" as it never made it to writer, only "4" did
|
||||
assertTrue(reader.processed.contains("4"));
|
||||
@@ -95,7 +95,7 @@ public class SkipLimitStepFactoryBeanTests extends TestCase {
|
||||
List<String> expectedOutput = Arrays.asList(StringUtils.commaDelimitedListToStringArray("1,3,5"));
|
||||
assertEquals(expectedOutput, writer.written);
|
||||
|
||||
assertEquals(4, stepExecution.getItemCount().intValue());
|
||||
assertEquals(4, stepExecution.getItemCount());
|
||||
|
||||
}
|
||||
|
||||
@@ -115,13 +115,13 @@ public class SkipLimitStepFactoryBeanTests extends TestCase {
|
||||
step.execute(stepExecution);
|
||||
|
||||
assertEquals(2, stepExecution.getSkipCount());
|
||||
assertEquals(1, stepExecution.getReadSkipCount().intValue());
|
||||
assertEquals(1, stepExecution.getWriteSkipCount().intValue());
|
||||
assertEquals(1, stepExecution.getReadSkipCount());
|
||||
assertEquals(1, stepExecution.getWriteSkipCount());
|
||||
|
||||
// no rollbacks
|
||||
assertEquals(0, stepExecution.getRollbackCount().intValue());
|
||||
assertEquals(0, stepExecution.getRollbackCount());
|
||||
|
||||
assertEquals(4, stepExecution.getItemCount().intValue());
|
||||
assertEquals(4, stepExecution.getItemCount());
|
||||
|
||||
}
|
||||
|
||||
@@ -204,8 +204,8 @@ public class SkipLimitStepFactoryBeanTests extends TestCase {
|
||||
}
|
||||
|
||||
assertEquals(3, stepExecution.getSkipCount());
|
||||
assertEquals(2, stepExecution.getReadSkipCount().intValue());
|
||||
assertEquals(1, stepExecution.getWriteSkipCount().intValue());
|
||||
assertEquals(2, stepExecution.getReadSkipCount());
|
||||
assertEquals(1, stepExecution.getWriteSkipCount());
|
||||
|
||||
// writer did not skip "2" as it never made it to writer, only "4" did
|
||||
assertFalse(reader.processed.contains("2"));
|
||||
@@ -253,8 +253,8 @@ public class SkipLimitStepFactoryBeanTests extends TestCase {
|
||||
}
|
||||
|
||||
assertEquals(1, stepExecution.getSkipCount());
|
||||
assertEquals(1, stepExecution.getReadSkipCount().intValue());
|
||||
assertEquals(0, stepExecution.getWriteSkipCount().intValue());
|
||||
assertEquals(1, stepExecution.getReadSkipCount());
|
||||
assertEquals(0, stepExecution.getWriteSkipCount());
|
||||
|
||||
}
|
||||
|
||||
@@ -290,8 +290,8 @@ public class SkipLimitStepFactoryBeanTests extends TestCase {
|
||||
}
|
||||
|
||||
assertEquals(1, stepExecution.getSkipCount());
|
||||
assertEquals(0, stepExecution.getReadSkipCount().intValue());
|
||||
assertEquals(1, stepExecution.getWriteSkipCount().intValue());
|
||||
assertEquals(0, stepExecution.getReadSkipCount());
|
||||
assertEquals(1, stepExecution.getWriteSkipCount());
|
||||
|
||||
}
|
||||
|
||||
@@ -313,8 +313,8 @@ public class SkipLimitStepFactoryBeanTests extends TestCase {
|
||||
|
||||
step.execute(stepExecution);
|
||||
assertEquals(4, stepExecution.getSkipCount());
|
||||
assertEquals(3, stepExecution.getReadSkipCount().intValue());
|
||||
assertEquals(1, stepExecution.getWriteSkipCount().intValue());
|
||||
assertEquals(3, stepExecution.getReadSkipCount());
|
||||
assertEquals(1, stepExecution.getWriteSkipCount());
|
||||
|
||||
// skipped 2,3,4,5
|
||||
List<String> expectedOutput = Arrays.asList(StringUtils.commaDelimitedListToStringArray("1,6"));
|
||||
@@ -345,8 +345,8 @@ public class SkipLimitStepFactoryBeanTests extends TestCase {
|
||||
System.err.println(writer.written);
|
||||
System.err.println(reader.processed);
|
||||
assertEquals(4, stepExecution.getSkipCount());
|
||||
assertEquals(2, stepExecution.getReadSkipCount().intValue());
|
||||
assertEquals(2, stepExecution.getWriteSkipCount().intValue());
|
||||
assertEquals(2, stepExecution.getReadSkipCount());
|
||||
assertEquals(2, stepExecution.getWriteSkipCount());
|
||||
|
||||
// skipped 2,3,4,5
|
||||
List<String> expectedOutput = Arrays.asList(StringUtils.commaDelimitedListToStringArray("1,6,7"));
|
||||
|
||||
@@ -146,7 +146,7 @@ public class StatefulRetryStepFactoryBeanTests extends TestCase {
|
||||
|
||||
// b is processed twice, plus a, plus c, plus the null at end
|
||||
assertEquals(5, count);
|
||||
assertEquals(3, stepExecution.getItemCount().intValue());
|
||||
assertEquals(3, stepExecution.getItemCount());
|
||||
}
|
||||
|
||||
public void testSkipAndRetry() throws Exception {
|
||||
@@ -174,7 +174,7 @@ public class StatefulRetryStepFactoryBeanTests extends TestCase {
|
||||
assertEquals(2, stepExecution.getSkipCount());
|
||||
// b is processed once and skipped, plus 1, plus c, plus the null at end
|
||||
assertEquals(7, count);
|
||||
assertEquals(4, stepExecution.getItemCount().intValue());
|
||||
assertEquals(4, stepExecution.getItemCount());
|
||||
}
|
||||
|
||||
public void testSkipAndRetryWithWriteFailure() throws Exception {
|
||||
@@ -217,7 +217,7 @@ public class StatefulRetryStepFactoryBeanTests extends TestCase {
|
||||
|
||||
assertEquals(2, recovered.size());
|
||||
assertEquals(2, stepExecution.getSkipCount());
|
||||
assertEquals(2, stepExecution.getWriteSkipCount().intValue());
|
||||
assertEquals(2, stepExecution.getWriteSkipCount());
|
||||
// each item once, plus 5 failed retries each for b and d, plus the null
|
||||
// terminator
|
||||
assertEquals(17, count);
|
||||
@@ -258,7 +258,7 @@ public class StatefulRetryStepFactoryBeanTests extends TestCase {
|
||||
assertEquals(0, stepExecution.getSkipCount());
|
||||
// b is processed 4 times plus the null at end
|
||||
assertEquals(5, count);
|
||||
assertEquals(0, stepExecution.getItemCount().intValue());
|
||||
assertEquals(0, stepExecution.getItemCount());
|
||||
}
|
||||
|
||||
public void testRetryPolicy() throws Exception {
|
||||
@@ -295,7 +295,7 @@ public class StatefulRetryStepFactoryBeanTests extends TestCase {
|
||||
assertEquals(0, stepExecution.getSkipCount());
|
||||
// b is processed 4 times plus the null at end
|
||||
assertEquals(5, count);
|
||||
assertEquals(0, stepExecution.getItemCount().intValue());
|
||||
assertEquals(0, stepExecution.getItemCount());
|
||||
}
|
||||
|
||||
public void testCacheLimitWithRetry() throws Exception {
|
||||
|
||||
@@ -132,7 +132,7 @@ public class StepHandlerStepTests extends TestCase {
|
||||
|
||||
step.execute(stepExecution);
|
||||
assertEquals(1, processed.size());
|
||||
assertEquals(1, stepExecution.getItemCount().intValue());
|
||||
assertEquals(1, stepExecution.getItemCount());
|
||||
}
|
||||
|
||||
public void testStepExecutionUpdates() throws Exception {
|
||||
@@ -148,7 +148,7 @@ public class StepHandlerStepTests extends TestCase {
|
||||
step.execute(stepExecution);
|
||||
|
||||
assertEquals(3, processed.size());
|
||||
assertEquals(3, stepExecution.getItemCount().intValue());
|
||||
assertEquals(3, stepExecution.getItemCount());
|
||||
assertTrue(3 <= jobRepository.updateCount);
|
||||
}
|
||||
|
||||
@@ -166,7 +166,7 @@ public class StepHandlerStepTests extends TestCase {
|
||||
StepContribution contribution = stepExecution.createStepContribution();
|
||||
step.processChunk(stepExecution, contribution);
|
||||
assertEquals(1, processed.size());
|
||||
assertEquals(0, stepExecution.getItemCount().intValue());
|
||||
assertEquals(0, stepExecution.getItemCount());
|
||||
assertEquals(1, contribution.getItemCount());
|
||||
|
||||
}
|
||||
@@ -202,7 +202,7 @@ public class StepHandlerStepTests extends TestCase {
|
||||
step.execute(stepExecution);
|
||||
}
|
||||
catch (Exception ex) {
|
||||
assertEquals(stepExecution.getRollbackCount(), new Integer(1));
|
||||
assertEquals(1, stepExecution.getRollbackCount());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -765,7 +765,7 @@ public class StepHandlerStepTests extends TestCase {
|
||||
|
||||
step.execute(stepExecution);
|
||||
assertEquals(3, processed.size());
|
||||
assertEquals(3, stepExecution.getItemCount().intValue());
|
||||
assertEquals(3, stepExecution.getItemCount());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -805,7 +805,7 @@ public class StepHandlerStepTests extends TestCase {
|
||||
public void update(StepExecution stepExecution) {
|
||||
updateCount++;
|
||||
if (updateCount <= 3) {
|
||||
assertEquals(Integer.valueOf(updateCount), stepExecution.getItemCount());
|
||||
assertEquals(updateCount, stepExecution.getItemCount());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -127,7 +127,7 @@ public class ChunkMessageItemWriterIntegrationTests {
|
||||
waitForResults(6, 10);
|
||||
|
||||
assertEquals(6, TestItemWriter.count);
|
||||
assertEquals(6, stepExecution.getItemCount().intValue());
|
||||
assertEquals(6, stepExecution.getItemCount());
|
||||
|
||||
}
|
||||
|
||||
@@ -154,7 +154,7 @@ public class ChunkMessageItemWriterIntegrationTests {
|
||||
waitForResults(8, 10);
|
||||
|
||||
assertEquals(8, TestItemWriter.count);
|
||||
assertEquals(6, stepExecution.getItemCount().intValue());
|
||||
assertEquals(6, stepExecution.getItemCount());
|
||||
|
||||
}
|
||||
|
||||
@@ -186,7 +186,7 @@ public class ChunkMessageItemWriterIntegrationTests {
|
||||
waitForResults(1, 10);
|
||||
|
||||
assertEquals(1, TestItemWriter.count);
|
||||
assertEquals(0, stepExecution.getItemCount().intValue());
|
||||
assertEquals(0, stepExecution.getItemCount());
|
||||
|
||||
}
|
||||
|
||||
@@ -261,7 +261,7 @@ public class ChunkMessageItemWriterIntegrationTests {
|
||||
}
|
||||
|
||||
assertEquals(0, TestItemWriter.count);
|
||||
assertEquals(0, stepExecution.getItemCount().intValue());
|
||||
assertEquals(0, stepExecution.getItemCount());
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user