openwebbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From strub...@apache.org
Subject svn commit: r1665522 - in /openwebbeans/trunk: webbeans-impl/src/main/java/org/apache/webbeans/component/creation/ webbeans-impl/src/main/java/org/apache/webbeans/container/ webbeans-impl/src/main/java/org/apache/webbeans/util/ webbeans-impl/src/test/j...
Date Tue, 10 Mar 2015 13:10:00 GMT
Author: struberg
Date: Tue Mar 10 13:10:00 2015
New Revision: 1665522

URL: http://svn.apache.org/r1665522
Log:
OWB-1042 implement backup lookup on raw type producers

Added:
    openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/injection/typed/
    openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/injection/typed/Bird.java
    openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/injection/typed/Raven.java
    openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/injection/typed/TypedFieldProducer.java
    openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/injection/typed/TypedMethodProducer.java
    openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/injection/typed/TypedProducerTest.java
Modified:
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/DecoratorBeanBuilder.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/BeanManagerImpl.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/InjectionResolver.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/ClassUtil.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/GenericsUtil.java
    openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/producer/GenericProducerTest.java
    openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/pfield/ProducerFieldComponentTest.java
    openwebbeans/trunk/webbeans-tck/standalone-suite.xml

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/DecoratorBeanBuilder.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/DecoratorBeanBuilder.java?rev=1665522&r1=1665521&r2=1665522&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/DecoratorBeanBuilder.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/DecoratorBeanBuilder.java
Tue Mar 10 13:10:00 2015
@@ -239,7 +239,7 @@ public class DecoratorBeanBuilder<T> ext
 
         for (Type interfaceType : interfaceTypes)
         {
-            if (!ClassUtil.isClassAssignable(ClassUtil.getClass(delegateType), ClassUtil.getClass(interfaceType)))
+            if (!ClassUtil.isClassAssignableFrom(ClassUtil.getClass(delegateType), ClassUtil.getClass(interfaceType)))
             {
                 // only check the interface from the decorated type
                 continue;

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/BeanManagerImpl.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/BeanManagerImpl.java?rev=1665522&r1=1665521&r2=1665522&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/BeanManagerImpl.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/BeanManagerImpl.java
Tue Mar 10 13:10:00 2015
@@ -701,7 +701,8 @@ public class BeanManagerImpl implements
         if(beanType != null && beanType != Object.class)
         {
             final boolean isProducer = AbstractProducerBean.class.isInstance(bean);
-            if(!isBeanTypeAssignableToGivenType(bean.getTypes(), beanType, bean instanceof
NewBean, isProducer) &&
+            if(!isProducer && // we have different rules for producers
+               !isBeanTypeAssignableToGivenType(bean.getTypes(), beanType, bean instanceof
NewBean, isProducer) &&
                !GenericsUtil.satisfiesDependency(false, isProducer, beanType, bean.getBeanClass()))
             {
                 throw new IllegalArgumentException("Given bean type : " + beanType + " is
not applicable for the bean instance : " + bean);
@@ -890,7 +891,7 @@ public class BeanManagerImpl implements
                 if (newBean && ClassUtil.isParametrizedType(givenType))
                 {
                     Class<?> requiredType = ClassUtil.getClass(givenType);
-                    if (ClassUtil.isClassAssignable(requiredType, ClassUtil.getClass(beanApiType)))
+                    if (ClassUtil.isClassAssignableFrom(requiredType, ClassUtil.getClass(beanApiType)))
                     {
                         return true;
                     }

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/InjectionResolver.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/InjectionResolver.java?rev=1665522&r1=1665521&r2=1665522&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/InjectionResolver.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/InjectionResolver.java
Tue Mar 10 13:10:00 2015
@@ -454,12 +454,7 @@ public class InjectionResolver
 
         resolvedComponents = new HashSet<Bean<?>>();
 
-        boolean returnAll = false;
-
-        if (injectionPointType.equals(Object.class) && currentQualifier)
-        {
-            returnAll = true;
-        }
+        boolean returnAll = injectionPointType.equals(Object.class) && currentQualifier;
 
         for (Bean<?> component : webBeansContext.getBeanManagerImpl().getBeans())
         {
@@ -479,8 +474,7 @@ public class InjectionResolver
                 for (Type componentApiType : component.getTypes())
                 {
 
-                    if (GenericsUtil.satisfiesDependency(isDelegate, AbstractProducerBean.class.isInstance(component),
-                            injectionPointType, componentApiType))
+                    if (ClassUtil.isRawClassEquals(injectionPointType, componentApiType))
                     {
                         resolvedComponents.add(component);
                         break;
@@ -489,8 +483,14 @@ public class InjectionResolver
             }
         }
 
-        // Look for qualifiers
-        resolvedComponents = findByQualifier(resolvedComponents, injectionPointType, qualifiers);
+        if (!returnAll)
+        {
+            // Look for qualifiers
+            resolvedComponents = findByQualifier(resolvedComponents, injectionPointType,
qualifiers);
+
+            // have an additional round of checks for assignability of parameterized types.
+            resolvedComponents = findByParameterizedType(resolvedComponents, injectionPointType,
isDelegate);
+        }
 
         resolvedBeansByType.put(cacheKey, resolvedComponents);
         if (logger.isLoggable(Level.FINE))
@@ -499,6 +499,37 @@ public class InjectionResolver
         }
 
         return resolvedComponents;
+    }
+
+    private Set<Bean<?>> findByParameterizedType(Set<Bean<?>> allComponents,
Type injectionPointType, boolean isDelegate)
+    {
+        Bean<?> rawProducerBean = null;
+
+        Set<Bean<?>> resolvedComponents = new HashSet<Bean<?>>();
+        for (Bean<?> component : allComponents)
+        {
+            boolean isProducer = AbstractProducerBean.class.isInstance(component);
+            for (Type componentApiType : component.getTypes())
+            {
+
+                if (GenericsUtil.satisfiesDependency(isDelegate, isProducer, injectionPointType,
componentApiType))
+                {
+                    resolvedComponents.add(component);
+                    break;
+                }
+                else if (isProducer && componentApiType instanceof Class &&
ClassUtil.isRawClassEquals(injectionPointType, componentApiType))
+                {
+                   rawProducerBean = component;
+                }
+            }
+        }
+
+        if (resolvedComponents.isEmpty() && rawProducerBean != null)
+        {
+            resolvedComponents.add(rawProducerBean);
+        }
+
+        return resolvedComponents;
     }
 
 

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/ClassUtil.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/ClassUtil.java?rev=1665522&r1=1665521&r2=1665522&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/ClassUtil.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/ClassUtil.java
Tue Mar 10 13:10:00 2015
@@ -570,7 +570,7 @@ public final class ClassUtil
      * @param rhs right hand side class
      * @return true if rhs is assignable to lhs
      */
-    public static boolean isClassAssignable(Class<?> lhs, Class<?> rhs)
+    public static boolean isClassAssignableFrom(Class<?> lhs, Class<?> rhs)
     {
         Asserts.assertNotNull(lhs, "lhs parameter can not be null");
         Asserts.assertNotNull(rhs, "rhs parameter can not be null");
@@ -678,90 +678,6 @@ public final class ClassUtil
          
         return true;
     }
-    
-    /**
-     * Checking bean type and required type.
-     * <p>
-     * Required type is class and bean type is
-     * a type variable.
-     * </p>
-     * @param beanTypeArg bean type 
-     * @param requiredTypeArg required type
-     * @return true if condition satisfy
-     */
-    public static boolean checkRequiredTypeIsClassAndBeanTypeIsVariable(Type beanTypeArg,
Type requiredTypeArg)
-    {
-        Class<?> clazzRequiredType = (Class<?>)requiredTypeArg;
-        
-        TypeVariable<?> tvBeanTypeArg = (TypeVariable<?>)beanTypeArg;
-        //TODO respect other bounds
-        Type tvBound = tvBeanTypeArg.getBounds()[0];
-        
-        if(tvBound instanceof Class)
-        {
-            Class<?> clazzTvBound = (Class<?>)tvBound;
-            
-            if(clazzTvBound != Object.class)
-            {
-                if(!clazzTvBound.isAssignableFrom(clazzRequiredType))
-                {
-                    return false;
-                }                                    
-            }            
-        }
-        
-        return true;
-    }
-
-    public static boolean checkRequiredTypeIsParameterizedAndBeanTypeIsVariable(Type beanTypeArg,
Type requiredTypeArg)
-    {
-        ParameterizedType requiredType = (ParameterizedType)requiredTypeArg;
-        //TODO respect parameters of required type
-        return checkRequiredTypeIsClassAndBeanTypeIsVariable(beanTypeArg, requiredType.getRawType());
-    }
-    
-    public static boolean checkRequiredTypeIsTypeVariableAndBeanTypeIsClass(Type beanTypeArg,
Type requiredTypeArg)
-    {
-        Class<?> clazzBeanType = (Class<?>)beanTypeArg;
-        
-        TypeVariable<?> tvRequiredTypeArg = (TypeVariable<?>)requiredTypeArg;
-        Type tvBound = tvRequiredTypeArg.getBounds()[0];
-        
-        if(tvBound instanceof Class)
-        {
-            Class<?> clazzTvBound = (Class<?>)tvBound;
-            
-            if(clazzTvBound.isAssignableFrom(clazzBeanType))
-            {
-                return true;
-            }                    
-        }
-        
-        return false;
-    }
-    
-
-    public static boolean checkBeanTypeAndRequiredIsTypeVariable(Type beanTypeArg, Type requiredTypeArg)
-    {
-        TypeVariable<?> tvBeanTypeArg = (TypeVariable<?>)beanTypeArg;
-        Type tvBeanBound = tvBeanTypeArg.getBounds()[0];
-        
-        TypeVariable<?> tvRequiredTypeArg = (TypeVariable<?>)requiredTypeArg;
-        Type tvRequiredBound = tvRequiredTypeArg.getBounds()[0];
-        
-        if(tvBeanBound instanceof Class && tvRequiredBound instanceof Class)
-        {
-            Class<?> clazzTvBeanBound = (Class<?>)tvBeanBound;
-            Class<?> clazzTvRequiredBound = (Class<?>)tvRequiredBound;
-            
-            if(clazzTvBeanBound.isAssignableFrom(clazzTvRequiredBound))
-            {
-                return true;
-            }                    
-        }
-        
-        return false;
-    }
 
     /**
      * Returns declared type arguments if {@code type} is a
@@ -944,4 +860,37 @@ public final class ClassUtil
     {
         return superClass.isAssignableFrom(subClass) && !superClass.equals(subClass);
     }
+
+    public static boolean isRawClassEquals(Type ipType, Type apiType)
+    {
+        Class ipClass = getRawPrimitiveType(ipType);
+        Class apiClass  = getRawPrimitiveType(apiType);
+
+        if (ipClass == null || apiClass == null)
+        {
+            // we found some illegal types
+            return false;
+        }
+
+        return ipClass.equals(apiClass);
+    }
+
+    private static Class getRawPrimitiveType(Type type)
+    {
+        if (type instanceof Class)
+        {
+            if (((Class) type).isPrimitive())
+            {
+                return getPrimitiveWrapper((Class) type);
+            }
+            return (Class) type;
+        }
+
+        if (type instanceof ParameterizedType)
+        {
+            return getRawPrimitiveType(((ParameterizedType) type).getRawType());
+        }
+
+        return null;
+    }
 }

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/GenericsUtil.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/GenericsUtil.java?rev=1665522&r1=1665521&r2=1665522&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/GenericsUtil.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/GenericsUtil.java
Tue Mar 10 13:10:00 2015
@@ -127,7 +127,7 @@ public final class GenericsUtil
 
     private static boolean isAssignableFrom(Class<?> injectionPointType, Class<?>
beanType)
     {
-        return ClassUtil.isClassAssignable(injectionPointType, beanType);
+        return ClassUtil.isClassAssignableFrom(injectionPointType, beanType);
     }
 
     private static boolean isAssignableFrom(boolean isDelegateOrEvent, Class<?> injectionPointType,
TypeVariable<?> beanType)

Added: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/injection/typed/Bird.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/injection/typed/Bird.java?rev=1665522&view=auto
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/injection/typed/Bird.java
(added)
+++ openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/injection/typed/Bird.java
Tue Mar 10 13:10:00 2015
@@ -0,0 +1,23 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.test.injection.typed;
+
+public interface Bird
+{
+}

Added: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/injection/typed/Raven.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/injection/typed/Raven.java?rev=1665522&view=auto
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/injection/typed/Raven.java
(added)
+++ openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/injection/typed/Raven.java
Tue Mar 10 13:10:00 2015
@@ -0,0 +1,26 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.test.injection.typed;
+
+import javax.enterprise.inject.Typed;
+
+@Typed
+public class Raven implements Bird
+{
+}

Added: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/injection/typed/TypedFieldProducer.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/injection/typed/TypedFieldProducer.java?rev=1665522&view=auto
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/injection/typed/TypedFieldProducer.java
(added)
+++ openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/injection/typed/TypedFieldProducer.java
Tue Mar 10 13:10:00 2015
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.test.injection.typed;
+
+import javax.enterprise.context.Dependent;
+import javax.enterprise.inject.Produces;
+import javax.enterprise.inject.Typed;
+
+@Dependent
+public class TypedFieldProducer
+{
+    @Produces
+    @Typed(Raven.class) // no boring bird
+    private Raven raven = new Raven();
+}

Added: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/injection/typed/TypedMethodProducer.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/injection/typed/TypedMethodProducer.java?rev=1665522&view=auto
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/injection/typed/TypedMethodProducer.java
(added)
+++ openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/injection/typed/TypedMethodProducer.java
Tue Mar 10 13:10:00 2015
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.test.injection.typed;
+
+import javax.enterprise.context.Dependent;
+import javax.enterprise.inject.Produces;
+import javax.enterprise.inject.Typed;
+
+@Dependent
+public class TypedMethodProducer
+{
+    @Produces
+    @Typed(Raven.class) // no boring bird
+    public Raven getRaven()
+    {
+       return new Raven();
+    }
+}

Added: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/injection/typed/TypedProducerTest.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/injection/typed/TypedProducerTest.java?rev=1665522&view=auto
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/injection/typed/TypedProducerTest.java
(added)
+++ openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/injection/typed/TypedProducerTest.java
Tue Mar 10 13:10:00 2015
@@ -0,0 +1,54 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.test.injection.typed;
+
+import javax.enterprise.inject.spi.Bean;
+import java.util.Set;
+
+import junit.framework.Assert;
+import org.apache.webbeans.test.AbstractUnitTest;
+import org.junit.Test;
+
+public class TypedProducerTest extends AbstractUnitTest
+{
+
+    @Test
+    public void testTypedProducerMethod()
+    {
+        startContainer(Bird.class, Raven.class, TypedMethodProducer.class);
+
+        Raven raven = getInstance(Raven.class);
+        Assert.assertNotNull(raven);
+
+        Set<Bean<?>> birdBeans = getBeanManager().getBeans(Bird.class);
+        Assert.assertTrue(birdBeans.isEmpty());
+    }
+
+    @Test
+    public void testTypedProducerField()
+    {
+        startContainer(Bird.class, Raven.class, TypedFieldProducer.class);
+
+        Raven raven = getInstance(Raven.class);
+        Assert.assertNotNull(raven);
+
+        Set<Bean<?>> birdBeans = getBeanManager().getBeans(Bird.class);
+        Assert.assertTrue(birdBeans.isEmpty());
+    }
+}

Modified: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/producer/GenericProducerTest.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/producer/GenericProducerTest.java?rev=1665522&r1=1665521&r2=1665522&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/producer/GenericProducerTest.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/producer/GenericProducerTest.java
Tue Mar 10 13:10:00 2015
@@ -36,9 +36,9 @@ public class GenericProducerTest extends
     private Injected injected;
 
     @Test
-    public void check()
+    public void checkParameterizedProducerMethod()
     {
-        startContainer(asList(TheProducer.class, Injected.class), Collections.<String>emptyList(),
true);
+        startContainer(asList(TheParameterizedProducer.class, Injected.class), Collections.<String>emptyList(),
true);
         assertNotNull(injected);
         assertNotNull(injected.getGauge());
         assertNotNull(injected.getGauge().getValue());
@@ -48,37 +48,80 @@ public class GenericProducerTest extends
         assertEquals(1L, injected.getGauge2().getValue().longValue());
     }
 
-    public static class TheProducer
+    /**
+     * This was explicitly specified to work in CDI-1.0.
+     * We need it for backward compatibility!
+     */
+    @Test
+    public void checkRawProducerMethod()
+    {
+        startContainer(asList(TheRawProducer.class, Injected.class), Collections.<String>emptyList(),
true);
+        assertNotNull(injected);
+        assertNotNull(injected.getGauge());
+        assertNotNull(injected.getGauge().getValue());
+        assertEquals("ok", injected.getGauge().getValue());
+        assertNotNull(injected.getGauge2());
+        assertNotNull(injected.getGauge2().getValue());
+        assertEquals(1L, injected.getGauge2().getValue().longValue());
+    }
+
+    /**
+     * This was explicitly specified to work in CDI-1.0.
+     * We need it for backward compatibility!
+     */
+    @Test
+    public void checkMixedProducerMethods()
+    {
+        startContainer(asList(TheRawProducer.class, TheParameterizedProducer.class, Injected.class),
Collections.<String>emptyList(), true);
+        assertNotNull(injected);
+        assertNotNull(injected.getGauge());
+        assertNotNull(injected.getGauge().getValue());
+        assertEquals("ok", injected.getGauge().getValue());
+        assertNotNull(injected.getGauge2());
+        assertNotNull(injected.getGauge2().getValue());
+        assertEquals(1L, injected.getGauge2().getValue().longValue());
+    }
+
+    public static class TheParameterizedProducer
     {
         @Produces
-        public <T> Gauge<T> gaugeProducer()
+        public <T, X> Gauge<T, X> gaugeProducer()
         {
-            return new Gauge<T>();
+            return new Gauge<T, X>();
+        }
+    }
+
+    public static class TheRawProducer
+    {
+        @Produces
+        public Gauge gaugeProducer()
+        {
+            return new Gauge();
         }
     }
 
     public static class Injected
     {
         @Inject
-        private Gauge<String> gauge;
+        private Gauge<String, Integer> gauge;
 
         @Inject
-        private Gauge<Long> gauge2;
+        private Gauge<Long, Integer> gauge2;
 
-        public Gauge<String> getGauge()
+        public Gauge<String, Integer> getGauge()
         {
             gauge.value = "ok";
             return gauge;
         }
 
-        public Gauge<Long> getGauge2()
+        public Gauge<Long, Integer> getGauge2()
         {
             gauge2.value = 1L;
             return gauge2;
         }
     }
 
-    public static class Gauge<T>
+    public static class Gauge<T, X>
     {
         private T value;
 
@@ -87,4 +130,7 @@ public class GenericProducerTest extends
             return value;
         }
     }
+
+
+
 }

Modified: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/pfield/ProducerFieldComponentTest.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/pfield/ProducerFieldComponentTest.java?rev=1665522&r1=1665521&r2=1665522&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/pfield/ProducerFieldComponentTest.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/pfield/ProducerFieldComponentTest.java
Tue Mar 10 13:10:00 2015
@@ -55,7 +55,9 @@ public class ProducerFieldComponentTest
     {
         startContainer(ProducerFieldDefinitionParameterized.class, ProducerFieldInjectedWrongType.class);
 
-        getInstance(ProducerFieldInjectedWrongType.class);
+        ProducerFieldInjectedWrongType instance = getInstance(ProducerFieldInjectedWrongType.class);
+        instance.getMyList();
+
     }
     
     @Test(expected = WebBeansConfigurationException.class)

Modified: openwebbeans/trunk/webbeans-tck/standalone-suite.xml
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-tck/standalone-suite.xml?rev=1665522&r1=1665521&r2=1665522&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-tck/standalone-suite.xml (original)
+++ openwebbeans/trunk/webbeans-tck/standalone-suite.xml Tue Mar 10 13:10:00 2015
@@ -141,7 +141,7 @@
                 </methods>
             </class>
 
-            <!-- CDITCK-467 -->
+            <!-- CDI-514 (issue got moved from original CDITC -->
             <class name="org.jboss.cdi.tck.tests.event.fires.FireEventTest">
                 <methods>
                     <exclude name="testDuplicateBindingsToFireEventFails"/>
@@ -172,6 +172,14 @@
                     <exclude name="testSameBindingTypesToResolveInterceptorsFails"/>
                 </methods>
             </class>
+
+
+            <!-- CDI-517 -->
+            <class name="org.jboss.cdi.tck.tests.lookup.typesafe.resolution.parameterized.raw.RawBeanTypeParameterizedRequiredTypeTest">
+                <methods>
+                    <exclude name="testNotAssignableTypeParams"/>
+                </methods>
+            </class>
         </classes>
 
 



Mime
View raw message