summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--test/antunit/common.xml37
-rw-r--r--test/antunit/property/propertycopy.xml42
-rw-r--r--test/antunit/property/propertyslector.xml44
3 files changed, 123 insertions, 0 deletions
diff --git a/test/antunit/common.xml b/test/antunit/common.xml
new file mode 100644
index 0000000..3968898
--- /dev/null
+++ b/test/antunit/common.xml
@@ -0,0 +1,37 @@
+<project name="common"
+ xmlns:au="antlib:org.apache.ant.antunit"
+ xmlns:antcontrib="antlib:net.sf.antcontrib"
+ xmlns:ivy="antlib:fr.jayasoft.ivy.ant">
+
+ <target name="setUp">
+ <dirname property="common.dir" file="${ant.file.common}" />
+ <property name="root.dir" location="${common.dir}/../../" />
+ <path id="ivy.lib.path">
+ <fileset dir="${root.dir}/lib/ivy/jars" includes="ivy-1.3.1.jar"/>
+ <fileset dir="${root.dir}/lib/commons-cli/jars" includes="commons-cli-1.0.jar"/>
+ <fileset dir="${root.dir}/lib/commons-codec/jars" includes="commons-codec-1.3.jar"/>
+ <fileset dir="${root.dir}/lib/commons-httpclient/jars" includes="commons-httpclient-3.0.1.jar"/>
+ <fileset dir="${root.dir}/lib/commons-logging/jars" includes="commons-logging-1.0.4.jar"/>
+ <fileset dir="${root.dir}/lib/oro/jars" includes="oro-2.0.8.jar"/>
+ </path>
+
+ <taskdef resource="fr/jayasoft/ivy/ant/antlib.xml"
+ uri="antlib:fr.jayasoft.ivy.ant"
+ classpathref="ivy.lib.path"/>
+
+ <ivy:configure file="${root.dir}/ivy-conf.xml" />
+ <ivy:resolve file="${root.dir}/ivy.xml" />
+ <ivy:cachepath pathid="test.classpath" type="jar" conf="test" />
+ <taskdef resource="net/sf/antcontrib/antlib.xml"
+ uri="antlib:net.sf.antcontrib">
+ <classpath>
+ <pathelement location="${root.dir}/target/classes" />
+ <path refid="test.classpath" />
+ </classpath>
+ </taskdef>
+ </target>
+
+ <target name="tearDown">
+ </target>
+
+</project> \ No newline at end of file
diff --git a/test/antunit/property/propertycopy.xml b/test/antunit/property/propertycopy.xml
new file mode 100644
index 0000000..87f5d6e
--- /dev/null
+++ b/test/antunit/property/propertycopy.xml
@@ -0,0 +1,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> \ No newline at end of file
diff --git a/test/antunit/property/propertyslector.xml b/test/antunit/property/propertyslector.xml
new file mode 100644
index 0000000..016f159
--- /dev/null
+++ b/test/antunit/property/propertyslector.xml
@@ -0,0 +1,44 @@
+<project name="propertycopy"
+ xmlns:au="antlib:org.apache.ant.antunit"
+ xmlns:antcontrib="antlib:net.sf.antcontrib">
+ <import file="../common.xml" />
+
+ <property name="module.Module1.id" value="1" />
+ <property name="module.Module1.name" value="Module 1" />
+ <property name="module.Module2.id" value="2" />
+ <property name="module.Module2.name" value="Module 2" />
+ <property name="module.Module2.foo.id" value="3" />
+ <property name="module.Module2.foo.name" value="Module 3" />
+
+ <target name="testGrouping0">
+ <antcontrib:propertyselector property="module.list"
+ match="module\.([^\.]*)\.id"
+ delimiter=","
+ casesensitive="false" />
+
+ <au:assertTrue>
+ <and>
+ <contains string="${module.list}" substring="module.Module1.id" />
+ <contains string="${module.list}" substring="module.Module2.id" />
+ <not><contains string="${module.list}" substring="module.Module3.foo.id" /></not>
+ </and>
+ </au:assertTrue>
+ </target>
+
+ <target name="testGrouping1">
+ <antcontrib:propertyselector property="module.list"
+ match="module\.([^\.]*)\.id"
+ select="\1"
+ delimiter=","
+ casesensitive="false" />
+ <au:assertTrue>
+ <and>
+ <not><contains string="${module.list}" substring="module." /></not>
+ <not><contains string="${module.list}" substring=".id" /></not>
+ <contains string="${module.list}" substring="Module1" />
+ <contains string="${module.list}" substring="Module2" />
+ <not><contains string="${module.list}" substring="Module3" /></not>
+ </and>
+ </au:assertTrue>
+ </target>
+</project> \ No newline at end of file