openwebbeans-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Arne Limburg <arne.limb...@openknowledge.de>
Subject Re: svn commit: r1412510 - in /openwebbeans/trunk/webbeans-impl/src: main/java/org/apache/webbeans/component/ test/java/org/apache/webbeans/newtests/producer/
Date Thu, 22 Nov 2012 13:45:39 GMT
Thanks! Nasty bug! Took me nearly two hours of debugging until I realized
that one time I get the one producer method and one time the other ;-)


I can merge it tomorrow, but if anyone of you has nothing else to do... ;-)

Cheers,
Arne

Am 22.11.12 14:36 schrieb "Mark Struberg" unter <struberg@yahoo.de>:

>yes, thats a straight bug fix.
>
>
>And btw: great catch Arne!
>
>LieGrue,
>trub
>
>
>
>----- Original Message -----
>> From: Romain Manni-Bucau <rmannibucau@gmail.com>
>> To: dev@openwebbeans.apache.org
>> Cc: 
>> Sent: Thursday, November 22, 2012 12:51 PM
>> Subject: Fwd: svn commit: r1412510 - in
>>/openwebbeans/trunk/webbeans-impl/src:
>>main/java/org/apache/webbeans/component/
>>test/java/org/apache/webbeans/newtests/producer/
>> 
>> Hi guys,
>> 
>> should we backport in owb 1.1.X branch?
>> 
>> *Romain Manni-Bucau*
>> *Twitter: @rmannibucau <https://twitter.com/rmannibucau>*
>> *Blog: 
>> **http://rmannibucau.wordpress.com/*<http://rmannibucau.wordpress.com/>
>> *LinkedIn: **http://fr.linkedin.com/in/rmannibucau*
>> *Github: https://github.com/rmannibucau*
>> 
>> 
>> 
>> 
>> ---------- Forwarded message ----------
>> From: <arne@apache.org>
>> Date: 2012/11/22
>> Subject: svn commit: r1412510 - in
>>/openwebbeans/trunk/webbeans-impl/src:
>> main/java/org/apache/webbeans/component/
>> test/java/org/apache/webbeans/newtests/producer/
>> To: commits@openwebbeans.apache.org
>> 
>> 
>> Author: arne
>> Date: Thu Nov 22 11:28:57 2012
>> New Revision: 1412510
>> 
>> URL: http://svn.apache.org/viewvc?rev=1412510&view=rev
>> Log:
>> OWB-724: Implemented equals and hashCode for AbstractProducerBean
>> 
>> Added:
>> 
>> 
>>openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtes
>>ts/producer/AmbigousProducerTest.java
>> 
>> 
>>openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtes
>>ts/producer/ProducerBean2.java
>> Modified:
>> 
>> 
>>openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/compon
>>ent/AbstractProducerBean.java
>> 
>> 
>>openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtes
>>ts/producer/ProducerBean.java
>> 
>> Modified:
>> 
>>openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/compon
>>ent/AbstractProducerBean.java
>> URL:
>> 
>>http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/ja
>>va/org/apache/webbeans/component/AbstractProducerBean.java?rev=1412510&r1
>>=1412509&r2=1412510&view=diff
>> 
>>=========================================================================
>>=====
>> ---
>> 
>>openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/compon
>>ent/AbstractProducerBean.java
>> (original)
>> +++
>> 
>>openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/compon
>>ent/AbstractProducerBean.java
>> Thu Nov 22 11:28:57 2012
>> @@ -165,4 +165,20 @@ public abstract class AbstractProducerBe
>>          // the injection points of producers are the parameters of the
>> producermethod.
>>          // since CDI-1.1 we must not check those for is serializable
>> anymore.
>>      }
>> +
>> +    @Override
>> +    public int hashCode()
>> +    {
>> +        return super.hashCode() ^ ownerComponent.hashCode();
>> +    }
>> +
>> +    public boolean equals(Object object)
>> +    {
>> +        if (!super.equals(object))
>> +        {
>> +            return false;
>> +        }
>> +        AbstractProducerBean<?> other = (AbstractProducerBean<?>)
>> object;
>> +        return ownerComponent.equals(other.ownerComponent);
>> +    }
>> }
>> 
>> Added:
>> 
>>openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtes
>>ts/producer/AmbigousProducerTest.java
>> URL:
>> 
>>http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/ja
>>va/org/apache/webbeans/newtests/producer/AmbigousProducerTest.java?rev=14
>>12510&view=auto
>> 
>>=========================================================================
>>=====
>> ---
>> 
>>openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtes
>>ts/producer/AmbigousProducerTest.java
>> (added)
>> +++
>> 
>>openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtes
>>ts/producer/AmbigousProducerTest.java
>> Thu Nov 22 11:28:57 2012
>> @@ -0,0 +1,55 @@
>> +/*
>> + * 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 javax.enterprise.inject.AmbiguousResolutionException;
>> +
>> +import junit.framework.Assert;
>> +
>> +import org.apache.webbeans.exception.WebBeansConfigurationException;
>> +import org.apache.webbeans.newtests.AbstractUnitTest;
>> +import org.junit.Test;
>> +
>> +public class AmbigousProducerTest extends AbstractUnitTest
>> +{
>> +
>> +    @Test
>> +    public void testAmbiguousProducer()
>> +    {
>> +        Collection<String> beanXmls = new ArrayList<String>();
>> +        Collection<Class<?>> beanClasses = new
>> ArrayList<Class<?>>();
>> +
>> +        beanClasses.add(ProducerBean.class);
>> +        beanClasses.add(ProducerBean2.class);
>> +
>> +        try {
>> +            startContainer(beanClasses, beanXmls);
>> +            Assert.fail("Should have thrown
>> AmbiguousResoultionException");
>> +        }
>> +        catch (WebBeansConfigurationException e)
>> +        {
>> +            Assert.assertEquals(AmbiguousResolutionException.class,
>> e.getCause().getClass());
>> +        }
>> +        shutDownContainer();
>> +
>> +    }
>> +}
>> 
>> Modified:
>> 
>>openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtes
>>ts/producer/ProducerBean.java
>> URL:
>> 
>>http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/ja
>>va/org/apache/webbeans/newtests/producer/ProducerBean.java?rev=1412510&r1
>>=1412509&r2=1412510&view=diff
>> 
>>=========================================================================
>>=====
>> ---
>> 
>>openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtes
>>ts/producer/ProducerBean.java
>> (original)
>> +++
>> 
>>openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtes
>>ts/producer/ProducerBean.java
>> Thu Nov 22 11:28:57 2012
>> @@ -49,7 +49,7 @@ public class ProducerBean {
>> 
>>      @Produces
>>      @Named("name5")
>> -    public String getName6() {
>> +    public String getName5() {
>>          return "name5";
>>      }
>> 
>> 
>> Added:
>> 
>>openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtes
>>ts/producer/ProducerBean2.java
>> URL:
>> 
>>http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/ja
>>va/org/apache/webbeans/newtests/producer/ProducerBean2.java?rev=1412510&v
>>iew=auto
>> 
>>=========================================================================
>>=====
>> ---
>> 
>>openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtes
>>ts/producer/ProducerBean2.java
>> (added)
>> +++
>> 
>>openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtes
>>ts/producer/ProducerBean2.java
>> Thu Nov 22 11:28:57 2012
>> @@ -0,0 +1,30 @@
>> +/*
>> + * 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 javax.enterprise.inject.Produces;
>> +import javax.inject.Named;
>> +
>> +public class ProducerBean2 {
>> +    @Produces
>> +    @Named
>> +    public String name1() {
>> +        return "name1 of ProducerBean2";
>> +    }
>> +}
>> 


Mime
View raw message