openwebbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From strub...@apache.org
Subject svn commit: r1620403 - in /openwebbeans/trunk: webbeans-impl/src/test/java/org/apache/webbeans/test/component/producer/specializes/ webbeans-impl/src/test/java/org/apache/webbeans/test/component/producer/specializes/superclazz/ webbeans-impl/src/test/j...
Date Mon, 25 Aug 2014 18:31:09 GMT
Author: struberg
Date: Mon Aug 25 18:31:09 2014
New Revision: 1620403

URL: http://svn.apache.org/r1620403
Log:
OWB-991 port over test from owb-1.2.x

This actually did work already in trunk, thus no code change needed.

Added:
    openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/component/producer/specializes/SpecializesProducerParentBean.java
      - copied, changed from r1620383, openwebbeans/branches/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/producer/specializes/SpecializesProducerParentBean.java
Removed:
    openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/producer/specializes/
Modified:
    openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/component/producer/specializes/SpecializesProducer1.java
    openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/component/producer/specializes/superclazz/SpecializesProducer1SuperClazz.java
    openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/producer/specializes/SpecializesProducer1Test.java
    openwebbeans/trunk/webbeans-tck/   (props changed)

Modified: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/component/producer/specializes/SpecializesProducer1.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/component/producer/specializes/SpecializesProducer1.java?rev=1620403&r1=1620402&r2=1620403&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/component/producer/specializes/SpecializesProducer1.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/component/producer/specializes/SpecializesProducer1.java
Mon Aug 25 18:31:09 2014
@@ -22,20 +22,12 @@ import javax.enterprise.inject.Produces;
 import javax.enterprise.inject.Specializes;
 
 import org.apache.webbeans.test.annotation.binding.Binding1;
-import org.apache.webbeans.test.annotation.binding.Binding2;
 import org.apache.webbeans.test.component.producer.specializes.superclazz.SpecializesProducer1SuperClazz;
 
 public class SpecializesProducer1 extends SpecializesProducer1SuperClazz
 {
-
-    public SpecializesProducer1()
-    {
-
-    }
-
     @Produces
     @Binding1
-    @Binding2
     @Specializes
     public int createMaxNumber()
     {

Copied: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/component/producer/specializes/SpecializesProducerParentBean.java
(from r1620383, openwebbeans/branches/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/producer/specializes/SpecializesProducerParentBean.java)
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/component/producer/specializes/SpecializesProducerParentBean.java?p2=openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/component/producer/specializes/SpecializesProducerParentBean.java&p1=openwebbeans/branches/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/producer/specializes/SpecializesProducerParentBean.java&r1=1620383&r2=1620403&rev=1620403&view=diff
==============================================================================
--- openwebbeans/branches/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/test/component/producer/specializes/SpecializesProducerParentBean.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/component/producer/specializes/SpecializesProducerParentBean.java
Mon Aug 25 18:31:09 2014
@@ -19,6 +19,7 @@
 package org.apache.webbeans.test.component.producer.specializes;
 
 import javax.enterprise.inject.Specializes;
+
 import org.apache.webbeans.test.component.producer.specializes.superclazz.SpecializesProducer1SuperClazz;
 
 /**

Modified: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/component/producer/specializes/superclazz/SpecializesProducer1SuperClazz.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/component/producer/specializes/superclazz/SpecializesProducer1SuperClazz.java?rev=1620403&r1=1620402&r2=1620403&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/component/producer/specializes/superclazz/SpecializesProducer1SuperClazz.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/component/producer/specializes/superclazz/SpecializesProducer1SuperClazz.java
Mon Aug 25 18:31:09 2014
@@ -25,17 +25,15 @@ import org.apache.webbeans.test.annotati
 
 public class SpecializesProducer1SuperClazz
 {
-
-    public SpecializesProducer1SuperClazz()
-    {
-
-    }
+    @Produces
+    @Binding2
+    private int producedField = 4711;
 
     @Produces
     @Binding1
-    @Binding2
     public int createMaxNumber()
     {
         return Integer.MAX_VALUE;
     }
+
 }

Modified: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/producer/specializes/SpecializesProducer1Test.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/producer/specializes/SpecializesProducer1Test.java?rev=1620403&r1=1620402&r2=1620403&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/producer/specializes/SpecializesProducer1Test.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/producer/specializes/SpecializesProducer1Test.java
Mon Aug 25 18:31:09 2014
@@ -31,24 +31,18 @@ import org.apache.webbeans.test.Abstract
 import org.apache.webbeans.test.annotation.binding.Binding1;
 import org.apache.webbeans.test.annotation.binding.Binding2;
 import org.apache.webbeans.test.component.producer.specializes.SpecializesProducer1;
+import org.apache.webbeans.test.component.producer.specializes.SpecializesProducerParentBean;
 import org.apache.webbeans.test.component.producer.specializes.superclazz.SpecializesProducer1SuperClazz;
 import org.junit.Assert;
 import org.junit.Test;
 
 public class SpecializesProducer1Test extends AbstractUnitTest
 {
-
     @Test
     public void testSpecializedProducer1()
     {
-        Collection<String> beanXmls = new ArrayList<String>();
-        Collection<Class<?>> beanClasses = new ArrayList<Class<?>>();
+        startContainer(SpecializesProducer1SuperClazz.class, SpecializesProducer1.class);
 
-        beanClasses.add(SpecializesProducer1SuperClazz.class);
-        beanClasses.add(SpecializesProducer1.class);
-        
-        startContainer(beanClasses, beanXmls);        
-        
         Annotation binding1 = new AnnotationLiteral<Binding1>()
         {
         };
@@ -56,16 +50,33 @@ public class SpecializesProducer1Test ex
         {
         };
 
-        Set beans = getBeanManager().getBeans(int.class, new Annotation[] { binding1, binding2
});
-        System.out.print("Size of the bean set is " + beans.size());
-        Assert.assertTrue(beans.size() == 1);
-        Bean<Integer> bean = (Bean<Integer>)beans.iterator().next();
-        CreationalContext<Integer> cc = getBeanManager().createCreationalContext(bean);
-        Integer number = (Integer) getBeanManager().getReference(bean, int.class, cc);
-        
-        Assert.assertEquals(10000, number.intValue());
-        
-        shutDownContainer();       
-        
+        Integer methodNumber = getInstance(int.class, binding1);
+        Assert.assertEquals(10000, methodNumber.intValue());
+
+        Integer fieldNumber = getInstance(int.class, binding2);
+        Assert.assertEquals(4711, fieldNumber.intValue());
+    }
+
+    /**
+     * SpecializesProducerParentBean specializes SpecializesProducer1SuperClazz
+     * Thus all the producer fields and methods in the parent class must be disabled.
+     */
+    @Test
+    public void testDisabledProducerViaSpecialization()
+    {
+        startContainer(SpecializesProducer1SuperClazz.class, SpecializesProducerParentBean.class);
+
+        Annotation binding1 = new AnnotationLiteral<Binding1>()
+        {
+        };
+        Annotation binding2 = new AnnotationLiteral<Binding2>()
+        {
+        };
+
+        Set<Bean<?>> beans = getBeanManager().getBeans(int.class, binding1);
+        Assert.assertEquals(0, beans.size());
+
+        beans = getBeanManager().getBeans(int.class, binding2);
+        Assert.assertEquals(0, beans.size());
     }
 }

Propchange: openwebbeans/trunk/webbeans-tck/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Mon Aug 25 18:31:09 2014
@@ -9,3 +9,4 @@ test-output
 jsr299-tck-impl-1.0.0-SNAPSHOT-suite.xml
 temp-testng-customsuite.xml
 events-test-suite.xml
+debug-suite.xml



Mime
View raw message