source: other-projects/trunk/gs3-release-maker/apache-ant-1.6.5/src/testcases/org/apache/tools/ant/taskdefs/InputTest.java@ 14627

Last change on this file since 14627 was 14627, checked in by oranfry, 17 years ago

initial import of the gs3-release-maker

File size: 2.5 KB
Line 
1/*
2 * Copyright 2001-2002,2004 The Apache Software Foundation
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 */
17
18package org.apache.tools.ant.taskdefs;
19
20import org.apache.tools.ant.BuildFileTest;
21import org.apache.tools.ant.input.PropertyFileInputHandler;
22import org.apache.tools.ant.util.JavaEnvUtils;
23
24/**
25 */
26public class InputTest extends BuildFileTest {
27
28 private String targetPostfix = "";
29
30 public InputTest(String name) {
31 super(name);
32 if (JavaEnvUtils.isJavaVersion(JavaEnvUtils.JAVA_1_1)) {
33 targetPostfix = ".1";
34 }
35 }
36
37 public void setUp() {
38 configureProject("src/etc/testcases/taskdefs/input.xml");
39 System.getProperties()
40 .put(PropertyFileInputHandler.FILE_NAME_KEY,
41 getProject().resolveFile("input.properties")
42 .getAbsolutePath());
43 getProject().setInputHandler(new PropertyFileInputHandler());
44 }
45
46 public void test1() {
47 executeTarget("test1" + targetPostfix);
48 }
49
50 public void test2() {
51 executeTarget("test2" + targetPostfix);
52 }
53
54 public void test3() {
55 expectSpecificBuildException("test3" + targetPostfix, "invalid input",
56 "Found invalid input test for \'"
57 + getKey("All data is"
58 + " going to be deleted from DB"
59 + " continue?")
60 + "\'");
61 }
62
63 public void test5() {
64 executeTarget("test5" + targetPostfix);
65 }
66
67 public void test6() {
68 executeTarget("test6" + targetPostfix);
69 assertEquals("scott", project.getProperty("db.user"));
70 }
71
72 private String getKey(String key) {
73 if (JavaEnvUtils.isJavaVersion(JavaEnvUtils.JAVA_1_1)) {
74 key = key.replace(' ', '_');
75 }
76 return key;
77 }
78
79}
Note: See TracBrowser for help on using the repository browser.