Author: vitold
Date: 2009-04-07 10:52:57 -0400 (Tue, 07 Apr 2009)
New Revision: 2331
Added:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/namespace/notdeclared/
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/namespace/notdeclared/NotDeclaredNamespaceTest.java
tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/xml/namespace/notdeclared/
tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/xml/namespace/notdeclared/beans.xml
tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/xml/namespace/notdeclared/namespace
Modified:
ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/ParseXmlHelper.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/metadata/XmlBasedMetadataTest.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/namespace/javaee/JavaEeNamespaceTest.java
tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/xml/metadata/beans.xml
tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/xml/metadata/schema.xsd
tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/xml/namespace/javaee/beans.xml
Log:
make some tck tests
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/ParseXmlHelper.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/ParseXmlHelper.java 2009-04-07
13:18:28 UTC (rev 2330)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/ParseXmlHelper.java 2009-04-07
14:52:57 UTC (rev 2331)
@@ -141,24 +141,29 @@
{
Namespace namespace = (Namespace) namespacesIterator.next();
String prefix = namespace.getPrefix();
- String uri = namespace.getURI();
- if (uri.startsWith(XmlConstants.URN_PREFIX))
+
+ for(String uri : namespace.getURI().split(" "))
{
- Set<String> packagesSet = new HashSet<String>();
+ if (uri.startsWith(XmlConstants.URN_PREFIX))
+ {
+ Set<String> packagesSet = new HashSet<String>();
- URL namespaceFile = environment.loadFileByUrn(uri,
XmlConstants.NAMESPACE_FILE_NAME);
- if (namespaceFile != null)
- {
- packagesSet.addAll(parseNamespaceFile(namespaceFile));
+ environment.loadFileByUrn(uri, XmlConstants.SCHEMA_FILE_NAME);
+
+ URL namespaceFile = environment.loadFileByUrn(uri,
XmlConstants.NAMESPACE_FILE_NAME);
+ if (namespaceFile != null)
+ {
+ packagesSet.addAll(parseNamespaceFile(namespaceFile));
+ }
+ else
+ {
+ String packageName = uri.replaceFirst(XmlConstants.URN_PREFIX,
"");
+ packagesSet.add(packageName);
+ }
+
+ addElementToPackagesMap(packagesMap, prefix, packagesSet);
}
- else
- {
- String packageName = uri.replaceFirst(XmlConstants.URN_PREFIX,
"");
- packagesSet.add(packageName);
- }
-
- addElementToPackagesMap(packagesMap, prefix, packagesSet);
- }
+ }
}
}
Modified:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/metadata/XmlBasedMetadataTest.java
===================================================================
---
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/metadata/XmlBasedMetadataTest.java 2009-04-07
13:18:28 UTC (rev 2330)
+++
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/metadata/XmlBasedMetadataTest.java 2009-04-07
14:52:57 UTC (rev 2331)
@@ -1,14 +1,11 @@
package org.jboss.jsr299.tck.tests.xml.metadata;
-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.metadata.foo.Order;
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.Resource;
import org.jboss.testharness.impl.packaging.Resources;
import org.jboss.testharness.impl.packaging.jsr299.BeansXml;
@@ -21,7 +18,6 @@
})
@Classes({Order.class})
@BeansXml("beans.xml")
-(a)ExpectedDeploymentException(DefinitionException.class)
public class XmlBasedMetadataTest extends AbstractJSR299Test
{
@Test
@@ -30,10 +26,12 @@
@SpecAssertion(section="9", id="b"),
@SpecAssertion(section="9", id="c"),
@SpecAssertion(section="9", id="d"),
- @SpecAssertion(section="9", id="e"),
@SpecAssertion(section="9.1", id="b"),
@SpecAssertion(section="9.1", id="c"),
- @SpecAssertion(section="9.1", id="d")
+ @SpecAssertion(section="9.1", id="d"),
+ @SpecAssertion(section="9.3", id="a"),
+ @SpecAssertion(section="9.3", id="b"),
+ @SpecAssertion(section="9.3", id="c")
})
public void testXmlBasedMetadata()
{
Modified:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/namespace/javaee/JavaEeNamespaceTest.java
===================================================================
---
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/namespace/javaee/JavaEeNamespaceTest.java 2009-04-07
13:18:28 UTC (rev 2330)
+++
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/namespace/javaee/JavaEeNamespaceTest.java 2009-04-07
14:52:57 UTC (rev 2331)
@@ -13,11 +13,10 @@
@Artifact
@Resources({
- @Resource(source="namespace",
destination="WEB-INF/classes/org/jboss/jsr299/tck/tests/xml/metadata/namespace")
+ @Resource(source="namespace",
destination="WEB-INF/classes/org/jboss/jsr299/tck/tests/xml/namespace/javaee/namespace")
})
@Classes({Order.class})
@BeansXml("beans.xml")
-//(a)ExpectedDeploymentException(DefinitionException.class)
public class JavaEeNamespaceTest extends AbstractJSR299Test
{
@Test
@@ -26,7 +25,9 @@
@SpecAssertion(section="9.2.1", id="b"),
@SpecAssertion(section="9.2.1", id="c"),
@SpecAssertion(section="9.2.1", id="d"),
- @SpecAssertion(section="9.2.1", id="e")
+ @SpecAssertion(section="9.2.1", id="e"),
+ @SpecAssertion(section="9.1", id="e"),
+ @SpecAssertion(section="9.1", id="f")
})
public void testJavaEeNamespace()
{
Added:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/namespace/notdeclared/NotDeclaredNamespaceTest.java
===================================================================
---
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/namespace/notdeclared/NotDeclaredNamespaceTest.java
(rev 0)
+++
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/namespace/notdeclared/NotDeclaredNamespaceTest.java 2009-04-07
14:52:57 UTC (rev 2331)
@@ -0,0 +1,34 @@
+package org.jboss.jsr299.tck.tests.xml.namespace.notdeclared;
+
+import javax.inject.DefinitionException;
+
+import org.hibernate.tck.annotations.SpecAssertion;
+import org.hibernate.tck.annotations.SpecAssertions;
+import org.jboss.jsr299.tck.tests.xml.metadata.foo.Order;
+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.Resource;
+import org.jboss.testharness.impl.packaging.Resources;
+import org.jboss.testharness.impl.packaging.jsr299.BeansXml;
+import org.testng.annotations.Test;
+
+@Artifact
+@Resources({
+ @Resource(source="namespace",
destination="WEB-INF/classes/org/jboss/jsr299/tck/tests/xml/namespace/notdeclared/namespace")
+})
+(a)Classes({Order.class})
+(a)ExpectedDeploymentException(DefinitionException.class)
+(a)BeansXml("beans.xml")
+public class NotDeclaredNamespaceTest
+{
+ @Test
+ @SpecAssertions({
+ @SpecAssertion(section="9", id="e")
+ })
+ public void testNotDeclaredNamespace()
+ {
+ assert true;
+ }
+
+}
Modified:
tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/xml/metadata/beans.xml
===================================================================
---
tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/xml/metadata/beans.xml 2009-04-07
13:18:28 UTC (rev 2330)
+++
tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/xml/metadata/beans.xml 2009-04-07
14:52:57 UTC (rev 2331)
@@ -1,16 +1,15 @@
-<Beans xmlns="urn:java:ee"
-
xmlns:test="http://www.w3.org/2001/XMLSchema-instance"
- test:schemaLocation="urn:java:ee
- urn:java:org.jboss.jsr299.tck.tests.xml.metadata
http://mydomain.com/myapp/schema-1.2.xsd">
+<Beans xmlns="urn:java:ee"
+ xmlns:dd="urn:java:ee urn:java:org.jboss.jsr299.tck.tests.xml.metadata"
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="urn:java:org.jboss.jsr299.tck.tests.xml.metadata
http://mydomain.com/myapp/schema-1.2.xsd">
<Deploy>
<Standard />
<Production />
- <test:AnotherDeploymentType />
+ <dd:AnotherDeploymentType />
</Deploy>
- <test:Order>
+ <dd:Order>
<RequestScoped />
- <test:str>hello</test:str>
- <test:getStr />
- <my:Type />
- </test:Order>
+ <dd:str>hello</dd:str>
+ <dd:getStr />
+ </dd:Order>
</Beans>
\ No newline at end of file
Modified:
tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/xml/metadata/schema.xsd
===================================================================
---
tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/xml/metadata/schema.xsd 2009-04-07
13:18:28 UTC (rev 2330)
+++
tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/xml/metadata/schema.xsd 2009-04-07
14:52:57 UTC (rev 2331)
@@ -0,0 +1,10 @@
+<xs:schema
xmlns:xs="http://www.w3.org/2001/XMLSchema">
+ <xs:element name="Beans">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:any namespace="##any" processContents="skip"
minOccurs="0" maxOccurs="unbounded" />
+ </xs:sequence>
+ <xs:anyAttribute/>
+ </xs:complexType>
+ </xs:element>
+</xs:schema>
\ No newline at end of file
Modified:
tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/xml/namespace/javaee/beans.xml
===================================================================
---
tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/xml/namespace/javaee/beans.xml 2009-04-07
13:18:28 UTC (rev 2330)
+++
tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/xml/namespace/javaee/beans.xml 2009-04-07
14:52:57 UTC (rev 2331)
@@ -11,6 +11,7 @@
<Array>
<String />
</Array>
+ <test:val/>
</test:Order>
<Decorators>
<test:TestDecorator />
Added:
tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/xml/namespace/notdeclared/beans.xml
===================================================================
---
tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/xml/namespace/notdeclared/beans.xml
(rev 0)
+++
tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/xml/namespace/notdeclared/beans.xml 2009-04-07
14:52:57 UTC (rev 2331)
@@ -0,0 +1,22 @@
+<Beans xmlns="urn:java:ee"
+ xmlns:test="urn:java:org.jboss.jsr299.tck.tests.xml.namespace.javaee">
+ <Deploy>
+ <Standard />
+ <Production />
+ <test:AnotherDeploymentType />
+ </Deploy>
+ <test:Order>
+ <RequestScoped />
+ <Integer />
+ <Array>
+ <String />
+ </Array>
+ </test:Order>
+ <Decorators>
+ <test:TestDecorator />
+ </Decorators>
+ <Interceptors>
+ <test:TestInterceptor />
+ </Interceptors>
+ <me:TestElement />
+</Beans>
\ No newline at end of file
Added:
tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/xml/namespace/notdeclared/namespace
===================================================================
---
tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/xml/namespace/notdeclared/namespace
(rev 0)
+++
tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/xml/namespace/notdeclared/namespace 2009-04-07
14:52:57 UTC (rev 2331)
@@ -0,0 +1,2 @@
+org.jboss.jsr299.tck.tests.xml.namespace.javaee
+org.jboss.jsr299.tck.tests.xml.namespace.javaee.foo
\ No newline at end of file