]> git.argeo.org Git - gpl/argeo-slc.git/blob - org.argeo.slc.core/ext/test/org/argeo/slc/core/execution/FileExecutionResourcesSpringTest.java
Disable trace logging
[gpl/argeo-slc.git] / org.argeo.slc.core / ext / test / org / argeo / slc / core / execution / FileExecutionResourcesSpringTest.java
1 /*
2 * Copyright (C) 2007-2012 Argeo GmbH
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16 package org.argeo.slc.core.execution;
17
18 import java.io.File;
19
20 public class FileExecutionResourcesSpringTest extends
21 AbstractExecutionFlowTestCase {
22 private String basePath = FileExecutionResources.DEFAULT_EXECUTION_RESOURCES_TMP_PATH;
23
24 public void testSimple() throws Exception {
25 File file = getFile("subdir/writeTo");
26 try {
27 assertFalse(file.exists());
28 configureAndExecuteSlcFlow("executionResources.xml",
29 "executionResources.simple");
30 assertTrue(file.exists());
31 } finally {
32 file.deleteOnExit();
33 }
34 }
35
36 public void testPlaceholderPass() throws Exception {
37 File file = getFile("subdir/60");
38 try {
39 assertFalse(file.exists());
40 configureAndExecuteSlcFlow("executionResources.xml",
41 "executionResources.placeholderPass");
42 assertTrue(file.exists());
43 } finally {
44 file.deleteOnExit();
45 }
46 }
47
48 /**
49 * Test that it generate the wrong file because of issue when using
50 * execution placeholder in contructor-arg
51 */
52 public void testPlaceholderFail() throws Exception {
53 File file = getFile("subdir/@{var}");
54 try {
55 assertFalse(file.exists());
56 configureAndExecuteSlcFlow("executionResources.xml",
57 "executionResources.placeholderFail");
58 assertTrue(file.exists());
59 } finally {
60 file.deleteOnExit();
61 }
62 }
63
64 protected File getFile(String relativePath) {
65 return new File(basePath + File.separator
66 + relativePath.replace('/', File.separatorChar));
67 }
68 }