BATCH-1209: add a Groovy job in samples using AntBuilder to do some file schlepping

This commit is contained in:
dsyer
2009-06-16 07:49:49 +00:00
parent 7b14a66a6e
commit 3a25f23218
5 changed files with 127 additions and 0 deletions

View File

@@ -0,0 +1,55 @@
/*
* 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.sample;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import java.io.File;
import java.io.IOException;
import org.apache.commons.io.FileUtils;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration()
public class GroovyJobFunctionalTests extends AbstractValidatingBatchLauncherTests {
@Before
public void removeOldData() throws IOException {
FileUtils.deleteDirectory(new File("target/groovyJob"));
}
@Test
public void testLaunchJob() throws Exception{
super.testLaunchJob();
}
protected void validatePostConditions() {
assertTrue(new File("target/groovyJob/output/files.zip").exists());
}
protected void validatePreConditions() {
assertFalse(new File("target/groovyJob/output/files.zip").exists());
}
}

View File

@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
<import resource="classpath:/simple-job-launcher-context.xml" />
<import resource="classpath:/jobs/groovyJob.xml" />
</beans>