You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openwebbeans.apache.org by be...@apache.org on 2013/12/17 17:25:56 UTC

svn commit: r1551606 - in /openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests: interceptors/resolution/ producer/ producer/beans/

Author: bergmark
Date: Tue Dec 17 16:25:56 2013
New Revision: 1551606

URL: http://svn.apache.org/r1551606
Log:
OWB-868 Add test to ensure no AmbiguousResolutionException with producer methods that produce unique List types

Added:
    openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/producer/ListProducerTest.java   (with props)
    openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/producer/beans/ListConsumerBean.java   (with props)
    openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/producer/beans/MultipleListProducerBean.java   (with props)
Modified:
    openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/resolution/InterceptBridgeMethodTest.java

Modified: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/resolution/InterceptBridgeMethodTest.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/resolution/InterceptBridgeMethodTest.java?rev=1551606&r1=1551605&r2=1551606&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/resolution/InterceptBridgeMethodTest.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/resolution/InterceptBridgeMethodTest.java Tue Dec 17 16:25:56 2013
@@ -72,5 +72,7 @@ public class InterceptBridgeMethodTest e
         // value was set
         Assert.assertEquals(TestInterceptor1.invocationCount, 2);
         Assert.assertEquals(instance.getValue(), "test2");
+        
+        shutDownContainer();
     }
 }

Added: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/producer/ListProducerTest.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/producer/ListProducerTest.java?rev=1551606&view=auto
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/producer/ListProducerTest.java (added)
+++ openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/producer/ListProducerTest.java Tue Dec 17 16:25:56 2013
@@ -0,0 +1,53 @@
+/*
+ * 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.newtests.producer;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import junit.framework.Assert;
+
+import org.apache.webbeans.exception.WebBeansConfigurationException;
+import org.apache.webbeans.newtests.AbstractUnitTest;
+import org.apache.webbeans.newtests.producer.beans.ListConsumerBean;
+import org.apache.webbeans.newtests.producer.beans.MultipleListProducerBean;
+import org.junit.Test;
+
+public class ListProducerTest extends AbstractUnitTest
+{
+    @Test
+    public void testListProducersWithDifferentParameterizedTypes()
+    {
+        Collection<String> beanXmls = new ArrayList<String>();
+        Collection<Class<?>> beanClasses = new ArrayList<Class<?>>();
+
+        beanClasses.add(ListConsumerBean.class);
+        beanClasses.add(MultipleListProducerBean.class);
+
+        try
+        {
+            startContainer(beanClasses, beanXmls);
+        }
+        catch (WebBeansConfigurationException e)
+        {
+            Assert.fail("Should not have thrown AmbiguousResoultionException");
+        }
+        shutDownContainer();
+    }
+}
\ No newline at end of file

Propchange: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/producer/ListProducerTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/producer/beans/ListConsumerBean.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/producer/beans/ListConsumerBean.java?rev=1551606&view=auto
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/producer/beans/ListConsumerBean.java (added)
+++ openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/producer/beans/ListConsumerBean.java Tue Dec 17 16:25:56 2013
@@ -0,0 +1,32 @@
+/*
+ * 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.newtests.producer.beans;
+
+import java.util.List;
+
+import javax.inject.Inject;
+import javax.inject.Named;
+
+@Named
+public class ListConsumerBean {
+
+   @Inject
+   public List<Integer> listInteger;
+
+}
\ No newline at end of file

Propchange: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/producer/beans/ListConsumerBean.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/producer/beans/MultipleListProducerBean.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/producer/beans/MultipleListProducerBean.java?rev=1551606&view=auto
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/producer/beans/MultipleListProducerBean.java (added)
+++ openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/producer/beans/MultipleListProducerBean.java Tue Dec 17 16:25:56 2013
@@ -0,0 +1,43 @@
+/*
+ * 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.newtests.producer.beans;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.enterprise.inject.Produces;
+import javax.inject.Named;
+
+public class MultipleListProducerBean
+{
+
+    @Produces
+    @Named("list1")
+    public ArrayList<String> getList1()
+    {
+        return null;
+    }
+
+    @Produces
+    @Named("list2")
+    public List<Integer> getList2()
+    {
+        return null;
+    }
+}
\ No newline at end of file

Propchange: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/producer/beans/MultipleListProducerBean.java
------------------------------------------------------------------------------
    svn:eol-style = native