OPEN - issue BATCH-937: Make sure JobRepository can be proxied

Plus fix error with stax config in tiger profile
This commit is contained in:
dsyer
2009-02-23 15:19:05 +00:00
parent d662888f83
commit 95bbf6d0f0
9 changed files with 95 additions and 13 deletions

View File

@@ -0,0 +1,3 @@
#Mon Feb 23 13:41:20 GMT 2009
eclipse.preferences.version=1
org.springframework.ide.eclipse.beans.core.ignoreMissingNamespaceHandler=false

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<beansProjectDescription>
<version>1</version>
<pluginVersion><![CDATA[2.2.0.v200809261800]]></pluginVersion>
<pluginVersion><![CDATA[2.2.1.v200811281800]]></pluginVersion>
<configSuffixes>
<configSuffix><![CDATA[xml]]></configSuffix>
</configSuffixes>
@@ -57,6 +57,12 @@
<config>src/test/resources/org/springframework/batch/core/configuration/xml/StepParserBeanNameTests-context.xml</config>
<config>src/test/resources/org/springframework/batch/core/configuration/xml/StepParserTaskletAttributesTests-context.xml</config>
<config>src/test/resources/org/springframework/batch/core/configuration/xml/StopIncompleteJobParserTests-context.xml</config>
<config>src/test/resources/org/springframework/batch/core/configuration/xml/AutoRegisteringStepScopeForJobElementTests-context.xml</config>
<config>src/test/resources/org/springframework/batch/core/configuration/xml/AutoRegisteringStepScopeForStepElementTests-context.xml</config>
<config>src/test/resources/org/springframework/batch/core/configuration/support/ClassPathXmlJobRegistryContextTests-context.xml</config>
<config>src/test/resources/org/springframework/batch/core/configuration/xml/StopAndRestartJobParserTests-context.xml</config>
<config>src/test/resources/org/springframework/batch/core/configuration/xml/StopRestartOnCompletedStepJobParserTests-context.xml</config>
<config>src/test/resources/org/springframework/batch/core/configuration/xml/StopRestartOnFailedStepJobParserTests-context.xml</config>
</configs>
<configSets>
<configSet>

View File

@@ -32,17 +32,13 @@ import org.springframework.transaction.annotation.Transactional;
@ContextConfiguration(locations = "/org/springframework/batch/core/repository/dao/sql-dao-test.xml")
public class SimpleJobRepositoryIntegrationTests {
@Autowired
private SimpleJobRepository jobRepository;
private JobSupport job = new JobSupport("SimpleJobRepositoryIntegrationTestsJob");
private JobParameters jobParameters = new JobParameters();
@Autowired
public void setJobRepository(SimpleJobRepository jobRepository) {
this.jobRepository = jobRepository;
}
/*
* Create two job executions for same job+parameters tuple. Check both
* executions belong to the same job instance and job.

View File

@@ -0,0 +1,56 @@
package org.springframework.batch.core.repository.support;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import org.aopalliance.intercept.MethodInterceptor;
import org.aopalliance.intercept.MethodInvocation;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.batch.core.JobExecution;
import org.springframework.batch.core.JobParameters;
import org.springframework.batch.core.job.JobSupport;
import org.springframework.batch.core.repository.JobRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.transaction.annotation.Transactional;
/**
* Repository tests using JDBC DAOs (rather than mocks).
*
* @author Robert Kasanicky
*/
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration
public class SimpleJobRepositoryProxyTests {
@Autowired
private JobRepository jobRepository;
@Autowired
private Advice advice;
private JobSupport job = new JobSupport("SimpleJobRepositoryProxyTestsJob");
@Transactional
@Test
public void testCreateAndFind() throws Exception {
assertFalse(advice.invoked);
JobExecution jobExecution = jobRepository.createJobExecution(job.getName(), new JobParameters());
assertNotNull(jobExecution);
assertTrue(advice.invoked);
}
public static class Advice implements MethodInterceptor {
private boolean invoked;
public Object invoke(MethodInvocation invocation) throws Throwable {
invoked = true;
return invocation.proceed();
}
}
}

View File

@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:aop="http://www.springframework.org/schema/aop"
xsi:schemaLocation="http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
<import resource="classpath:/org/springframework/batch/core/repository/dao/data-source-context.xml" />
<bean class="org.springframework.batch.core.repository.support.JobRepositoryFactoryBean">
<property name="dataSource" ref="dataSource" />
<property name="transactionManager" ref="transactionManager"/>
</bean>
<aop:config>
<aop:advisor advice-ref="advice" pointcut="execution(* org.springframework.batch..JobRepository+.*(..))" />
</aop:config>
<bean id="advice" class="org.springframework.batch.core.repository.support.SimpleJobRepositoryProxyTests$Advice" />
</beans>

View File

@@ -21,8 +21,8 @@
</activation>
<dependencies>
<dependency>
<groupId>javax.xml.stream</groupId>
<artifactId>com.springsource.javax.xml.stream</artifactId>
<groupId>stax</groupId>
<artifactId>stax</artifactId>
</dependency>
</dependencies>
</profile>

View File

@@ -1,3 +1,4 @@
package org.springframework.batch.item.file;
import java.io.File;
import java.io.IOException;
import java.util.Arrays;
@@ -10,7 +11,6 @@ import javax.xml.transform.Result;
import static org.junit.Assert.*;
import org.junit.Before;
import org.junit.Test;
import org.springframework.batch.item.file.AbstractMultiResourceItemWriterTests;
import org.springframework.batch.item.file.MultiResourceItemWriter;
import org.springframework.batch.item.xml.StaxEventItemWriter;
import org.springframework.oxm.Marshaller;

View File

@@ -21,8 +21,8 @@
</activation>
<dependencies>
<dependency>
<groupId>javax.xml.stream</groupId>
<artifactId>com.springsource.javax.xml.stream</artifactId>
<groupId>stax</groupId>
<artifactId>stax</artifactId>
</dependency>
</dependencies>
</profile>

View File

@@ -21,8 +21,8 @@
</activation>
<dependencies>
<dependency>
<groupId>javax.xml.stream</groupId>
<artifactId>com.springsource.javax.xml.stream</artifactId>
<groupId>stax</groupId>
<artifactId>stax</artifactId>
</dependency>
</dependencies>
</profile>