openwebbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bergm...@apache.org
Subject svn commit: r1089620 - in /openwebbeans/trunk/webbeans-impl/src: main/java/org/apache/webbeans/component/ test/java/org/apache/webbeans/newtests/profields/ test/java/org/apache/webbeans/newtests/profields/beans/stringproducer/
Date Wed, 06 Apr 2011 20:52:34 GMT
Author: bergmark
Date: Wed Apr  6 20:52:33 2011
New Revision: 1089620

URL: http://svn.apache.org/viewvc?rev=1089620&view=rev
Log:
[OWB-558] Fix PassivationCapable ID generation for ProducerFields with generics.

Added:
    openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/profields/ProducerFieldPassivationIdTest.java
  (with props)
    openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/profields/beans/stringproducer/MultipleListProducer.java
  (with props)
Modified:
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/ProducerFieldBean.java

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/ProducerFieldBean.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/ProducerFieldBean.java?rev=1089620&r1=1089619&r2=1089620&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/ProducerFieldBean.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/ProducerFieldBean.java
Wed Apr  6 20:52:33 2011
@@ -187,6 +187,17 @@ public class ProducerFieldBean<T> extend
         return isPassivationCapable(this.producerField.getType(),this.producerField.getModifiers());
     }
     
+    @Override
+    public String getId()
+    {
+        if (passivatingId == null)
+        {
+            String id = super.getId();
+            
+            passivatingId = id + "#" + producerField.toGenericString();
+        }
+        return passivatingId;
+    }
 
     /**
      * {@inheritDoc}

Added: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/profields/ProducerFieldPassivationIdTest.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/profields/ProducerFieldPassivationIdTest.java?rev=1089620&view=auto
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/profields/ProducerFieldPassivationIdTest.java
(added)
+++ openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/profields/ProducerFieldPassivationIdTest.java
Wed Apr  6 20:52:33 2011
@@ -0,0 +1,50 @@
+/*
+ * 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.profields;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import junit.framework.Assert;
+
+import org.apache.webbeans.newtests.AbstractUnitTest;
+import org.apache.webbeans.newtests.profields.beans.stringproducer.MultipleListProducer;
+import org.junit.Test;
+
+public class ProducerFieldPassivationIdTest extends AbstractUnitTest
+{
+    
+    /**
+     * Tests the the getID() method of PassivationCapable Producer Field beans are unique
if
+     * generics are used in the field type.
+     */
+    @Test
+    public void testMultipleListsWithGenerics()
+    {
+        Collection<Class<?>> beanClasses = new ArrayList<Class<?>>();
+        beanClasses.add(MultipleListProducer.class);
+        
+        
+        //Will fail to deploy if we have conflicting IDs
+        startContainer(beanClasses);
+        
+        shutDownContainer();
+    }
+
+}

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

Added: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/profields/beans/stringproducer/MultipleListProducer.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/profields/beans/stringproducer/MultipleListProducer.java?rev=1089620&view=auto
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/profields/beans/stringproducer/MultipleListProducer.java
(added)
+++ openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/profields/beans/stringproducer/MultipleListProducer.java
Wed Apr  6 20:52:33 2011
@@ -0,0 +1,35 @@
+/*
+ * 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.profields.beans.stringproducer;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.enterprise.context.SessionScoped;
+import javax.enterprise.inject.Produces;
+import javax.inject.Named;
+
+public class MultipleListProducer
+{
+    @Produces @SessionScoped List<String> produceList1 = new ArrayList<String>();
+    @Produces @SessionScoped List<Integer> produceList2 = new ArrayList<Integer>();

+    
+    @Produces @SessionScoped @Named(value="name1") List<Double> producerList3 = new
ArrayList<Double>();
+    @Produces @SessionScoped @Named(value="name2") List<Double> producerList4 = new
ArrayList<Double>();
+}

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



Mime
View raw message