]> git.argeo.org Git - gpl/argeo-slc.git/blob - runtime/org.argeo.slc.core/src/test/java/org/argeo/slc/core/execution/FileExecutionResourcesSpringTest.java
Introduce relative resource sets
[gpl/argeo-slc.git] / runtime / org.argeo.slc.core / src / test / java / org / argeo / slc / core / execution / FileExecutionResourcesSpringTest.java
1 package org.argeo.slc.core.execution;
2
3 import java.io.File;
4
5 public class FileExecutionResourcesSpringTest extends
6 AbstractExecutionFlowTestCase {
7 private String basePath = FileExecutionResources.DEFAULT_EXECUTION_RESOURCES_TMP_PATH;
8
9 public void testSimple() throws Exception {
10 File file = getFile("subdir/writeTo");
11 try {
12 assertFalse(file.exists());
13 configureAndExecuteSlcFlow("executionResources.xml",
14 "executionResources.simple");
15 assertTrue(file.exists());
16 } finally {
17 file.deleteOnExit();
18 }
19 }
20
21 public void testPlaceholderPass() throws Exception {
22 File file = getFile("subdir/60");
23 try {
24 assertFalse(file.exists());
25 configureAndExecuteSlcFlow("executionResources.xml",
26 "executionResources.placeholderPass");
27 assertTrue(file.exists());
28 } finally {
29 file.deleteOnExit();
30 }
31 }
32
33 /**
34 * Test that it generate the wrong file because of issue when using
35 * execution placeholder in contructor-arg
36 */
37 public void testPlaceholderFail() throws Exception {
38 File file = getFile("subdir/@{var}");
39 try {
40 assertFalse(file.exists());
41 configureAndExecuteSlcFlow("executionResources.xml",
42 "executionResources.placeholderFail");
43 assertTrue(file.exists());
44 } finally {
45 file.deleteOnExit();
46 }
47 }
48
49 protected File getFile(String relativePath) {
50 return new File(basePath + File.separator
51 + relativePath.replace('/', File.separatorChar));
52 }
53 }