[webbeans-commits] Webbeans SVN: r2383 - tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/declaration and 13 other directories.
webbeans-commits at lists.jboss.org
webbeans-commits at lists.jboss.org
Fri Apr 10 05:53:32 EDT 2009
Author: vitold
Date: 2009-04-10 05:53:32 -0400 (Fri, 10 Apr 2009)
New Revision: 2383
Added:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/declaration/deployment/
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/declaration/deployment/DeploymentDeclarationTest.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/declaration/deployment/foo/
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/declaration/deployment/foo/NotDeploymentType.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/declaration/deployment/foo/TestDeploymentType.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/declaration/deployment/notvalid/
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/declaration/deployment/notvalid/multipledeclaration/
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/declaration/deployment/notvalid/multipledeclaration/MultipleDeclarationTest.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/declaration/deployment/notvalid/notdeploymenttype/
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/declaration/deployment/notvalid/notdeploymenttype/NotDeploymentTypeTest.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/declaration/deployment/notvalid/notjavatype/
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/declaration/deployment/notvalid/notjavatype/NotJavaTypeTest.java
tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/xml/declaration/
tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/xml/declaration/deployment/
tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/xml/declaration/deployment/beans.xml
tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/xml/declaration/deployment/notvalid/
tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/xml/declaration/deployment/notvalid/multipledeclaration/
tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/xml/declaration/deployment/notvalid/multipledeclaration/beans.xml
tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/xml/declaration/deployment/notvalid/notdeploymenttype/
tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/xml/declaration/deployment/notvalid/notdeploymenttype/beans.xml
tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/xml/declaration/deployment/notvalid/notjavatype/
tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/xml/declaration/deployment/notvalid/notjavatype/beans.xml
Modified:
ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/XmlParser.java
Log:
add some tests for 9.12.1
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/XmlParser.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/XmlParser.java 2009-04-09 23:54:39 UTC (rev 2382)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/XmlParser.java 2009-04-10 09:53:32 UTC (rev 2383)
@@ -7,7 +7,6 @@
import java.net.URL;
import java.util.ArrayList;
import java.util.HashMap;
-import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
@@ -271,30 +270,33 @@
return true;
}
- @SuppressWarnings("unchecked")
// TODO Make this object orientated
private List<Class<? extends Annotation>> obtainDeploymentTypes(Element element)
{
if (haveAnyDeployElement)
throw new DefinitionException("<Deploy> element is specified more than once");
- List<Element> deployElements = element.elements();
- Set<Element> deployElementsSet = new HashSet<Element>(deployElements);
- if(deployElements.size() - deployElementsSet.size() != 0)
- throw new DefinitionException("The same deployment type is declared more than once");
-
List<Element> standardElements = ParseXmlHelper.findElementsInEeNamespace(element, XmlConstants.STANDARD);
if (standardElements.size() == 0)
- throw new DeploymentException("The @Standard deployment type must be declared");
+ throw new DeploymentException("The @Standard deployment type must be declared");
List<Class<? extends Annotation>> deploymentClasses = new ArrayList<Class<? extends Annotation>>();
- List<Element> children = element.elements();
- for (Element child : children)
- {
- Class<? extends Annotation> deploymentClass = ParseXmlHelper.loadAnnotationClass(child, Annotation.class, environment, packagesMap);
+ Iterator<?> deployIterator = element.elementIterator();
+ while(deployIterator.hasNext())
+ {
+ Element deploymentElement = (Element)deployIterator.next();
+ String elementName = deploymentElement.getName();
+ String elementPrefix = deploymentElement.getNamespacePrefix();
+ String elementUri = deploymentElement.getNamespaceURI();
+ List<Element> deploymentElements = ParseXmlHelper.findElements(element, elementName, elementPrefix, elementUri);
+ if(deploymentElements.size() != 1)
+ throw new DefinitionException("The same deployment type '" + deploymentElement.getName() + "' is declared more than once");
+
+ Class<? extends Annotation> deploymentClass = ParseXmlHelper.loadAnnotationClass(deploymentElement, Annotation.class, environment, packagesMap);
+
if(!deploymentClass.isAnnotationPresent(DeploymentType.class))
- throw new DefinitionException("<Deploy> child <" + child.getName() + "> must be a deployment type");
+ throw new DefinitionException("<Deploy> child '" + deploymentElement.getName() + "' must be a deployment type");
deploymentClasses.add(deploymentClass);
}
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/declaration/deployment/DeploymentDeclarationTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/declaration/deployment/DeploymentDeclarationTest.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/declaration/deployment/DeploymentDeclarationTest.java 2009-04-10 09:53:32 UTC (rev 2383)
@@ -0,0 +1,26 @@
+package org.jboss.jsr299.tck.tests.xml.declaration.deployment;
+
+import org.hibernate.tck.annotations.SpecAssertion;
+import org.hibernate.tck.annotations.SpecAssertions;
+import org.jboss.jsr299.tck.AbstractJSR299Test;
+import org.jboss.jsr299.tck.tests.xml.declaration.deployment.foo.TestDeploymentType;
+import org.jboss.testharness.impl.packaging.Artifact;
+import org.jboss.testharness.impl.packaging.Classes;
+import org.jboss.testharness.impl.packaging.jsr299.BeansXml;
+import org.testng.annotations.Test;
+
+ at Artifact
+ at Classes({TestDeploymentType.class})
+ at BeansXml("beans.xml")
+public class DeploymentDeclarationTest extends AbstractJSR299Test
+{
+ @Test
+ @SpecAssertions({
+ @SpecAssertion(section="9.12", id="a"),
+ @SpecAssertion(section="9.12.1", id="a")
+ })
+ public void testDeploymentDeclaration()
+ {
+ assert true;
+ }
+}
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/declaration/deployment/foo/NotDeploymentType.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/declaration/deployment/foo/NotDeploymentType.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/declaration/deployment/foo/NotDeploymentType.java 2009-04-10 09:53:32 UTC (rev 2383)
@@ -0,0 +1,6 @@
+package org.jboss.jsr299.tck.tests.xml.declaration.deployment.foo;
+
+public @interface NotDeploymentType
+{
+
+}
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/declaration/deployment/foo/TestDeploymentType.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/declaration/deployment/foo/TestDeploymentType.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/declaration/deployment/foo/TestDeploymentType.java 2009-04-10 09:53:32 UTC (rev 2383)
@@ -0,0 +1,21 @@
+package org.jboss.jsr299.tck.tests.xml.declaration.deployment.foo;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import javax.inject.DeploymentType;
+
+ at Target( { TYPE, METHOD, FIELD })
+ at Retention(RUNTIME)
+ at Documented
+ at DeploymentType
+public @interface TestDeploymentType
+{
+
+}
\ No newline at end of file
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/declaration/deployment/notvalid/multipledeclaration/MultipleDeclarationTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/declaration/deployment/notvalid/multipledeclaration/MultipleDeclarationTest.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/declaration/deployment/notvalid/multipledeclaration/MultipleDeclarationTest.java 2009-04-10 09:53:32 UTC (rev 2383)
@@ -0,0 +1,29 @@
+package org.jboss.jsr299.tck.tests.xml.declaration.deployment.notvalid.multipledeclaration;
+
+import javax.inject.DefinitionException;
+
+import org.hibernate.tck.annotations.SpecAssertion;
+import org.hibernate.tck.annotations.SpecAssertions;
+import org.jboss.jsr299.tck.AbstractJSR299Test;
+import org.jboss.jsr299.tck.tests.xml.declaration.deployment.foo.TestDeploymentType;
+import org.jboss.testharness.impl.packaging.Artifact;
+import org.jboss.testharness.impl.packaging.Classes;
+import org.jboss.testharness.impl.packaging.ExpectedDeploymentException;
+import org.jboss.testharness.impl.packaging.jsr299.BeansXml;
+import org.testng.annotations.Test;
+
+ at Artifact
+ at Classes({TestDeploymentType.class })
+ at BeansXml("beans.xml")
+ at ExpectedDeploymentException(DefinitionException.class)
+public class MultipleDeclarationTest extends AbstractJSR299Test
+{
+ @Test
+ @SpecAssertions({
+ @SpecAssertion(section="9.12.1", id="c")
+ })
+ public void testMultipleDeclaration()
+ {
+ assert true;
+ }
+}
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/declaration/deployment/notvalid/notdeploymenttype/NotDeploymentTypeTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/declaration/deployment/notvalid/notdeploymenttype/NotDeploymentTypeTest.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/declaration/deployment/notvalid/notdeploymenttype/NotDeploymentTypeTest.java 2009-04-10 09:53:32 UTC (rev 2383)
@@ -0,0 +1,29 @@
+package org.jboss.jsr299.tck.tests.xml.declaration.deployment.notvalid.notdeploymenttype;
+
+import javax.inject.DefinitionException;
+
+import org.hibernate.tck.annotations.SpecAssertion;
+import org.hibernate.tck.annotations.SpecAssertions;
+import org.jboss.jsr299.tck.AbstractJSR299Test;
+import org.jboss.jsr299.tck.tests.xml.declaration.deployment.foo.NotDeploymentType;
+import org.jboss.testharness.impl.packaging.Artifact;
+import org.jboss.testharness.impl.packaging.Classes;
+import org.jboss.testharness.impl.packaging.ExpectedDeploymentException;
+import org.jboss.testharness.impl.packaging.jsr299.BeansXml;
+import org.testng.annotations.Test;
+
+ at Artifact
+ at Classes({NotDeploymentType.class})
+ at BeansXml("beans.xml")
+ at ExpectedDeploymentException(DefinitionException.class)
+public class NotDeploymentTypeTest extends AbstractJSR299Test
+{
+ @Test(groups="ri-broken")
+ @SpecAssertions({
+ @SpecAssertion(section="9.12.1", id="b")
+ })
+ public void testNotJavaType()
+ {
+ assert true;
+ }
+}
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/declaration/deployment/notvalid/notjavatype/NotJavaTypeTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/declaration/deployment/notvalid/notjavatype/NotJavaTypeTest.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/declaration/deployment/notvalid/notjavatype/NotJavaTypeTest.java 2009-04-10 09:53:32 UTC (rev 2383)
@@ -0,0 +1,26 @@
+package org.jboss.jsr299.tck.tests.xml.declaration.deployment.notvalid.notjavatype;
+
+import javax.inject.DefinitionException;
+
+import org.hibernate.tck.annotations.SpecAssertion;
+import org.hibernate.tck.annotations.SpecAssertions;
+import org.jboss.jsr299.tck.AbstractJSR299Test;
+import org.jboss.testharness.impl.packaging.Artifact;
+import org.jboss.testharness.impl.packaging.ExpectedDeploymentException;
+import org.jboss.testharness.impl.packaging.jsr299.BeansXml;
+import org.testng.annotations.Test;
+
+ at Artifact
+ at BeansXml("beans.xml")
+ at ExpectedDeploymentException(DefinitionException.class)
+public class NotJavaTypeTest extends AbstractJSR299Test
+{
+ @Test(groups="ri-broken")
+ @SpecAssertions({
+ @SpecAssertion(section="9.12.1", id="b")
+ })
+ public void testNotJavaType()
+ {
+ assert true;
+ }
+}
Added: tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/xml/declaration/deployment/beans.xml
===================================================================
--- tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/xml/declaration/deployment/beans.xml (rev 0)
+++ tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/xml/declaration/deployment/beans.xml 2009-04-10 09:53:32 UTC (rev 2383)
@@ -0,0 +1,8 @@
+<Beans xmlns="urn:java:ee"
+ xmlns:test="urn:java:org.jboss.jsr299.tck.tests.xml.declaration.deployment.foo">
+ <Deploy>
+ <Standard />
+ <Production />
+ <test:TestDeploymentType />
+ </Deploy>
+</Beans>
Added: tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/xml/declaration/deployment/notvalid/multipledeclaration/beans.xml
===================================================================
--- tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/xml/declaration/deployment/notvalid/multipledeclaration/beans.xml (rev 0)
+++ tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/xml/declaration/deployment/notvalid/multipledeclaration/beans.xml 2009-04-10 09:53:32 UTC (rev 2383)
@@ -0,0 +1,9 @@
+<Beans xmlns="urn:java:ee"
+ xmlns:test="urn:java:org.jboss.jsr299.tck.tests.xml.declaration.deployment.foo">
+ <Deploy>
+ <Standard />
+ <Production />
+ <test:TestDeploymentType />
+ <test:TestDeploymentType />
+ </Deploy>
+</Beans>
Added: tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/xml/declaration/deployment/notvalid/notdeploymenttype/beans.xml
===================================================================
--- tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/xml/declaration/deployment/notvalid/notdeploymenttype/beans.xml (rev 0)
+++ tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/xml/declaration/deployment/notvalid/notdeploymenttype/beans.xml 2009-04-10 09:53:32 UTC (rev 2383)
@@ -0,0 +1,8 @@
+<Beans xmlns="urn:java:ee"
+ xmlns:test="urn:java:org.jboss.jsr299.tck.tests.xml.declaration.deployment.foo">
+ <Deploy>
+ <Standard />
+ <Production />
+ <test:NotDeploymentType />
+ </Deploy>
+</Beans>
Added: tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/xml/declaration/deployment/notvalid/notjavatype/beans.xml
===================================================================
--- tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/xml/declaration/deployment/notvalid/notjavatype/beans.xml (rev 0)
+++ tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/xml/declaration/deployment/notvalid/notjavatype/beans.xml 2009-04-10 09:53:32 UTC (rev 2383)
@@ -0,0 +1,8 @@
+<Beans xmlns="urn:java:ee"
+ xmlns:test="urn:java:org.jboss.jsr299.tck.tests.xml.declaration.deployment.foo">
+ <Deploy>
+ <Standard />
+ <Production />
+ <test:NotJavaType />
+ </Deploy>
+</Beans>
More information about the weld-commits
mailing list