Author: vitold
Date: 2009-03-17 10:36:58 -0400 (Tue, 17 Mar 2009)
New Revision: 2070
Modified:
ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/xml/parser/XmlParserImplTest.java
Log:
some changes with testing xml parser
Modified:
ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/xml/parser/XmlParserImplTest.java
===================================================================
---
ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/xml/parser/XmlParserImplTest.java 2009-03-17
14:16:49 UTC (rev 2069)
+++
ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/xml/parser/XmlParserImplTest.java 2009-03-17
14:36:58 UTC (rev 2070)
@@ -1,6 +1,5 @@
package org.jboss.webbeans.test.unit.xml.parser;
-import java.lang.reflect.AnnotatedElement;
import java.net.URL;
import java.util.HashSet;
import java.util.Set;
@@ -9,9 +8,13 @@
import org.jboss.testharness.impl.packaging.Classes;
import org.jboss.testharness.impl.packaging.Resource;
import org.jboss.testharness.impl.packaging.Resources;
+import org.jboss.webbeans.introspector.AnnotatedClass;
+import org.jboss.webbeans.introspector.AnnotatedItem;
+import org.jboss.webbeans.resources.DefaultResourceLoader;
import org.jboss.webbeans.test.unit.AbstractWebBeansTest;
import org.jboss.webbeans.test.unit.xml.beans.Order;
import org.jboss.webbeans.util.xml.XmlParserImpl;
+import org.jboss.webbeans.xml.XmlParserEnvironment;
import org.testng.annotations.Test;
@Artifact
@@ -24,6 +27,9 @@
@Test
public void testParse()
{
+ XmlParserEnvironment parserEnv = new XmlParserEnvironment(new
DefaultResourceLoader(), getResources("beans.xml"));
+ AnnotatedClass<?> aClass =
parserEnv.loadClass("org.jboss.webbeans.test.unit.xml.beans.Order",
Order.class);
+
Set<URL> xmls = new HashSet<URL>();
Iterable<URL> urls = getResources("user-defined-beans.xml");
@@ -31,33 +37,35 @@
xmls.add(url);
XmlParserImpl parser = new XmlParserImpl();
- Set<AnnotatedElement> aSet = parser.parse(xmls);
+ Set<AnnotatedItem<?, ?>> aSet = parser.parse(xmls);
- for(AnnotatedElement aElement : aSet){
- assert aElement.equals(Order.class);
+ for (AnnotatedItem<?, ?> aElement : aSet)
+ {
+ assert aElement.equals(aClass);
}
+
assert aSet.size() == 1;
}
}
-/*
-<Beans xmlns="urn:java:ee"
xmlns:myapp="urn:java:com.mydomain.myapp"
-xmlns:test="urn:java:org.jboss.webbeans.test.unit.xml">
-<Deploy>
- <Standard />
- <Production />
- <test:AnotherDeploymentType />
-</Deploy>
-<myapp:Order>
- <ConversationScoped />
- <myapp:PaymentProcessor>
- <myapp:Asynchronous />
- </myapp:PaymentProcessor>
- <myapp:User />
-</myapp:Order>
-<myapp:Login>
- <ConversationScoped />
- <BindingType />
-</myapp:Login>
-</Beans>
-*/
+ /*
+ <Beans xmlns="urn:java:ee"
xmlns:myapp="urn:java:org.jboss.webbeans.test.unit.xml.beans"
+ xmlns:test="urn:java:org.jboss.webbeans.test.unit.xml">
+ <Deploy>
+ <Standard />
+ <Production />
+ <test:AnotherDeploymentType />
+ </Deploy>
+ <myapp:Order>
+ <ConversationScoped />
+ <myapp:PaymentProcessor>
+ <myapp:Asynchronous />
+ </myapp:PaymentProcessor>
+ <myapp:User />
+ </myapp:Order>
+ <myapp:Login>
+ <ConversationScoped />
+ <BindingType />
+ </myapp:Login>
+ </Beans>
+ */
Show replies by date