[webbeans-commits] Webbeans SVN: r1146 - in tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit: inheritance/realization and 1 other directories.

webbeans-commits at lists.jboss.org webbeans-commits at lists.jboss.org
Wed Jan 21 12:12:23 EST 2009


Author: pete.muir at jboss.org
Date: 2009-01-21 12:12:23 -0500 (Wed, 21 Jan 2009)
New Revision: 1146

Added:
   tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/inheritance/specialization/AnotherDeploymentType.java
   tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/inheritance/specialization/Building.java
   tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/inheritance/specialization/FarmYard_Broken.java
   tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/inheritance/specialization/FishFarmer_Broken.java
   tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/inheritance/specialization/Landowner.java
   tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/inheritance/specialization/Lazy.java
   tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/inheritance/specialization/Office.java
   tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/inheritance/specialization/OrganicFarmer_Broken.java
   tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/inheritance/specialization/SheepFarmer_Broken.java
   tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/inheritance/specialization/Waste.java
   tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/inheritance/specialization/Yard.java
Removed:
   tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/inheritance/specialization/OrganicFarmer.java
Modified:
   tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/event/EventTest.java
   tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/inheritance/realization/RealizationTest.java
   tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/inheritance/specialization/Farmer.java
   tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/inheritance/specialization/LazyFarmer.java
   tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/inheritance/specialization/SpecializationTest.java
Log:
start work on specialization tests

Modified: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/event/EventTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/event/EventTest.java	2009-01-21 16:45:35 UTC (rev 1145)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/event/EventTest.java	2009-01-21 17:12:23 UTC (rev 1146)
@@ -17,7 +17,6 @@
 import org.jboss.webbeans.tck.AbstractTest;
 import org.jboss.webbeans.tck.impl.SpecAssertion;
 import org.jboss.webbeans.tck.impl.SpecVersion;
-import org.jboss.webbeans.tck.unit.inheritance.specialization.LazyFarmer;
 import org.testng.annotations.Test;
 
 /**

Modified: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/inheritance/realization/RealizationTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/inheritance/realization/RealizationTest.java	2009-01-21 16:45:35 UTC (rev 1145)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/inheritance/realization/RealizationTest.java	2009-01-21 17:12:23 UTC (rev 1146)
@@ -17,8 +17,7 @@
 {
    
    private static Annotation SMELLY_LITERAL = new AnnotationLiteral<Smelly>(){}; 
-   
-   
+      
    @Override
    protected List<Class<? extends Annotation>> getEnabledDeploymentTypes()
    {

Added: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/inheritance/specialization/AnotherDeploymentType.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/inheritance/specialization/AnotherDeploymentType.java	                        (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/inheritance/specialization/AnotherDeploymentType.java	2009-01-21 17:12:23 UTC (rev 1146)
@@ -0,0 +1,20 @@
+package org.jboss.webbeans.tck.unit.inheritance.specialization;
+
+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.webbeans.DeploymentType;
+
+ at Target( { TYPE, METHOD })
+ at Retention(RUNTIME)
+ at Documented
+ at DeploymentType
+ at interface AnotherDeploymentType
+{
+
+}


Property changes on: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/inheritance/specialization/AnotherDeploymentType.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/inheritance/specialization/Building.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/inheritance/specialization/Building.java	                        (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/inheritance/specialization/Building.java	2009-01-21 17:12:23 UTC (rev 1146)
@@ -0,0 +1,14 @@
+package org.jboss.webbeans.tck.unit.inheritance.specialization;
+
+import javax.webbeans.Produces;
+
+class Building
+{
+   
+   @Produces
+   public Waste getWaste()
+   {
+      return new Waste();
+   }
+   
+}


Property changes on: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/inheritance/specialization/Building.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/inheritance/specialization/FarmYard_Broken.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/inheritance/specialization/FarmYard_Broken.java	                        (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/inheritance/specialization/FarmYard_Broken.java	2009-01-21 17:12:23 UTC (rev 1146)
@@ -0,0 +1,10 @@
+package org.jboss.webbeans.tck.unit.inheritance.specialization;
+
+import javax.webbeans.Specializes;
+
+ at Specializes
+ at AnotherDeploymentType
+class FarmYard_Broken extends Yard
+{
+   
+}


Property changes on: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/inheritance/specialization/FarmYard_Broken.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Modified: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/inheritance/specialization/Farmer.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/inheritance/specialization/Farmer.java	2009-01-21 16:45:35 UTC (rev 1145)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/inheritance/specialization/Farmer.java	2009-01-21 17:12:23 UTC (rev 1146)
@@ -1,15 +1,11 @@
 package org.jboss.webbeans.tck.unit.inheritance.specialization;
 
-import javax.webbeans.Observes;
+import javax.webbeans.Named;
 
-import org.jboss.webbeans.tck.unit.inheritance.specialization.Egg;
 
+ at Landowner
+ at Named
 class Farmer
 {
    
-   public void observeEggLaying(@Observes Egg egg)
-   {
-      
-   }
-   
 }

Added: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/inheritance/specialization/FishFarmer_Broken.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/inheritance/specialization/FishFarmer_Broken.java	                        (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/inheritance/specialization/FishFarmer_Broken.java	2009-01-21 17:12:23 UTC (rev 1146)
@@ -0,0 +1,10 @@
+package org.jboss.webbeans.tck.unit.inheritance.specialization;
+
+import javax.webbeans.Specializes;
+
+ at Specializes
+ at AnotherDeploymentType
+class FishFarmer_Broken extends Farmer
+{
+   
+}


Property changes on: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/inheritance/specialization/FishFarmer_Broken.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/inheritance/specialization/Landowner.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/inheritance/specialization/Landowner.java	                        (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/inheritance/specialization/Landowner.java	2009-01-21 17:12:23 UTC (rev 1146)
@@ -0,0 +1,22 @@
+package org.jboss.webbeans.tck.unit.inheritance.specialization;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.PARAMETER;
+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.webbeans.BindingType;
+
+ at Target( { TYPE, METHOD, PARAMETER, FIELD })
+ at Retention(RUNTIME)
+ at Documented
+ at BindingType
+ at interface Landowner
+{
+
+}


Property changes on: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/inheritance/specialization/Landowner.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/inheritance/specialization/Lazy.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/inheritance/specialization/Lazy.java	                        (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/inheritance/specialization/Lazy.java	2009-01-21 17:12:23 UTC (rev 1146)
@@ -0,0 +1,22 @@
+package org.jboss.webbeans.tck.unit.inheritance.specialization;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.PARAMETER;
+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.webbeans.BindingType;
+
+ at Target( { TYPE, METHOD, PARAMETER, FIELD })
+ at Retention(RUNTIME)
+ at Documented
+ at BindingType
+ at interface Lazy
+{
+
+}


Property changes on: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/inheritance/specialization/Lazy.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Modified: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/inheritance/specialization/LazyFarmer.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/inheritance/specialization/LazyFarmer.java	2009-01-21 16:45:35 UTC (rev 1145)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/inheritance/specialization/LazyFarmer.java	2009-01-21 17:12:23 UTC (rev 1146)
@@ -1,7 +1,11 @@
 package org.jboss.webbeans.tck.unit.inheritance.specialization;
 
+import javax.webbeans.Specializes;
 
-public class LazyFarmer extends Farmer
+
+ at Specializes @Lazy
+ at AnotherDeploymentType
+class LazyFarmer extends Farmer
 {
    
 }

Added: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/inheritance/specialization/Office.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/inheritance/specialization/Office.java	                        (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/inheritance/specialization/Office.java	2009-01-21 17:12:23 UTC (rev 1146)
@@ -0,0 +1,7 @@
+package org.jboss.webbeans.tck.unit.inheritance.specialization;
+
+ at AnotherDeploymentType
+class Office extends Building
+{
+   
+}


Property changes on: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/inheritance/specialization/Office.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Deleted: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/inheritance/specialization/OrganicFarmer.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/inheritance/specialization/OrganicFarmer.java	2009-01-21 16:45:35 UTC (rev 1145)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/inheritance/specialization/OrganicFarmer.java	2009-01-21 17:12:23 UTC (rev 1146)
@@ -1,9 +0,0 @@
-package org.jboss.webbeans.tck.unit.inheritance.specialization;
-
-import javax.webbeans.Specializes;
-
- at Specializes
-public class OrganicFarmer extends Farmer
-{
-   
-}

Copied: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/inheritance/specialization/OrganicFarmer_Broken.java (from rev 1121, tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/inheritance/specialization/OrganicFarmer.java)
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/inheritance/specialization/OrganicFarmer_Broken.java	                        (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/inheritance/specialization/OrganicFarmer_Broken.java	2009-01-21 17:12:23 UTC (rev 1146)
@@ -0,0 +1,9 @@
+package org.jboss.webbeans.tck.unit.inheritance.specialization;
+
+import javax.webbeans.Specializes;
+
+ at Specializes
+class OrganicFarmer_Broken extends Farmer
+{
+   
+}

Added: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/inheritance/specialization/SheepFarmer_Broken.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/inheritance/specialization/SheepFarmer_Broken.java	                        (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/inheritance/specialization/SheepFarmer_Broken.java	2009-01-21 17:12:23 UTC (rev 1146)
@@ -0,0 +1,9 @@
+package org.jboss.webbeans.tck.unit.inheritance.specialization;
+
+import javax.webbeans.Specializes;
+
+ at Specializes @AnotherDeploymentType
+class SheepFarmer_Broken extends Farmer
+{
+   
+}


Property changes on: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/inheritance/specialization/SheepFarmer_Broken.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Modified: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/inheritance/specialization/SpecializationTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/inheritance/specialization/SpecializationTest.java	2009-01-21 16:45:35 UTC (rev 1145)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/inheritance/specialization/SpecializationTest.java	2009-01-21 17:12:23 UTC (rev 1146)
@@ -1,25 +1,89 @@
 package org.jboss.webbeans.tck.unit.inheritance.specialization;
 
+import static org.jboss.webbeans.tck.impl.util.Reflections.annotationSetMatches;
+
+import java.lang.annotation.Annotation;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.webbeans.AnnotationLiteral;
+import javax.webbeans.DefinitionException;
 import javax.webbeans.InconsistentSpecializationException;
 
 import org.jboss.webbeans.tck.AbstractTest;
 import org.jboss.webbeans.tck.impl.SpecAssertion;
 import org.testng.annotations.Test;
 
+import sun.swing.SwingUtilities2.Section;
+
+/**
+ * @see Section 3.2.6, 3.3.6, 3.4.5, 6.7, 6.8, 8.4
+ * 
+ */
 public class SpecializationTest extends AbstractTest
 {
-
-   @Test(expectedExceptions = InconsistentSpecializationException.class, groups = { "stub", "specialization" })
-   public void testInconsistentSpecialization()
+   
+   @Override
+   protected List<Class<? extends Annotation>> getEnabledDeploymentTypes()
    {
-
+      List<Class<? extends Annotation>> deploymentTypes = new ArrayList<Class<? extends Annotation>>();
+      deploymentTypes.addAll(getStandardDeploymentTypes());
+      deploymentTypes.add(AnotherDeploymentType.class);
+      return deploymentTypes;
    }
+   
+   private static Annotation LANDOWNER_LITERAL = new AnnotationLiteral<Landowner>() {};
 
-   @Test
-   @SpecAssertion(section = "4.3")
-   public void testSpecializedBeanDirectlyExtendsLowerPriorityBean()
+   @Test(groups="broken") @SpecAssertion(section = "4.3.1")
+   public void testSpecializingBeanHasBindingsOfSpecializedAndSpecializingBean()
    {
-
+      deployBeans(LazyFarmer.class);
+      assert manager.resolveByType(Farmer.class, LANDOWNER_LITERAL).size() == 1;
+      assert manager.resolveByType(Farmer.class, LANDOWNER_LITERAL).iterator().next().getTypes().contains(LazyFarmer.class);
+      assert manager.resolveByType(Farmer.class, LANDOWNER_LITERAL).iterator().next().getBindings().size() == 2;
+      assert annotationSetMatches( manager.resolveByType(Farmer.class, LANDOWNER_LITERAL).iterator().next().getBindings(), Landowner.class, Lazy.class);
    }
+   
+   @Test(groups="broken") @SpecAssertion(section = "4.3.1")
+   public void testSpecializingBeanHasNameOfSpecializedBean()
+   {
+      deployBeans(LazyFarmer.class);
+      assert manager.resolveByType(Farmer.class, LANDOWNER_LITERAL).size() == 1;
+      assert manager.resolveByType(Farmer.class, LANDOWNER_LITERAL).iterator().next().getTypes().contains(LazyFarmer.class);
+      assert manager.resolveByType(Farmer.class, LANDOWNER_LITERAL).iterator().next().getName().equals("farmer");
+   }
+   
+   @Test(groups="broken", expectedExceptions=DefinitionException.class) @SpecAssertion(section = "4.3.1")
+   public void testSpecializedBeanHasNonDefaultName()
+   {
+      deployBeans(FarmYard_Broken.class);
+   }
+   
+   @Test(groups="broken") @SpecAssertion(section="4.3.1")
+   public void testSpecializedBeanNotDeployed()
+   {
+      deployBeans(LazyFarmer.class, Farmer.class);
+      assert manager.resolveByType(Farmer.class, LANDOWNER_LITERAL).size() == 1;
+      assert manager.resolveByType(Farmer.class, LANDOWNER_LITERAL).iterator().next().getTypes().contains(LazyFarmer.class);
+   }
+   
+   @Test(groups="broken") @SpecAssertion(section="4.3.1")
+   public void testProducerMethodOnSpecializedBeanNotDeployed()
+   {
+      deployBeans(Office.class, Building.class);
+      assert manager.resolveByType(Waste.class).size() == 0;
+   }
+   
+   @Test(groups="broken", expectedExceptions=InconsistentSpecializationException.class) @SpecAssertion(section="4.3.1")
+   public void testSpecializingBeanDoesNotHaveHigherPrecedenceThanSpecializedBean()
+   {
+      deployBeans(OrganicFarmer_Broken.class);
+   }
+   
+   @Test(groups="broken", expectedExceptions=InconsistentSpecializationException.class) @SpecAssertion(section="4.3.1")
+   public void testTwoBeansSpecializeTheSameBean()
+   {
+      deployBeans(SheepFarmer_Broken.class, FishFarmer_Broken.class);
+   }
 
 }

Added: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/inheritance/specialization/Waste.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/inheritance/specialization/Waste.java	                        (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/inheritance/specialization/Waste.java	2009-01-21 17:12:23 UTC (rev 1146)
@@ -0,0 +1,6 @@
+package org.jboss.webbeans.tck.unit.inheritance.specialization;
+
+class Waste
+{
+   
+}


Property changes on: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/inheritance/specialization/Waste.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/inheritance/specialization/Yard.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/inheritance/specialization/Yard.java	                        (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/inheritance/specialization/Yard.java	2009-01-21 17:12:23 UTC (rev 1146)
@@ -0,0 +1,9 @@
+package org.jboss.webbeans.tck.unit.inheritance.specialization;
+
+import javax.webbeans.Named;
+
+ at Named("backyard")
+class Yard
+{
+   
+}


Property changes on: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/inheritance/specialization/Yard.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain




More information about the weld-commits mailing list