aboutsummaryrefslogtreecommitdiffstats
path: root/framework/src/ant/apache-ant-1.9.6/src/etc/testcases/taskdefs/optional/propertyfile.xml
blob: 20a17271b7c42ae781d26422f5ab4f3a9669f0f0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
<?xml version="1.0"?>
<!--
  Licensed to the Apache Software Foundation (ASF) under one or more
  contributor license agreements.  See the NOTICE file distributed with
  this work for additional information regarding copyright ownership.
  The ASF licenses this file to You under the Apache License, Version 2.0
  (the "License"); you may not use this file except in compliance with
  the License.  You may obtain a copy of the License at

      http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
-->

<project name="propertyfile-test" default="main" basedir=".">

  <import file="../../buildfiletest-base.xml"/>

  <target name="setUp">
    <mkdir dir="${output}" />
  </target>

  <property file="${output}/propertyfile.build.properties"/>

   <target name="main">
      <fail>
         This file is for testing purposes only...
         @see PropertyFileTest.java for more info.
      </fail>
   </target>

   <target name="update-existing-properties">
      <propertyfile
          file="${output}/${test.propertyfile}"
          comment="unit test for the property file task..." >
        <entry  key="firstname" value="${firstname}" />
        <entry  key="lastname"  value="${lastname}" />
        <entry  key="email"     value="${email}" />
        <entry  key="phone"     default="${phone}" />
        <entry  key="age"       default="${age}" type="int"/>
        <entry  key="date"      default="${date}" type="date"/>
      </propertyfile>
   </target>

   <target name="delete-properties">
    <echoproperties/>
      <propertyfile
          file="${output}/${test.propertyfile}"
          comment="unit test for the property file task..." >
        <entry  key="firstname" operation="del" />
      </propertyfile>
   </target>

   <target name="exercise">
     <propertyfile file="${output}/${test.propertyfile}">
        <entry key="existing.prop"
               type="int"
               default="23"/>
        <entry key="ethans.birth"
               value="2002/01/21 12:18"
               type="date"/>
        <entry key="first.birthday"
               value="1"
               default="2002/01/21"
               pattern="yyyy/MM/dd"
               unit="year"
               type="date"
               operation="+"/>
        <entry key="int.with.default"
               value="1"
               default="2"
               operation="+"
               type="int"/>
        <entry key="int.without.value"
               default="5"
               operation="+"
               type="int"/>
        <entry key="int.without.default"
               value="1"
               operation="+"
               type="int"/>
        <entry key="string.with.default"
               value="&gt;"
               default="--"
               operation="+"/>
        <entry key="string.without.default"
               value="."
               operation="+"/>
        <entry key="olderThanAWeek"
               type="date"
               default="0201"
               operation="-"
               value="8"
               pattern="MMdd"/>
     </propertyfile>
     <property file="${output}/${test.propertyfile}"/>
   </target>
   
    <target name="createfile">
       <echo file="${output}/${overwrite.test.propertyfile}">
 foo=3
       </echo>
    </target>
    
    <target name="bugDemo1" depends="createfile,bugDemoInit"/>
    
    <target name="bugDemo2" depends="bugDemoInit">
        <property file="${output}/${overwrite.test.propertyfile}"/>
    </target>

    <target name="bugDemoInit">
       <propertyfile file="${output}/${overwrite.test.propertyfile}">
          <entry key="foo" default="0" value="1" operation="+" type="int"/>
       </propertyfile>
    </target>

</project>