You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openwebbeans.apache.org by st...@apache.org on 2010/02/25 14:00:30 UTC
svn commit: r916274 - in /openwebbeans/trunk/webbeans-impl/src:
main/java/org/apache/webbeans/annotation/
main/java/org/apache/webbeans/decorator/
main/java/org/apache/webbeans/inject/instance/
main/java/org/apache/webbeans/util/ test/java/org/apache/w...
Author: struberg
Date: Thu Feb 25 13:00:29 2010
New Revision: 916274
URL: http://svn.apache.org/viewvc?rev=916274&view=rev
Log:
OWB-304 add test for broken behaviour
+ a few cleanup tasks
Added:
openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/profields/beans/InformationConsumerBean.java
Modified:
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/annotation/NamedLiteral.java
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/decorator/DecoratorUtil.java
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/instance/InstanceImpl.java
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansAnnotatedTypeUtil.java
openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/AbstractUnitTest.java
openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/typeliteral/TypeLiteralTest.java
openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/profields/GetterStringInjectorTest.java
Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/annotation/NamedLiteral.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/annotation/NamedLiteral.java?rev=916274&r1=916273&r2=916274&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/annotation/NamedLiteral.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/annotation/NamedLiteral.java Thu Feb 25 13:00:29 2010
@@ -25,6 +25,16 @@
public class NamedLiteral extends AnnotationLiteral<Named> implements Named
{
private String value;
+
+ public NamedLiteral()
+ {
+
+ }
+
+ public NamedLiteral(String value)
+ {
+ this.value = value;
+ }
@Override
public String value()
Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/decorator/DecoratorUtil.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/decorator/DecoratorUtil.java?rev=916274&r1=916273&r2=916274&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/decorator/DecoratorUtil.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/decorator/DecoratorUtil.java Thu Feb 25 13:00:29 2010
@@ -26,7 +26,6 @@
import javax.enterprise.inject.spi.Decorator;
import org.apache.webbeans.component.AbstractInjectionTargetBean;
-import org.apache.webbeans.component.ManagedBean;
import org.apache.webbeans.config.OWBLogConst;
import org.apache.webbeans.container.BeanManagerImpl;
import org.apache.webbeans.exception.WebBeansConfigurationException;
Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/instance/InstanceImpl.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/instance/InstanceImpl.java?rev=916274&r1=916273&r2=916274&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/instance/InstanceImpl.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/instance/InstanceImpl.java Thu Feb 25 13:00:29 2010
@@ -38,6 +38,8 @@
*/
class InstanceImpl<T> implements Instance<T>, Serializable
{
+ private static final long serialVersionUID = -8401944412490389024L;
+
/** Injected class type */
private Type injectionClazz;
Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansAnnotatedTypeUtil.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansAnnotatedTypeUtil.java?rev=916274&r1=916273&r2=916274&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansAnnotatedTypeUtil.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansAnnotatedTypeUtil.java Thu Feb 25 13:00:29 2010
@@ -67,7 +67,6 @@
import org.apache.webbeans.config.OWBLogConst;
import org.apache.webbeans.config.OpenWebBeansConfiguration;
import org.apache.webbeans.container.InjectionResolver;
-import org.apache.webbeans.decorator.DecoratorUtil;
import org.apache.webbeans.decorator.DecoratorsManager;
import org.apache.webbeans.decorator.WebBeansDecoratorConfig;
import org.apache.webbeans.event.NotificationManager;
@@ -104,11 +103,9 @@
{
throw new WebBeansConfigurationException("There are more than one constructor with @Inject annotation in annotation type : " + type);
}
- else
- {
- found = true;
- result = annConst;
- }
+
+ found = true;
+ result = annConst;
}
else
{
@@ -254,10 +251,7 @@
throw new UnsatisfiedResolutionException("Producer method component of the disposal method : " + declaredMethod.getName() + " in class : " + annotatedMethod.getDeclaringType().getJavaClass() + "is not found");
}
- else
- {
- pr = (ProducerMethodBean<?>) foundBean;
- }
+ pr = (ProducerMethodBean<?>) foundBean;
if (previous == null)
{
@@ -623,9 +617,8 @@
+ ". Multiple disposes annotation.");
}
else
- {
- found = true;
- }
+
+ found = true;
}
}
@@ -728,12 +721,10 @@
{
throw new WebBeansConfigurationException("Maanged bean class : " + clazz.getName() + " can not define non-static, non-private final methods. Because it is annotated with at least one @InterceptorBinding");
}
- else
+
+ if (AnnotationUtil.hasInterceptorBindingMetaAnnotation(AnnotationUtil.getAnnotationsFromSet(methodA.getAnnotations())))
{
- if (AnnotationUtil.hasInterceptorBindingMetaAnnotation(AnnotationUtil.getAnnotationsFromSet(methodA.getAnnotations())))
- {
- throw new WebBeansConfigurationException("Method : " + method.getName() + "in managed bean class : " + clazz.getName() + " can not be defined as non-static, non-private and final . Because it is annotated with at least one @InterceptorBinding");
- }
+ throw new WebBeansConfigurationException("Method : " + method.getName() + "in managed bean class : " + clazz.getName() + " can not be defined as non-static, non-private and final . Because it is annotated with at least one @InterceptorBinding");
}
}
Modified: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/AbstractUnitTest.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/AbstractUnitTest.java?rev=916274&r1=916273&r2=916274&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/AbstractUnitTest.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/AbstractUnitTest.java Thu Feb 25 13:00:29 2010
@@ -13,18 +13,21 @@
*/
package org.apache.webbeans.newtests;
+import java.lang.annotation.Annotation;
import java.net.URL;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
+import java.util.Set;
+import javax.enterprise.inject.spi.Bean;
import javax.enterprise.inject.spi.BeanManager;
import javax.enterprise.inject.spi.Extension;
import org.apache.webbeans.lifecycle.test.OpenWebBeansTestLifeCycle;
import org.apache.webbeans.lifecycle.test.OpenWebBeansTestMetaDataDiscoveryService;
import org.apache.webbeans.portable.events.ExtensionLoader;
-
+import org.junit.Assert;
public abstract class AbstractUnitTest
@@ -95,6 +98,18 @@
return this.testLifecycle.getBeanManager();
}
+ @SuppressWarnings("unchecked")
+ protected <T> T getInstance(Class<T> type, Annotation... qualifiers)
+ {
+ Set<Bean<?>> beans = getBeanManager().getBeans(type, qualifiers);
+ Assert.assertNotNull(beans);
+ Assert.assertTrue("resolving bean with type" + type + " is ambiguous!", beans.size() == 1);
+
+ Bean<T> bean = (Bean<T>) beans.iterator().next();
+
+ return (T) getBeanManager().getReference(bean, type, getBeanManager().createCreationalContext(bean));
+ }
+
protected URL getXMLUrl(String packageName, String fileName)
{
StringBuilder prefix = new StringBuilder(packageName.replace('.', '/'));
Modified: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/typeliteral/TypeLiteralTest.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/typeliteral/TypeLiteralTest.java?rev=916274&r1=916273&r2=916274&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/typeliteral/TypeLiteralTest.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/typeliteral/TypeLiteralTest.java Thu Feb 25 13:00:29 2010
@@ -19,22 +19,16 @@
package org.apache.webbeans.newtests.injection.typeliteral;
import java.lang.annotation.Annotation;
-import java.lang.reflect.Field;
import java.net.URL;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Set;
-import javax.enterprise.context.spi.CreationalContext;
import javax.enterprise.inject.spi.Bean;
-import javax.enterprise.inject.spi.InjectionPoint;
import javax.enterprise.util.TypeLiteral;
-import junit.framework.Assert;
import org.apache.webbeans.newtests.AbstractUnitTest;
-import org.apache.webbeans.newtests.injection.injectionpoint.beans.InjectionPointMetaDataOwner;
-import org.apache.webbeans.newtests.injection.injectionpoint.beans.LoggerInjectedBean;
import org.junit.Test;
public class TypeLiteralTest extends AbstractUnitTest
Modified: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/profields/GetterStringInjectorTest.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/profields/GetterStringInjectorTest.java?rev=916274&r1=916273&r2=916274&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/profields/GetterStringInjectorTest.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/profields/GetterStringInjectorTest.java Thu Feb 25 13:00:29 2010
@@ -26,9 +26,11 @@
import junit.framework.Assert;
+import org.apache.webbeans.annotation.NamedLiteral;
import org.apache.webbeans.newtests.AbstractUnitTest;
import org.apache.webbeans.newtests.profields.beans.GetterStringFieldInjector;
import org.apache.webbeans.newtests.profields.beans.GetterStringProducerBean;
+import org.apache.webbeans.newtests.profields.beans.InformationConsumerBean;
import org.junit.Test;
public class GetterStringInjectorTest extends AbstractUnitTest
@@ -42,6 +44,7 @@
Collection<Class<?>> beanClasses = new ArrayList<Class<?>>();
beanClasses.add(GetterStringProducerBean.class);
beanClasses.add(GetterStringFieldInjector.class);
+ beanClasses.add(InformationConsumerBean.class);
startContainer(beanClasses, beanXmls);
@@ -50,6 +53,8 @@
Assert.assertEquals("Sucess from getProducts",injector.getTestNamed3());
+ InformationConsumerBean icb = getInstance(InformationConsumerBean.class, new NamedLiteral("ProMethodNamed1"));
+
shutDownContainer();
}
Added: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/profields/beans/InformationConsumerBean.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/profields/beans/InformationConsumerBean.java?rev=916274&view=auto
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/profields/beans/InformationConsumerBean.java (added)
+++ openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/profields/beans/InformationConsumerBean.java Thu Feb 25 13:00:29 2010
@@ -0,0 +1,38 @@
+/*
+ * 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;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.inject.Inject;
+import javax.inject.Named;
+
+/**
+ * This simply tests if actually injecting the String values
+ * from our fancy producer methods really works.
+ */
+@ApplicationScoped
+public class InformationConsumerBean {
+
+ private @Inject @Named("ProMethodNamed1") String proMethodString;
+
+ public String getProMethodString()
+ {
+ return proMethodString;
+ }
+}
Re: AW: svn commit: r916274 - in /openwebbeans/trunk/webbeans-impl/src: main/java/org/apache/webbeans/annotation/ main/java/org/apache/webbeans/decorator/ main/java/org/apache/webbeans/inject/instance/ main/java/org/apache/webbeans/util/ test/java/org/apache/w...
Posted by Mark Struberg <st...@yahoo.de>.
Thanks, will check it out!
The problem did occur in my real world application so I should try translate this scenario into a test.
LieGrue,
strub
--- Gurkan Erdogdu <gu...@yahoo.com> schrieb am Do, 25.2.2010:
> Von: Gurkan Erdogdu <gu...@yahoo.com>
> Betreff: Re: AW: svn commit: r916274 - in /openwebbeans/trunk/webbeans-impl/src: main/java/org/apache/webbeans/annotation/ main/java/org/apache/webbeans/decorator/ main/java/org/apache/webbeans/inject/instance/ main/java/org/apache/webbeans/util/ test/java/org/apache/w...
> An: dev@openwebbeans.apache.org
> Datum: Donnerstag, 25. Februar, 2010 18:54 Uhr
> Mark;
>
> Seems that your test case is implemented wrongly! I have
> committed changes and test run succesfully.
>
> Please check it!
>
> --Gurkan
>
>
>
>
> ________________________________
> From: Mark Struberg <st...@yahoo.de>
> To: dev@openwebbeans.apache.org
> Sent: Thu, February 25, 2010 3:08:13 PM
> Subject: AW: svn commit: r916274 - in
> /openwebbeans/trunk/webbeans-impl/src:
> main/java/org/apache/webbeans/annotation/
> main/java/org/apache/webbeans/decorator/
> main/java/org/apache/webbeans/inject/instance/
> main/java/org/apache/webbeans/util/
> test/java/org/apache/w...
>
> Hi!
>
> usually I don't commits which break the tests, but this is
> really an outstanding blocker. Basically all ProducerMethods
> are not working anymore as far as I saw.
>
> Looks like it has something to do with the
> ParameterizedType.
>
> Gurkan, can we look at this together in the evening
> please?
>
> LieGrue,
> strub
>
> --- struberg@apache.org
> <st...@apache.org>
> schrieb am Do, 25.2.2010:
>
> > Von: struberg@apache.org
> <st...@apache.org>
> > Betreff: svn commit: r916274 - in
> /openwebbeans/trunk/webbeans-impl/src:
> main/java/org/apache/webbeans/annotation/
> main/java/org/apache/webbeans/decorator/
> main/java/org/apache/webbeans/inject/instance/
> main/java/org/apache/webbeans/util/
> test/java/org/apache/w...
> > An: commits@openwebbeans.apache.org
> > Datum: Donnerstag, 25. Februar, 2010 14:00 Uhr
> > Author: struberg
> > Date: Thu Feb 25 13:00:29 2010
> > New Revision: 916274
> >
> > URL: http://svn.apache.org/viewvc?rev=916274&view=rev
> > Log:
> > OWB-304 add test for broken behaviour
> >
> > + a few cleanup tasks
> >
> > Added:
> >
> >
> openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/profields/beans/InformationConsumerBean.java
> > Modified:
> >
> >
> openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/annotation/NamedLiteral.java
> >
> >
> openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/decorator/DecoratorUtil.java
> >
> >
> openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/instance/InstanceImpl.java
> >
> >
> openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansAnnotatedTypeUtil.java
> >
> >
> openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/AbstractUnitTest.java
> >
> >
> openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/typeliteral/TypeLiteralTest.java
> >
> >
> openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/profields/GetterStringInjectorTest.java
> >
> > Modified:
> >
> openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/annotation/NamedLiteral.java
> > URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/annotation/NamedLiteral.java?rev=916274&r1=916273&r2=916274&view=diff
> >
> ==============================================================================
> > ---
> >
> openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/annotation/NamedLiteral.java
> > (original)
> > +++
> >
> openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/annotation/NamedLiteral.java
> > Thu Feb 25 13:00:29 2010
> > @@ -25,6 +25,16 @@
> > public class NamedLiteral extends
> > AnnotationLiteral<Named> implements Named
> > {
> > private String value;
> > +
> > + public NamedLiteral()
> > + {
> > +
> > + }
> > +
> > + public NamedLiteral(String value)
> > + {
> > + this.value = value;
> > + }
> >
> > @Override
> > public String value()
> >
> > Modified:
> >
> openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/decorator/DecoratorUtil.java
> > URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/decorator/DecoratorUtil.java?rev=916274&r1=916273&r2=916274&view=diff
> >
> ==============================================================================
> > ---
> >
> openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/decorator/DecoratorUtil.java
> > (original)
> > +++
> >
> openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/decorator/DecoratorUtil.java
> > Thu Feb 25 13:00:29 2010
> > @@ -26,7 +26,6 @@
> > import javax.enterprise.inject.spi.Decorator;
> >
> > import
> >
> org.apache.webbeans.component.AbstractInjectionTargetBean;
> > -import org.apache.webbeans.component.ManagedBean;
> > import org.apache.webbeans.config.OWBLogConst;
> > import
> org.apache.webbeans.container.BeanManagerImpl;
> > import
> >
> org.apache.webbeans.exception.WebBeansConfigurationException;
> >
> > Modified:
> >
> openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/instance/InstanceImpl.java
> > URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/instance/InstanceImpl.java?rev=916274&r1=916273&r2=916274&view=diff
> >
> ==============================================================================
> > ---
> >
> openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/instance/InstanceImpl.java
> > (original)
> > +++
> >
> openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/instance/InstanceImpl.java
> > Thu Feb 25 13:00:29 2010
> > @@ -38,6 +38,8 @@
> > */
> > class InstanceImpl<T> implements
> Instance<T>,
> > Serializable
> > {
> > + private static final long
> serialVersionUID =
> > -8401944412490389024L;
> > +
> > /** Injected class type */
> > private Type injectionClazz;
> >
> >
> > Modified:
> >
> openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansAnnotatedTypeUtil.java
> > URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansAnnotatedTypeUtil.java?rev=916274&r1=916273&r2=916274&view=diff
> >
> ==============================================================================
> > ---
> >
> openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansAnnotatedTypeUtil.java
> > (original)
> > +++
> >
> openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansAnnotatedTypeUtil.java
> > Thu Feb 25 13:00:29 2010
> > @@ -67,7 +67,6 @@
> > import org.apache.webbeans.config.OWBLogConst;
> > import
> > org.apache.webbeans.config.OpenWebBeansConfiguration;
> > import
> org.apache.webbeans.container.InjectionResolver;
> > -import org.apache.webbeans.decorator.DecoratorUtil;
> > import
> org.apache.webbeans.decorator.DecoratorsManager;
> > import
> >
> org.apache.webbeans.decorator.WebBeansDecoratorConfig;
> > import
> org.apache.webbeans.event.NotificationManager;
> > @@ -104,11 +103,9 @@
> >
>
> > {
> >
>
> > throw new
> > WebBeansConfigurationException("There are more than
> one
> > constructor with @Inject annotation in annotation type
> : " +
> > type);
> >
>
> > }
> > -
>
> > else
> > -
>
> > {
> > -
>
> > found = true;
> > -
>
> > result =
> annConst;
> > -
>
> > }
>
> >
> > +
>
> >
> > +
>
> > found = true;
> > +
>
> > result = annConst;
> >
> > }
> >
> > else
> >
> > {
> > @@ -254,10 +251,7 @@
> >
>
> > throw new
> > UnsatisfiedResolutionException("Producer method
> component of
> > the disposal method : " + declaredMethod.getName() + "
> in
> > class : " +
> > annotatedMethod.getDeclaringType().getJavaClass() +
> "is not
> > found");
> >
> > }
> >
> > -
>
> > else
> > -
> {
> > -
>
> > pr =
> (ProducerMethodBean<?>) foundBean;
> > -
> }
> > +
> pr
> > = (ProducerMethodBean<?>) foundBean;
> >
> >
> > if (previous == null)
> >
> > {
> > @@ -623,9 +617,8 @@
> >
>
> > + ".
> > Multiple disposes annotation.");
> >
> > }
> >
> > else
> > -
> {
> > -
>
> > found = true;
> > -
> }
> > +
> > +
>
> > found = true;
> > }
> > }
> >
> > @@ -728,12 +721,10 @@
> >
> > {
> >
>
> > throw new
> > WebBeansConfigurationException("Maanged bean class : "
> +
> > clazz.getName() + " can not define non-static,
> non-private
> > final methods. Because it is annotated with at least
> one
> > @InterceptorBinding");
> >
> > }
> > -
>
> > else
> > +
> > +
> if
> >
> (AnnotationUtil.hasInterceptorBindingMetaAnnotation(AnnotationUtil.getAnnotationsFromSet(methodA.getAnnotations())))
> >
> > {
> > -
>
> > if
> >
> (AnnotationUtil.hasInterceptorBindingMetaAnnotation(AnnotationUtil.getAnnotationsFromSet(methodA.getAnnotations())))
> > -
>
> > {
> > -
>
> > throw new
> > WebBeansConfigurationException("Method : " +
> > method.getName() + "in managed bean class : " +
> > clazz.getName() + " can not be defined as non-static,
> > non-private and final . Because it is annotated with
> at
> > least one @InterceptorBinding");
> > -
>
> > }
> > +
>
> > throw new
> > WebBeansConfigurationException("Method : " +
> > method.getName() + "in managed bean class : " +
> > clazz.getName() + " can not be defined as non-static,
> > non-private and final . Because it is annotated with
> at
> > least one @InterceptorBinding");
> >
> > }
> > }
> >
> >
> > Modified:
> >
> openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/AbstractUnitTest.java
> > URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/AbstractUnitTest.java?rev=916274&r1=916273&r2=916274&view=diff
> >
> ==============================================================================
> > ---
> >
> openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/AbstractUnitTest.java
> > (original)
> > +++
> >
> openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/AbstractUnitTest.java
> > Thu Feb 25 13:00:29 2010
> > @@ -13,18 +13,21 @@
> > */
> > package org.apache.webbeans.newtests;
> >
> > +import java.lang.annotation.Annotation;
> > import java.net.URL;
> > import java.util.ArrayList;
> > import java.util.Collection;
> > import java.util.List;
> > +import java.util.Set;
> >
> > +import javax.enterprise.inject.spi.Bean;
> > import javax.enterprise.inject.spi.BeanManager;
> > import javax.enterprise.inject.spi.Extension;
> >
> > import
> >
> org.apache.webbeans.lifecycle.test.OpenWebBeansTestLifeCycle;
> > import
> >
> org.apache.webbeans.lifecycle.test.OpenWebBeansTestMetaDataDiscoveryService;
> > import
> > org.apache.webbeans.portable.events.ExtensionLoader;
> > -
> > +import org.junit.Assert;
> >
> >
> > public abstract class AbstractUnitTest
> > @@ -95,6 +98,18 @@
> > return
> > this.testLifecycle.getBeanManager();
> > }
> >
> > + @SuppressWarnings("unchecked")
> > + protected <T> T
> > getInstance(Class<T> type, Annotation...
> qualifiers)
> > + {
> > + Set<Bean<?>>
> beans
> > = getBeanManager().getBeans(type, qualifiers);
> > +
> Assert.assertNotNull(beans);
> > +
> Assert.assertTrue("resolving
> > bean with type" + type + " is ambiguous!",
> beans.size() ==
> > 1);
> > +
> > + Bean<T> bean =
> > (Bean<T>) beans.iterator().next();
> > +
> > + return (T)
> > getBeanManager().getReference(bean, type,
> > getBeanManager().createCreationalContext(bean));
> > + }
> > +
> > protected URL getXMLUrl(String
> > packageName, String fileName)
> > {
> > StringBuilder
> prefix
> > = new StringBuilder(packageName.replace('.', '/'));
> >
> > Modified:
> >
> openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/typeliteral/TypeLiteralTest.java
> > URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/typeliteral/TypeLiteralTest.java?rev=916274&r1=916273&r2=916274&view=diff
> >
> ==============================================================================
> > ---
> >
> openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/typeliteral/TypeLiteralTest.java
> > (original)
> > +++
> >
> openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/typeliteral/TypeLiteralTest.java
> > Thu Feb 25 13:00:29 2010
> > @@ -19,22 +19,16 @@
> > package
> > org.apache.webbeans.newtests.injection.typeliteral;
> >
> > import java.lang.annotation.Annotation;
> > -import java.lang.reflect.Field;
> > import java.net.URL;
> > import java.util.ArrayList;
> > import java.util.Collection;
> > import java.util.Set;
> >
> > -import
> javax.enterprise.context.spi.CreationalContext;
> > import javax.enterprise.inject.spi.Bean;
> > -import javax.enterprise.inject.spi.InjectionPoint;
> > import javax.enterprise.util.TypeLiteral;
> >
> > -import junit.framework.Assert;
> >
> > import
> org.apache.webbeans.newtests.AbstractUnitTest;
> > -import
> >
> org.apache.webbeans.newtests.injection.injectionpoint.beans.InjectionPointMetaDataOwner;
> > -import
> >
> org.apache.webbeans.newtests.injection.injectionpoint.beans.LoggerInjectedBean;
> > import org.junit.Test;
> >
> > public class TypeLiteralTest extends
> AbstractUnitTest
> >
> > Modified:
> >
> openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/profields/GetterStringInjectorTest.java
> > URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/profields/GetterStringInjectorTest.java?rev=916274&r1=916273&r2=916274&view=diff
> >
> ==============================================================================
> > ---
> >
> openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/profields/GetterStringInjectorTest.java
> > (original)
> > +++
> >
> openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/profields/GetterStringInjectorTest.java
> > Thu Feb 25 13:00:29 2010
> > @@ -26,9 +26,11 @@
> >
> > import junit.framework.Assert;
> >
> > +import org.apache.webbeans.annotation.NamedLiteral;
> > import
> org.apache.webbeans.newtests.AbstractUnitTest;
> > import
> >
> org.apache.webbeans.newtests.profields.beans.GetterStringFieldInjector;
> > import
> >
> org.apache.webbeans.newtests.profields.beans.GetterStringProducerBean;
> > +import
> >
> org.apache.webbeans.newtests.profields.beans.InformationConsumerBean;
> > import org.junit.Test;
> >
> > public class GetterStringInjectorTest extends
> > AbstractUnitTest
> > @@ -42,6 +44,7 @@
> >
> > Collection<Class<?>>
> > beanClasses = new ArrayList<Class<?>>();
> >
> >
> beanClasses.add(GetterStringProducerBean.class);
> >
> >
> beanClasses.add(GetterStringFieldInjector.class);
> > +
> > beanClasses.add(InformationConsumerBean.class);
> >
> >
> > startContainer(beanClasses,
> > beanXmls);
> >
> > @@ -50,6 +53,8 @@
> >
> >
> > Assert.assertEquals("Sucess from
> > getProducts",injector.getTestNamed3());
> >
> > + InformationConsumerBean
> icb =
> > getInstance(InformationConsumerBean.class, new
> > NamedLiteral("ProMethodNamed1"));
> > +
> >
> > shutDownContainer();
> > }
> >
> >
> > Added:
> >
> openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/profields/beans/InformationConsumerBean.java
> > URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/profields/beans/InformationConsumerBean.java?rev=916274&view=auto
> >
> ==============================================================================
> > ---
> >
> openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/profields/beans/InformationConsumerBean.java
> > (added)
> > +++
> >
> openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/profields/beans/InformationConsumerBean.java
> > Thu Feb 25 13:00:29 2010
> > @@ -0,0 +1,38 @@
> > +/*
> > + * 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;
> > +
> > +import javax.enterprise.context.ApplicationScoped;
> > +import javax.inject.Inject;
> > +import javax.inject.Named;
> > +
> > +/**
> > + * This simply tests if actually injecting the
> String
> > values
> > + * from our fancy producer methods really works.
> > + */
> > +@ApplicationScoped
> > +public class InformationConsumerBean {
> > +
> > + private @Inject
> > @Named("ProMethodNamed1") String proMethodString;
> > +
> > + public String getProMethodString()
> > + {
> > + return proMethodString;
> > + }
> > +}
> >
> >
> >
>
> __________________________________________________
> Do You Yahoo!?
> Sie sind Spam leid? Yahoo! Mail verfügt über einen
> herausragenden Schutz gegen Massenmails.
> http://mail.yahoo.com
>
>
>
>
> ___________________________________________________________________
> Yahoo! Türkiye açıldı! http://yahoo.com.tr
> İnternet üzerindeki en iyi içeriği Yahoo! Türkiye
> sizlere sunuyor!
__________________________________________________
Do You Yahoo!?
Sie sind Spam leid? Yahoo! Mail verfügt über einen herausragenden Schutz gegen Massenmails.
http://mail.yahoo.com
Re: AW: svn commit: r916274 - in /openwebbeans/trunk/webbeans-impl/src: main/java/org/apache/webbeans/annotation/ main/java/org/apache/webbeans/decorator/ main/java/org/apache/webbeans/inject/instance/ main/java/org/apache/webbeans/util/ test/java/org/apache/w...
Posted by Gurkan Erdogdu <gu...@yahoo.com>.
Mark;
Seems that your test case is implemented wrongly! I have committed changes and test run succesfully.
Please check it!
--Gurkan
________________________________
From: Mark Struberg <st...@yahoo.de>
To: dev@openwebbeans.apache.org
Sent: Thu, February 25, 2010 3:08:13 PM
Subject: AW: svn commit: r916274 - in /openwebbeans/trunk/webbeans-impl/src: main/java/org/apache/webbeans/annotation/ main/java/org/apache/webbeans/decorator/ main/java/org/apache/webbeans/inject/instance/ main/java/org/apache/webbeans/util/ test/java/org/apache/w...
Hi!
usually I don't commits which break the tests, but this is really an outstanding blocker. Basically all ProducerMethods are not working anymore as far as I saw.
Looks like it has something to do with the ParameterizedType.
Gurkan, can we look at this together in the evening please?
LieGrue,
strub
--- struberg@apache.org <st...@apache.org> schrieb am Do, 25.2.2010:
> Von: struberg@apache.org <st...@apache.org>
> Betreff: svn commit: r916274 - in /openwebbeans/trunk/webbeans-impl/src: main/java/org/apache/webbeans/annotation/ main/java/org/apache/webbeans/decorator/ main/java/org/apache/webbeans/inject/instance/ main/java/org/apache/webbeans/util/ test/java/org/apache/w...
> An: commits@openwebbeans.apache.org
> Datum: Donnerstag, 25. Februar, 2010 14:00 Uhr
> Author: struberg
> Date: Thu Feb 25 13:00:29 2010
> New Revision: 916274
>
> URL: http://svn.apache.org/viewvc?rev=916274&view=rev
> Log:
> OWB-304 add test for broken behaviour
>
> + a few cleanup tasks
>
> Added:
>
> openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/profields/beans/InformationConsumerBean.java
> Modified:
>
> openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/annotation/NamedLiteral.java
>
> openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/decorator/DecoratorUtil.java
>
> openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/instance/InstanceImpl.java
>
> openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansAnnotatedTypeUtil.java
>
> openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/AbstractUnitTest.java
>
> openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/typeliteral/TypeLiteralTest.java
>
> openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/profields/GetterStringInjectorTest.java
>
> Modified:
> openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/annotation/NamedLiteral.java
> URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/annotation/NamedLiteral.java?rev=916274&r1=916273&r2=916274&view=diff
> ==============================================================================
> ---
> openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/annotation/NamedLiteral.java
> (original)
> +++
> openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/annotation/NamedLiteral.java
> Thu Feb 25 13:00:29 2010
> @@ -25,6 +25,16 @@
> public class NamedLiteral extends
> AnnotationLiteral<Named> implements Named
> {
> private String value;
> +
> + public NamedLiteral()
> + {
> +
> + }
> +
> + public NamedLiteral(String value)
> + {
> + this.value = value;
> + }
>
> @Override
> public String value()
>
> Modified:
> openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/decorator/DecoratorUtil.java
> URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/decorator/DecoratorUtil.java?rev=916274&r1=916273&r2=916274&view=diff
> ==============================================================================
> ---
> openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/decorator/DecoratorUtil.java
> (original)
> +++
> openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/decorator/DecoratorUtil.java
> Thu Feb 25 13:00:29 2010
> @@ -26,7 +26,6 @@
> import javax.enterprise.inject.spi.Decorator;
>
> import
> org.apache.webbeans.component.AbstractInjectionTargetBean;
> -import org.apache.webbeans.component.ManagedBean;
> import org.apache.webbeans.config.OWBLogConst;
> import org.apache.webbeans.container.BeanManagerImpl;
> import
> org.apache.webbeans.exception.WebBeansConfigurationException;
>
> Modified:
> openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/instance/InstanceImpl.java
> URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/instance/InstanceImpl.java?rev=916274&r1=916273&r2=916274&view=diff
> ==============================================================================
> ---
> openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/instance/InstanceImpl.java
> (original)
> +++
> openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/instance/InstanceImpl.java
> Thu Feb 25 13:00:29 2010
> @@ -38,6 +38,8 @@
> */
> class InstanceImpl<T> implements Instance<T>,
> Serializable
> {
> + private static final long serialVersionUID =
> -8401944412490389024L;
> +
> /** Injected class type */
> private Type injectionClazz;
>
>
> Modified:
> openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansAnnotatedTypeUtil.java
> URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansAnnotatedTypeUtil.java?rev=916274&r1=916273&r2=916274&view=diff
> ==============================================================================
> ---
> openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansAnnotatedTypeUtil.java
> (original)
> +++
> openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansAnnotatedTypeUtil.java
> Thu Feb 25 13:00:29 2010
> @@ -67,7 +67,6 @@
> import org.apache.webbeans.config.OWBLogConst;
> import
> org.apache.webbeans.config.OpenWebBeansConfiguration;
> import org.apache.webbeans.container.InjectionResolver;
> -import org.apache.webbeans.decorator.DecoratorUtil;
> import org.apache.webbeans.decorator.DecoratorsManager;
> import
> org.apache.webbeans.decorator.WebBeansDecoratorConfig;
> import org.apache.webbeans.event.NotificationManager;
> @@ -104,11 +103,9 @@
>
> {
>
> throw new
> WebBeansConfigurationException("There are more than one
> constructor with @Inject annotation in annotation type : " +
> type);
>
> }
> -
> else
> -
> {
> -
> found = true;
> -
> result = annConst;
> -
> }
>
> +
>
> +
> found = true;
> +
> result = annConst;
>
> }
>
> else
>
> {
> @@ -254,10 +251,7 @@
>
> throw new
> UnsatisfiedResolutionException("Producer method component of
> the disposal method : " + declaredMethod.getName() + " in
> class : " +
> annotatedMethod.getDeclaringType().getJavaClass() + "is not
> found");
>
> }
>
> -
> else
> - {
> -
> pr = (ProducerMethodBean<?>) foundBean;
> - }
> + pr
> = (ProducerMethodBean<?>) foundBean;
>
>
> if (previous == null)
>
> {
> @@ -623,9 +617,8 @@
>
> + ".
> Multiple disposes annotation.");
>
> }
>
> else
> - {
> -
> found = true;
> - }
> +
> +
> found = true;
> }
> }
>
> @@ -728,12 +721,10 @@
>
> {
>
> throw new
> WebBeansConfigurationException("Maanged bean class : " +
> clazz.getName() + " can not define non-static, non-private
> final methods. Because it is annotated with at least one
> @InterceptorBinding");
>
> }
> -
> else
> +
> + if
> (AnnotationUtil.hasInterceptorBindingMetaAnnotation(AnnotationUtil.getAnnotationsFromSet(methodA.getAnnotations())))
>
> {
> -
> if
> (AnnotationUtil.hasInterceptorBindingMetaAnnotation(AnnotationUtil.getAnnotationsFromSet(methodA.getAnnotations())))
> -
> {
> -
> throw new
> WebBeansConfigurationException("Method : " +
> method.getName() + "in managed bean class : " +
> clazz.getName() + " can not be defined as non-static,
> non-private and final . Because it is annotated with at
> least one @InterceptorBinding");
> -
> }
> +
> throw new
> WebBeansConfigurationException("Method : " +
> method.getName() + "in managed bean class : " +
> clazz.getName() + " can not be defined as non-static,
> non-private and final . Because it is annotated with at
> least one @InterceptorBinding");
>
> }
> }
>
>
> Modified:
> openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/AbstractUnitTest.java
> URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/AbstractUnitTest.java?rev=916274&r1=916273&r2=916274&view=diff
> ==============================================================================
> ---
> openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/AbstractUnitTest.java
> (original)
> +++
> openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/AbstractUnitTest.java
> Thu Feb 25 13:00:29 2010
> @@ -13,18 +13,21 @@
> */
> package org.apache.webbeans.newtests;
>
> +import java.lang.annotation.Annotation;
> import java.net.URL;
> import java.util.ArrayList;
> import java.util.Collection;
> import java.util.List;
> +import java.util.Set;
>
> +import javax.enterprise.inject.spi.Bean;
> import javax.enterprise.inject.spi.BeanManager;
> import javax.enterprise.inject.spi.Extension;
>
> import
> org.apache.webbeans.lifecycle.test.OpenWebBeansTestLifeCycle;
> import
> org.apache.webbeans.lifecycle.test.OpenWebBeansTestMetaDataDiscoveryService;
> import
> org.apache.webbeans.portable.events.ExtensionLoader;
> -
> +import org.junit.Assert;
>
>
> public abstract class AbstractUnitTest
> @@ -95,6 +98,18 @@
> return
> this.testLifecycle.getBeanManager();
> }
>
> + @SuppressWarnings("unchecked")
> + protected <T> T
> getInstance(Class<T> type, Annotation... qualifiers)
> + {
> + Set<Bean<?>> beans
> = getBeanManager().getBeans(type, qualifiers);
> + Assert.assertNotNull(beans);
> + Assert.assertTrue("resolving
> bean with type" + type + " is ambiguous!", beans.size() ==
> 1);
> +
> + Bean<T> bean =
> (Bean<T>) beans.iterator().next();
> +
> + return (T)
> getBeanManager().getReference(bean, type,
> getBeanManager().createCreationalContext(bean));
> + }
> +
> protected URL getXMLUrl(String
> packageName, String fileName)
> {
> StringBuilder prefix
> = new StringBuilder(packageName.replace('.', '/'));
>
> Modified:
> openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/typeliteral/TypeLiteralTest.java
> URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/typeliteral/TypeLiteralTest.java?rev=916274&r1=916273&r2=916274&view=diff
> ==============================================================================
> ---
> openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/typeliteral/TypeLiteralTest.java
> (original)
> +++
> openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/typeliteral/TypeLiteralTest.java
> Thu Feb 25 13:00:29 2010
> @@ -19,22 +19,16 @@
> package
> org.apache.webbeans.newtests.injection.typeliteral;
>
> import java.lang.annotation.Annotation;
> -import java.lang.reflect.Field;
> import java.net.URL;
> import java.util.ArrayList;
> import java.util.Collection;
> import java.util.Set;
>
> -import javax.enterprise.context.spi.CreationalContext;
> import javax.enterprise.inject.spi.Bean;
> -import javax.enterprise.inject.spi.InjectionPoint;
> import javax.enterprise.util.TypeLiteral;
>
> -import junit.framework.Assert;
>
> import org.apache.webbeans.newtests.AbstractUnitTest;
> -import
> org.apache.webbeans.newtests.injection.injectionpoint.beans.InjectionPointMetaDataOwner;
> -import
> org.apache.webbeans.newtests.injection.injectionpoint.beans.LoggerInjectedBean;
> import org.junit.Test;
>
> public class TypeLiteralTest extends AbstractUnitTest
>
> Modified:
> openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/profields/GetterStringInjectorTest.java
> URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/profields/GetterStringInjectorTest.java?rev=916274&r1=916273&r2=916274&view=diff
> ==============================================================================
> ---
> openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/profields/GetterStringInjectorTest.java
> (original)
> +++
> openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/profields/GetterStringInjectorTest.java
> Thu Feb 25 13:00:29 2010
> @@ -26,9 +26,11 @@
>
> import junit.framework.Assert;
>
> +import org.apache.webbeans.annotation.NamedLiteral;
> import org.apache.webbeans.newtests.AbstractUnitTest;
> import
> org.apache.webbeans.newtests.profields.beans.GetterStringFieldInjector;
> import
> org.apache.webbeans.newtests.profields.beans.GetterStringProducerBean;
> +import
> org.apache.webbeans.newtests.profields.beans.InformationConsumerBean;
> import org.junit.Test;
>
> public class GetterStringInjectorTest extends
> AbstractUnitTest
> @@ -42,6 +44,7 @@
>
> Collection<Class<?>>
> beanClasses = new ArrayList<Class<?>>();
>
> beanClasses.add(GetterStringProducerBean.class);
>
> beanClasses.add(GetterStringFieldInjector.class);
> +
> beanClasses.add(InformationConsumerBean.class);
>
>
> startContainer(beanClasses,
> beanXmls);
>
> @@ -50,6 +53,8 @@
>
>
> Assert.assertEquals("Sucess from
> getProducts",injector.getTestNamed3());
>
> + InformationConsumerBean icb =
> getInstance(InformationConsumerBean.class, new
> NamedLiteral("ProMethodNamed1"));
> +
>
> shutDownContainer();
> }
>
>
> Added:
> openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/profields/beans/InformationConsumerBean.java
> URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/profields/beans/InformationConsumerBean.java?rev=916274&view=auto
> ==============================================================================
> ---
> openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/profields/beans/InformationConsumerBean.java
> (added)
> +++
> openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/profields/beans/InformationConsumerBean.java
> Thu Feb 25 13:00:29 2010
> @@ -0,0 +1,38 @@
> +/*
> + * 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;
> +
> +import javax.enterprise.context.ApplicationScoped;
> +import javax.inject.Inject;
> +import javax.inject.Named;
> +
> +/**
> + * This simply tests if actually injecting the String
> values
> + * from our fancy producer methods really works.
> + */
> +@ApplicationScoped
> +public class InformationConsumerBean {
> +
> + private @Inject
> @Named("ProMethodNamed1") String proMethodString;
> +
> + public String getProMethodString()
> + {
> + return proMethodString;
> + }
> +}
>
>
>
__________________________________________________
Do You Yahoo!?
Sie sind Spam leid? Yahoo! Mail verfügt über einen herausragenden Schutz gegen Massenmails.
http://mail.yahoo.com
___________________________________________________________________
Yahoo! Türkiye açıldı! http://yahoo.com.tr
İnternet üzerindeki en iyi içeriği Yahoo! Türkiye sizlere sunuyor!
AW: svn commit: r916274 - in /openwebbeans/trunk/webbeans-impl/src: main/java/org/apache/webbeans/annotation/ main/java/org/apache/webbeans/decorator/ main/java/org/apache/webbeans/inject/instance/ main/java/org/apache/webbeans/util/ test/java/org/apache/w...
Posted by Mark Struberg <st...@yahoo.de>.
Hi!
usually I don't commits which break the tests, but this is really an outstanding blocker. Basically all ProducerMethods are not working anymore as far as I saw.
Looks like it has something to do with the ParameterizedType.
Gurkan, can we look at this together in the evening please?
LieGrue,
strub
--- struberg@apache.org <st...@apache.org> schrieb am Do, 25.2.2010:
> Von: struberg@apache.org <st...@apache.org>
> Betreff: svn commit: r916274 - in /openwebbeans/trunk/webbeans-impl/src: main/java/org/apache/webbeans/annotation/ main/java/org/apache/webbeans/decorator/ main/java/org/apache/webbeans/inject/instance/ main/java/org/apache/webbeans/util/ test/java/org/apache/w...
> An: commits@openwebbeans.apache.org
> Datum: Donnerstag, 25. Februar, 2010 14:00 Uhr
> Author: struberg
> Date: Thu Feb 25 13:00:29 2010
> New Revision: 916274
>
> URL: http://svn.apache.org/viewvc?rev=916274&view=rev
> Log:
> OWB-304 add test for broken behaviour
>
> + a few cleanup tasks
>
> Added:
>
> openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/profields/beans/InformationConsumerBean.java
> Modified:
>
> openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/annotation/NamedLiteral.java
>
> openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/decorator/DecoratorUtil.java
>
> openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/instance/InstanceImpl.java
>
> openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansAnnotatedTypeUtil.java
>
> openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/AbstractUnitTest.java
>
> openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/typeliteral/TypeLiteralTest.java
>
> openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/profields/GetterStringInjectorTest.java
>
> Modified:
> openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/annotation/NamedLiteral.java
> URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/annotation/NamedLiteral.java?rev=916274&r1=916273&r2=916274&view=diff
> ==============================================================================
> ---
> openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/annotation/NamedLiteral.java
> (original)
> +++
> openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/annotation/NamedLiteral.java
> Thu Feb 25 13:00:29 2010
> @@ -25,6 +25,16 @@
> public class NamedLiteral extends
> AnnotationLiteral<Named> implements Named
> {
> private String value;
> +
> + public NamedLiteral()
> + {
> +
> + }
> +
> + public NamedLiteral(String value)
> + {
> + this.value = value;
> + }
>
> @Override
> public String value()
>
> Modified:
> openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/decorator/DecoratorUtil.java
> URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/decorator/DecoratorUtil.java?rev=916274&r1=916273&r2=916274&view=diff
> ==============================================================================
> ---
> openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/decorator/DecoratorUtil.java
> (original)
> +++
> openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/decorator/DecoratorUtil.java
> Thu Feb 25 13:00:29 2010
> @@ -26,7 +26,6 @@
> import javax.enterprise.inject.spi.Decorator;
>
> import
> org.apache.webbeans.component.AbstractInjectionTargetBean;
> -import org.apache.webbeans.component.ManagedBean;
> import org.apache.webbeans.config.OWBLogConst;
> import org.apache.webbeans.container.BeanManagerImpl;
> import
> org.apache.webbeans.exception.WebBeansConfigurationException;
>
> Modified:
> openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/instance/InstanceImpl.java
> URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/instance/InstanceImpl.java?rev=916274&r1=916273&r2=916274&view=diff
> ==============================================================================
> ---
> openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/instance/InstanceImpl.java
> (original)
> +++
> openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/instance/InstanceImpl.java
> Thu Feb 25 13:00:29 2010
> @@ -38,6 +38,8 @@
> */
> class InstanceImpl<T> implements Instance<T>,
> Serializable
> {
> + private static final long serialVersionUID =
> -8401944412490389024L;
> +
> /** Injected class type */
> private Type injectionClazz;
>
>
> Modified:
> openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansAnnotatedTypeUtil.java
> URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansAnnotatedTypeUtil.java?rev=916274&r1=916273&r2=916274&view=diff
> ==============================================================================
> ---
> openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansAnnotatedTypeUtil.java
> (original)
> +++
> openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansAnnotatedTypeUtil.java
> Thu Feb 25 13:00:29 2010
> @@ -67,7 +67,6 @@
> import org.apache.webbeans.config.OWBLogConst;
> import
> org.apache.webbeans.config.OpenWebBeansConfiguration;
> import org.apache.webbeans.container.InjectionResolver;
> -import org.apache.webbeans.decorator.DecoratorUtil;
> import org.apache.webbeans.decorator.DecoratorsManager;
> import
> org.apache.webbeans.decorator.WebBeansDecoratorConfig;
> import org.apache.webbeans.event.NotificationManager;
> @@ -104,11 +103,9 @@
>
> {
>
> throw new
> WebBeansConfigurationException("There are more than one
> constructor with @Inject annotation in annotation type : " +
> type);
>
> }
> -
> else
> -
> {
> -
> found = true;
> -
> result = annConst;
> -
> }
>
> +
>
> +
> found = true;
> +
> result = annConst;
>
> }
>
> else
>
> {
> @@ -254,10 +251,7 @@
>
> throw new
> UnsatisfiedResolutionException("Producer method component of
> the disposal method : " + declaredMethod.getName() + " in
> class : " +
> annotatedMethod.getDeclaringType().getJavaClass() + "is not
> found");
>
> }
>
> -
> else
> - {
> -
> pr = (ProducerMethodBean<?>) foundBean;
> - }
> + pr
> = (ProducerMethodBean<?>) foundBean;
>
>
> if (previous == null)
>
> {
> @@ -623,9 +617,8 @@
>
> + ".
> Multiple disposes annotation.");
>
> }
>
> else
> - {
> -
> found = true;
> - }
> +
> +
> found = true;
> }
> }
>
> @@ -728,12 +721,10 @@
>
> {
>
> throw new
> WebBeansConfigurationException("Maanged bean class : " +
> clazz.getName() + " can not define non-static, non-private
> final methods. Because it is annotated with at least one
> @InterceptorBinding");
>
> }
> -
> else
> +
> + if
> (AnnotationUtil.hasInterceptorBindingMetaAnnotation(AnnotationUtil.getAnnotationsFromSet(methodA.getAnnotations())))
>
> {
> -
> if
> (AnnotationUtil.hasInterceptorBindingMetaAnnotation(AnnotationUtil.getAnnotationsFromSet(methodA.getAnnotations())))
> -
> {
> -
> throw new
> WebBeansConfigurationException("Method : " +
> method.getName() + "in managed bean class : " +
> clazz.getName() + " can not be defined as non-static,
> non-private and final . Because it is annotated with at
> least one @InterceptorBinding");
> -
> }
> +
> throw new
> WebBeansConfigurationException("Method : " +
> method.getName() + "in managed bean class : " +
> clazz.getName() + " can not be defined as non-static,
> non-private and final . Because it is annotated with at
> least one @InterceptorBinding");
>
> }
> }
>
>
> Modified:
> openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/AbstractUnitTest.java
> URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/AbstractUnitTest.java?rev=916274&r1=916273&r2=916274&view=diff
> ==============================================================================
> ---
> openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/AbstractUnitTest.java
> (original)
> +++
> openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/AbstractUnitTest.java
> Thu Feb 25 13:00:29 2010
> @@ -13,18 +13,21 @@
> */
> package org.apache.webbeans.newtests;
>
> +import java.lang.annotation.Annotation;
> import java.net.URL;
> import java.util.ArrayList;
> import java.util.Collection;
> import java.util.List;
> +import java.util.Set;
>
> +import javax.enterprise.inject.spi.Bean;
> import javax.enterprise.inject.spi.BeanManager;
> import javax.enterprise.inject.spi.Extension;
>
> import
> org.apache.webbeans.lifecycle.test.OpenWebBeansTestLifeCycle;
> import
> org.apache.webbeans.lifecycle.test.OpenWebBeansTestMetaDataDiscoveryService;
> import
> org.apache.webbeans.portable.events.ExtensionLoader;
> -
> +import org.junit.Assert;
>
>
> public abstract class AbstractUnitTest
> @@ -95,6 +98,18 @@
> return
> this.testLifecycle.getBeanManager();
> }
>
> + @SuppressWarnings("unchecked")
> + protected <T> T
> getInstance(Class<T> type, Annotation... qualifiers)
> + {
> + Set<Bean<?>> beans
> = getBeanManager().getBeans(type, qualifiers);
> + Assert.assertNotNull(beans);
> + Assert.assertTrue("resolving
> bean with type" + type + " is ambiguous!", beans.size() ==
> 1);
> +
> + Bean<T> bean =
> (Bean<T>) beans.iterator().next();
> +
> + return (T)
> getBeanManager().getReference(bean, type,
> getBeanManager().createCreationalContext(bean));
> + }
> +
> protected URL getXMLUrl(String
> packageName, String fileName)
> {
> StringBuilder prefix
> = new StringBuilder(packageName.replace('.', '/'));
>
> Modified:
> openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/typeliteral/TypeLiteralTest.java
> URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/typeliteral/TypeLiteralTest.java?rev=916274&r1=916273&r2=916274&view=diff
> ==============================================================================
> ---
> openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/typeliteral/TypeLiteralTest.java
> (original)
> +++
> openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/typeliteral/TypeLiteralTest.java
> Thu Feb 25 13:00:29 2010
> @@ -19,22 +19,16 @@
> package
> org.apache.webbeans.newtests.injection.typeliteral;
>
> import java.lang.annotation.Annotation;
> -import java.lang.reflect.Field;
> import java.net.URL;
> import java.util.ArrayList;
> import java.util.Collection;
> import java.util.Set;
>
> -import javax.enterprise.context.spi.CreationalContext;
> import javax.enterprise.inject.spi.Bean;
> -import javax.enterprise.inject.spi.InjectionPoint;
> import javax.enterprise.util.TypeLiteral;
>
> -import junit.framework.Assert;
>
> import org.apache.webbeans.newtests.AbstractUnitTest;
> -import
> org.apache.webbeans.newtests.injection.injectionpoint.beans.InjectionPointMetaDataOwner;
> -import
> org.apache.webbeans.newtests.injection.injectionpoint.beans.LoggerInjectedBean;
> import org.junit.Test;
>
> public class TypeLiteralTest extends AbstractUnitTest
>
> Modified:
> openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/profields/GetterStringInjectorTest.java
> URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/profields/GetterStringInjectorTest.java?rev=916274&r1=916273&r2=916274&view=diff
> ==============================================================================
> ---
> openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/profields/GetterStringInjectorTest.java
> (original)
> +++
> openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/profields/GetterStringInjectorTest.java
> Thu Feb 25 13:00:29 2010
> @@ -26,9 +26,11 @@
>
> import junit.framework.Assert;
>
> +import org.apache.webbeans.annotation.NamedLiteral;
> import org.apache.webbeans.newtests.AbstractUnitTest;
> import
> org.apache.webbeans.newtests.profields.beans.GetterStringFieldInjector;
> import
> org.apache.webbeans.newtests.profields.beans.GetterStringProducerBean;
> +import
> org.apache.webbeans.newtests.profields.beans.InformationConsumerBean;
> import org.junit.Test;
>
> public class GetterStringInjectorTest extends
> AbstractUnitTest
> @@ -42,6 +44,7 @@
>
> Collection<Class<?>>
> beanClasses = new ArrayList<Class<?>>();
>
> beanClasses.add(GetterStringProducerBean.class);
>
> beanClasses.add(GetterStringFieldInjector.class);
> +
> beanClasses.add(InformationConsumerBean.class);
>
>
> startContainer(beanClasses,
> beanXmls);
>
> @@ -50,6 +53,8 @@
>
>
> Assert.assertEquals("Sucess from
> getProducts",injector.getTestNamed3());
>
> + InformationConsumerBean icb =
> getInstance(InformationConsumerBean.class, new
> NamedLiteral("ProMethodNamed1"));
> +
>
> shutDownContainer();
> }
>
>
> Added:
> openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/profields/beans/InformationConsumerBean.java
> URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/profields/beans/InformationConsumerBean.java?rev=916274&view=auto
> ==============================================================================
> ---
> openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/profields/beans/InformationConsumerBean.java
> (added)
> +++
> openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/profields/beans/InformationConsumerBean.java
> Thu Feb 25 13:00:29 2010
> @@ -0,0 +1,38 @@
> +/*
> + * 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;
> +
> +import javax.enterprise.context.ApplicationScoped;
> +import javax.inject.Inject;
> +import javax.inject.Named;
> +
> +/**
> + * This simply tests if actually injecting the String
> values
> + * from our fancy producer methods really works.
> + */
> +@ApplicationScoped
> +public class InformationConsumerBean {
> +
> + private @Inject
> @Named("ProMethodNamed1") String proMethodString;
> +
> + public String getProMethodString()
> + {
> + return proMethodString;
> + }
> +}
>
>
>
__________________________________________________
Do You Yahoo!?
Sie sind Spam leid? Yahoo! Mail verfügt über einen herausragenden Schutz gegen Massenmails.
http://mail.yahoo.com