Return-Path: X-Original-To: apmail-openwebbeans-commits-archive@www.apache.org Delivered-To: apmail-openwebbeans-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 7089E1152C for ; Sat, 16 Aug 2014 21:54:06 +0000 (UTC) Received: (qmail 28209 invoked by uid 500); 16 Aug 2014 21:54:06 -0000 Delivered-To: apmail-openwebbeans-commits-archive@openwebbeans.apache.org Received: (qmail 28183 invoked by uid 500); 16 Aug 2014 21:54:06 -0000 Mailing-List: contact commits-help@openwebbeans.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@openwebbeans.apache.org Delivered-To: mailing list commits@openwebbeans.apache.org Received: (qmail 28172 invoked by uid 99); 16 Aug 2014 21:54:05 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 16 Aug 2014 21:54:05 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 16 Aug 2014 21:53:42 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id E3F59238897A; Sat, 16 Aug 2014 21:53:40 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1618419 - in /openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test: component/decorator/clean/ injection/injectionpoint/beans/ tests/ unittests/decorator/ Date: Sat, 16 Aug 2014 21:53:40 -0000 To: commits@openwebbeans.apache.org From: struberg@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20140816215340.E3F59238897A@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: struberg Date: Sat Aug 16 21:53:40 2014 New Revision: 1618419 URL: http://svn.apache.org/r1618419 Log: fix InjectionPoint test Modified: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/component/decorator/clean/ServiceDecorator.java openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/injection/injectionpoint/beans/ConstructorInjectionPointOwner.java openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/tests/InjectionPointInjectionTest.java openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/decorator/Decorator1Test.java Modified: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/component/decorator/clean/ServiceDecorator.java URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/component/decorator/clean/ServiceDecorator.java?rev=1618419&r1=1618418&r2=1618419&view=diff ============================================================================== --- openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/component/decorator/clean/ServiceDecorator.java (original) +++ openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/component/decorator/clean/ServiceDecorator.java Sat Aug 16 21:53:40 2014 @@ -20,6 +20,7 @@ package org.apache.webbeans.test.compone import javax.decorator.Delegate; import javax.decorator.Decorator; +import javax.enterprise.inject.spi.InjectionPoint; import javax.inject.Inject; import javax.inject.Named; @@ -30,9 +31,16 @@ import org.apache.webbeans.test.componen @Named public class ServiceDecorator implements IService { - @Inject @Delegate @Binding1 IService delegate; + private @Inject @Delegate @Binding1 IService delegate; public static String delegateAttr = null; + public static InjectionPoint ip; + + @Inject + public ServiceDecorator(InjectionPoint ip) + { + ServiceDecorator.ip = ip; + } @Override public String service() Modified: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/injection/injectionpoint/beans/ConstructorInjectionPointOwner.java URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/injection/injectionpoint/beans/ConstructorInjectionPointOwner.java?rev=1618419&r1=1618418&r2=1618419&view=diff ============================================================================== --- openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/injection/injectionpoint/beans/ConstructorInjectionPointOwner.java (original) +++ openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/injection/injectionpoint/beans/ConstructorInjectionPointOwner.java Sat Aug 16 21:53:40 2014 @@ -15,11 +15,13 @@ */ package org.apache.webbeans.test.injection.injectionpoint.beans; +import javax.enterprise.context.Dependent; import javax.enterprise.context.SessionScoped; import javax.enterprise.inject.spi.InjectionPoint; import javax.inject.Inject; import java.io.Serializable; +@Dependent public class ConstructorInjectionPointOwner extends AbstractInjectionPointOwner { Modified: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/tests/InjectionPointInjectionTest.java URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/tests/InjectionPointInjectionTest.java?rev=1618419&r1=1618418&r2=1618419&view=diff ============================================================================== --- openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/tests/InjectionPointInjectionTest.java (original) +++ openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/tests/InjectionPointInjectionTest.java Sat Aug 16 21:53:40 2014 @@ -25,12 +25,15 @@ import static org.junit.Assert.assertNot import java.util.ArrayList; import java.util.Collection; +import javax.enterprise.context.Dependent; import javax.enterprise.context.spi.CreationalContext; import javax.enterprise.inject.Instance; import javax.enterprise.inject.spi.AnnotatedField; import javax.enterprise.inject.spi.Bean; import javax.enterprise.inject.spi.InjectionPoint; +import javax.inject.Inject; +import junit.framework.Assert; import org.apache.webbeans.annotation.DefaultLiteral; import org.apache.webbeans.test.AbstractUnitTest; import org.apache.webbeans.test.injection.injectionpoint.beans.AbstractInjectionPointOwner; @@ -133,5 +136,35 @@ public class InjectionPointInjectionTest assertNotNull(pmp.getInjectionPoint()); } + @Test + public void testManualConstructorInjectionPoint() throws Exception + { + startContainer(ConstructorInjectionPointOwner.class); + ConstructorInjectionPointOwner owner = getInstance(ConstructorInjectionPointOwner.class); + Assert.assertNotNull(owner); + Assert.assertNull(owner.getInjectionPoint()); + } + + @Test + public void testIndirectConstructorInjectionPoint() throws Exception + { + startContainer(ConstructorInjectionPointOwner.class, ConstructorInjectionOwner.class); + ConstructorInjectionOwner owner = getInstance(ConstructorInjectionOwner.class); + Assert.assertNotNull(owner); + Assert.assertNotNull(owner.getConstructorInjectionPointOwner()); + Assert.assertNotNull(owner.getConstructorInjectionPointOwner().getInjectionPoint()); + Assert.assertNotNull(owner.getConstructorInjectionPointOwner().getName()); + } + + @Dependent + public static class ConstructorInjectionOwner + { + private @Inject ConstructorInjectionPointOwner constructorInjectionPointOwner; + + public ConstructorInjectionPointOwner getConstructorInjectionPointOwner() + { + return constructorInjectionPointOwner; + } + } } Modified: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/decorator/Decorator1Test.java URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/decorator/Decorator1Test.java?rev=1618419&r1=1618418&r2=1618419&view=diff ============================================================================== --- openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/decorator/Decorator1Test.java (original) +++ openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/decorator/Decorator1Test.java Sat Aug 16 21:53:40 2014 @@ -53,6 +53,7 @@ public class Decorator1Test extends Abst startContainer(ServiceDecorator.class, CheckWithCheckPayment.class, ServiceImpl1.class, Binding1.class); ServiceDecorator.delegateAttr = null; + ServiceDecorator.ip = null; ServiceImpl1 serviceImpl = getInstance(ServiceImpl1.class, new Annotation[]{new Binding1Literal()}); String s = serviceImpl.service(); @@ -67,6 +68,10 @@ public class Decorator1Test extends Abst Assert.assertTrue(decs.size() > 0); Assert.assertEquals(ServiceDecorator.delegateAttr, "ServiceImpl1"); + + // actually the following is NOT defined in the spec! + // Assert.assertNotNull(ServiceDecorator.ip); + // It is _currently_ totally fine that it is null. } @Test