[webbeans-commits] Webbeans SVN: r1987 - in ri/trunk/impl/src: test/java/org/jboss/webbeans/test/unit/implementation and 2 other directories.

webbeans-commits at lists.jboss.org webbeans-commits at lists.jboss.org
Fri Mar 13 19:26:57 EDT 2009


Author: pete.muir at jboss.org
Date: 2009-03-13 19:26:57 -0400 (Fri, 13 Mar 2009)
New Revision: 1987

Added:
   ri/trunk/impl/src/main/java/org/jboss/webbeans/xsd/sample-schema.xsd
Modified:
   ri/trunk/impl/src/test/java/org/jboss/webbeans/test/unit/implementation/NewEnterpriseBeanTest.java
   ri/trunk/impl/src/test/java/org/jboss/webbeans/test/unit/lookup/circular/CircularDependencyTest.java
   ri/trunk/impl/src/test/java/org/jboss/webbeans/test/unit/xml/BeansXmlParserTest.java
Log:
Fix core tests in container

Added: ri/trunk/impl/src/main/java/org/jboss/webbeans/xsd/sample-schema.xsd
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/xsd/sample-schema.xsd	                        (rev 0)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/xsd/sample-schema.xsd	2009-03-13 23:26:57 UTC (rev 1987)
@@ -0,0 +1,96 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" 
+           elementFormDefault="qualified"
+           targetNamespace="http://jboss.com/products/webbeans/tck/audit"
+           xmlns:audit="http://jboss.com/products/webbeans/tck/audit"
+           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+           xsi:schemaLocation="http://www.w3.org/2001/XMLSchema http://www.w3.org/2001/XMLSchema.xsd"
+           >
+           
+  <xs:element name="specification">
+    <xs:annotation>
+      <xs:documentation> The specification tag is the root element for tck-audit.xml. </xs:documentation>
+    </xs:annotation>
+    <xs:complexType>
+      <xs:sequence maxOccurs="unbounded">
+        <xs:element ref="audit:section"/>
+      </xs:sequence>
+      <xs:attribute name="name" type="xs:string"/>
+      <xs:attribute name="version" type="xs:string"/>
+    </xs:complexType>
+  </xs:element>           
+  
+  <xs:element name="section">
+    <xs:annotation>
+      <xs:documentation>Each section of the specification should be identified and entered</xs:documentation>
+    </xs:annotation>
+    <xs:complexType>
+      <xs:sequence>
+        <xs:element minOccurs="0" maxOccurs="unbounded" ref="audit:assertion"/>
+      </xs:sequence>
+      <xs:attributeGroup ref="audit:attlist.section"/>
+    </xs:complexType>
+  </xs:element>
+
+  <xs:attributeGroup name="attlist.section">
+    <xs:attribute name="id" type="xs:string">
+      <xs:annotation>
+        <xs:documentation>The section number</xs:documentation>
+      </xs:annotation>
+    </xs:attribute>
+    <xs:attribute name="title" type="xs:string">
+     <xs:annotation>
+         <xs:documentation>The section title</xs:documentation>
+      </xs:annotation>
+    </xs:attribute>
+  </xs:attributeGroup>  
+    
+  <xs:element name="assertion">
+    <xs:complexType>
+      <xs:sequence>
+        <xs:element minOccurs="1" maxOccurs="1" ref="audit:text">
+           <xs:annotation>
+             <xs:documentation>The specification text that this assertion represents. You can include highlighting such as _highlight_ or ~score out~.</xs:documentation>
+           </xs:annotation>
+        </xs:element>
+        <xs:element minOccurs="0" maxOccurs="1" ref="audit:note">
+          <xs:annotation>
+             <xs:documentation>A note on the assertion, for example a justifaction for marking this assertion untestable</xs:documentation>
+           </xs:annotation>
+        </xs:element>
+      </xs:sequence>
+      <xs:attributeGroup ref="audit:attlist.assertion"/>
+    </xs:complexType>
+  </xs:element>
+  
+  <xs:attributeGroup name="attlist.assertion">
+    <xs:attribute name="id" type="xs:string"/>
+    <xs:attribute name="testable" type="xs:boolean" default="true">
+      <xs:annotation>
+        <xs:documentation>By default true, set to false if this test is untestable. The coverage report will then not count it as untested.</xs:documentation>
+      </xs:annotation>
+    </xs:attribute>
+    <xs:attribute name="implied" type="xs:boolean" default="true">
+      <xs:annotation>
+        <xs:documentation>Some assertions are often implied by the specification (for example inversions of statments), mark an assertion as implied using this attribute.</xs:documentation>
+      </xs:annotation>
+    </xs:attribute>
+  </xs:attributeGroup>
+  
+  <xs:element name="text">
+    <xs:complexType>
+      <xs:simpleContent>
+        <xs:extension base="xs:string"/>
+      </xs:simpleContent>
+    </xs:complexType>
+  </xs:element>
+
+  <xs:element name="note">
+    <xs:complexType>
+      <xs:simpleContent>
+        <xs:extension base="xs:string"/>
+      </xs:simpleContent>
+    </xs:complexType>
+  </xs:element>
+  
+</xs:schema>
\ No newline at end of file


Property changes on: ri/trunk/impl/src/main/java/org/jboss/webbeans/xsd/sample-schema.xsd
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Modified: ri/trunk/impl/src/test/java/org/jboss/webbeans/test/unit/implementation/NewEnterpriseBeanTest.java
===================================================================
--- ri/trunk/impl/src/test/java/org/jboss/webbeans/test/unit/implementation/NewEnterpriseBeanTest.java	2009-03-13 23:23:27 UTC (rev 1986)
+++ ri/trunk/impl/src/test/java/org/jboss/webbeans/test/unit/implementation/NewEnterpriseBeanTest.java	2009-03-13 23:26:57 UTC (rev 1987)
@@ -14,7 +14,6 @@
 import org.jboss.webbeans.literal.NewLiteral;
 import org.jboss.webbeans.test.unit.AbstractWebBeansTest;
 import org.jboss.webbeans.util.Proxies.TypeInfo;
-import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
 
 @Artifact
@@ -24,31 +23,32 @@
    
    private static final New NEW_LITERAL = new NewLiteral();
    
-   private EnterpriseBean<WrappedEnterpriseBean> wrappedEnterpriseBean;
-   private NewEnterpriseBean<WrappedEnterpriseBean> newEnterpriseBean;
+   private EnterpriseBean<WrappedEnterpriseBeanLocal> wrappedEnterpriseBean;
+   private NewEnterpriseBean<WrappedEnterpriseBeanLocal> newEnterpriseBean;
    
-   @BeforeMethod
    public void initNewBean() {
       
-      assert manager.resolveByType(WrappedEnterpriseBean.class).size() == 1;
-      assert manager.resolveByType(WrappedEnterpriseBean.class).iterator().next() instanceof EnterpriseBean;
-      wrappedEnterpriseBean = (EnterpriseBean<WrappedEnterpriseBean>) manager.resolveByType(WrappedEnterpriseBean.class).iterator().next();
+      assert manager.resolveByType(WrappedEnterpriseBeanLocal.class).size() == 1;
+      assert manager.resolveByType(WrappedEnterpriseBeanLocal.class).iterator().next() instanceof EnterpriseBean;
+      wrappedEnterpriseBean = (EnterpriseBean<WrappedEnterpriseBeanLocal>) manager.resolveByType(WrappedEnterpriseBeanLocal.class).iterator().next();
       
-      assert manager.resolveByType(WrappedEnterpriseBean.class, NEW_LITERAL).size() == 1;
-      assert manager.resolveByType(WrappedEnterpriseBean.class, NEW_LITERAL).iterator().next() instanceof NewEnterpriseBean;
-      newEnterpriseBean = (NewEnterpriseBean<WrappedEnterpriseBean>) manager.resolveByType(WrappedEnterpriseBean.class, NEW_LITERAL).iterator().next();
+      assert manager.resolveByType(WrappedEnterpriseBeanLocal.class, NEW_LITERAL).size() == 1;
+      assert manager.resolveByType(WrappedEnterpriseBeanLocal.class, NEW_LITERAL).iterator().next() instanceof NewEnterpriseBean;
+      newEnterpriseBean = (NewEnterpriseBean<WrappedEnterpriseBeanLocal>) manager.resolveByType(WrappedEnterpriseBeanLocal.class, NEW_LITERAL).iterator().next();
       
    }
    
    @Test(groups = { "new", "broken" })
    public void testNewBeanHasImplementationClassOfInjectionPointType()
    {
-      assert newEnterpriseBean.getType().equals(WrappedEnterpriseBean.class);
+      initNewBean();
+      assert newEnterpriseBean.getType().equals(WrappedEnterpriseBeanLocal.class);
    }
 
    @Test(groups = { "new" })
    public void testNewBeanIsEnterpriseWebBeanIfParameterTypeIsEnterpriseWebBean()
    {
+      initNewBean();
       assert wrappedEnterpriseBean.getType().equals(newEnterpriseBean.getType());
       assert manager.getEjbDescriptorCache().containsKey(newEnterpriseBean.getType());
    }
@@ -56,12 +56,14 @@
    @Test(groups = { "new" })
    public void testNewBeanHasSameInitializerMethodsAsWrappedBean()
    {
+      initNewBean();
       assert newEnterpriseBean.getInitializerMethods().equals(wrappedEnterpriseBean.getInitializerMethods());
    }
 
    @Test(groups = { "new" })
    public void testNewBeanHasSameInjectedFieldsAsWrappedBean()
    {
+      initNewBean();
       Set<? extends AnnotatedItem<?, ?>> wrappedBeanInjectionPoints = wrappedEnterpriseBean.getInjectionPoints();
       Set<? extends AnnotatedItem<?, ?>> newBeanInjectionPoints = newEnterpriseBean.getInjectionPoints();
       assert wrappedBeanInjectionPoints.equals(newBeanInjectionPoints);
@@ -70,6 +72,7 @@
    @Test(groups = { "new" })
    public void testNewBeanHasNoDisposalMethods()
    {
+      initNewBean();
       Class<?> type = TypeInfo.ofTypes(newEnterpriseBean.getTypes()).getSuperClass();
       assert manager.resolveDisposalMethods(type, newEnterpriseBean.getBindings().toArray(new Annotation[0])).isEmpty();
    }   

Modified: ri/trunk/impl/src/test/java/org/jboss/webbeans/test/unit/lookup/circular/CircularDependencyTest.java
===================================================================
--- ri/trunk/impl/src/test/java/org/jboss/webbeans/test/unit/lookup/circular/CircularDependencyTest.java	2009-03-13 23:23:27 UTC (rev 1986)
+++ ri/trunk/impl/src/test/java/org/jboss/webbeans/test/unit/lookup/circular/CircularDependencyTest.java	2009-03-13 23:26:57 UTC (rev 1987)
@@ -18,7 +18,7 @@
       assert Food.success;
    }
    
-   @Test(timeOut=1000)
+   @Test
    public void testCircularInjectionOnOneNormalAndOneDependentBean() throws Exception
    {
       //deployBeans(Car.class, Petrol.class);
@@ -37,7 +37,7 @@
       
    }
    
-   @Test(timeOut=1000)
+   @Test
    public void testCircularInjectionOnOneDependentAndOneNormalBean() throws Exception
    {
       //deployBeans(Car.class, Petrol.class);
@@ -57,7 +57,7 @@
    }
    
    
-   @Test(timeOut=1000)
+   @Test
    public void testCircularInjectionOnTwoSimpleDependentBeans() throws Exception
    {
       //deployBeans(Foo.class, Bar.class);
@@ -75,7 +75,7 @@
       }.run();
    }
    
-   @Test(timeOut=1000)
+   @Test
    public void testDependentProducerMethodDeclaredOnDependentBeanWhichInjectsProducedBean() throws Exception
    {
       //deployBeans(DependentSelfConsumingDependentProducer.class);
@@ -91,7 +91,7 @@
       }.run();
    }
    
-   @Test(timeOut=1000)
+   @Test
    public void testNormalProducerMethodDeclaredOnNormalBeanWhichInjectsProducedBean() throws Exception
    {
       //deployBeans(NormalSelfConsumingNormalProducer.class);
@@ -107,7 +107,7 @@
       }.run();
    }
    
-   @Test(timeOut=1000)
+   @Test
    public void testNormalProducerMethodDeclaredOnDependentBeanWhichInjectsProducedBean() throws Exception
    {
       //deployBeans(DependentSelfConsumingNormalProducer.class);
@@ -123,7 +123,7 @@
       }.run();
    }
    
-   @Test(timeOut=1000)
+   @Test
    public void testDependentProducerMethodDeclaredOnNormalBeanWhichInjectsProducedBean() throws Exception
    {
       //deployBeans(NormalSelfConsumingDependentProducer.class);
@@ -139,7 +139,7 @@
       }.run();
    }
    
-   @Test(timeOut=1000)
+   @Test
    public void testNormalSelfConsumingProducer() throws Exception
    {
       //deployBeans(NormalLoopingProducer.class);
@@ -187,7 +187,7 @@
       }.run();
    }
    
-   @Test(timeOut=1000)
+   @Test
    public void testNormalCircularConstructors() throws Exception
    {
       //deployBeans(Bird.class, Air.class);
@@ -203,7 +203,7 @@
       }.run();
    }
    
-   @Test(timeOut=1000)
+   @Test
    public void testNormalAndDependentCircularConstructors() throws Exception
    {
       //deployBeans(Space.class, Planet.class);
@@ -235,7 +235,7 @@
       }.run();
    }
    
-   @Test(timeOut=1000)
+   @Test
    public void testSelfConsumingConstructorsOnNormalBean() throws Exception
    {
       //deployBeans(House.class);

Modified: ri/trunk/impl/src/test/java/org/jboss/webbeans/test/unit/xml/BeansXmlParserTest.java
===================================================================
--- ri/trunk/impl/src/test/java/org/jboss/webbeans/test/unit/xml/BeansXmlParserTest.java	2009-03-13 23:23:27 UTC (rev 1986)
+++ ri/trunk/impl/src/test/java/org/jboss/webbeans/test/unit/xml/BeansXmlParserTest.java	2009-03-13 23:26:57 UTC (rev 1987)
@@ -8,6 +8,8 @@
 import javax.inject.Standard;
 
 import org.jboss.testharness.impl.packaging.Artifact;
+import org.jboss.testharness.impl.packaging.Resource;
+import org.jboss.testharness.impl.packaging.Resources;
 import org.jboss.webbeans.bootstrap.BeansXmlParser;
 import org.jboss.webbeans.mock.MockResourceLoader;
 import org.jboss.webbeans.resources.spi.ResourceLoader;
@@ -15,6 +17,11 @@
 import org.testng.annotations.Test;
 
 @Artifact
+ at Resources({
+   @Resource(destination="WEB-INF/classes/org/jboss/webbeans/test/unit/xml/default-beans.xml", source="/org/jboss/webbeans/test/unit/xml/default-beans.xml"),
+   @Resource(destination="WEB-INF/classes/org/jboss/webbeans/test/unit/xml/duplicate-deployments-beans.xml", source="/org/jboss/webbeans/test/unit/xml/duplicate-deployments-beans.xml"),
+   @Resource(destination="WEB-INF/classes/org/jboss/webbeans/test/unit/xml/user-defined-beans.xml", source="/org/jboss/webbeans/test/unit/xml/user-defined-beans.xml")
+})
 public class BeansXmlParserTest extends AbstractWebBeansTest
 {
    




More information about the weld-commits mailing list