Skip to content

Commit dfa783a

Browse files
author
nebhale
committed
[BATCH-63] More test changes
1 parent a13214b commit dfa783a

File tree

4 files changed

+182
-5
lines changed

4 files changed

+182
-5
lines changed
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
#Wed Feb 20 09:27:35 GMT 2008
2+
eclipse.preferences.version=1
3+
org.springframework.ide.eclipse.core.builders.enable.aopreferencemodelbuilder=true
4+
org.springframework.ide.eclipse.core.enable.project.preferences=false
5+
org.springframework.ide.eclipse.core.validator.enable.org.springframework.ide.eclipse.beans.core.beansvalidator=true
6+
org.springframework.ide.eclipse.core.validator.enable.org.springframework.ide.eclipse.core.springvalidator=true
7+
org.springframework.ide.eclipse.core.validator.enable.org.springframework.ide.eclipse.webflow.core.validator=true
8+
org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.beans.core.beanAlias-org.springframework.ide.eclipse.beans.core.beansvalidator=true
9+
org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.beans.core.beanClass-org.springframework.ide.eclipse.beans.core.beansvalidator=true
10+
org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.beans.core.beanConstructorArgument-org.springframework.ide.eclipse.beans.core.beansvalidator=true
11+
org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.beans.core.beanDefinition-org.springframework.ide.eclipse.beans.core.beansvalidator=true
12+
org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.beans.core.beanDefinitionHolder-org.springframework.ide.eclipse.beans.core.beansvalidator=true
13+
org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.beans.core.beanFactory-org.springframework.ide.eclipse.beans.core.beansvalidator=true
14+
org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.beans.core.beanInitDestroyMethod-org.springframework.ide.eclipse.beans.core.beansvalidator=true
15+
org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.beans.core.beanProperty-org.springframework.ide.eclipse.beans.core.beansvalidator=true
16+
org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.beans.core.beanReference-org.springframework.ide.eclipse.beans.core.beansvalidator=true
17+
org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.beans.core.methodOverride-org.springframework.ide.eclipse.beans.core.beansvalidator=true
18+
org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.beans.core.parsingProblems-org.springframework.ide.eclipse.beans.core.beansvalidator=true
19+
org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.beans.core.requiredProperty-org.springframework.ide.eclipse.beans.core.beansvalidator=false
20+
org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.core.springClasspath-org.springframework.ide.eclipse.core.springvalidator=true
21+
org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.webflow.core.validation.action-org.springframework.ide.eclipse.webflow.core.validator=true
22+
org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.webflow.core.validation.actionstate-org.springframework.ide.eclipse.webflow.core.validator=true
23+
org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.webflow.core.validation.attribute-org.springframework.ide.eclipse.webflow.core.validator=true
24+
org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.webflow.core.validation.attributemapper-org.springframework.ide.eclipse.webflow.core.validator=true
25+
org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.webflow.core.validation.beanaction-org.springframework.ide.eclipse.webflow.core.validator=true
26+
org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.webflow.core.validation.evaluationaction-org.springframework.ide.eclipse.webflow.core.validator=true
27+
org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.webflow.core.validation.evaluationresult-org.springframework.ide.eclipse.webflow.core.validator=true
28+
org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.webflow.core.validation.exceptionhandler-org.springframework.ide.eclipse.webflow.core.validator=true
29+
org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.webflow.core.validation.import-org.springframework.ide.eclipse.webflow.core.validator=true
30+
org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.webflow.core.validation.inputattribute-org.springframework.ide.eclipse.webflow.core.validator=true
31+
org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.webflow.core.validation.mapping-org.springframework.ide.eclipse.webflow.core.validator=true
32+
org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.webflow.core.validation.outputattribute-org.springframework.ide.eclipse.webflow.core.validator=true
33+
org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.webflow.core.validation.set-org.springframework.ide.eclipse.webflow.core.validator=true
34+
org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.webflow.core.validation.state-org.springframework.ide.eclipse.webflow.core.validator=true
35+
org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.webflow.core.validation.subflowstate-org.springframework.ide.eclipse.webflow.core.validator=true
36+
org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.webflow.core.validation.transition-org.springframework.ide.eclipse.webflow.core.validator=true
37+
org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.webflow.core.validation.variable-org.springframework.ide.eclipse.webflow.core.validator=true
38+
org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.webflow.core.validation.webflowstate-org.springframework.ide.eclipse.webflow.core.validator=true
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
/*
2+
* Copyright 2002-2007 the original author or authors.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package org.springframework.batch.execution.configuration;
18+
19+
import junit.framework.TestCase;
20+
21+
import org.springframework.beans.factory.parsing.BeanDefinitionParsingException;
22+
import org.springframework.context.support.ClassPathXmlApplicationContext;
23+
24+
public class BatchNamespaceHandlerJobRepositoryTests extends TestCase {
25+
26+
private static final String PACKAGE = "org/springframework/batch/execution/configuration/";
27+
28+
public void testRepositoryOk() {
29+
new ClassPathXmlApplicationContext(PACKAGE + "BatchNamespaceHandlerJobRepositoryOk.xml");
30+
}
31+
32+
public void testRepositoryMissingDataSource() {
33+
try {
34+
new ClassPathXmlApplicationContext(PACKAGE + "BatchNamespaceHandlerJobRepositoryMissingDataSource.xml");
35+
fail("Expected BeanDefinitionParsingException");
36+
} catch (BeanDefinitionParsingException e) { }
37+
}
38+
39+
public void testRepositoryDb2() {
40+
new ClassPathXmlApplicationContext(PACKAGE + "BatchNamespaceHandlerJobRepositoryDb2.xml");
41+
}
42+
43+
public void testRepositoryDerby() {
44+
new ClassPathXmlApplicationContext(PACKAGE + "BatchNamespaceHandlerJobRepositoryDerby.xml");
45+
}
46+
47+
public void testRepositoryHsql() {
48+
new ClassPathXmlApplicationContext(PACKAGE + "BatchNamespaceHandlerJobRepositoryHsql.xml");
49+
}
50+
51+
public void testRepositoryMySql() {
52+
new ClassPathXmlApplicationContext(PACKAGE + "BatchNamespaceHandlerJobRepositoryMySql.xml");
53+
}
54+
55+
public void testRepositoryOracle() {
56+
new ClassPathXmlApplicationContext(PACKAGE + "BatchNamespaceHandlerJobRepositoryOracle.xml");
57+
}
58+
59+
public void testRepositoryPostgres() {
60+
new ClassPathXmlApplicationContext(PACKAGE + "BatchNamespaceHandlerJobRepositoryPostgres.xml");
61+
}
62+
}

spring-batch-execution/src/test/java/org/springframework/batch/execution/configuration/BatchNamespaceHandlerTaskletStepTests.java

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,24 +18,44 @@
1818

1919
import junit.framework.TestCase;
2020

21+
import org.springframework.batch.execution.step.tasklet.TaskletStep;
2122
import org.springframework.beans.factory.parsing.BeanDefinitionParsingException;
23+
import org.springframework.context.ApplicationContext;
2224
import org.springframework.context.support.ClassPathXmlApplicationContext;
2325

2426
public class BatchNamespaceHandlerTaskletStepTests extends TestCase {
2527

2628
private static final String PACKAGE = "org/springframework/batch/execution/configuration/";
2729

28-
public void testNamespaceOk() {
30+
public void testTaskletStepOk() {
2931
new ClassPathXmlApplicationContext(PACKAGE + "BatchNamespaceHandlerTaskletStepOk.xml");
3032
}
3133

32-
public void testNamespaceMissingTasklet() {
34+
public void testTaskletStepMissingTasklet() {
3335
try {
3436
new ClassPathXmlApplicationContext(PACKAGE + "BatchNamespaceHandlerTaskletStepMissingTasklet.xml");
3537
fail("Expected BeanDefinitionParsingException");
36-
} catch (BeanDefinitionParsingException e) {
37-
38-
}
38+
} catch (BeanDefinitionParsingException e) { }
39+
}
40+
41+
public void testTaskletStepRerunAlways() {
42+
ApplicationContext ctx = new ClassPathXmlApplicationContext(PACKAGE + "BatchNamespaceHandlerTaskletStepRerunAlways.xml");
43+
TaskletStep step = (TaskletStep) ctx.getBean("process");
44+
assertEquals(Integer.MAX_VALUE, step.getStartLimit());
45+
assertTrue(step.isAllowStartIfComplete());
46+
}
47+
48+
public void testTaskletStepRerunNever() {
49+
ApplicationContext ctx = new ClassPathXmlApplicationContext(PACKAGE + "BatchNamespaceHandlerTaskletStepRerunNever.xml");
50+
TaskletStep step = (TaskletStep) ctx.getBean("process");
51+
assertEquals(1, step.getStartLimit());
52+
assertFalse(step.isAllowStartIfComplete());
3953
}
4054

55+
public void testTaskletStepRerunIncomplete() {
56+
ApplicationContext ctx = new ClassPathXmlApplicationContext(PACKAGE + "BatchNamespaceHandlerTaskletStepRerunIncomplete.xml");
57+
TaskletStep step = (TaskletStep) ctx.getBean("process");
58+
assertEquals(Integer.MAX_VALUE, step.getStartLimit());
59+
assertFalse(step.isAllowStartIfComplete());
60+
}
4161
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
/*
2+
* Copyright 2002-2007 the original author or authors.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package org.springframework.batch.execution.configuration;
18+
19+
import java.io.PrintWriter;
20+
import java.sql.Connection;
21+
import java.sql.SQLException;
22+
23+
import javax.sql.DataSource;
24+
25+
public class StubDataSource implements DataSource {
26+
27+
public Connection getConnection() throws SQLException {
28+
// TODO Auto-generated method stub
29+
throw new UnsupportedOperationException();
30+
}
31+
32+
public Connection getConnection(String username, String password) throws SQLException {
33+
// TODO Auto-generated method stub
34+
throw new UnsupportedOperationException();
35+
}
36+
37+
public PrintWriter getLogWriter() throws SQLException {
38+
// TODO Auto-generated method stub
39+
throw new UnsupportedOperationException();
40+
}
41+
42+
public int getLoginTimeout() throws SQLException {
43+
// TODO Auto-generated method stub
44+
throw new UnsupportedOperationException();
45+
}
46+
47+
public void setLogWriter(PrintWriter out) throws SQLException {
48+
// TODO Auto-generated method stub
49+
throw new UnsupportedOperationException();
50+
}
51+
52+
public void setLoginTimeout(int seconds) throws SQLException {
53+
// TODO Auto-generated method stub
54+
throw new UnsupportedOperationException();
55+
}
56+
57+
}

0 commit comments

Comments
 (0)