[shrinkwrap-issues] [JBoss JIRA] (SHRINKWRAP-398) Descriptors 2.0 module creates duplicate <alternatives/> entries (test case attached)
Craig Ringer (JIRA)
jira-events at lists.jboss.org
Fri Apr 13 06:13:47 EDT 2012
[ https://issues.jboss.org/browse/SHRINKWRAP-398?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Craig Ringer updated SHRINKWRAP-398:
------------------------------------
Description:
Using: org.jboss.shrinkwrap.descriptors:shrinkwrap-descriptors-impl-javaee:jar:2.0.0-alpha-2
The attached test case produces an invalid beans.xml with a duplicate <alternatives/> entry with the code:
{code}
BeansDescriptor beansXml = Descriptors.importAs(BeansDescriptor.class)
.from(new File("src/main/webapp/WEB-INF/beans.xml"))
.getOrCreateAlternatives();
{code}
'getOrCreate' is in fact always creating an alternatives entry, so the following beans.xml is produced in the example:
{code}
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<beans xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/beans_1_0.xsd">
<alternatives>
<alternative>com.example.shrinkwraptestskeleton.Production</alternative>
</alternatives>
<alternatives/>
</beans>
{code}
Also: Since there can only ever be one <alternatives/> block, it's not clear what the difference between getOrCreateAlternatives() and createAlternatives() is. Is the latter supposed to *replace* any existing block?
The API for managing alternatives is in Descriptors 2.0 is IMO difficult to use and understand. Issues with examples pending.
was:
Using: org.jboss.shrinkwrap.descriptors:shrinkwrap-descriptors-impl-javaee:jar:2.0.0-alpha-2
The attached test case produces an invalid beans.xml with a duplicate <alternatives/> entry with the code:
BeansDescriptor beansXml = Descriptors.importAs(BeansDescriptor.class)
.from(new File("src/main/webapp/WEB-INF/beans.xml"))
.getOrCreateAlternatives();
'getOrCreate' is in fact always creating an alternatives entry.
Also: Since there can only ever be one <alternatives/> block, it's not clear what the difference between getOrCreateAlternatives() and createAlternatives() is. Is the latter supposed to *replace* any existing block?
The API for managing alternatives is in Descriptors 2.0 is IMO difficult to use and understand. Issues with examples pending.
> Descriptors 2.0 module creates duplicate <alternatives/> entries (test case attached)
> -------------------------------------------------------------------------------------
>
> Key: SHRINKWRAP-398
> URL: https://issues.jboss.org/browse/SHRINKWRAP-398
> Project: ShrinkWrap
> Issue Type: Bug
> Components: ext-descriptors
> Affects Versions: 1.0.0
> Environment: java version "1.7.0_01"
> Java(TM) SE Runtime Environment (build 1.7.0_01-b08)
> Java HotSpot(TM) 64-Bit Server VM (build 21.1-b02, mixed mode)
> Linux ayaki.localdomain 3.3.0-4.fc16.x86_64 #1 SMP Tue Mar 20 18:05:40 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux
> Reporter: Craig Ringer
> Labels: arquillian, beans, beans.xml, descriptors, shrinkwrap
> Attachments: ArquillianShrinkwrapDuplicateAlternatives.zip
>
>
> Using: org.jboss.shrinkwrap.descriptors:shrinkwrap-descriptors-impl-javaee:jar:2.0.0-alpha-2
> The attached test case produces an invalid beans.xml with a duplicate <alternatives/> entry with the code:
> {code}
> BeansDescriptor beansXml = Descriptors.importAs(BeansDescriptor.class)
> .from(new File("src/main/webapp/WEB-INF/beans.xml"))
> .getOrCreateAlternatives();
> {code}
> 'getOrCreate' is in fact always creating an alternatives entry, so the following beans.xml is produced in the example:
> {code}
> <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
> <beans xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/beans_1_0.xsd">
> <alternatives>
> <alternative>com.example.shrinkwraptestskeleton.Production</alternative>
> </alternatives>
> <alternatives/>
> </beans>
> {code}
> Also: Since there can only ever be one <alternatives/> block, it's not clear what the difference between getOrCreateAlternatives() and createAlternatives() is. Is the latter supposed to *replace* any existing block?
> The API for managing alternatives is in Descriptors 2.0 is IMO difficult to use and understand. Issues with examples pending.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.jboss.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the shrinkwrap-issues
mailing list