2
* Licensed to the Apache Software Foundation (ASF) under one or more
3
* contributor license agreements. See the NOTICE file distributed with
4
* this work for additional information regarding copyright ownership.
5
* The ASF licenses this file to You under the Apache License, Version 2.0
6
* (the "License"); you may not use this file except in compliance with
7
* the License. You may obtain a copy of the License at
9
* http://www.apache.org/licenses/LICENSE-2.0
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.
19
package org.apache.tools.ant.taskdefs;
21
import java.io.FileInputStream;
23
import org.apache.tools.ant.BuildFileTest;
24
import org.apache.tools.ant.input.PropertyFileInputHandler;
27
public class InputTest extends BuildFileTest {
29
public InputTest(String name) {
34
configureProject("src/etc/testcases/taskdefs/input.xml");
35
System.getProperties()
36
.put(PropertyFileInputHandler.FILE_NAME_KEY,
37
getProject().resolveFile("input.properties")
39
getProject().setInputHandler(new PropertyFileInputHandler());
43
executeTarget("test1");
47
executeTarget("test2");
51
expectSpecificBuildException("test3", "invalid input",
52
"Found invalid input test for \'"
53
+ getKey("All data is"
54
+ " going to be deleted from DB"
60
executeTarget("test5");
64
executeTarget("test6");
65
assertEquals("scott", project.getProperty("db.user"));
68
public void testPropertyFileInlineHandler() {
69
executeTarget("testPropertyFileInlineHandler");
72
public void testDefaultInlineHandler() {
74
executeTarget("testDefaultInlineHandler");
77
public void testGreedyInlineHandler() {
79
executeTarget("testGreedyInlineHandler");
82
public void testGreedyInlineHandlerClassname() {
84
executeTarget("testGreedyInlineHandlerClassname");
87
public void testGreedyInlineHandlerRefid() {
89
executeTarget("testGreedyInlineHandlerRefid");
92
private void stdin() {
94
System.setIn(new FileInputStream(
95
getProject().resolveFile("input.stdin")));
96
} catch (Exception e) {
97
throw e instanceof RuntimeException
98
? (RuntimeException) e : new RuntimeException(e.getMessage());
102
private String getKey(String key) {
103
return key; // XXX what is this for?
2
* Licensed to the Apache Software Foundation (ASF) under one or more
3
* contributor license agreements. See the NOTICE file distributed with
4
* this work for additional information regarding copyright ownership.
5
* The ASF licenses this file to You under the Apache License, Version 2.0
6
* (the "License"); you may not use this file except in compliance with
7
* the License. You may obtain a copy of the License at
9
* http://www.apache.org/licenses/LICENSE-2.0
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.
19
package org.apache.tools.ant.taskdefs;
21
import java.io.FileInputStream;
23
import org.apache.tools.ant.BuildFileTest;
24
import org.apache.tools.ant.input.PropertyFileInputHandler;
27
public class InputTest extends BuildFileTest {
29
public InputTest(String name) {
34
configureProject("src/etc/testcases/taskdefs/input.xml");
35
System.getProperties()
36
.put(PropertyFileInputHandler.FILE_NAME_KEY,
37
getProject().resolveFile("input.properties")
39
getProject().setInputHandler(new PropertyFileInputHandler());
43
executeTarget("test1");
47
executeTarget("test2");
51
expectSpecificBuildException("test3", "invalid input",
52
"Found invalid input test for \'"
53
+ getKey("All data is"
54
+ " going to be deleted from DB"
60
executeTarget("test5");
64
executeTarget("test6");
65
assertEquals("scott", project.getProperty("db.user"));
68
public void testPropertyFileInlineHandler() {
69
executeTarget("testPropertyFileInlineHandler");
72
public void testDefaultInlineHandler() {
74
executeTarget("testDefaultInlineHandler");
77
public void testGreedyInlineHandler() {
79
executeTarget("testGreedyInlineHandler");
82
public void testGreedyInlineHandlerClassname() {
84
executeTarget("testGreedyInlineHandlerClassname");
87
public void testGreedyInlineHandlerRefid() {
89
executeTarget("testGreedyInlineHandlerRefid");
92
private void stdin() {
94
System.setIn(new FileInputStream(
95
getProject().resolveFile("input.stdin")));
96
} catch (Exception e) {
97
throw e instanceof RuntimeException
98
? (RuntimeException) e : new RuntimeException(e.getMessage());
102
private String getKey(String key) {
103
return key; // XXX what is this for?