[BATCH-432] Moved the domain objects up to the root core directory

This commit is contained in:
nebhale
2008-03-07 09:55:04 +00:00
parent dc40160583
commit fff1f0fb9e
130 changed files with 455 additions and 388 deletions

View File

@@ -13,13 +13,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.batch.core.domain;
package org.springframework.batch.core;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import org.springframework.batch.core.BatchStatus;
import junit.framework.TestCase;
/**
@@ -30,7 +32,7 @@ public class BatchStatusTests extends TestCase {
/**
* Test method for
* {@link org.springframework.batch.core.domain.BatchStatus#toString()}.
* {@link org.springframework.batch.core.BatchStatus#toString()}.
*/
public void testToString() {
assertEquals("FAILED", BatchStatus.FAILED.toString());
@@ -38,7 +40,7 @@ public class BatchStatusTests extends TestCase {
/**
* Test method for
* {@link org.springframework.batch.core.domain.BatchStatus#getStatus(java.lang.String)}.
* {@link org.springframework.batch.core.BatchStatus#getStatus(java.lang.String)}.
*/
public void testGetStatus() {
assertEquals(BatchStatus.FAILED, BatchStatus.getStatus(BatchStatus.FAILED.toString()));
@@ -46,7 +48,7 @@ public class BatchStatusTests extends TestCase {
/**
* Test method for
* {@link org.springframework.batch.core.domain.BatchStatus#getStatus(java.lang.String)}.
* {@link org.springframework.batch.core.BatchStatus#getStatus(java.lang.String)}.
*/
public void testGetStatusWrongCode() {
try {
@@ -60,7 +62,7 @@ public class BatchStatusTests extends TestCase {
/**
* Test method for
* {@link org.springframework.batch.core.domain.BatchStatus#getStatus(java.lang.String)}.
* {@link org.springframework.batch.core.BatchStatus#getStatus(java.lang.String)}.
*/
public void testGetStatusNullCode() {
assertNull(BatchStatus.getStatus(null));

View File

@@ -13,7 +13,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.batch.core.domain;
package org.springframework.batch.core;
import org.springframework.batch.core.Entity;
import junit.framework.TestCase;
@@ -26,14 +28,14 @@ public class EntityTests extends TestCase {
Entity entity = new Entity(new Long(11));
/**
* Test method for {@link org.springframework.batch.core.domain.Entity#hashCode()}.
* Test method for {@link org.springframework.batch.core.Entity#hashCode()}.
*/
public void testHashCode() {
assertEquals(entity.hashCode(), new Entity(entity.getId()).hashCode());
}
/**
* Test method for {@link org.springframework.batch.core.domain.Entity#hashCode()}.
* Test method for {@link org.springframework.batch.core.Entity#hashCode()}.
*/
public void testHashCodeNullId() {
int withoutNull = entity.hashCode();
@@ -43,14 +45,14 @@ public class EntityTests extends TestCase {
}
/**
* Test method for {@link org.springframework.batch.core.domain.Entity#getVersion()}.
* Test method for {@link org.springframework.batch.core.Entity#getVersion()}.
*/
public void testGetVersion() {
assertEquals(null, entity.getVersion());
}
/**
* Test method for {@link org.springframework.batch.core.domain.Entity#getVersion()}.
* Test method for {@link org.springframework.batch.core.Entity#getVersion()}.
*/
public void testIncrementVersion() {
entity.incrementVersion();
@@ -58,7 +60,7 @@ public class EntityTests extends TestCase {
}
/**
* Test method for {@link org.springframework.batch.core.domain.Entity#getVersion()}.
* Test method for {@link org.springframework.batch.core.Entity#getVersion()}.
*/
public void testIncrementVersionTwice() {
entity.incrementVersion();
@@ -75,14 +77,14 @@ public class EntityTests extends TestCase {
}
/**
* Test method for {@link org.springframework.batch.core.domain.Entity#equals(java.lang.Object)}.
* Test method for {@link org.springframework.batch.core.Entity#equals(java.lang.Object)}.
*/
public void testEqualsSelf() {
assertEquals(entity, entity);
}
/**
* Test method for {@link org.springframework.batch.core.domain.Entity#equals(java.lang.Object)}.
* Test method for {@link org.springframework.batch.core.Entity#equals(java.lang.Object)}.
*/
public void testEqualsSelfWithNullId() {
entity = new Entity(null);
@@ -90,7 +92,7 @@ public class EntityTests extends TestCase {
}
/**
* Test method for {@link org.springframework.batch.core.domain.Entity#equals(java.lang.Object)}.
* Test method for {@link org.springframework.batch.core.Entity#equals(java.lang.Object)}.
*/
public void testEqualsEntityWithNullId() {
entity = new Entity(null);
@@ -98,28 +100,28 @@ public class EntityTests extends TestCase {
}
/**
* Test method for {@link org.springframework.batch.core.domain.Entity#equals(java.lang.Object)}.
* Test method for {@link org.springframework.batch.core.Entity#equals(java.lang.Object)}.
*/
public void testEqualsEntity() {
assertEquals(entity, new Entity(entity.getId()));
}
/**
* Test method for {@link org.springframework.batch.core.domain.Entity#equals(java.lang.Object)}.
* Test method for {@link org.springframework.batch.core.Entity#equals(java.lang.Object)}.
*/
public void testEqualsEntityWrongId() {
assertFalse(entity.equals(new Entity()));
}
/**
* Test method for {@link org.springframework.batch.core.domain.Entity#equals(java.lang.Object)}.
* Test method for {@link org.springframework.batch.core.Entity#equals(java.lang.Object)}.
*/
public void testEqualsObject() {
assertFalse(entity.equals(new Object()));
}
/**
* Test method for {@link org.springframework.batch.core.domain.Entity#equals(java.lang.Object)}.
* Test method for {@link org.springframework.batch.core.Entity#equals(java.lang.Object)}.
*/
public void testEqualsNull() {
assertFalse(entity.equals(null));

View File

@@ -0,0 +1,40 @@
/*
* 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.core;
import org.springframework.batch.core.JobExecutionException;
/**
* @author Dave Syer
*
*/
public class JobExecutionExceptionTests extends AbstractExceptionTests {
/* (non-Javadoc)
* @see org.springframework.batch.io.exception.AbstractExceptionTests#getException(java.lang.String)
*/
public Exception getException(String msg) throws Exception {
return new JobExecutionException(msg);
}
/* (non-Javadoc)
* @see org.springframework.batch.io.exception.AbstractExceptionTests#getException(java.lang.String, java.lang.Throwable)
*/
public Exception getException(String msg, Throwable t) throws Exception {
return new JobExecutionException(msg, t);
}
}

View File

@@ -13,12 +13,17 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.batch.core.domain;
package org.springframework.batch.core;
import java.util.Date;
import junit.framework.TestCase;
import org.springframework.batch.core.BatchStatus;
import org.springframework.batch.core.JobExecution;
import org.springframework.batch.core.JobInstance;
import org.springframework.batch.core.JobParameters;
import org.springframework.batch.core.StepExecution;
import org.springframework.batch.repeat.ExitStatus;
/**
@@ -31,7 +36,7 @@ public class JobExecutionTests extends TestCase {
/**
* Test method for
* {@link org.springframework.batch.core.domain.JobExecution#JobExecution()}.
* {@link org.springframework.batch.core.JobExecution#JobExecution()}.
*/
public void testJobExecution() {
assertNull(new JobExecution().getId());
@@ -39,7 +44,7 @@ public class JobExecutionTests extends TestCase {
/**
* Test method for
* {@link org.springframework.batch.core.domain.JobExecution#getEndTime()}.
* {@link org.springframework.batch.core.JobExecution#getEndTime()}.
*/
public void testGetEndTime() {
assertNull(execution.getEndTime());
@@ -49,7 +54,7 @@ public class JobExecutionTests extends TestCase {
/**
* Test method for
* {@link org.springframework.batch.core.domain.JobExecution#getEndTime()}.
* {@link org.springframework.batch.core.JobExecution#getEndTime()}.
*/
public void testIsRunning() {
assertTrue(execution.isRunning());
@@ -59,7 +64,7 @@ public class JobExecutionTests extends TestCase {
/**
* Test method for
* {@link org.springframework.batch.core.domain.JobExecution#getEndTime()}.
* {@link org.springframework.batch.core.JobExecution#getEndTime()}.
*/
public void testIsRunningWithStoppedExecution() {
assertTrue(execution.isRunning());
@@ -70,7 +75,7 @@ public class JobExecutionTests extends TestCase {
/**
* Test method for
* {@link org.springframework.batch.core.domain.JobExecution#getStartTime()}.
* {@link org.springframework.batch.core.JobExecution#getStartTime()}.
*/
public void testGetStartTime() {
assertNull(execution.getStartTime());
@@ -80,7 +85,7 @@ public class JobExecutionTests extends TestCase {
/**
* Test method for
* {@link org.springframework.batch.core.domain.JobExecution#getStatus()}.
* {@link org.springframework.batch.core.JobExecution#getStatus()}.
*/
public void testGetStatus() {
assertEquals(BatchStatus.STARTING, execution.getStatus());
@@ -90,7 +95,7 @@ public class JobExecutionTests extends TestCase {
/**
* Test method for
* {@link org.springframework.batch.core.domain.JobExecution#getJobId()}.
* {@link org.springframework.batch.core.JobExecution#getJobId()}.
*/
public void testGetJobId() {
assertEquals(11, execution.getJobId().longValue());
@@ -100,7 +105,7 @@ public class JobExecutionTests extends TestCase {
/**
* Test method for
* {@link org.springframework.batch.core.domain.JobExecution#getJobId()}.
* {@link org.springframework.batch.core.JobExecution#getJobId()}.
*/
public void testGetJobIdForNullJob() {
execution = new JobExecution(null);
@@ -109,7 +114,7 @@ public class JobExecutionTests extends TestCase {
/**
* Test method for
* {@link org.springframework.batch.core.domain.JobExecution#getJobId()}.
* {@link org.springframework.batch.core.JobExecution#getJobId()}.
*/
public void testGetJob() {
assertNotNull(execution.getJobInstance());
@@ -117,7 +122,7 @@ public class JobExecutionTests extends TestCase {
/**
* Test method for
* {@link org.springframework.batch.core.domain.JobExecution#getExitStatus()}.
* {@link org.springframework.batch.core.JobExecution#getExitStatus()}.
*/
public void testGetExitCode() {
assertEquals(ExitStatus.UNKNOWN, execution.getExitStatus());

View File

@@ -13,7 +13,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.batch.core.domain;
package org.springframework.batch.core;
import org.springframework.batch.core.JobInstance;
import org.springframework.batch.core.JobParameters;
import junit.framework.TestCase;
@@ -26,7 +29,7 @@ public class JobInstanceTests extends TestCase {
private JobInstance instance = new JobInstance(new Long(11), new JobParameters(), new JobSupport("job"));
/**
* Test method for {@link org.springframework.batch.core.domain.JobInstance#getIdentifier()}.
* Test method for {@link org.springframework.batch.core.JobInstance#getIdentifier()}.
*/
public void testGetName() {
instance = new JobInstance(new Long(1), new JobParameters(), new JobSupport("foo"));

View File

@@ -13,10 +13,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.batch.core.domain;
package org.springframework.batch.core;
import org.springframework.batch.core.AbstractExceptionTests;
import org.springframework.batch.core.domain.JobInterruptedException;
import org.springframework.batch.core.JobInterruptedException;
/**
* @author Dave Syer

View File

@@ -1,11 +1,14 @@
/**
*
*/
package org.springframework.batch.core.domain;
package org.springframework.batch.core;
import java.util.Date;
import java.util.Iterator;
import org.springframework.batch.core.JobParameters;
import org.springframework.batch.core.JobParametersBuilder;
import junit.framework.TestCase;
/**

View File

@@ -1,7 +1,7 @@
/**
*
*/
package org.springframework.batch.core.domain;
package org.springframework.batch.core;
import java.util.Date;
import java.util.HashMap;
@@ -9,6 +9,8 @@ import java.util.Iterator;
import java.util.Map;
import java.util.Map.Entry;
import org.springframework.batch.core.JobParameters;
import junit.framework.TestCase;
/**

View File

@@ -14,14 +14,14 @@
* limitations under the License.
*/
package org.springframework.batch.core.domain;
package org.springframework.batch.core;
import java.util.ArrayList;
import java.util.List;
import org.springframework.batch.core.domain.Job;
import org.springframework.batch.core.domain.JobExecution;
import org.springframework.batch.core.domain.Step;
import org.springframework.batch.core.Job;
import org.springframework.batch.core.JobExecution;
import org.springframework.batch.core.Step;
import org.springframework.batch.io.exception.InfrastructureException;
import org.springframework.beans.factory.BeanNameAware;
import org.springframework.util.ClassUtils;

View File

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

View File

@@ -13,10 +13,12 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.batch.core.domain;
package org.springframework.batch.core;
import junit.framework.TestCase;
import org.springframework.batch.core.StepContribution;
import org.springframework.batch.core.StepExecution;
import org.springframework.batch.item.ExecutionContext;
/**
@@ -31,7 +33,7 @@ public class StepContributionTests extends TestCase {
/**
* Test method for
* {@link org.springframework.batch.core.domain.StepContribution#incrementTaskCount()}.
* {@link org.springframework.batch.core.StepContribution#incrementTaskCount()}.
*/
public void testIncrementTaskCount() {
assertEquals(0, contribution.getTaskCount());
@@ -41,7 +43,7 @@ public class StepContributionTests extends TestCase {
/**
* Test method for
* {@link org.springframework.batch.core.domain.StepContribution#setExecutionContext(ExecutionContext)}.
* {@link org.springframework.batch.core.StepContribution#setExecutionContext(ExecutionContext)}.
*/
public void testSetExecutionContext() {
assertEquals(null, contribution.getExecutionContext());
@@ -53,7 +55,7 @@ public class StepContributionTests extends TestCase {
/**
* Test method for
* {@link org.springframework.batch.core.domain.StepContribution#incrementCommitCount()}.
* {@link org.springframework.batch.core.StepContribution#incrementCommitCount()}.
*/
public void testIncrementCommitCount() {
assertEquals(0, contribution.getCommitCount());
@@ -63,7 +65,7 @@ public class StepContributionTests extends TestCase {
/**
* Test method for
* {@link org.springframework.batch.core.domain.StepContribution#isTerminateOnly()}.
* {@link org.springframework.batch.core.StepContribution#isTerminateOnly()}.
*/
public void testIsTerminateOnly() {
assertFalse(contribution.isTerminateOnly());

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.batch.core.domain;
package org.springframework.batch.core;
import java.util.Date;
import java.util.HashSet;
@@ -21,6 +21,14 @@ import java.util.Set;
import junit.framework.TestCase;
import org.springframework.batch.core.BatchStatus;
import org.springframework.batch.core.Entity;
import org.springframework.batch.core.JobExecution;
import org.springframework.batch.core.JobInstance;
import org.springframework.batch.core.JobParameters;
import org.springframework.batch.core.Step;
import org.springframework.batch.core.StepContribution;
import org.springframework.batch.core.StepExecution;
import org.springframework.batch.item.ExecutionContext;
import org.springframework.batch.repeat.ExitStatus;
import org.springframework.batch.support.PropertiesConverter;
@@ -37,7 +45,7 @@ public class StepExecutionTests extends TestCase {
private StepExecution blankExecution = new StepExecution(new StepSupport("blank"), new JobExecution());
/**
* Test method for
* {@link org.springframework.batch.core.domain.JobExecution#JobExecution()}.
* {@link org.springframework.batch.core.JobExecution#JobExecution()}.
*/
public void testStepExecution() {
assertNull(new StepExecution().getId());
@@ -45,7 +53,7 @@ public class StepExecutionTests extends TestCase {
/**
* Test method for
* {@link org.springframework.batch.core.domain.JobExecution#JobExecution()}.
* {@link org.springframework.batch.core.JobExecution#JobExecution()}.
*/
public void testStepExecutionWithNullId() {
assertNull(new StepExecution(new StepSupport("stepName"), new JobExecution()).getId());
@@ -53,7 +61,7 @@ public class StepExecutionTests extends TestCase {
/**
* Test method for
* {@link org.springframework.batch.core.domain.JobExecution#getEndTime()}.
* {@link org.springframework.batch.core.JobExecution#getEndTime()}.
*/
public void testGetEndTime() {
assertNull(execution.getEndTime());
@@ -63,7 +71,7 @@ public class StepExecutionTests extends TestCase {
/**
* Test method for
* {@link org.springframework.batch.core.domain.JobExecution#getStartTime()}.
* {@link org.springframework.batch.core.JobExecution#getStartTime()}.
*/
public void testGetStartTime() {
assertNotNull(execution.getStartTime());
@@ -73,7 +81,7 @@ public class StepExecutionTests extends TestCase {
/**
* Test method for
* {@link org.springframework.batch.core.domain.JobExecution#getStatus()}.
* {@link org.springframework.batch.core.JobExecution#getStatus()}.
*/
public void testGetStatus() {
assertEquals(BatchStatus.STARTING, execution.getStatus());
@@ -83,7 +91,7 @@ public class StepExecutionTests extends TestCase {
/**
* Test method for
* {@link org.springframework.batch.core.domain.JobExecution#getJobId()}.
* {@link org.springframework.batch.core.JobExecution#getJobId()}.
*/
public void testGetJobId() {
assertEquals(23, execution.getJobExecutionId().longValue());
@@ -91,7 +99,7 @@ public class StepExecutionTests extends TestCase {
/**
* Test method for
* {@link org.springframework.batch.core.domain.JobExecution#getExitStatus()}.
* {@link org.springframework.batch.core.JobExecution#getExitStatus()}.
*/
public void testGetExitCode() {
assertEquals(ExitStatus.UNKNOWN, execution.getExitStatus());
@@ -101,7 +109,7 @@ public class StepExecutionTests extends TestCase {
/**
* Test method for
* {@link org.springframework.batch.core.domain.StepExecution#incrementCommitCount()}.
* {@link org.springframework.batch.core.StepExecution#incrementCommitCount()}.
*/
public void testIncrementCommitCount() {
int before = execution.getCommitCount().intValue();
@@ -112,7 +120,7 @@ public class StepExecutionTests extends TestCase {
/**
* Test method for
* {@link org.springframework.batch.core.domain.StepExecution#incrementTaskCount()}.
* {@link org.springframework.batch.core.StepExecution#incrementTaskCount()}.
*/
public void testIncrementLuwCount() {
int before = execution.getTaskCount().intValue();
@@ -123,7 +131,7 @@ public class StepExecutionTests extends TestCase {
/**
* Test method for
* {@link org.springframework.batch.core.domain.StepExecution#rollback()}.
* {@link org.springframework.batch.core.StepExecution#rollback()}.
*/
public void testIncrementRollbackCount() {
int before = execution.getRollbackCount().intValue();
@@ -134,7 +142,7 @@ public class StepExecutionTests extends TestCase {
/**
* Test method for
* {@link org.springframework.batch.core.domain.StepExecution#getCommitCount()}.
* {@link org.springframework.batch.core.StepExecution#getCommitCount()}.
*/
public void testGetCommitCount() {
execution.setCommitCount(123);
@@ -143,7 +151,7 @@ public class StepExecutionTests extends TestCase {
/**
* Test method for
* {@link org.springframework.batch.core.domain.StepExecution#getTaskCount()}.
* {@link org.springframework.batch.core.StepExecution#getTaskCount()}.
*/
public void testGetTaskCount() {
execution.setTaskCount(123);
@@ -152,7 +160,7 @@ public class StepExecutionTests extends TestCase {
/**
* Test method for
* {@link org.springframework.batch.core.domain.StepExecution#getRollbackCount()}.
* {@link org.springframework.batch.core.StepExecution#getRollbackCount()}.
*/
public void testGetRollbackCount() {
execution.setRollbackCount(123);

View File

@@ -13,11 +13,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.batch.core.domain;
package org.springframework.batch.core;
import org.springframework.batch.core.domain.JobInterruptedException;
import org.springframework.batch.core.domain.Step;
import org.springframework.batch.core.domain.StepExecution;
import org.springframework.batch.core.JobInterruptedException;
import org.springframework.batch.core.Step;
import org.springframework.batch.core.StepExecution;
import org.springframework.batch.io.exception.InfrastructureException;
import org.springframework.beans.factory.BeanNameAware;
@@ -108,7 +108,7 @@ public class StepSupport implements Step, BeanNameAware {
*
* @throws UnsupportedOperationException always
*
* @see org.springframework.batch.core.domain.Step#execute(org.springframework.batch.core.domain.StepExecution)
* @see org.springframework.batch.core.Step#execute(org.springframework.batch.core.StepExecution)
*/
public void execute(StepExecution stepExecution) throws JobInterruptedException, InfrastructureException {
throw new UnsupportedOperationException(