X-Git-Url: http://git.argeo.org/?a=blobdiff_plain;f=org.argeo.slc.agent%2Fsrc%2Ftest%2Fjava%2Forg%2Fargeo%2Fslc%2Fant%2FSlcAntTest.java;h=b52f38a250b84be2f17b3455a7b09e6ede1d9cdb;hb=489db3e2297debe1a32e5e98534d5dbf059e1c1d;hp=c19cdd4a26ff77d86fbe2fa51da7c7d488e2f998;hpb=a7b136d40c14e4559faa5c34dc2b4dd2170ac2d4;p=gpl%2Fargeo-slc.git diff --git a/org.argeo.slc.agent/src/test/java/org/argeo/slc/ant/SlcAntTest.java b/org.argeo.slc.agent/src/test/java/org/argeo/slc/ant/SlcAntTest.java index c19cdd4a2..b52f38a25 100644 --- a/org.argeo.slc.agent/src/test/java/org/argeo/slc/ant/SlcAntTest.java +++ b/org.argeo.slc.agent/src/test/java/org/argeo/slc/ant/SlcAntTest.java @@ -1,24 +1,27 @@ package org.argeo.slc.ant; -import java.net.URL; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import java.io.File; +import org.argeo.slc.core.process.SlcExecution; import org.argeo.slc.unit.AbstractSpringTestCase; +import org.springframework.core.io.FileSystemResource; public class SlcAntTest extends AbstractSpringTestCase { - private Log log = LogFactory.getLog(getClass()); + // private Log log = LogFactory.getLog(getClass()); public void testSimpleRun() { - // AntRegistryUtil.runAll(getClass().getResource( - // "/org/argeo/slc/ant/build.xml"), "test", null); - - URL url = getClass().getResource("/org/argeo/slc/ant/build.xml"); - log.info("Run Ant file from URL: " + url); - AntRunner antRunner = new AntRunner(getContext(), url, "test"); - - antRunner.run(); + AntSlcApplication slcApp = new AntSlcApplication(); + slcApp.setRootDir(new FileSystemResource(new File("src/test/resources") + .getAbsolutePath() + + File.separator)); + slcApp.setWorkDir(new File(System.getProperty("java.io.tmpdir"))); + slcApp.setParentContext(getContext()); + + SlcExecution slcExecution = new SlcExecution(); + slcExecution.getAttributes().put(SlcAntConstants.EXECATTR_ANT_FILE, + "/org/argeo/slc/ant/build.xml"); + + slcApp.execute(slcExecution, null, null, null); } }