]> git.argeo.org Git - gpl/argeo-slc.git/blob - org.argeo.slc.agent/src/main/java/org/argeo/slc/ant/unit/MinimalAntClasspathTestCase.java
Make sure Spring context will be properly closed
[gpl/argeo-slc.git] / org.argeo.slc.agent / src / main / java / org / argeo / slc / ant / unit / MinimalAntClasspathTestCase.java
1 package org.argeo.slc.ant.unit;
2
3 import java.io.File;
4 import java.util.UUID;
5
6 import org.argeo.slc.ant.AntConstants;
7 import org.argeo.slc.ant.AntSlcApplication;
8 import org.argeo.slc.core.process.SlcExecution;
9 import org.argeo.slc.unit.AbstractSpringTestCase;
10 import org.springframework.core.io.FileSystemResource;
11
12 public class MinimalAntClasspathTestCase extends AbstractSpringTestCase {
13 protected void execute(String scriptPath) {
14 AntSlcApplication slcApp = new AntSlcApplication();
15 slcApp.setRootDir(new FileSystemResource(new File("src/test/resources")
16 .getAbsolutePath()
17 + File.separator));
18 slcApp.setWorkDir(new File(System.getProperty("java.io.tmpdir")));
19 slcApp.setParentContext(getContext());
20
21 SlcExecution slcExecution = new SlcExecution();
22 slcExecution.setUuid(UUID.randomUUID().toString());
23 slcExecution.getAttributes().put(AntConstants.EXECATTR_ANT_FILE,
24 scriptPath);
25 slcExecution.setUser("user");
26
27 slcApp.execute(slcExecution, null, null, null);
28 }
29
30 }