summaryrefslogtreecommitdiffstats
path: root/test/antunit/property/propertycopy.xml
blob: 87f5d6e799bd8628fe1fcbd6bb9e81e5757a4602 (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
<project name="propertycopy"
         xmlns:au="antlib:org.apache.ant.antunit"
         xmlns:antcontrib="antlib:net.sf.antcontrib">
    <import file="../common.xml" />
  
    <target name="testCopy">
        <property name="org" value="MyOrg" />
        <property name="org.MyOrg.DisplayName" value="My Organiziation" />
        <antcontrib:propertycopy name="displayName" from="org.${org}.DisplayName" />

        <au:assertPropertyEquals name="displayName"
                                 value="${org.MyOrg.DisplayName}"
                                 message="displayName failed" />
      </target>
  
    <target name="testSilent">
        <antcontrib:propertycopy name="foo" from="bar" silent="true"/>
        <au:assertTrue>
            <not>
                <isset property="foo" />
            </not>
        </au:assertTrue>
    </target>

    <target name="testNotSilent">
        <au:expectfailure expectedmessage="Property 'bar' is not defined.">
            <antcontrib:propertycopy name="foo" from="bar"/>
        </au:expectfailure>
    </target>

    <target name="testMissingName">
        <au:expectfailure expectedmessage="You must specify a property to set.">
            <antcontrib:propertycopy from="bar"/>
        </au:expectfailure>
    </target>

    <target name="testMissingFrom">
        <au:expectfailure expectedmessage="Missing the 'from' attribute.">
            <antcontrib:propertycopy name="foo"/>
        </au:expectfailure>
    </target>
</project>