This is an automated email from the ASF dual-hosted git repository.

asf-gitbox-commits pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/ant-antlibs-cyclonedx.git


The following commit(s) were added to refs/heads/main by this push:
     new aebc4fd  test refid handling
aebc4fd is described below

commit aebc4fd0a02cd59485903e4f027384bdc9021937
Author: Stefan Bodewig <[email protected]>
AuthorDate: Fri May 15 16:32:31 2026 +0200

    test refid handling
---
 src/tests/antunit/component-test.xml | 183 +++++++++++++++++++++++++++++++++++
 1 file changed, 183 insertions(+)

diff --git a/src/tests/antunit/component-test.xml 
b/src/tests/antunit/component-test.xml
index 4952b97..c4413d9 100644
--- a/src/tests/antunit/component-test.xml
+++ b/src/tests/antunit/component-test.xml
@@ -565,4 +565,187 @@
     </au:expectfailure>
   </target>
 
+  <target
+      name="testComponentWithRefIdDoesntAllowOtherAttributes">
+    <cdx:component name="foo" bomRef="foo" id="foo"
+                   xmlns:cdx="antlib:org.apache.ant.cyclonedx"/>
+    <au:expectfailure
+        expectedMessage='You must not specify more than one attribute when 
using refid'
+        xmlns:au="antlib:org.apache.ant.antunit">
+      <cdx:component name="foo" refid="foo"
+                     xmlns:cdx="antlib:org.apache.ant.cyclonedx"/>
+    </au:expectfailure>
+    <au:expectfailure
+        expectedMessage='You must not specify more than one attribute when 
using refid'
+        xmlns:au="antlib:org.apache.ant.antunit">
+      <cdx:component type="library" refid="foo"
+                     xmlns:cdx="antlib:org.apache.ant.cyclonedx"/>
+    </au:expectfailure>
+    <au:expectfailure
+        expectedMessage='You must not specify more than one attribute when 
using refid'
+        xmlns:au="antlib:org.apache.ant.antunit">
+      <cdx:component group="foo" refid="foo"
+                     xmlns:cdx="antlib:org.apache.ant.cyclonedx"/>
+    </au:expectfailure>
+    <au:expectfailure
+        expectedMessage='You must not specify more than one attribute when 
using refid'
+        xmlns:au="antlib:org.apache.ant.antunit">
+      <cdx:component version="1.0" refid="foo"
+                     xmlns:cdx="antlib:org.apache.ant.cyclonedx"/>
+    </au:expectfailure>
+    <au:expectfailure
+        expectedMessage='You must not specify more than one attribute when 
using refid'
+        xmlns:au="antlib:org.apache.ant.antunit">
+      <cdx:component purl="foo" refid="foo"
+                     xmlns:cdx="antlib:org.apache.ant.cyclonedx"/>
+    </au:expectfailure>
+    <au:expectfailure
+        expectedMessage='You must not specify more than one attribute when 
using refid'
+        xmlns:au="antlib:org.apache.ant.antunit">
+      <cdx:component bomRef="foo" refid="foo"
+                     xmlns:cdx="antlib:org.apache.ant.cyclonedx"/>
+    </au:expectfailure>
+    <au:expectfailure
+        expectedMessage='You must not specify more than one attribute when 
using refid'
+        xmlns:au="antlib:org.apache.ant.antunit">
+      <cdx:component scope="optional" refid="foo"
+                     xmlns:cdx="antlib:org.apache.ant.cyclonedx"/>
+    </au:expectfailure>
+    <au:expectfailure
+        expectedMessage='You must not specify more than one attribute when 
using refid'
+        xmlns:au="antlib:org.apache.ant.antunit">
+      <cdx:component isExternal="false" refid="foo"
+                     xmlns:cdx="antlib:org.apache.ant.cyclonedx"/>
+    </au:expectfailure>
+    <au:expectfailure
+        expectedMessage='You must not specify more than one attribute when 
using refid'
+        xmlns:au="antlib:org.apache.ant.antunit">
+      <cdx:component description="foo" refid="foo"
+                     xmlns:cdx="antlib:org.apache.ant.cyclonedx"/>
+    </au:expectfailure>
+    <au:expectfailure
+        expectedMessage='You must not specify more than one attribute when 
using refid'
+        xmlns:au="antlib:org.apache.ant.antunit">
+      <cdx:component publisher="foo" refid="foo"
+                     xmlns:cdx="antlib:org.apache.ant.cyclonedx"/>
+    </au:expectfailure>
+    <au:expectfailure
+        expectedMessage='You must not specify more than one attribute when 
using refid'
+        xmlns:au="antlib:org.apache.ant.antunit">
+      <cdx:component copyright="foo" refid="foo"
+                     xmlns:cdx="antlib:org.apache.ant.cyclonedx"/>
+    </au:expectfailure>
+    <au:expectfailure
+        expectedMessage='You must not specify more than one attribute when 
using refid'
+        xmlns:au="antlib:org.apache.ant.antunit">
+      <cdx:component mimetype="foo" refid="foo"
+                     xmlns:cdx="antlib:org.apache.ant.cyclonedx"/>
+    </au:expectfailure>
+    <au:expectfailure
+        expectedMessage='You must not specify more than one attribute when 
using refid'
+        xmlns:au="antlib:org.apache.ant.antunit">
+      <cdx:component unknownDependencies="false" refid="foo"
+                     xmlns:cdx="antlib:org.apache.ant.cyclonedx"/>
+    </au:expectfailure>
+    <au:expectfailure
+        expectedMessage='You must not specify more than one attribute when 
using refid'
+        xmlns:au="antlib:org.apache.ant.antunit">
+      <cdx:component manufacturerIsSupplier="false" refid="foo"
+                     xmlns:cdx="antlib:org.apache.ant.cyclonedx"/>
+    </au:expectfailure>
+  </target>
+
+  <target
+      name="testComponentWithRefIdDoesntAllowNestedChildren">
+    <cdx:component name="foo" bomRef="foo" id="foo"
+                   xmlns:cdx="antlib:org.apache.ant.cyclonedx"/>
+    <au:expectfailure
+        expectedMessage='You must not specify nested elements when using refid'
+        xmlns:au="antlib:org.apache.ant.antunit">
+      <cdx:component refid="foo"
+                     xmlns:cdx="antlib:org.apache.ant.cyclonedx">
+        <file file="${ant.file}"/>
+      </cdx:component>
+    </au:expectfailure>
+    <au:expectfailure
+        expectedMessage='You must not specify nested elements when using refid'
+        xmlns:au="antlib:org.apache.ant.antunit">
+      <cdx:component refid="foo"
+                     xmlns:cdx="antlib:org.apache.ant.cyclonedx">
+        <manufacturer/>
+      </cdx:component>
+    </au:expectfailure>
+    <au:expectfailure
+        expectedMessage='You must not specify nested elements when using refid'
+        xmlns:au="antlib:org.apache.ant.antunit">
+      <cdx:component refid="foo"
+                     xmlns:cdx="antlib:org.apache.ant.cyclonedx">
+        <supplier/>
+      </cdx:component>
+    </au:expectfailure>
+    <au:expectfailure
+        expectedMessage='You must not specify nested elements when using refid'
+        xmlns:au="antlib:org.apache.ant.antunit">
+      <cdx:component refid="foo"
+                     xmlns:cdx="antlib:org.apache.ant.cyclonedx">
+        <author/>
+      </cdx:component>
+    </au:expectfailure>
+    <au:expectfailure
+        expectedMessage='You must not specify nested elements when using refid'
+        xmlns:au="antlib:org.apache.ant.antunit">
+      <cdx:component refid="foo"
+                     xmlns:cdx="antlib:org.apache.ant.cyclonedx">
+        <tag/>
+      </cdx:component>
+    </au:expectfailure>
+    <au:expectfailure
+        expectedMessage='You must not specify nested elements when using refid'
+        xmlns:au="antlib:org.apache.ant.antunit">
+      <cdx:component refid="foo"
+                     xmlns:cdx="antlib:org.apache.ant.cyclonedx">
+        <property/>
+      </cdx:component>
+    </au:expectfailure>
+    <au:expectfailure
+        expectedMessage='You must not specify nested elements when using refid'
+        xmlns:au="antlib:org.apache.ant.antunit">
+      <cdx:component refid="foo"
+                     xmlns:cdx="antlib:org.apache.ant.cyclonedx">
+        <license/>
+      </cdx:component>
+    </au:expectfailure>
+    <au:expectfailure
+        expectedMessage='You must not specify nested elements when using refid'
+        xmlns:au="antlib:org.apache.ant.antunit">
+      <cdx:component refid="foo"
+                     xmlns:cdx="antlib:org.apache.ant.cyclonedx">
+        <externalReference/>
+      </cdx:component>
+    </au:expectfailure>
+    <au:expectfailure
+        expectedMessage='You must not specify nested elements when using refid'
+        xmlns:au="antlib:org.apache.ant.antunit">
+      <cdx:component refid="foo"
+                     xmlns:cdx="antlib:org.apache.ant.cyclonedx">
+        <externalreferenceset/>
+      </cdx:component>
+    </au:expectfailure>
+    <au:expectfailure
+        expectedMessage='You must not specify nested elements when using refid'
+        xmlns:au="antlib:org.apache.ant.antunit">
+      <cdx:component refid="foo"
+                     xmlns:cdx="antlib:org.apache.ant.cyclonedx">
+        <dependency/>
+      </cdx:component>
+    </au:expectfailure>
+    <au:expectfailure
+        expectedMessage='You must not specify nested elements when using refid'
+        xmlns:au="antlib:org.apache.ant.antunit">
+      <cdx:component refid="foo"
+                     xmlns:cdx="antlib:org.apache.ant.cyclonedx">
+        <component/>
+      </cdx:component>
+    </au:expectfailure>
+  </target>
 </project>

Reply via email to