01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: *
17: */
18:
19: package org.apache.tools.ant.taskdefs;
20:
21: import org.apache.tools.ant.BuildFileTest;
22: import org.apache.tools.ant.util.FileUtils;
23:
24: import java.io.IOException;
25:
26: /**
27: */
28: public class RecorderTest extends BuildFileTest {
29:
30: private static final String REC_IN = "recorder/";
31: private static final String REC_DIR = "recorder-out/";
32:
33: /** Utilities used for file operations */
34: private static final FileUtils FILE_UTILS = FileUtils
35: .getFileUtils();
36:
37: public RecorderTest(String name) {
38: super (name);
39: }
40:
41: public void setUp() {
42: configureProject("src/etc/testcases/taskdefs/recorder.xml");
43: executeTarget("prepare");
44: }
45:
46: public void tearDown() {
47: executeTarget("cleanup");
48: }
49:
50: public void testNoAppend() throws IOException {
51: executeTarget("noappend");
52: assertTrue(FILE_UTILS.contentEquals(project.resolveFile(REC_IN
53: + "rectest1.result"), project.resolveFile(REC_DIR
54: + "rectest1.log"), true));
55: }
56:
57: public void testAppend() throws IOException {
58: executeTarget("append");
59: assertTrue(FILE_UTILS.contentEquals(project.resolveFile(REC_IN
60: + "rectest2.result"), project.resolveFile(REC_DIR
61: + "rectest2.log"), true));
62: }
63:
64: public void testRestart() throws IOException {
65: executeTarget("restart");
66: assertTrue(FILE_UTILS.contentEquals(project.resolveFile(REC_IN
67: + "rectest3.result"), project.resolveFile(REC_DIR
68: + "rectest3.log"), true));
69: }
70:
71: public void testDeleteRestart() throws IOException {
72: executeTarget("deleterestart");
73: assertTrue(FILE_UTILS.contentEquals(project.resolveFile(REC_IN
74: + "rectest4.result"), project.resolveFile(REC_DIR
75: + "rectest4.log"), true));
76: }
77:
78: }
|