Change svn:eol-style to LF
This commit is contained in:
@@ -1,41 +1,41 @@
|
||||
/*
|
||||
* 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.configuration;
|
||||
|
||||
import org.springframework.batch.core.domain.Job;
|
||||
import org.springframework.batch.core.repository.NoSuchJobException;
|
||||
|
||||
/**
|
||||
* A runtime service locator interface for retrieving job configurations by
|
||||
* <code>name</code>.
|
||||
*
|
||||
* @author Dave Syer
|
||||
*
|
||||
*/
|
||||
public interface JobLocator {
|
||||
|
||||
/**
|
||||
* Locates a {@link Job} at runtime.
|
||||
*
|
||||
* @param name the name of the {@link Job} which should be
|
||||
* unique
|
||||
* @return a {@link Job} identified by the given name
|
||||
*
|
||||
* @throws NoSuchJobException if the required configuration can
|
||||
* not be found.
|
||||
*/
|
||||
Job getJob(String name) throws NoSuchJobException;
|
||||
}
|
||||
/*
|
||||
* 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.configuration;
|
||||
|
||||
import org.springframework.batch.core.domain.Job;
|
||||
import org.springframework.batch.core.repository.NoSuchJobException;
|
||||
|
||||
/**
|
||||
* A runtime service locator interface for retrieving job configurations by
|
||||
* <code>name</code>.
|
||||
*
|
||||
* @author Dave Syer
|
||||
*
|
||||
*/
|
||||
public interface JobLocator {
|
||||
|
||||
/**
|
||||
* Locates a {@link Job} at runtime.
|
||||
*
|
||||
* @param name the name of the {@link Job} which should be
|
||||
* unique
|
||||
* @return a {@link Job} identified by the given name
|
||||
*
|
||||
* @throws NoSuchJobException if the required configuration can
|
||||
* not be found.
|
||||
*/
|
||||
Job getJob(String name) throws NoSuchJobException;
|
||||
}
|
||||
|
||||
@@ -1,47 +1,47 @@
|
||||
/*
|
||||
* 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.configuration;
|
||||
|
||||
import org.springframework.batch.core.domain.Job;
|
||||
import org.springframework.batch.core.repository.DuplicateJobException;
|
||||
|
||||
/**
|
||||
* A runtime service registry interface for registering job configurations by
|
||||
* <code>name</code>.
|
||||
*
|
||||
* @author Dave Syer
|
||||
*
|
||||
*/
|
||||
public interface JobRegistry extends JobLocator {
|
||||
|
||||
/**
|
||||
* Registers a {@link Job} at runtime.
|
||||
*
|
||||
* @param jobFactory the {@link Job} to be registered
|
||||
*
|
||||
* @throws DuplicateJobException if a factory with the same job name has
|
||||
* already been registered.
|
||||
*/
|
||||
void register(JobFactory jobFactory) throws DuplicateJobException;
|
||||
|
||||
/**
|
||||
* Unregisters a previously registered {@link Job}. If it was not
|
||||
* previously registered there is no error.
|
||||
*
|
||||
* @param jobName the {@link Job} to unregister.
|
||||
*/
|
||||
void unregister(String jobName);
|
||||
}
|
||||
/*
|
||||
* 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.configuration;
|
||||
|
||||
import org.springframework.batch.core.domain.Job;
|
||||
import org.springframework.batch.core.repository.DuplicateJobException;
|
||||
|
||||
/**
|
||||
* A runtime service registry interface for registering job configurations by
|
||||
* <code>name</code>.
|
||||
*
|
||||
* @author Dave Syer
|
||||
*
|
||||
*/
|
||||
public interface JobRegistry extends JobLocator {
|
||||
|
||||
/**
|
||||
* Registers a {@link Job} at runtime.
|
||||
*
|
||||
* @param jobFactory the {@link Job} to be registered
|
||||
*
|
||||
* @throws DuplicateJobException if a factory with the same job name has
|
||||
* already been registered.
|
||||
*/
|
||||
void register(JobFactory jobFactory) throws DuplicateJobException;
|
||||
|
||||
/**
|
||||
* Unregisters a previously registered {@link Job}. If it was not
|
||||
* previously registered there is no error.
|
||||
*
|
||||
* @param jobName the {@link Job} to unregister.
|
||||
*/
|
||||
void unregister(String jobName);
|
||||
}
|
||||
|
||||
@@ -1,35 +1,35 @@
|
||||
/*
|
||||
* 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.configuration;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* A listable extension of {@link JobRegistry}.
|
||||
*
|
||||
* @author Dave Syer
|
||||
*
|
||||
*/
|
||||
public interface ListableJobRegistry extends JobRegistry {
|
||||
|
||||
/**
|
||||
* Provides the currently registered job names. The return value is
|
||||
* unmodifiable and disconnected from the underlying registry storage.
|
||||
*
|
||||
* @return a collection of String. Empty if none are registered.
|
||||
*/
|
||||
Collection getJobNames();
|
||||
}
|
||||
/*
|
||||
* 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.configuration;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* A listable extension of {@link JobRegistry}.
|
||||
*
|
||||
* @author Dave Syer
|
||||
*
|
||||
*/
|
||||
public interface ListableJobRegistry extends JobRegistry {
|
||||
|
||||
/**
|
||||
* Provides the currently registered job names. The return value is
|
||||
* unmodifiable and disconnected from the underlying registry storage.
|
||||
*
|
||||
* @return a collection of String. Empty if none are registered.
|
||||
*/
|
||||
Collection getJobNames();
|
||||
}
|
||||
|
||||
@@ -1,31 +1,31 @@
|
||||
/*
|
||||
* 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.domain;
|
||||
|
||||
/**
|
||||
* @author Dave Syer
|
||||
*
|
||||
*/
|
||||
public class JobExecutionException extends Exception {
|
||||
|
||||
public JobExecutionException(String msg) {
|
||||
super(msg);
|
||||
}
|
||||
|
||||
public JobExecutionException(String msg, Throwable cause) {
|
||||
super(msg, cause);
|
||||
}
|
||||
}
|
||||
/*
|
||||
* 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.domain;
|
||||
|
||||
/**
|
||||
* @author Dave Syer
|
||||
*
|
||||
*/
|
||||
public class JobExecutionException extends Exception {
|
||||
|
||||
public JobExecutionException(String msg) {
|
||||
super(msg);
|
||||
}
|
||||
|
||||
public JobExecutionException(String msg, Throwable cause) {
|
||||
super(msg, cause);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,65 +1,65 @@
|
||||
/*
|
||||
* 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.domain;
|
||||
|
||||
import org.springframework.batch.io.exception.InfrastructureException;
|
||||
|
||||
/**
|
||||
* Batch domain interface representing the configuration of a step. As with the
|
||||
* (@link Job), a {@link Step} is meant to explicitly represent a the
|
||||
* configuration of a step by a developer, but also the ability to execute the
|
||||
* step.
|
||||
*
|
||||
* @author Dave Syer
|
||||
*
|
||||
*/
|
||||
public interface Step {
|
||||
|
||||
/**
|
||||
* @return the name of this step.
|
||||
*/
|
||||
String getName();
|
||||
|
||||
/**
|
||||
* @return true if a step that is already marked as complete can be started
|
||||
* again.
|
||||
*/
|
||||
boolean isAllowStartIfComplete();
|
||||
|
||||
/**
|
||||
* @return the number of times a job can be started with the same
|
||||
* identifier.
|
||||
*/
|
||||
int getStartLimit();
|
||||
|
||||
/**
|
||||
* Process the step and assign progress and status meta information to the
|
||||
* {@link StepExecution} provided. The {@link Step} is responsible for
|
||||
* setting the meta information and also saving it if required by the
|
||||
* implementation.<br/>
|
||||
*
|
||||
* It is not safe to re-use an instance of {@link Step} to process multiple
|
||||
* concurrent executions.
|
||||
*
|
||||
* @param stepExecution an entity representing the step to be executed
|
||||
*
|
||||
* @throws JobInterruptedException if the step is interrupted externally
|
||||
* @throws InfrastructureException if there is a problem that needs to be
|
||||
* signalled to the caller
|
||||
*/
|
||||
void execute(StepExecution stepExecution) throws JobInterruptedException, InfrastructureException;
|
||||
|
||||
/*
|
||||
* 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.domain;
|
||||
|
||||
import org.springframework.batch.io.exception.InfrastructureException;
|
||||
|
||||
/**
|
||||
* Batch domain interface representing the configuration of a step. As with the
|
||||
* (@link Job), a {@link Step} is meant to explicitly represent a the
|
||||
* configuration of a step by a developer, but also the ability to execute the
|
||||
* step.
|
||||
*
|
||||
* @author Dave Syer
|
||||
*
|
||||
*/
|
||||
public interface Step {
|
||||
|
||||
/**
|
||||
* @return the name of this step.
|
||||
*/
|
||||
String getName();
|
||||
|
||||
/**
|
||||
* @return true if a step that is already marked as complete can be started
|
||||
* again.
|
||||
*/
|
||||
boolean isAllowStartIfComplete();
|
||||
|
||||
/**
|
||||
* @return the number of times a job can be started with the same
|
||||
* identifier.
|
||||
*/
|
||||
int getStartLimit();
|
||||
|
||||
/**
|
||||
* Process the step and assign progress and status meta information to the
|
||||
* {@link StepExecution} provided. The {@link Step} is responsible for
|
||||
* setting the meta information and also saving it if required by the
|
||||
* implementation.<br/>
|
||||
*
|
||||
* It is not safe to re-use an instance of {@link Step} to process multiple
|
||||
* concurrent executions.
|
||||
*
|
||||
* @param stepExecution an entity representing the step to be executed
|
||||
*
|
||||
* @throws JobInterruptedException if the step is interrupted externally
|
||||
* @throws InfrastructureException if there is a problem that needs to be
|
||||
* signalled to the caller
|
||||
*/
|
||||
void execute(StepExecution stepExecution) throws JobInterruptedException, InfrastructureException;
|
||||
|
||||
}
|
||||
@@ -1,44 +1,44 @@
|
||||
/*
|
||||
* 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.repository;
|
||||
|
||||
import org.springframework.batch.core.domain.Job;
|
||||
|
||||
/**
|
||||
* Checked exception that indicates a name clash when registering
|
||||
* {@link Job} instances.
|
||||
*
|
||||
* @author Dave Syer
|
||||
*
|
||||
*/
|
||||
public class DuplicateJobException extends JobException {
|
||||
|
||||
/**
|
||||
* Create an exception with the given message.
|
||||
*/
|
||||
public DuplicateJobException(String msg) {
|
||||
super(msg);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param msg The message to send to caller
|
||||
* @param e the cause of the exception
|
||||
*/
|
||||
public DuplicateJobException(String msg, Throwable e) {
|
||||
super(msg, e);
|
||||
}
|
||||
|
||||
}
|
||||
/*
|
||||
* 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.repository;
|
||||
|
||||
import org.springframework.batch.core.domain.Job;
|
||||
|
||||
/**
|
||||
* Checked exception that indicates a name clash when registering
|
||||
* {@link Job} instances.
|
||||
*
|
||||
* @author Dave Syer
|
||||
*
|
||||
*/
|
||||
public class DuplicateJobException extends JobException {
|
||||
|
||||
/**
|
||||
* Create an exception with the given message.
|
||||
*/
|
||||
public DuplicateJobException(String msg) {
|
||||
super(msg);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param msg The message to send to caller
|
||||
* @param e the cause of the exception
|
||||
*/
|
||||
public DuplicateJobException(String msg, Throwable e) {
|
||||
super(msg, e);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,44 +1,44 @@
|
||||
/*
|
||||
* 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.repository;
|
||||
|
||||
import org.springframework.batch.core.domain.Job;
|
||||
|
||||
/**
|
||||
* Base class for checked exceptions related to {@link Job}
|
||||
* creation, registration or use.
|
||||
*
|
||||
* @author Dave Syer
|
||||
*
|
||||
*/
|
||||
public class JobException extends Exception {
|
||||
|
||||
/**
|
||||
* Create an exception with the given message.
|
||||
*/
|
||||
public JobException(String msg) {
|
||||
super(msg);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param msg The message to send to caller
|
||||
* @param e the cause of the exception
|
||||
*/
|
||||
public JobException(String msg, Throwable e) {
|
||||
super(msg, e);
|
||||
}
|
||||
|
||||
}
|
||||
/*
|
||||
* 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.repository;
|
||||
|
||||
import org.springframework.batch.core.domain.Job;
|
||||
|
||||
/**
|
||||
* Base class for checked exceptions related to {@link Job}
|
||||
* creation, registration or use.
|
||||
*
|
||||
* @author Dave Syer
|
||||
*
|
||||
*/
|
||||
public class JobException extends Exception {
|
||||
|
||||
/**
|
||||
* Create an exception with the given message.
|
||||
*/
|
||||
public JobException(String msg) {
|
||||
super(msg);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param msg The message to send to caller
|
||||
* @param e the cause of the exception
|
||||
*/
|
||||
public JobException(String msg, Throwable e) {
|
||||
super(msg, e);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,41 +1,41 @@
|
||||
/*
|
||||
* 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.repository;
|
||||
|
||||
import org.springframework.batch.core.domain.JobExecutionException;
|
||||
|
||||
/**
|
||||
* @author Dave Syer
|
||||
*
|
||||
*/
|
||||
public class JobExecutionAlreadyRunningException extends JobExecutionException {
|
||||
|
||||
/**
|
||||
* @param msg
|
||||
*/
|
||||
public JobExecutionAlreadyRunningException(String msg) {
|
||||
super(msg);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param msg
|
||||
* @param cause
|
||||
*/
|
||||
public JobExecutionAlreadyRunningException(String msg, Throwable cause) {
|
||||
super(msg, cause);
|
||||
}
|
||||
|
||||
}
|
||||
/*
|
||||
* 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.repository;
|
||||
|
||||
import org.springframework.batch.core.domain.JobExecutionException;
|
||||
|
||||
/**
|
||||
* @author Dave Syer
|
||||
*
|
||||
*/
|
||||
public class JobExecutionAlreadyRunningException extends JobExecutionException {
|
||||
|
||||
/**
|
||||
* @param msg
|
||||
*/
|
||||
public JobExecutionAlreadyRunningException(String msg) {
|
||||
super(msg);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param msg
|
||||
* @param cause
|
||||
*/
|
||||
public JobExecutionAlreadyRunningException(String msg, Throwable cause) {
|
||||
super(msg, cause);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,41 +1,41 @@
|
||||
/*
|
||||
* 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.repository;
|
||||
|
||||
/**
|
||||
* An exception indicating an illegal attempt to restart a job.
|
||||
*
|
||||
* @author Dave Syer
|
||||
*
|
||||
*/
|
||||
public class JobRestartException extends JobException {
|
||||
|
||||
/**
|
||||
* @param string the message
|
||||
*/
|
||||
public JobRestartException(String string) {
|
||||
super(string);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param msg the cause
|
||||
* @param t the message
|
||||
*/
|
||||
public JobRestartException(String msg, Throwable t) {
|
||||
super(msg, t);
|
||||
}
|
||||
|
||||
}
|
||||
/*
|
||||
* 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.repository;
|
||||
|
||||
/**
|
||||
* An exception indicating an illegal attempt to restart a job.
|
||||
*
|
||||
* @author Dave Syer
|
||||
*
|
||||
*/
|
||||
public class JobRestartException extends JobException {
|
||||
|
||||
/**
|
||||
* @param string the message
|
||||
*/
|
||||
public JobRestartException(String string) {
|
||||
super(string);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param msg the cause
|
||||
* @param t the message
|
||||
*/
|
||||
public JobRestartException(String msg, Throwable t) {
|
||||
super(msg, t);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,46 +1,46 @@
|
||||
/*
|
||||
* 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.repository;
|
||||
|
||||
import org.springframework.batch.core.domain.Job;
|
||||
|
||||
|
||||
/**
|
||||
* Checked exception to indicate that a required {@link Job} is not
|
||||
* available.
|
||||
*
|
||||
* @author Dave Syer
|
||||
*
|
||||
*/
|
||||
public class NoSuchJobException extends JobException {
|
||||
|
||||
private static final long serialVersionUID = -8044082897778706564L;
|
||||
|
||||
/**
|
||||
* Create an exception with the given message.
|
||||
*/
|
||||
public NoSuchJobException(String msg) {
|
||||
super(msg);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param msg The message to send to caller
|
||||
* @param e the cause of the exception
|
||||
*/
|
||||
public NoSuchJobException(String msg, Throwable e) {
|
||||
super(msg, e);
|
||||
}
|
||||
}
|
||||
/*
|
||||
* 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.repository;
|
||||
|
||||
import org.springframework.batch.core.domain.Job;
|
||||
|
||||
|
||||
/**
|
||||
* Checked exception to indicate that a required {@link Job} is not
|
||||
* available.
|
||||
*
|
||||
* @author Dave Syer
|
||||
*
|
||||
*/
|
||||
public class NoSuchJobException extends JobException {
|
||||
|
||||
private static final long serialVersionUID = -8044082897778706564L;
|
||||
|
||||
/**
|
||||
* Create an exception with the given message.
|
||||
*/
|
||||
public NoSuchJobException(String msg) {
|
||||
super(msg);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param msg The message to send to caller
|
||||
* @param e the cause of the exception
|
||||
*/
|
||||
public NoSuchJobException(String msg, Throwable e) {
|
||||
super(msg, e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,44 +1,44 @@
|
||||
/*
|
||||
* 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.runtime;
|
||||
|
||||
import org.springframework.batch.common.ExceptionClassifier;
|
||||
import org.springframework.batch.repeat.ExitStatus;
|
||||
|
||||
/**
|
||||
* Extension of the {@link ExceptionClassifier} that explicitly deals with
|
||||
* returns an {@link ExitStatus}. This is useful for mapping from an exception
|
||||
* type to an exit status with a customised code or detailed message.
|
||||
*
|
||||
* @author Lucas Ward
|
||||
*
|
||||
*/
|
||||
public interface ExitStatusExceptionClassifier extends ExceptionClassifier {
|
||||
|
||||
public static final String FATAL_EXCEPTION = "FATAL_EXCEPTION";
|
||||
|
||||
public static final String JOB_INTERRUPTED = "JOB_INTERRUPTED";
|
||||
|
||||
/**
|
||||
* Typesafe version of classify that explicitly returns an
|
||||
* {@link ExitStatus} object.
|
||||
*
|
||||
* @param throwable
|
||||
* @return ExitStatus representing the ExitCode and Message for the given
|
||||
* exception.
|
||||
*/
|
||||
public ExitStatus classifyForExitCode(Throwable throwable);
|
||||
}
|
||||
/*
|
||||
* 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.runtime;
|
||||
|
||||
import org.springframework.batch.common.ExceptionClassifier;
|
||||
import org.springframework.batch.repeat.ExitStatus;
|
||||
|
||||
/**
|
||||
* Extension of the {@link ExceptionClassifier} that explicitly deals with
|
||||
* returns an {@link ExitStatus}. This is useful for mapping from an exception
|
||||
* type to an exit status with a customised code or detailed message.
|
||||
*
|
||||
* @author Lucas Ward
|
||||
*
|
||||
*/
|
||||
public interface ExitStatusExceptionClassifier extends ExceptionClassifier {
|
||||
|
||||
public static final String FATAL_EXCEPTION = "FATAL_EXCEPTION";
|
||||
|
||||
public static final String JOB_INTERRUPTED = "JOB_INTERRUPTED";
|
||||
|
||||
/**
|
||||
* Typesafe version of classify that explicitly returns an
|
||||
* {@link ExitStatus} object.
|
||||
*
|
||||
* @param throwable
|
||||
* @return ExitStatus representing the ExitCode and Message for the given
|
||||
* exception.
|
||||
*/
|
||||
public ExitStatus classifyForExitCode(Throwable throwable);
|
||||
}
|
||||
|
||||
@@ -1,83 +1,83 @@
|
||||
/*
|
||||
* 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.domain;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.ObjectInputStream;
|
||||
import java.io.ObjectOutputStream;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
/**
|
||||
* @author Dave Syer
|
||||
*
|
||||
*/
|
||||
public class BatchStatusTests extends TestCase {
|
||||
|
||||
/**
|
||||
* Test method for
|
||||
* {@link org.springframework.batch.core.domain.BatchStatus#toString()}.
|
||||
*/
|
||||
public void testToString() {
|
||||
assertEquals("FAILED", BatchStatus.FAILED.toString());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for
|
||||
* {@link org.springframework.batch.core.domain.BatchStatus#getStatus(java.lang.String)}.
|
||||
*/
|
||||
public void testGetStatus() {
|
||||
assertEquals(BatchStatus.FAILED, BatchStatus.getStatus(BatchStatus.FAILED.toString()));
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for
|
||||
* {@link org.springframework.batch.core.domain.BatchStatus#getStatus(java.lang.String)}.
|
||||
*/
|
||||
public void testGetStatusWrongCode() {
|
||||
try {
|
||||
BatchStatus.getStatus("foo");
|
||||
fail();
|
||||
}
|
||||
catch (IllegalArgumentException ex) {
|
||||
// expected
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for
|
||||
* {@link org.springframework.batch.core.domain.BatchStatus#getStatus(java.lang.String)}.
|
||||
*/
|
||||
public void testGetStatusNullCode() {
|
||||
assertNull(BatchStatus.getStatus(null));
|
||||
}
|
||||
|
||||
public void testSerialization() throws Exception {
|
||||
|
||||
ByteArrayOutputStream bout = new ByteArrayOutputStream();
|
||||
ObjectOutputStream out = new ObjectOutputStream(bout);
|
||||
|
||||
out.writeObject(BatchStatus.COMPLETED);
|
||||
out.flush();
|
||||
|
||||
ByteArrayInputStream bin = new ByteArrayInputStream(bout.toByteArray());
|
||||
ObjectInputStream in = new ObjectInputStream(bin);
|
||||
|
||||
BatchStatus status = (BatchStatus) in.readObject();
|
||||
assertEquals(BatchStatus.COMPLETED, status);
|
||||
}
|
||||
}
|
||||
/*
|
||||
* 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.domain;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.ObjectInputStream;
|
||||
import java.io.ObjectOutputStream;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
/**
|
||||
* @author Dave Syer
|
||||
*
|
||||
*/
|
||||
public class BatchStatusTests extends TestCase {
|
||||
|
||||
/**
|
||||
* Test method for
|
||||
* {@link org.springframework.batch.core.domain.BatchStatus#toString()}.
|
||||
*/
|
||||
public void testToString() {
|
||||
assertEquals("FAILED", BatchStatus.FAILED.toString());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for
|
||||
* {@link org.springframework.batch.core.domain.BatchStatus#getStatus(java.lang.String)}.
|
||||
*/
|
||||
public void testGetStatus() {
|
||||
assertEquals(BatchStatus.FAILED, BatchStatus.getStatus(BatchStatus.FAILED.toString()));
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for
|
||||
* {@link org.springframework.batch.core.domain.BatchStatus#getStatus(java.lang.String)}.
|
||||
*/
|
||||
public void testGetStatusWrongCode() {
|
||||
try {
|
||||
BatchStatus.getStatus("foo");
|
||||
fail();
|
||||
}
|
||||
catch (IllegalArgumentException ex) {
|
||||
// expected
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for
|
||||
* {@link org.springframework.batch.core.domain.BatchStatus#getStatus(java.lang.String)}.
|
||||
*/
|
||||
public void testGetStatusNullCode() {
|
||||
assertNull(BatchStatus.getStatus(null));
|
||||
}
|
||||
|
||||
public void testSerialization() throws Exception {
|
||||
|
||||
ByteArrayOutputStream bout = new ByteArrayOutputStream();
|
||||
ObjectOutputStream out = new ObjectOutputStream(bout);
|
||||
|
||||
out.writeObject(BatchStatus.COMPLETED);
|
||||
out.flush();
|
||||
|
||||
ByteArrayInputStream bin = new ByteArrayInputStream(bout.toByteArray());
|
||||
ObjectInputStream in = new ObjectInputStream(bin);
|
||||
|
||||
BatchStatus status = (BatchStatus) in.readObject();
|
||||
assertEquals(BatchStatus.COMPLETED, status);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,128 +1,128 @@
|
||||
/*
|
||||
* 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.domain;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
/**
|
||||
* @author Dave Syer
|
||||
*
|
||||
*/
|
||||
public class EntityTests extends TestCase {
|
||||
|
||||
Entity entity = new Entity(new Long(11));
|
||||
|
||||
/**
|
||||
* Test method for {@link org.springframework.batch.core.domain.Entity#hashCode()}.
|
||||
*/
|
||||
public void testHashCode() {
|
||||
assertEquals(entity.hashCode(), new Entity(entity.getId()).hashCode());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for {@link org.springframework.batch.core.domain.Entity#hashCode()}.
|
||||
*/
|
||||
public void testHashCodeNullId() {
|
||||
int withoutNull = entity.hashCode();
|
||||
entity.setId(null);
|
||||
int withNull = entity.hashCode();
|
||||
assertTrue(withoutNull!=withNull);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for {@link org.springframework.batch.core.domain.Entity#getVersion()}.
|
||||
*/
|
||||
public void testGetVersion() {
|
||||
assertEquals(null, entity.getVersion());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for {@link org.springframework.batch.core.domain.Entity#getVersion()}.
|
||||
*/
|
||||
public void testIncrementVersion() {
|
||||
entity.incrementVersion();
|
||||
assertEquals(new Integer(0), entity.getVersion());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for {@link org.springframework.batch.core.domain.Entity#getVersion()}.
|
||||
*/
|
||||
public void testIncrementVersionTwice() {
|
||||
entity.incrementVersion();
|
||||
entity.incrementVersion();
|
||||
assertEquals(new Integer(1), entity.getVersion());
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws Exception
|
||||
*/
|
||||
public void testToString() throws Exception {
|
||||
Entity job = new Entity();
|
||||
assertTrue(job.toString().indexOf("id=null") >= 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for {@link org.springframework.batch.core.domain.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)}.
|
||||
*/
|
||||
public void testEqualsSelfWithNullId() {
|
||||
entity = new Entity(null);
|
||||
assertEquals(entity, entity);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for {@link org.springframework.batch.core.domain.Entity#equals(java.lang.Object)}.
|
||||
*/
|
||||
public void testEqualsEntityWithNullId() {
|
||||
entity = new Entity(null);
|
||||
assertNotSame(entity, new Entity(null));
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for {@link org.springframework.batch.core.domain.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)}.
|
||||
*/
|
||||
public void testEqualsEntityWrongId() {
|
||||
assertFalse(entity.equals(new Entity()));
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for {@link org.springframework.batch.core.domain.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)}.
|
||||
*/
|
||||
public void testEqualsNull() {
|
||||
assertFalse(entity.equals(null));
|
||||
}
|
||||
|
||||
}
|
||||
/*
|
||||
* 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.domain;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
/**
|
||||
* @author Dave Syer
|
||||
*
|
||||
*/
|
||||
public class EntityTests extends TestCase {
|
||||
|
||||
Entity entity = new Entity(new Long(11));
|
||||
|
||||
/**
|
||||
* Test method for {@link org.springframework.batch.core.domain.Entity#hashCode()}.
|
||||
*/
|
||||
public void testHashCode() {
|
||||
assertEquals(entity.hashCode(), new Entity(entity.getId()).hashCode());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for {@link org.springframework.batch.core.domain.Entity#hashCode()}.
|
||||
*/
|
||||
public void testHashCodeNullId() {
|
||||
int withoutNull = entity.hashCode();
|
||||
entity.setId(null);
|
||||
int withNull = entity.hashCode();
|
||||
assertTrue(withoutNull!=withNull);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for {@link org.springframework.batch.core.domain.Entity#getVersion()}.
|
||||
*/
|
||||
public void testGetVersion() {
|
||||
assertEquals(null, entity.getVersion());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for {@link org.springframework.batch.core.domain.Entity#getVersion()}.
|
||||
*/
|
||||
public void testIncrementVersion() {
|
||||
entity.incrementVersion();
|
||||
assertEquals(new Integer(0), entity.getVersion());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for {@link org.springframework.batch.core.domain.Entity#getVersion()}.
|
||||
*/
|
||||
public void testIncrementVersionTwice() {
|
||||
entity.incrementVersion();
|
||||
entity.incrementVersion();
|
||||
assertEquals(new Integer(1), entity.getVersion());
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws Exception
|
||||
*/
|
||||
public void testToString() throws Exception {
|
||||
Entity job = new Entity();
|
||||
assertTrue(job.toString().indexOf("id=null") >= 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for {@link org.springframework.batch.core.domain.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)}.
|
||||
*/
|
||||
public void testEqualsSelfWithNullId() {
|
||||
entity = new Entity(null);
|
||||
assertEquals(entity, entity);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for {@link org.springframework.batch.core.domain.Entity#equals(java.lang.Object)}.
|
||||
*/
|
||||
public void testEqualsEntityWithNullId() {
|
||||
entity = new Entity(null);
|
||||
assertNotSame(entity, new Entity(null));
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for {@link org.springframework.batch.core.domain.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)}.
|
||||
*/
|
||||
public void testEqualsEntityWrongId() {
|
||||
assertFalse(entity.equals(new Entity()));
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for {@link org.springframework.batch.core.domain.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)}.
|
||||
*/
|
||||
public void testEqualsNull() {
|
||||
assertFalse(entity.equals(null));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,41 +1,41 @@
|
||||
/*
|
||||
* 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.domain;
|
||||
|
||||
import org.springframework.batch.core.AbstractExceptionTests;
|
||||
import org.springframework.batch.core.domain.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);
|
||||
}
|
||||
|
||||
}
|
||||
/*
|
||||
* 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.domain;
|
||||
|
||||
import org.springframework.batch.core.AbstractExceptionTests;
|
||||
import org.springframework.batch.core.domain.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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,155 +1,155 @@
|
||||
/*
|
||||
* 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.domain;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.springframework.batch.repeat.ExitStatus;
|
||||
|
||||
/**
|
||||
* @author Dave Syer
|
||||
*
|
||||
*/
|
||||
public class JobExecutionTests extends TestCase {
|
||||
|
||||
private JobExecution execution = new JobExecution(new JobInstance(new Long(11), new JobParameters(), new JobSupport("foo")), new Long(12));
|
||||
|
||||
/**
|
||||
* Test method for
|
||||
* {@link org.springframework.batch.core.domain.JobExecution#JobExecution()}.
|
||||
*/
|
||||
public void testJobExecution() {
|
||||
assertNull(new JobExecution().getId());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for
|
||||
* {@link org.springframework.batch.core.domain.JobExecution#getEndTime()}.
|
||||
*/
|
||||
public void testGetEndTime() {
|
||||
assertNull(execution.getEndTime());
|
||||
execution.setEndTime(new Date(100L));
|
||||
assertEquals(100L, execution.getEndTime().getTime());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for
|
||||
* {@link org.springframework.batch.core.domain.JobExecution#getEndTime()}.
|
||||
*/
|
||||
public void testIsRunning() {
|
||||
assertTrue(execution.isRunning());
|
||||
execution.setEndTime(new Date(100L));
|
||||
assertFalse(execution.isRunning());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for
|
||||
* {@link org.springframework.batch.core.domain.JobExecution#getEndTime()}.
|
||||
*/
|
||||
public void testIsRunningWithStoppedExecution() {
|
||||
assertTrue(execution.isRunning());
|
||||
execution.stop();
|
||||
assertTrue(execution.isRunning());
|
||||
assertTrue(execution.isStopping());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for
|
||||
* {@link org.springframework.batch.core.domain.JobExecution#getStartTime()}.
|
||||
*/
|
||||
public void testGetStartTime() {
|
||||
assertNull(execution.getStartTime());
|
||||
execution.setStartTime(new Date(0L));
|
||||
assertEquals(0L, execution.getStartTime().getTime());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for
|
||||
* {@link org.springframework.batch.core.domain.JobExecution#getStatus()}.
|
||||
*/
|
||||
public void testGetStatus() {
|
||||
assertEquals(BatchStatus.STARTING, execution.getStatus());
|
||||
execution.setStatus(BatchStatus.COMPLETED);
|
||||
assertEquals(BatchStatus.COMPLETED, execution.getStatus());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for
|
||||
* {@link org.springframework.batch.core.domain.JobExecution#getJobId()}.
|
||||
*/
|
||||
public void testGetJobId() {
|
||||
assertEquals(11, execution.getJobId().longValue());
|
||||
execution = new JobExecution(new JobInstance(new Long(23), new JobParameters(), new JobSupport("testJob")), null);
|
||||
assertEquals(23, execution.getJobId().longValue());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for
|
||||
* {@link org.springframework.batch.core.domain.JobExecution#getJobId()}.
|
||||
*/
|
||||
public void testGetJobIdForNullJob() {
|
||||
execution = new JobExecution(null);
|
||||
assertEquals(null, execution.getJobId());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for
|
||||
* {@link org.springframework.batch.core.domain.JobExecution#getJobId()}.
|
||||
*/
|
||||
public void testGetJob() {
|
||||
assertNotNull(execution.getJobInstance());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for
|
||||
* {@link org.springframework.batch.core.domain.JobExecution#getExitStatus()}.
|
||||
*/
|
||||
public void testGetExitCode() {
|
||||
assertEquals(ExitStatus.UNKNOWN, execution.getExitStatus());
|
||||
execution.setExitStatus(new ExitStatus(true, "23"));
|
||||
assertEquals("23", execution.getExitStatus().getExitCode());
|
||||
}
|
||||
|
||||
public void testContextContainsInfo() throws Exception {
|
||||
assertEquals("foo", execution.getJobInstance().getJobName());
|
||||
}
|
||||
|
||||
public void testAddAndRemoveStepExecution() throws Exception {
|
||||
assertEquals(0, execution.getStepExecutions().size());
|
||||
execution.createStepExecution(new StepSupport("stepName"));
|
||||
assertEquals(1, execution.getStepExecutions().size());
|
||||
}
|
||||
|
||||
public void testStop() throws Exception {
|
||||
StepExecution stepExecution = execution.createStepExecution(new StepSupport("stepName"));
|
||||
assertFalse(stepExecution.isTerminateOnly());
|
||||
execution.stop();
|
||||
assertTrue(stepExecution.isTerminateOnly());
|
||||
}
|
||||
|
||||
public void testToString() throws Exception {
|
||||
assertTrue("JobExecution string does not contain id", execution.toString().indexOf("id=") >= 0);
|
||||
assertTrue("JobExecution string does not contain name: " + execution, execution.toString().indexOf("foo") >= 0);
|
||||
}
|
||||
|
||||
public void testToStringWithNullJob() throws Exception {
|
||||
execution = new JobExecution();
|
||||
assertTrue("JobExecution string does not contain id", execution.toString().indexOf("id=") >= 0);
|
||||
assertTrue("JobExecution string does not contain job: " + execution, execution.toString().indexOf("job=") >= 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.core.domain;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.springframework.batch.repeat.ExitStatus;
|
||||
|
||||
/**
|
||||
* @author Dave Syer
|
||||
*
|
||||
*/
|
||||
public class JobExecutionTests extends TestCase {
|
||||
|
||||
private JobExecution execution = new JobExecution(new JobInstance(new Long(11), new JobParameters(), new JobSupport("foo")), new Long(12));
|
||||
|
||||
/**
|
||||
* Test method for
|
||||
* {@link org.springframework.batch.core.domain.JobExecution#JobExecution()}.
|
||||
*/
|
||||
public void testJobExecution() {
|
||||
assertNull(new JobExecution().getId());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for
|
||||
* {@link org.springframework.batch.core.domain.JobExecution#getEndTime()}.
|
||||
*/
|
||||
public void testGetEndTime() {
|
||||
assertNull(execution.getEndTime());
|
||||
execution.setEndTime(new Date(100L));
|
||||
assertEquals(100L, execution.getEndTime().getTime());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for
|
||||
* {@link org.springframework.batch.core.domain.JobExecution#getEndTime()}.
|
||||
*/
|
||||
public void testIsRunning() {
|
||||
assertTrue(execution.isRunning());
|
||||
execution.setEndTime(new Date(100L));
|
||||
assertFalse(execution.isRunning());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for
|
||||
* {@link org.springframework.batch.core.domain.JobExecution#getEndTime()}.
|
||||
*/
|
||||
public void testIsRunningWithStoppedExecution() {
|
||||
assertTrue(execution.isRunning());
|
||||
execution.stop();
|
||||
assertTrue(execution.isRunning());
|
||||
assertTrue(execution.isStopping());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for
|
||||
* {@link org.springframework.batch.core.domain.JobExecution#getStartTime()}.
|
||||
*/
|
||||
public void testGetStartTime() {
|
||||
assertNull(execution.getStartTime());
|
||||
execution.setStartTime(new Date(0L));
|
||||
assertEquals(0L, execution.getStartTime().getTime());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for
|
||||
* {@link org.springframework.batch.core.domain.JobExecution#getStatus()}.
|
||||
*/
|
||||
public void testGetStatus() {
|
||||
assertEquals(BatchStatus.STARTING, execution.getStatus());
|
||||
execution.setStatus(BatchStatus.COMPLETED);
|
||||
assertEquals(BatchStatus.COMPLETED, execution.getStatus());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for
|
||||
* {@link org.springframework.batch.core.domain.JobExecution#getJobId()}.
|
||||
*/
|
||||
public void testGetJobId() {
|
||||
assertEquals(11, execution.getJobId().longValue());
|
||||
execution = new JobExecution(new JobInstance(new Long(23), new JobParameters(), new JobSupport("testJob")), null);
|
||||
assertEquals(23, execution.getJobId().longValue());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for
|
||||
* {@link org.springframework.batch.core.domain.JobExecution#getJobId()}.
|
||||
*/
|
||||
public void testGetJobIdForNullJob() {
|
||||
execution = new JobExecution(null);
|
||||
assertEquals(null, execution.getJobId());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for
|
||||
* {@link org.springframework.batch.core.domain.JobExecution#getJobId()}.
|
||||
*/
|
||||
public void testGetJob() {
|
||||
assertNotNull(execution.getJobInstance());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for
|
||||
* {@link org.springframework.batch.core.domain.JobExecution#getExitStatus()}.
|
||||
*/
|
||||
public void testGetExitCode() {
|
||||
assertEquals(ExitStatus.UNKNOWN, execution.getExitStatus());
|
||||
execution.setExitStatus(new ExitStatus(true, "23"));
|
||||
assertEquals("23", execution.getExitStatus().getExitCode());
|
||||
}
|
||||
|
||||
public void testContextContainsInfo() throws Exception {
|
||||
assertEquals("foo", execution.getJobInstance().getJobName());
|
||||
}
|
||||
|
||||
public void testAddAndRemoveStepExecution() throws Exception {
|
||||
assertEquals(0, execution.getStepExecutions().size());
|
||||
execution.createStepExecution(new StepSupport("stepName"));
|
||||
assertEquals(1, execution.getStepExecutions().size());
|
||||
}
|
||||
|
||||
public void testStop() throws Exception {
|
||||
StepExecution stepExecution = execution.createStepExecution(new StepSupport("stepName"));
|
||||
assertFalse(stepExecution.isTerminateOnly());
|
||||
execution.stop();
|
||||
assertTrue(stepExecution.isTerminateOnly());
|
||||
}
|
||||
|
||||
public void testToString() throws Exception {
|
||||
assertTrue("JobExecution string does not contain id", execution.toString().indexOf("id=") >= 0);
|
||||
assertTrue("JobExecution string does not contain name: " + execution, execution.toString().indexOf("foo") >= 0);
|
||||
}
|
||||
|
||||
public void testToStringWithNullJob() throws Exception {
|
||||
execution = new JobExecution();
|
||||
assertTrue("JobExecution string does not contain id", execution.toString().indexOf("id=") >= 0);
|
||||
assertTrue("JobExecution string does not contain job: " + execution, execution.toString().indexOf("job=") >= 0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,52 +1,52 @@
|
||||
/*
|
||||
* 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.domain;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
/**
|
||||
* @author dsyer
|
||||
*
|
||||
*/
|
||||
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()}.
|
||||
*/
|
||||
public void testGetName() {
|
||||
instance = new JobInstance(new Long(1), new JobParameters(), new JobSupport("foo"));
|
||||
assertEquals("foo", instance.getJobName());
|
||||
}
|
||||
|
||||
public void testGetJob(){
|
||||
assertEquals("job", instance.getJob().getName());
|
||||
}
|
||||
|
||||
public void testCreateWithNulls(){
|
||||
try {
|
||||
new JobInstance(null, null, null);
|
||||
fail("job instance can't exist without job specified");
|
||||
}
|
||||
catch (IllegalArgumentException e) {
|
||||
// expected
|
||||
}
|
||||
instance = new JobInstance(null, null, new JobSupport("testJob"));
|
||||
assertEquals("testJob", instance.getJobName());
|
||||
assertEquals(0, instance.getJobParameters().getParameters().size());
|
||||
}
|
||||
}
|
||||
/*
|
||||
* 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.domain;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
/**
|
||||
* @author dsyer
|
||||
*
|
||||
*/
|
||||
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()}.
|
||||
*/
|
||||
public void testGetName() {
|
||||
instance = new JobInstance(new Long(1), new JobParameters(), new JobSupport("foo"));
|
||||
assertEquals("foo", instance.getJobName());
|
||||
}
|
||||
|
||||
public void testGetJob(){
|
||||
assertEquals("job", instance.getJob().getName());
|
||||
}
|
||||
|
||||
public void testCreateWithNulls(){
|
||||
try {
|
||||
new JobInstance(null, null, null);
|
||||
fail("job instance can't exist without job specified");
|
||||
}
|
||||
catch (IllegalArgumentException e) {
|
||||
// expected
|
||||
}
|
||||
instance = new JobInstance(null, null, new JobSupport("testJob"));
|
||||
assertEquals("testJob", instance.getJobName());
|
||||
assertEquals(0, instance.getJobParameters().getParameters().size());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,41 +1,41 @@
|
||||
/*
|
||||
* 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.domain;
|
||||
|
||||
import org.springframework.batch.core.AbstractExceptionTests;
|
||||
import org.springframework.batch.core.domain.JobInterruptedException;
|
||||
|
||||
/**
|
||||
* @author Dave Syer
|
||||
*
|
||||
*/
|
||||
public class JobInterruptedExceptionTests extends AbstractExceptionTests {
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.springframework.batch.io.exception.AbstractExceptionTests#getException(java.lang.String)
|
||||
*/
|
||||
public Exception getException(String msg) throws Exception {
|
||||
return new JobInterruptedException(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 RuntimeException(msg, t);
|
||||
}
|
||||
|
||||
}
|
||||
/*
|
||||
* 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.domain;
|
||||
|
||||
import org.springframework.batch.core.AbstractExceptionTests;
|
||||
import org.springframework.batch.core.domain.JobInterruptedException;
|
||||
|
||||
/**
|
||||
* @author Dave Syer
|
||||
*
|
||||
*/
|
||||
public class JobInterruptedExceptionTests extends AbstractExceptionTests {
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.springframework.batch.io.exception.AbstractExceptionTests#getException(java.lang.String)
|
||||
*/
|
||||
public Exception getException(String msg) throws Exception {
|
||||
return new JobInterruptedException(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 RuntimeException(msg, t);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,271 +1,271 @@
|
||||
/*
|
||||
* 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.domain;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.springframework.batch.item.ExecutionContext;
|
||||
import org.springframework.batch.repeat.ExitStatus;
|
||||
import org.springframework.batch.support.PropertiesConverter;
|
||||
|
||||
/**
|
||||
* @author Dave Syer
|
||||
*
|
||||
*/
|
||||
public class StepExecutionTests extends TestCase {
|
||||
|
||||
private StepExecution execution = newStepExecution(new StepSupport("stepName"),
|
||||
new Long(23));
|
||||
|
||||
private StepExecution blankExecution = new StepExecution(new StepSupport("blank"), new JobExecution());
|
||||
/**
|
||||
* Test method for
|
||||
* {@link org.springframework.batch.core.domain.JobExecution#JobExecution()}.
|
||||
*/
|
||||
public void testStepExecution() {
|
||||
assertNull(new StepExecution().getId());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for
|
||||
* {@link org.springframework.batch.core.domain.JobExecution#JobExecution()}.
|
||||
*/
|
||||
public void testStepExecutionWithNullId() {
|
||||
assertNull(new StepExecution(new StepSupport("stepName"), new JobExecution()).getId());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for
|
||||
* {@link org.springframework.batch.core.domain.JobExecution#getEndTime()}.
|
||||
*/
|
||||
public void testGetEndTime() {
|
||||
assertNull(execution.getEndTime());
|
||||
execution.setEndTime(new Date(0L));
|
||||
assertEquals(0L, execution.getEndTime().getTime());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for
|
||||
* {@link org.springframework.batch.core.domain.JobExecution#getStartTime()}.
|
||||
*/
|
||||
public void testGetStartTime() {
|
||||
assertNotNull(execution.getStartTime());
|
||||
execution.setStartTime(new Date(10L));
|
||||
assertEquals(10L, execution.getStartTime().getTime());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for
|
||||
* {@link org.springframework.batch.core.domain.JobExecution#getStatus()}.
|
||||
*/
|
||||
public void testGetStatus() {
|
||||
assertEquals(BatchStatus.STARTING, execution.getStatus());
|
||||
execution.setStatus(BatchStatus.COMPLETED);
|
||||
assertEquals(BatchStatus.COMPLETED, execution.getStatus());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for
|
||||
* {@link org.springframework.batch.core.domain.JobExecution#getJobId()}.
|
||||
*/
|
||||
public void testGetJobId() {
|
||||
assertEquals(23, execution.getJobExecutionId().longValue());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for
|
||||
* {@link org.springframework.batch.core.domain.JobExecution#getExitStatus()}.
|
||||
*/
|
||||
public void testGetExitCode() {
|
||||
assertEquals(ExitStatus.UNKNOWN, execution.getExitStatus());
|
||||
execution.setExitStatus(ExitStatus.FINISHED);
|
||||
assertEquals(ExitStatus.FINISHED, execution.getExitStatus());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for
|
||||
* {@link org.springframework.batch.core.domain.StepExecution#incrementCommitCount()}.
|
||||
*/
|
||||
public void testIncrementCommitCount() {
|
||||
int before = execution.getCommitCount().intValue();
|
||||
execution.incrementCommitCount();
|
||||
int after = execution.getCommitCount().intValue();
|
||||
assertEquals(before + 1, after);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for
|
||||
* {@link org.springframework.batch.core.domain.StepExecution#incrementTaskCount()}.
|
||||
*/
|
||||
public void testIncrementLuwCount() {
|
||||
int before = execution.getTaskCount().intValue();
|
||||
execution.incrementTaskCount();
|
||||
int after = execution.getTaskCount().intValue();
|
||||
assertEquals(before + 1, after);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for
|
||||
* {@link org.springframework.batch.core.domain.StepExecution#rollback()}.
|
||||
*/
|
||||
public void testIncrementRollbackCount() {
|
||||
int before = execution.getRollbackCount().intValue();
|
||||
execution.rollback();
|
||||
int after = execution.getRollbackCount().intValue();
|
||||
assertEquals(before + 1, after);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for
|
||||
* {@link org.springframework.batch.core.domain.StepExecution#getCommitCount()}.
|
||||
*/
|
||||
public void testGetCommitCount() {
|
||||
execution.setCommitCount(123);
|
||||
assertEquals(123, execution.getCommitCount().intValue());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for
|
||||
* {@link org.springframework.batch.core.domain.StepExecution#getTaskCount()}.
|
||||
*/
|
||||
public void testGetTaskCount() {
|
||||
execution.setTaskCount(123);
|
||||
assertEquals(123, execution.getTaskCount().intValue());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for
|
||||
* {@link org.springframework.batch.core.domain.StepExecution#getRollbackCount()}.
|
||||
*/
|
||||
public void testGetRollbackCount() {
|
||||
execution.setRollbackCount(123);
|
||||
assertEquals(123, execution.getRollbackCount().intValue());
|
||||
}
|
||||
|
||||
public void testGetJobExecution() throws Exception {
|
||||
assertNotNull(execution.getJobExecution());
|
||||
}
|
||||
|
||||
public void testApplyContribution() throws Exception {
|
||||
StepContribution contribution = execution.createStepContribution();
|
||||
contribution.incrementCommitCount();
|
||||
execution.apply(contribution);
|
||||
assertEquals(new Integer(1), execution.getCommitCount());
|
||||
}
|
||||
|
||||
public void testTerminateOnly() throws Exception {
|
||||
assertFalse(execution.isTerminateOnly());
|
||||
execution.setTerminateOnly();
|
||||
assertTrue(execution.isTerminateOnly());
|
||||
}
|
||||
|
||||
public void testToStringWithNullName() throws Exception {
|
||||
String value = new StepExecution(new StepSupport(null), new JobExecution()).toString();
|
||||
assertTrue("Should contain name=null: "+value, value.indexOf("name=null")>=0);
|
||||
}
|
||||
|
||||
public void testToString() throws Exception {
|
||||
assertTrue("Should contain task count: " + execution.toString(),
|
||||
execution.toString().indexOf("task") >= 0);
|
||||
assertTrue("Should contain commit count: " + execution.toString(),
|
||||
execution.toString().indexOf("commit") >= 0);
|
||||
assertTrue("Should contain rollback count: " + execution.toString(),
|
||||
execution.toString().indexOf("rollback") >= 0);
|
||||
}
|
||||
|
||||
public void testExecutionContext() throws Exception {
|
||||
assertNotNull(execution.getExecutionContext());
|
||||
ExecutionContext context = new ExecutionContext();
|
||||
context.putString("foo", "bar");
|
||||
execution.setExecutionContext(context );
|
||||
assertEquals("bar", execution.getExecutionContext().getString("foo"));
|
||||
}
|
||||
|
||||
public void testEqualsWithSameIdentifier() throws Exception {
|
||||
Step step = new StepSupport("stepName");
|
||||
Entity stepExecution1 = newStepExecution(step, new Long(11));
|
||||
Entity stepExecution2 = newStepExecution(step, new Long(11));
|
||||
assertEquals(stepExecution1, stepExecution2);
|
||||
}
|
||||
|
||||
public void testEqualsWithNull() throws Exception {
|
||||
Entity stepExecution = newStepExecution(new StepSupport("stepName"), new Long(11));
|
||||
assertFalse(stepExecution.equals(null));
|
||||
}
|
||||
|
||||
public void testEqualsWithNullIdentifiers() throws Exception {
|
||||
Entity stepExecution = newStepExecution(new StepSupport("stepName"), new Long(11));
|
||||
assertFalse(stepExecution.equals(blankExecution));
|
||||
}
|
||||
|
||||
public void testEqualsWithNullJob() throws Exception {
|
||||
Entity stepExecution = newStepExecution(new StepSupport("stepName"), new Long(11));
|
||||
assertFalse(stepExecution.equals(blankExecution));
|
||||
}
|
||||
|
||||
public void testEqualsWithNullStep() throws Exception {
|
||||
Entity stepExecution = newStepExecution(new StepSupport("stepName"), null);
|
||||
assertFalse(stepExecution.equals(blankExecution));
|
||||
}
|
||||
|
||||
public void testEqualsWithSelf() throws Exception {
|
||||
assertTrue(execution.equals(execution));
|
||||
}
|
||||
|
||||
public void testEqualsWithDifferent() throws Exception {
|
||||
Entity stepExecution = newStepExecution(new StepSupport("foo"), new Long(13));
|
||||
assertFalse(execution.equals(stepExecution));
|
||||
}
|
||||
|
||||
public void testEqualsWithNullStepId() throws Exception {
|
||||
Step step = new StepSupport("name");
|
||||
execution = newStepExecution(step, new Long(31));
|
||||
assertEquals("name", execution.getStepName());
|
||||
StepExecution stepExecution = newStepExecution(step, new Long(31));
|
||||
assertEquals(stepExecution.getJobExecutionId(), execution.getJobExecutionId());
|
||||
assertTrue(execution.equals(stepExecution));
|
||||
}
|
||||
|
||||
public void testHashCode() throws Exception {
|
||||
assertTrue("Hash code same as parent", new Entity(execution.getId())
|
||||
.hashCode() != execution.hashCode());
|
||||
}
|
||||
|
||||
public void testHashCodeWithNullIds() throws Exception {
|
||||
assertTrue("Hash code not same as parent",
|
||||
new Entity(execution.getId()).hashCode() != blankExecution
|
||||
.hashCode());
|
||||
}
|
||||
|
||||
public void testHashCodeViaHashSet() throws Exception {
|
||||
Set set = new HashSet();
|
||||
set.add(execution);
|
||||
assertTrue(set.contains(execution));
|
||||
execution.setExecutionContext(new ExecutionContext(PropertiesConverter.stringToProperties("foo=bar")));
|
||||
assertTrue(set.contains(execution));
|
||||
}
|
||||
|
||||
private StepExecution newStepExecution(Step step, Long long2) {
|
||||
JobInstance job = new JobInstance(new Long(3), new JobParameters(), new JobSupport("testJob"));
|
||||
StepExecution execution = new StepExecution(step, new JobExecution(job, long2), new Long(4));
|
||||
return execution;
|
||||
}
|
||||
|
||||
}
|
||||
/*
|
||||
* 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.domain;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.springframework.batch.item.ExecutionContext;
|
||||
import org.springframework.batch.repeat.ExitStatus;
|
||||
import org.springframework.batch.support.PropertiesConverter;
|
||||
|
||||
/**
|
||||
* @author Dave Syer
|
||||
*
|
||||
*/
|
||||
public class StepExecutionTests extends TestCase {
|
||||
|
||||
private StepExecution execution = newStepExecution(new StepSupport("stepName"),
|
||||
new Long(23));
|
||||
|
||||
private StepExecution blankExecution = new StepExecution(new StepSupport("blank"), new JobExecution());
|
||||
/**
|
||||
* Test method for
|
||||
* {@link org.springframework.batch.core.domain.JobExecution#JobExecution()}.
|
||||
*/
|
||||
public void testStepExecution() {
|
||||
assertNull(new StepExecution().getId());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for
|
||||
* {@link org.springframework.batch.core.domain.JobExecution#JobExecution()}.
|
||||
*/
|
||||
public void testStepExecutionWithNullId() {
|
||||
assertNull(new StepExecution(new StepSupport("stepName"), new JobExecution()).getId());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for
|
||||
* {@link org.springframework.batch.core.domain.JobExecution#getEndTime()}.
|
||||
*/
|
||||
public void testGetEndTime() {
|
||||
assertNull(execution.getEndTime());
|
||||
execution.setEndTime(new Date(0L));
|
||||
assertEquals(0L, execution.getEndTime().getTime());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for
|
||||
* {@link org.springframework.batch.core.domain.JobExecution#getStartTime()}.
|
||||
*/
|
||||
public void testGetStartTime() {
|
||||
assertNotNull(execution.getStartTime());
|
||||
execution.setStartTime(new Date(10L));
|
||||
assertEquals(10L, execution.getStartTime().getTime());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for
|
||||
* {@link org.springframework.batch.core.domain.JobExecution#getStatus()}.
|
||||
*/
|
||||
public void testGetStatus() {
|
||||
assertEquals(BatchStatus.STARTING, execution.getStatus());
|
||||
execution.setStatus(BatchStatus.COMPLETED);
|
||||
assertEquals(BatchStatus.COMPLETED, execution.getStatus());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for
|
||||
* {@link org.springframework.batch.core.domain.JobExecution#getJobId()}.
|
||||
*/
|
||||
public void testGetJobId() {
|
||||
assertEquals(23, execution.getJobExecutionId().longValue());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for
|
||||
* {@link org.springframework.batch.core.domain.JobExecution#getExitStatus()}.
|
||||
*/
|
||||
public void testGetExitCode() {
|
||||
assertEquals(ExitStatus.UNKNOWN, execution.getExitStatus());
|
||||
execution.setExitStatus(ExitStatus.FINISHED);
|
||||
assertEquals(ExitStatus.FINISHED, execution.getExitStatus());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for
|
||||
* {@link org.springframework.batch.core.domain.StepExecution#incrementCommitCount()}.
|
||||
*/
|
||||
public void testIncrementCommitCount() {
|
||||
int before = execution.getCommitCount().intValue();
|
||||
execution.incrementCommitCount();
|
||||
int after = execution.getCommitCount().intValue();
|
||||
assertEquals(before + 1, after);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for
|
||||
* {@link org.springframework.batch.core.domain.StepExecution#incrementTaskCount()}.
|
||||
*/
|
||||
public void testIncrementLuwCount() {
|
||||
int before = execution.getTaskCount().intValue();
|
||||
execution.incrementTaskCount();
|
||||
int after = execution.getTaskCount().intValue();
|
||||
assertEquals(before + 1, after);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for
|
||||
* {@link org.springframework.batch.core.domain.StepExecution#rollback()}.
|
||||
*/
|
||||
public void testIncrementRollbackCount() {
|
||||
int before = execution.getRollbackCount().intValue();
|
||||
execution.rollback();
|
||||
int after = execution.getRollbackCount().intValue();
|
||||
assertEquals(before + 1, after);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for
|
||||
* {@link org.springframework.batch.core.domain.StepExecution#getCommitCount()}.
|
||||
*/
|
||||
public void testGetCommitCount() {
|
||||
execution.setCommitCount(123);
|
||||
assertEquals(123, execution.getCommitCount().intValue());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for
|
||||
* {@link org.springframework.batch.core.domain.StepExecution#getTaskCount()}.
|
||||
*/
|
||||
public void testGetTaskCount() {
|
||||
execution.setTaskCount(123);
|
||||
assertEquals(123, execution.getTaskCount().intValue());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for
|
||||
* {@link org.springframework.batch.core.domain.StepExecution#getRollbackCount()}.
|
||||
*/
|
||||
public void testGetRollbackCount() {
|
||||
execution.setRollbackCount(123);
|
||||
assertEquals(123, execution.getRollbackCount().intValue());
|
||||
}
|
||||
|
||||
public void testGetJobExecution() throws Exception {
|
||||
assertNotNull(execution.getJobExecution());
|
||||
}
|
||||
|
||||
public void testApplyContribution() throws Exception {
|
||||
StepContribution contribution = execution.createStepContribution();
|
||||
contribution.incrementCommitCount();
|
||||
execution.apply(contribution);
|
||||
assertEquals(new Integer(1), execution.getCommitCount());
|
||||
}
|
||||
|
||||
public void testTerminateOnly() throws Exception {
|
||||
assertFalse(execution.isTerminateOnly());
|
||||
execution.setTerminateOnly();
|
||||
assertTrue(execution.isTerminateOnly());
|
||||
}
|
||||
|
||||
public void testToStringWithNullName() throws Exception {
|
||||
String value = new StepExecution(new StepSupport(null), new JobExecution()).toString();
|
||||
assertTrue("Should contain name=null: "+value, value.indexOf("name=null")>=0);
|
||||
}
|
||||
|
||||
public void testToString() throws Exception {
|
||||
assertTrue("Should contain task count: " + execution.toString(),
|
||||
execution.toString().indexOf("task") >= 0);
|
||||
assertTrue("Should contain commit count: " + execution.toString(),
|
||||
execution.toString().indexOf("commit") >= 0);
|
||||
assertTrue("Should contain rollback count: " + execution.toString(),
|
||||
execution.toString().indexOf("rollback") >= 0);
|
||||
}
|
||||
|
||||
public void testExecutionContext() throws Exception {
|
||||
assertNotNull(execution.getExecutionContext());
|
||||
ExecutionContext context = new ExecutionContext();
|
||||
context.putString("foo", "bar");
|
||||
execution.setExecutionContext(context );
|
||||
assertEquals("bar", execution.getExecutionContext().getString("foo"));
|
||||
}
|
||||
|
||||
public void testEqualsWithSameIdentifier() throws Exception {
|
||||
Step step = new StepSupport("stepName");
|
||||
Entity stepExecution1 = newStepExecution(step, new Long(11));
|
||||
Entity stepExecution2 = newStepExecution(step, new Long(11));
|
||||
assertEquals(stepExecution1, stepExecution2);
|
||||
}
|
||||
|
||||
public void testEqualsWithNull() throws Exception {
|
||||
Entity stepExecution = newStepExecution(new StepSupport("stepName"), new Long(11));
|
||||
assertFalse(stepExecution.equals(null));
|
||||
}
|
||||
|
||||
public void testEqualsWithNullIdentifiers() throws Exception {
|
||||
Entity stepExecution = newStepExecution(new StepSupport("stepName"), new Long(11));
|
||||
assertFalse(stepExecution.equals(blankExecution));
|
||||
}
|
||||
|
||||
public void testEqualsWithNullJob() throws Exception {
|
||||
Entity stepExecution = newStepExecution(new StepSupport("stepName"), new Long(11));
|
||||
assertFalse(stepExecution.equals(blankExecution));
|
||||
}
|
||||
|
||||
public void testEqualsWithNullStep() throws Exception {
|
||||
Entity stepExecution = newStepExecution(new StepSupport("stepName"), null);
|
||||
assertFalse(stepExecution.equals(blankExecution));
|
||||
}
|
||||
|
||||
public void testEqualsWithSelf() throws Exception {
|
||||
assertTrue(execution.equals(execution));
|
||||
}
|
||||
|
||||
public void testEqualsWithDifferent() throws Exception {
|
||||
Entity stepExecution = newStepExecution(new StepSupport("foo"), new Long(13));
|
||||
assertFalse(execution.equals(stepExecution));
|
||||
}
|
||||
|
||||
public void testEqualsWithNullStepId() throws Exception {
|
||||
Step step = new StepSupport("name");
|
||||
execution = newStepExecution(step, new Long(31));
|
||||
assertEquals("name", execution.getStepName());
|
||||
StepExecution stepExecution = newStepExecution(step, new Long(31));
|
||||
assertEquals(stepExecution.getJobExecutionId(), execution.getJobExecutionId());
|
||||
assertTrue(execution.equals(stepExecution));
|
||||
}
|
||||
|
||||
public void testHashCode() throws Exception {
|
||||
assertTrue("Hash code same as parent", new Entity(execution.getId())
|
||||
.hashCode() != execution.hashCode());
|
||||
}
|
||||
|
||||
public void testHashCodeWithNullIds() throws Exception {
|
||||
assertTrue("Hash code not same as parent",
|
||||
new Entity(execution.getId()).hashCode() != blankExecution
|
||||
.hashCode());
|
||||
}
|
||||
|
||||
public void testHashCodeViaHashSet() throws Exception {
|
||||
Set set = new HashSet();
|
||||
set.add(execution);
|
||||
assertTrue(set.contains(execution));
|
||||
execution.setExecutionContext(new ExecutionContext(PropertiesConverter.stringToProperties("foo=bar")));
|
||||
assertTrue(set.contains(execution));
|
||||
}
|
||||
|
||||
private StepExecution newStepExecution(Step step, Long long2) {
|
||||
JobInstance job = new JobInstance(new Long(3), new JobParameters(), new JobSupport("testJob"));
|
||||
StepExecution execution = new StepExecution(step, new JobExecution(job, long2), new Long(4));
|
||||
return execution;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,117 +1,117 @@
|
||||
/*
|
||||
* 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.domain;
|
||||
|
||||
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.io.exception.InfrastructureException;
|
||||
import org.springframework.beans.factory.BeanNameAware;
|
||||
|
||||
/**
|
||||
* Basic no-op support implementation for use as base class for {@link Step}. Implements {@link BeanNameAware} so that
|
||||
* if no name is provided explicitly it will be inferred from the bean definition in Spring configuration.
|
||||
*
|
||||
* @author Dave Syer
|
||||
*
|
||||
*/
|
||||
public class StepSupport implements Step, BeanNameAware {
|
||||
|
||||
private String name;
|
||||
|
||||
private int startLimit = Integer.MAX_VALUE;
|
||||
|
||||
private boolean allowStartIfComplete;
|
||||
|
||||
/**
|
||||
* Default constructor for {@link StepSupport}.
|
||||
*/
|
||||
public StepSupport() {
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string
|
||||
*/
|
||||
public StepSupport(String string) {
|
||||
super();
|
||||
this.name = string;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the name property if it is not already set. Because of the order of the callbacks in a Spring container the
|
||||
* name property will be set first if it is present. Care is needed with bean definition inheritance - if a parent
|
||||
* bean has a name, then its children need an explicit name as well, otherwise they will not be unique.
|
||||
*
|
||||
* @see org.springframework.beans.factory.BeanNameAware#setBeanName(java.lang.String)
|
||||
*/
|
||||
public void setBeanName(String name) {
|
||||
if (this.name == null) {
|
||||
this.name = name;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 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;
|
||||
}
|
||||
|
||||
public int getStartLimit() {
|
||||
return this.startLimit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Public setter for the startLimit.
|
||||
*
|
||||
* @param startLimit the startLimit to set
|
||||
*/
|
||||
public void setStartLimit(int startLimit) {
|
||||
this.startLimit = startLimit;
|
||||
}
|
||||
|
||||
public boolean isAllowStartIfComplete() {
|
||||
return this.allowStartIfComplete;
|
||||
}
|
||||
|
||||
/**
|
||||
* Public setter for the shouldAllowStartIfComplete.
|
||||
*
|
||||
* @param allowStartIfComplete the shouldAllowStartIfComplete to set
|
||||
*/
|
||||
public void setAllowStartIfComplete(boolean allowStartIfComplete) {
|
||||
this.allowStartIfComplete = allowStartIfComplete;
|
||||
}
|
||||
|
||||
/**
|
||||
* Not supported but provided so that tests can easily create a step.
|
||||
*
|
||||
* @throws UnsupportedOperationException always
|
||||
*
|
||||
* @see org.springframework.batch.core.domain.Step#execute(org.springframework.batch.core.domain.StepExecution)
|
||||
*/
|
||||
public void execute(StepExecution stepExecution) throws JobInterruptedException, InfrastructureException {
|
||||
throw new UnsupportedOperationException(
|
||||
"Cannot process a StepExecution. Use a smarter subclass of StepSupport.");
|
||||
}
|
||||
}
|
||||
/*
|
||||
* 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.domain;
|
||||
|
||||
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.io.exception.InfrastructureException;
|
||||
import org.springframework.beans.factory.BeanNameAware;
|
||||
|
||||
/**
|
||||
* Basic no-op support implementation for use as base class for {@link Step}. Implements {@link BeanNameAware} so that
|
||||
* if no name is provided explicitly it will be inferred from the bean definition in Spring configuration.
|
||||
*
|
||||
* @author Dave Syer
|
||||
*
|
||||
*/
|
||||
public class StepSupport implements Step, BeanNameAware {
|
||||
|
||||
private String name;
|
||||
|
||||
private int startLimit = Integer.MAX_VALUE;
|
||||
|
||||
private boolean allowStartIfComplete;
|
||||
|
||||
/**
|
||||
* Default constructor for {@link StepSupport}.
|
||||
*/
|
||||
public StepSupport() {
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string
|
||||
*/
|
||||
public StepSupport(String string) {
|
||||
super();
|
||||
this.name = string;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the name property if it is not already set. Because of the order of the callbacks in a Spring container the
|
||||
* name property will be set first if it is present. Care is needed with bean definition inheritance - if a parent
|
||||
* bean has a name, then its children need an explicit name as well, otherwise they will not be unique.
|
||||
*
|
||||
* @see org.springframework.beans.factory.BeanNameAware#setBeanName(java.lang.String)
|
||||
*/
|
||||
public void setBeanName(String name) {
|
||||
if (this.name == null) {
|
||||
this.name = name;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 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;
|
||||
}
|
||||
|
||||
public int getStartLimit() {
|
||||
return this.startLimit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Public setter for the startLimit.
|
||||
*
|
||||
* @param startLimit the startLimit to set
|
||||
*/
|
||||
public void setStartLimit(int startLimit) {
|
||||
this.startLimit = startLimit;
|
||||
}
|
||||
|
||||
public boolean isAllowStartIfComplete() {
|
||||
return this.allowStartIfComplete;
|
||||
}
|
||||
|
||||
/**
|
||||
* Public setter for the shouldAllowStartIfComplete.
|
||||
*
|
||||
* @param allowStartIfComplete the shouldAllowStartIfComplete to set
|
||||
*/
|
||||
public void setAllowStartIfComplete(boolean allowStartIfComplete) {
|
||||
this.allowStartIfComplete = allowStartIfComplete;
|
||||
}
|
||||
|
||||
/**
|
||||
* Not supported but provided so that tests can easily create a step.
|
||||
*
|
||||
* @throws UnsupportedOperationException always
|
||||
*
|
||||
* @see org.springframework.batch.core.domain.Step#execute(org.springframework.batch.core.domain.StepExecution)
|
||||
*/
|
||||
public void execute(StepExecution stepExecution) throws JobInterruptedException, InfrastructureException {
|
||||
throw new UnsupportedOperationException(
|
||||
"Cannot process a StepExecution. Use a smarter subclass of StepSupport.");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,44 +1,44 @@
|
||||
/*
|
||||
* 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.repository;
|
||||
|
||||
import org.springframework.batch.core.AbstractExceptionTests;
|
||||
import org.springframework.batch.core.repository.DuplicateJobException;
|
||||
|
||||
/**
|
||||
* @author Dave Syer
|
||||
*
|
||||
*/
|
||||
public class DuplicateJobExceptionTests extends AbstractExceptionTests {
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.batch.io.exception.AbstractExceptionTests#getException(java.lang.String)
|
||||
*/
|
||||
public Exception getException(String msg) throws Exception {
|
||||
return new DuplicateJobException(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 DuplicateJobException(msg, t);
|
||||
}
|
||||
|
||||
}
|
||||
/*
|
||||
* 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.repository;
|
||||
|
||||
import org.springframework.batch.core.AbstractExceptionTests;
|
||||
import org.springframework.batch.core.repository.DuplicateJobException;
|
||||
|
||||
/**
|
||||
* @author Dave Syer
|
||||
*
|
||||
*/
|
||||
public class DuplicateJobExceptionTests extends AbstractExceptionTests {
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.batch.io.exception.AbstractExceptionTests#getException(java.lang.String)
|
||||
*/
|
||||
public Exception getException(String msg) throws Exception {
|
||||
return new DuplicateJobException(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 DuplicateJobException(msg, t);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,44 +1,44 @@
|
||||
/*
|
||||
* 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.repository;
|
||||
|
||||
import org.springframework.batch.core.AbstractExceptionTests;
|
||||
import org.springframework.batch.core.repository.JobException;
|
||||
|
||||
/**
|
||||
* @author Dave Syer
|
||||
*
|
||||
*/
|
||||
public class JobExceptionTests extends AbstractExceptionTests {
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.batch.io.exception.AbstractExceptionTests#getException(java.lang.String)
|
||||
*/
|
||||
public Exception getException(String msg) throws Exception {
|
||||
return new JobException(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 JobException(msg, t);
|
||||
}
|
||||
|
||||
}
|
||||
/*
|
||||
* 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.repository;
|
||||
|
||||
import org.springframework.batch.core.AbstractExceptionTests;
|
||||
import org.springframework.batch.core.repository.JobException;
|
||||
|
||||
/**
|
||||
* @author Dave Syer
|
||||
*
|
||||
*/
|
||||
public class JobExceptionTests extends AbstractExceptionTests {
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.batch.io.exception.AbstractExceptionTests#getException(java.lang.String)
|
||||
*/
|
||||
public Exception getException(String msg) throws Exception {
|
||||
return new JobException(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 JobException(msg, t);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,40 +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.repository;
|
||||
|
||||
import org.springframework.batch.core.AbstractExceptionTests;
|
||||
|
||||
/**
|
||||
* @author Dave Syer
|
||||
*
|
||||
*/
|
||||
public class JobExecutionAlreadyRunningExceptionTests extends AbstractExceptionTests {
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.springframework.batch.io.exception.AbstractExceptionTests#getException(java.lang.String)
|
||||
*/
|
||||
public Exception getException(String msg) throws Exception {
|
||||
return new JobExecutionAlreadyRunningException(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 JobExecutionAlreadyRunningException(msg, t);
|
||||
}
|
||||
|
||||
}
|
||||
/*
|
||||
* 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.repository;
|
||||
|
||||
import org.springframework.batch.core.AbstractExceptionTests;
|
||||
|
||||
/**
|
||||
* @author Dave Syer
|
||||
*
|
||||
*/
|
||||
public class JobExecutionAlreadyRunningExceptionTests extends AbstractExceptionTests {
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.springframework.batch.io.exception.AbstractExceptionTests#getException(java.lang.String)
|
||||
*/
|
||||
public Exception getException(String msg) throws Exception {
|
||||
return new JobExecutionAlreadyRunningException(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 JobExecutionAlreadyRunningException(msg, t);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,43 +1,43 @@
|
||||
/*
|
||||
* 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.repository;
|
||||
|
||||
import org.springframework.batch.core.AbstractExceptionTests;
|
||||
|
||||
/**
|
||||
* @author Dave Syer
|
||||
*
|
||||
*/
|
||||
public class JobRestartExceptionTests extends AbstractExceptionTests {
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.batch.io.exception.AbstractExceptionTests#getException(java.lang.String)
|
||||
*/
|
||||
public Exception getException(String msg) throws Exception {
|
||||
return new JobRestartException(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 JobRestartException(msg, t);
|
||||
}
|
||||
|
||||
}
|
||||
/*
|
||||
* 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.repository;
|
||||
|
||||
import org.springframework.batch.core.AbstractExceptionTests;
|
||||
|
||||
/**
|
||||
* @author Dave Syer
|
||||
*
|
||||
*/
|
||||
public class JobRestartExceptionTests extends AbstractExceptionTests {
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.batch.io.exception.AbstractExceptionTests#getException(java.lang.String)
|
||||
*/
|
||||
public Exception getException(String msg) throws Exception {
|
||||
return new JobRestartException(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 JobRestartException(msg, t);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,44 +1,44 @@
|
||||
/*
|
||||
* 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.repository;
|
||||
|
||||
import org.springframework.batch.core.AbstractExceptionTests;
|
||||
import org.springframework.batch.core.repository.NoSuchJobException;
|
||||
|
||||
/**
|
||||
* @author Dave Syer
|
||||
*
|
||||
*/
|
||||
public class NoSuchJobExceptionTests extends AbstractExceptionTests {
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.batch.io.exception.AbstractExceptionTests#getException(java.lang.String)
|
||||
*/
|
||||
public Exception getException(String msg) throws Exception {
|
||||
return new NoSuchJobException(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 NoSuchJobException(msg, t);
|
||||
}
|
||||
|
||||
}
|
||||
/*
|
||||
* 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.repository;
|
||||
|
||||
import org.springframework.batch.core.AbstractExceptionTests;
|
||||
import org.springframework.batch.core.repository.NoSuchJobException;
|
||||
|
||||
/**
|
||||
* @author Dave Syer
|
||||
*
|
||||
*/
|
||||
public class NoSuchJobExceptionTests extends AbstractExceptionTests {
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.batch.io.exception.AbstractExceptionTests#getException(java.lang.String)
|
||||
*/
|
||||
public Exception getException(String msg) throws Exception {
|
||||
return new NoSuchJobException(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 NoSuchJobException(msg, t);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user