You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by bo...@apache.org on 2009/07/16 15:12:00 UTC

svn commit: r794666 - in /ant/core/trunk: docs/manual/CoreTasks/xmlproperty.html src/tests/antunit/taskdefs/xmlproperty-test.xml

Author: bodewig
Date: Thu Jul 16 13:12:00 2009
New Revision: 794666

URL: http://svn.apache.org/viewvc?rev=794666&view=rev
Log:
fix xmlproperty examples.  PR 43583

Modified:
    ant/core/trunk/docs/manual/CoreTasks/xmlproperty.html
    ant/core/trunk/src/tests/antunit/taskdefs/xmlproperty-test.xml

Modified: ant/core/trunk/docs/manual/CoreTasks/xmlproperty.html
URL: http://svn.apache.org/viewvc/ant/core/trunk/docs/manual/CoreTasks/xmlproperty.html?rev=794666&r1=794665&r2=794666&view=diff
==============================================================================
--- ant/core/trunk/docs/manual/CoreTasks/xmlproperty.html (original)
+++ ant/core/trunk/docs/manual/CoreTasks/xmlproperty.html Thu Jul 16 13:12:00 2009
@@ -237,7 +237,7 @@
 
 <h5>default loading (semanticAttributes=true)</h5>
 <p>This entry in a build file:
-<pre>   &lt;xmlproperty file="somefile.xml"
+<pre>   &lt;xmlproperty file="somefile.xml" keepRoot="false"
                 semanticAttributes="true"/&gt;</pre>
 is equivalent to the following entries in a build file:
 <pre>
@@ -246,22 +246,22 @@
   &lt;property name="build.classes" location="${build.folder}/classes" id="build.classes"/&gt;
   &lt;property name="build.reference" refid="build.classes"/&gt;
 
-  &lt;property name="run-time.jars" value="*.jar/&gt;
+  &lt;property name="run-time.jars" value="*.jar"/&gt;
 
-  &lt;classpath id="compile.classpath"&gt;
+  &lt;path id="compile.classpath"&gt;
     &lt;pathelement location="${build.classes}"/&gt;
-  &lt;/classpath&gt;
+  &lt;/path&gt;
 
-  &lt;classpath id="run-time.classpath"&gt;
+  &lt;path id="run-time.classpath"&gt;
     &lt;path refid="compile.classpath"/&gt;
     &lt;pathelement path="${run-time.jars}"/&gt;
-  &lt;/classpath&gt;
+  &lt;/path&gt;
 </pre>
 
 <h5>includeSemanticAttribute="true"</h5>
 <p>This entry in a build file:
 <pre>   &lt;xmlproperty file="somefile.xml"
-                semanticAttributes="true"
+                semanticAttributes="true" keepRoot="false"
                 includeSemanticAttribute="true"/&gt;
 </pre>
 is equivalent to the following entries in a build file:
@@ -269,18 +269,18 @@
   &lt;property name="version.value" value="0.0.1"/&gt;
   &lt;property name="build.folder" value="build"/&gt;
   &lt;property name="build.classes.location" location="${build.folder}/classes"/&gt;
-  &lt;property name="build.reference.refid" refid="build.location"/&gt;
+  &lt;property name="build.reference.refid" refid="build.classes"/&gt;
 
-  &lt;property name="run-time.jars" value="*.jar/&gt;
+  &lt;property name="run-time.jars" value="*.jar"/&gt;
 
-  &lt;classpath id="compile.classpath"&gt;
+  &lt;path id="compile.classpath"&gt;
     &lt;pathelement location="${build.classes}"/&gt;
-  &lt;/classpath&gt;
+  &lt;/path&gt;
 
-  &lt;classpath id="run-time.classpath"&gt;
+  &lt;path id="run-time.classpath"&gt;
     &lt;path refid="compile.classpath"/&gt;
     &lt;pathelement path="${run-time.jars}"/&gt;
-  &lt;/classpath&gt;
+  &lt;/path&gt;
 </pre>
 
 

Modified: ant/core/trunk/src/tests/antunit/taskdefs/xmlproperty-test.xml
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/tests/antunit/taskdefs/xmlproperty-test.xml?rev=794666&r1=794665&r2=794666&view=diff
==============================================================================
--- ant/core/trunk/src/tests/antunit/taskdefs/xmlproperty-test.xml (original)
+++ ant/core/trunk/src/tests/antunit/taskdefs/xmlproperty-test.xml Thu Jul 16 13:12:00 2009
@@ -15,8 +15,11 @@
   See the License for the specific language governing permissions and
   limitations under the License.
 -->
-<project xmlns:au="antlib:org.apache.ant.antunit">
+<project default="antunit" xmlns:au="antlib:org.apache.ant.antunit">
   <description/>
+
+  <import file="../antunit-base.xml" />
+
   <target name="test-empty">
     <xmlproperty file="xmlproperty-test.xml"/>
     <au:assertTrue>
@@ -64,5 +67,78 @@
       </condition>
     </fail>
   </target>
+
+  <target name="createDocExample">
+    <mkdir dir="${input}"/>
+    <echoxml file="${input}/example.xml">
+      <root-tag>
+        <version value="0.0.1"/>
+        <build folder="build">
+          <classes id="build.classes" location="${build.folder}/classes"/>
+          <reference refid="build.classes"/>
+        </build>
+        <compile>
+          <classpath pathid="compile.classpath">
+            <pathelement location="${build.classes}"/>
+          </classpath>
+        </compile>
+        <run-time>
+          <jars>*.jar</jars>
+          <classpath pathid="run-time.classpath">
+            <path refid="compile.classpath"/>
+            <pathelement path="${run-time.jars}"/>
+          </classpath>
+        </run-time>
+      </root-tag>
+    </echoxml>
+  </target>
+
+  <target name="testSemanticLoadingDocExample" depends="createDocExample">
+    <xmlproperty file="${input}/example.xml" semanticAttributes="true"
+                 keepRoot="false"/>
+
+    <au:assertPropertyEquals name="version" value="0.0.1"/>
+    <au:assertPropertyEquals name="build.folder" value="build"/>
+    <property name="b.c" location="${build.folder}/classes"/>
+    <au:assertPropertyEquals name="build.classes" value="${b.c}"/>
+    <au:assertReferenceSet refid="build.classes"/>
+    <property name="b.c.r" refid="build.classes"/>
+    <au:assertPropertyEquals name="b.c.r" value="${b.c}"/>
+    <au:assertPropertyEquals name="build.reference" value="${b.c}"/>
+    <au:assertPropertyEquals name="run-time.jars" value="*.jar"/>
+    <au:assertReferenceIsType refid="compile.classpath" type="path"/>
+    <au:assertReferenceIsType refid="run-time.classpath" type="path"/>
+    <property name="c.c" refid="compile.classpath"/>
+    <au:assertPropertyEquals name="c.c" value="${b.c}"/>
+    <property name="rt.c" refid="run-time.classpath"/>
+    <property name="glob.dot.jar" location="*.jar"/>
+    <au:assertPropertyEquals name="rt.c"
+                             value="${b.c}${path.separator}${glob.dot.jar}"/>
+  </target>
+
+  <target name="testIncludeSemanticDocExample" depends="createDocExample">
+    <xmlproperty file="${input}/example.xml" semanticAttributes="true"
+                 keepRoot="false" includeSemanticAttribute="true"/>
+
+    <au:assertPropertyEquals name="version.value" value="0.0.1"/>
+    <au:assertPropertyEquals name="build.folder" value="build"/>
+    <property name="b.c" location="${build.folder}/classes"/>
+    <au:assertPropertyEquals name="build.classes.location" value="${b.c}"/>
+    <au:assertReferenceSet refid="build.classes"/>
+    <property name="b.c.r" refid="build.classes"/>
+    <au:assertPropertyEquals name="b.c.r" value="${b.c}"/>
+    <au:assertPropertyEquals name="build.reference" value="${b.c}"/>
+    <au:assertPropertyEquals name="run-time.jars" value="*.jar"/>
+    <au:assertReferenceIsType refid="compile.classpath" type="path"/>
+    <au:assertReferenceIsType refid="run-time.classpath" type="path"/>
+    <property name="c.c" refid="compile.classpath"/>
+    <!-- not set at all because property's name is build.classes.refid now -->
+    <property name="b.c.loc" location="${build.classes}"/>
+    <au:assertPropertyEquals name="c.c" value="${b.c.loc}"/>
+    <property name="rt.c" refid="run-time.classpath"/>
+    <property name="glob.dot.jar" location="*.jar"/>
+    <au:assertPropertyEquals name="rt.c"
+                             value="${b.c.loc}${path.separator}${glob.dot.jar}"/>
+  </target>
 </project>