1 | /*
|
---|
2 | * Copyright 2001,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 |
|
---|
18 | package org.apache.tools.ant;
|
---|
19 |
|
---|
20 | import org.apache.tools.ant.BuildFileTest;
|
---|
21 |
|
---|
22 | /**
|
---|
23 | */
|
---|
24 | public class ImmutableTest extends BuildFileTest {
|
---|
25 |
|
---|
26 | public ImmutableTest(String name) {
|
---|
27 | super(name);
|
---|
28 | }
|
---|
29 |
|
---|
30 | public void setUp() {
|
---|
31 | configureProject("src/etc/testcases/core/immutable.xml");
|
---|
32 | }
|
---|
33 |
|
---|
34 | // override allowed on <available>
|
---|
35 | public void test1() {
|
---|
36 | executeTarget("test1");
|
---|
37 | assertEquals("override", project.getProperty("test"));
|
---|
38 | }
|
---|
39 |
|
---|
40 | // ensure <tstamp>'s new prefix attribute is working
|
---|
41 | public void test2() {
|
---|
42 | executeTarget("test2");
|
---|
43 | assertNotNull(project.getProperty("DSTAMP"));
|
---|
44 | assertNotNull(project.getProperty("start.DSTAMP"));
|
---|
45 | }
|
---|
46 |
|
---|
47 | // ensure <tstamp> follows the immutability rule
|
---|
48 | public void test3() {
|
---|
49 | executeTarget("test3");
|
---|
50 | assertEquals("original", project.getProperty("DSTAMP"));
|
---|
51 | }
|
---|
52 |
|
---|
53 | // ensure <condition> follows the immutability rule
|
---|
54 | public void test4() {
|
---|
55 | executeTarget("test4");
|
---|
56 | assertEquals("original", project.getProperty("test"));
|
---|
57 | }
|
---|
58 | // ensure <checksum> follows the immutability rule
|
---|
59 | public void test5() {
|
---|
60 | executeTarget("test5");
|
---|
61 | assertEquals("original", project.getProperty("test"));
|
---|
62 | }
|
---|
63 |
|
---|
64 | // ensure <exec> follows the immutability rule
|
---|
65 | public void test6() {
|
---|
66 | executeTarget("test6");
|
---|
67 | assertEquals("original", project.getProperty("test1"));
|
---|
68 | assertEquals("original", project.getProperty("test2"));
|
---|
69 | }
|
---|
70 |
|
---|
71 | // ensure <pathconvert> follows the immutability rule
|
---|
72 | public void test7() {
|
---|
73 | executeTarget("test7");
|
---|
74 | assertEquals("original", project.getProperty("test"));
|
---|
75 | }
|
---|
76 | }
|
---|
77 |
|
---|