LDAP-302: Spring IO Checks
This commit is contained in:
@@ -5,7 +5,7 @@ buildscript {
|
||||
dependencies {
|
||||
classpath("org.springframework.build.gradle:propdeps-plugin:0.0.3")
|
||||
classpath('org.asciidoctor:asciidoctor-gradle-plugin:0.7.0')
|
||||
classpath 'org.springframework.build.gradle:springio-platform-plugin:0.0.2.RELEASE'
|
||||
classpath 'org.springframework.build.gradle:spring-io-plugin:0.0.3.RELEASE'
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,7 +44,6 @@ configure(allprojects) {
|
||||
|
||||
configure(coreModules) {
|
||||
apply from: JAVA_MODULE_SCRIPT
|
||||
apply plugin: 'springio-platform'
|
||||
}
|
||||
|
||||
configure(subprojects - coreModules) {
|
||||
|
||||
@@ -1,35 +1,23 @@
|
||||
apply from: JAVA_SCRIPT
|
||||
apply from: MAVEN_DEPLOYMENT_SCRIPT
|
||||
apply from: RELEASE_CHECKS_SCRIPT
|
||||
apply plugin: 'spring-io'
|
||||
|
||||
ext.springIoVersion = project.hasProperty('platformVersion') ? platformVersion : '1.0.0.BUILD-SNAPSHOT'
|
||||
|
||||
configurations {
|
||||
jacoco //Configuration Group used by Sonar to provide Code Coverage using JaCoCo
|
||||
spring4TestRuntime.extendsFrom testRuntime
|
||||
}
|
||||
|
||||
configurations.spring4TestRuntime {
|
||||
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
|
||||
if (details.requested.group == 'org.springframework') {
|
||||
details.useVersion '4.0.2.RELEASE'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
jacoco group: "org.jacoco", name: "org.jacoco.agent", version: "0.6.2.201302030002", classifier: "runtime"
|
||||
springIoVersions "io.spring.platform:platform-versions:${springIoVersion}@properties"
|
||||
}
|
||||
|
||||
test {
|
||||
jvmArgs "-javaagent:${configurations.jacoco.asPath}=destfile=${buildDir}/jacoco.exec,includes=org.springframework.*"
|
||||
}
|
||||
|
||||
task spring4Test(type: Test) {
|
||||
classpath = sourceSets.test.output + sourceSets.main.output + configurations.spring4TestRuntime
|
||||
testResultsDir = file("$buildDir/spring4-test-results/")
|
||||
testReportDir = file("$buildDir/reports/spring4-tests/")
|
||||
}
|
||||
check.dependsOn spring4Test
|
||||
|
||||
jar {
|
||||
manifest.attributes["Created-By"] =
|
||||
"${System.getProperty("java.version")} (${System.getProperty("java.specification.vendor")})"
|
||||
|
||||
@@ -29,4 +29,5 @@ ext.powerMockDependencies = [
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
maven { url 'https://repo.spring.io/libs-snapshot' }
|
||||
}
|
||||
@@ -17,4 +17,14 @@ dependencies {
|
||||
testCompile("org.springframework.batch:spring-batch-test:$springBatchVersion") {
|
||||
exclude group: "org.springframework", module: "spring-test"
|
||||
}
|
||||
}
|
||||
|
||||
test {
|
||||
exclude '**/Batch22*.class'
|
||||
}
|
||||
|
||||
project.tasks.withType(Test).all { t->
|
||||
if(name.startsWith('springIo')) {
|
||||
exclude '**/Batch20*.class'
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
package org.springframework.ldap.ldif.batch;
|
||||
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
|
||||
/**
|
||||
* @author Rob Winch
|
||||
*/
|
||||
@ContextConfiguration(locations={"classpath:batch20-applicationContext-test1.xml"})
|
||||
public class Batch20LdifReaderTest extends LdifReaderTest {
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
* Copyright 2002-2013 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.ldap.ldif.batch;
|
||||
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
|
||||
/**
|
||||
* @author Rob Winch
|
||||
*/
|
||||
@ContextConfiguration(locations={"classpath:batch20-applicationContext-test2.xml"})
|
||||
public class Batch20MappingLdifReaderTest extends MappingLdifReaderTest {
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
package org.springframework.ldap.ldif.batch;
|
||||
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
|
||||
/**
|
||||
* @author Rob Winch
|
||||
*/
|
||||
@ContextConfiguration(locations={"classpath:batch22-applicationContext-test1.xml"})
|
||||
public class Batch22LdifReaderTest extends LdifReaderTest {
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
* Copyright 2002-2013 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.ldap.ldif.batch;
|
||||
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
|
||||
/**
|
||||
* @author Rob Winch
|
||||
*/
|
||||
@ContextConfiguration(locations={"classpath:batch22-applicationContext-test2.xml"})
|
||||
public class Batch22MappingLdifReaderTest extends MappingLdifReaderTest {
|
||||
}
|
||||
@@ -36,8 +36,7 @@ import java.net.MalformedURLException;
|
||||
import static org.junit.Assert.fail;
|
||||
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@ContextConfiguration(locations={"classpath*:applicationContext-test1.xml"})
|
||||
public class LdifReaderTest extends AbstractJobTests {
|
||||
public abstract class LdifReaderTest extends AbstractJobTests {
|
||||
private static Logger log = LoggerFactory.getLogger(LdifReaderTest.class);
|
||||
|
||||
private Resource expected;
|
||||
|
||||
@@ -36,8 +36,7 @@ import java.net.MalformedURLException;
|
||||
import static org.junit.Assert.fail;
|
||||
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@ContextConfiguration(locations={"classpath*:applicationContext-test2.xml"})
|
||||
public class MappingLdifReaderTest extends AbstractJobTests {
|
||||
public abstract class MappingLdifReaderTest extends AbstractJobTests {
|
||||
private static Logger log = LoggerFactory.getLogger(MappingLdifReaderTest.class);
|
||||
|
||||
private Resource expected;
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
<?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:batch="http://www.springframework.org/schema/batch"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
|
||||
http://www.springframework.org/schema/batch http://www.springframework.org/schema/batch/spring-batch-2.2.xsd">
|
||||
|
||||
<batch:job id="job">
|
||||
<batch:step id="step1" next="step2">
|
||||
<batch:tasklet transaction-manager="transactionManager">
|
||||
<batch:chunk reader="itemReader1" writer="itemWriter" commit-interval="2" skip-limit="1">
|
||||
<batch:skippable-exception-classes>
|
||||
<batch:include class="org.springframework.ldap.ldif.InvalidAttributeFormatException"/>
|
||||
</batch:skippable-exception-classes>
|
||||
</batch:chunk>
|
||||
</batch:tasklet>
|
||||
</batch:step>
|
||||
<batch:step id="step2">
|
||||
<batch:tasklet transaction-manager="transactionManager">
|
||||
<batch:chunk reader="itemReader2" writer="itemWriter" commit-interval="2" />
|
||||
</batch:tasklet>
|
||||
</batch:step>
|
||||
</batch:job>
|
||||
|
||||
<bean id="itemReader1" class="org.springframework.ldap.ldif.batch.LdifReader">
|
||||
<property name="resource" value="file:src/test/resources/test.ldif" />
|
||||
<property name="recordsToSkip" value="1" />
|
||||
</bean>
|
||||
|
||||
<bean id="itemReader2" class="org.springframework.ldap.ldif.batch.LdifReader">
|
||||
<property name="resource" value="file:src/test/resources/missing.ldif" />
|
||||
<property name="recordsToSkip" value="1" />
|
||||
</bean>
|
||||
|
||||
<bean id="itemWriter" class="org.springframework.batch.item.file.FlatFileItemWriter">
|
||||
<property name="resource" value="file:target/test-outputs/output.ldif" />
|
||||
<property name="lineAggregator">
|
||||
<bean class="org.springframework.ldap.ldif.batch.LdifAggregator" />
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
<bean id="jobLauncher" class="org.springframework.batch.core.launch.support.SimpleJobLauncher">
|
||||
<property name="jobRepository" ref="jobRepository" />
|
||||
<property name="taskExecutor" ref="taskExecutor" />
|
||||
</bean>
|
||||
|
||||
<bean id="jobRepository" class="org.springframework.batch.core.repository.support.MapJobRepositoryFactoryBean">
|
||||
<property name="transactionManager" ref="transactionManager"/>
|
||||
</bean>
|
||||
|
||||
<bean id="transactionManager" class="org.springframework.batch.support.transaction.ResourcelessTransactionManager" />
|
||||
|
||||
<bean id="taskExecutor" class="org.springframework.core.task.SyncTaskExecutor" />
|
||||
|
||||
</beans>
|
||||
@@ -0,0 +1,59 @@
|
||||
<?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:batch="http://www.springframework.org/schema/batch"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
|
||||
http://www.springframework.org/schema/batch http://www.springframework.org/schema/batch/spring-batch-2.2.xsd">
|
||||
|
||||
<batch:job id="job">
|
||||
<batch:step id="step1" next="step2">
|
||||
<batch:tasklet transaction-manager="transactionManager">
|
||||
<batch:chunk reader="itemReader1" writer="itemWriter" commit-interval="2" skip-limit="1">
|
||||
<batch:skippable-exception-classes>
|
||||
<batch:include class="org.springframework.ldap.ldif.InvalidAttributeFormatException"/>
|
||||
</batch:skippable-exception-classes>
|
||||
</batch:chunk>
|
||||
</batch:tasklet>
|
||||
</batch:step>
|
||||
<batch:step id="step2">
|
||||
<batch:tasklet transaction-manager="transactionManager">
|
||||
<batch:chunk reader="itemReader2" writer="itemWriter" commit-interval="2" />
|
||||
</batch:tasklet>
|
||||
</batch:step>
|
||||
</batch:job>
|
||||
|
||||
<bean id="itemReader1" class="org.springframework.ldap.ldif.batch.MappingLdifReader">
|
||||
<property name="resource" value="file:src/test/resources/test.ldif" />
|
||||
<property name="recordsToSkip" value="1" />
|
||||
<property name="recordMapper" ref="recordMapper" />
|
||||
</bean>
|
||||
|
||||
<bean id="itemReader2" class="org.springframework.ldap.ldif.batch.MappingLdifReader">
|
||||
<property name="resource" value="file:src/test/resources/missing.ldif" />
|
||||
<property name="recordsToSkip" value="1" />
|
||||
<property name="recordMapper" ref="recordMapper" />
|
||||
</bean>
|
||||
|
||||
<bean id="recordMapper" class="org.springframework.ldap.ldif.batch.MyMapper" />
|
||||
|
||||
<bean id="itemWriter" class="org.springframework.batch.item.file.FlatFileItemWriter">
|
||||
<property name="resource" value="file:target/test-outputs/output.ldif" />
|
||||
<property name="lineAggregator">
|
||||
<bean class="org.springframework.ldap.ldif.batch.LdifAggregator" />
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
<bean id="jobLauncher" class="org.springframework.batch.core.launch.support.SimpleJobLauncher">
|
||||
<property name="jobRepository" ref="jobRepository" />
|
||||
<property name="taskExecutor" ref="taskExecutor" />
|
||||
</bean>
|
||||
|
||||
<bean id="jobRepository" class="org.springframework.batch.core.repository.support.MapJobRepositoryFactoryBean">
|
||||
<property name="transactionManager" ref="transactionManager"/>
|
||||
</bean>
|
||||
|
||||
<bean id="transactionManager" class="org.springframework.batch.support.transaction.ResourcelessTransactionManager" />
|
||||
|
||||
<bean id="taskExecutor" class="org.springframework.core.task.SyncTaskExecutor" />
|
||||
|
||||
</beans>
|
||||
Reference in New Issue
Block a user