openwebbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From strub...@apache.org
Subject svn commit: r1557050 - in /openwebbeans/trunk/webbeans-impl/src: main/java/org/apache/webbeans/portable/ test/java/org/apache/webbeans/newtests/injection/injectionpoint/beans/ test/java/org/apache/webbeans/newtests/injection/injectionpoint/tests/ test/...
Date Fri, 10 Jan 2014 08:03:19 GMT
Author: struberg
Date: Fri Jan 10 08:03:19 2014
New Revision: 1557050

URL: http://svn.apache.org/r1557050
Log:
OWB-921 add tests for synthetic InjectionPoint creation

This is now in sync with the spec.

Added:
    openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/injectionpoint/beans/ProducerInjectionPointInstanceOwner.java
  (with props)
Modified:
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/InjectionPointProducer.java
    openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/injectionpoint/beans/MethodInjectionPointOwner.java
    openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/injectionpoint/tests/InjectionPointInjectionTest.java
    openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/multiple/MultipleSpecializationTest.java

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/InjectionPointProducer.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/InjectionPointProducer.java?rev=1557050&r1=1557049&r2=1557050&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/InjectionPointProducer.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/InjectionPointProducer.java
Fri Jan 10 08:03:19 2014
@@ -22,7 +22,6 @@ import javax.enterprise.context.spi.Crea
 import javax.enterprise.inject.spi.InjectionPoint;
 
 import org.apache.webbeans.context.creational.CreationalContextImpl;
-import org.apache.webbeans.inject.impl.InjectionPointFactory;
 import org.apache.webbeans.util.ClassUtil;
 
 public class InjectionPointProducer extends AbstractProducer<InjectionPoint>
@@ -47,16 +46,7 @@ public class InjectionPointProducer exte
         }
         try
         {
-            InjectionPoint injectionPoint = creationalContextImpl.getInjectionPoint();
-
-            if (injectionPoint == null)
-            {
-                // create a 'virtual' Injection Point.
-                // This is required since CDI-1.1 and is being used in case of programmatic
lookups
-                injectionPoint = InjectionPointFactory.getVirtualInjectionPoint(((CreationalContextImpl<InjectionPoint>)
creationalContext).getBean());
-            }
-
-            return injectionPoint;
+            return creationalContextImpl.getInjectionPoint();
         }
         finally
         {

Modified: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/injectionpoint/beans/MethodInjectionPointOwner.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/injectionpoint/beans/MethodInjectionPointOwner.java?rev=1557050&r1=1557049&r2=1557050&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/injectionpoint/beans/MethodInjectionPointOwner.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/injectionpoint/beans/MethodInjectionPointOwner.java
Fri Jan 10 08:03:19 2014
@@ -15,9 +15,11 @@
  */
 package org.apache.webbeans.newtests.injection.injectionpoint.beans;
 
+import javax.enterprise.context.Dependent;
 import javax.enterprise.inject.spi.InjectionPoint;
 import javax.inject.Inject;
 
+@Dependent
 public class MethodInjectionPointOwner extends AbstractInjectionPointOwner {
 
     @Inject

Added: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/injectionpoint/beans/ProducerInjectionPointInstanceOwner.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/injectionpoint/beans/ProducerInjectionPointInstanceOwner.java?rev=1557050&view=auto
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/injectionpoint/beans/ProducerInjectionPointInstanceOwner.java
(added)
+++ openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/injectionpoint/beans/ProducerInjectionPointInstanceOwner.java
Fri Jan 10 08:03:19 2014
@@ -0,0 +1,34 @@
+/*
+ * 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.injection.injectionpoint.beans;
+
+import javax.enterprise.inject.Instance;
+import javax.inject.Inject;
+
+public class ProducerInjectionPointInstanceOwner
+{
+    @Inject
+    private Instance<ProducerMethodInjectionPointOwner> ipOwnerInstance;
+
+
+    public Instance<ProducerMethodInjectionPointOwner> getIpOwnerInstance()
+    {
+        return ipOwnerInstance;
+    }
+}

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

Modified: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/injectionpoint/tests/InjectionPointInjectionTest.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/injectionpoint/tests/InjectionPointInjectionTest.java?rev=1557050&r1=1557049&r2=1557050&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/injectionpoint/tests/InjectionPointInjectionTest.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/injectionpoint/tests/InjectionPointInjectionTest.java
Fri Jan 10 08:03:19 2014
@@ -26,6 +26,7 @@ import java.util.ArrayList;
 import java.util.Collection;
 
 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;
@@ -40,6 +41,7 @@ import org.apache.webbeans.newtests.inje
 import org.apache.webbeans.newtests.injection.injectionpoint.beans.InjectionPointOwnerInstance;
 import org.apache.webbeans.newtests.injection.injectionpoint.beans.InjectionPointOwnerProducer;
 import org.apache.webbeans.newtests.injection.injectionpoint.beans.MethodInjectionPointOwner;
+import org.apache.webbeans.newtests.injection.injectionpoint.beans.ProducerInjectionPointInstanceOwner;
 import org.apache.webbeans.newtests.injection.injectionpoint.beans.ProducerMethodInjectionPointOwner;
 import org.junit.Test;
 
@@ -99,8 +101,7 @@ public class InjectionPointInjectionTest
         ProducerMethodInjectionPointOwner producedInstance = getInstance(ProducerMethodInjectionPointOwner.class);
         assertThat(producedInstance, notNullValue());
         InjectionPoint ip = producedInstance.getInjectionPoint();
-        assertThat(ip, notNullValue());
-        assertThat(ip.getAnnotated(), nullValue());
+        assertThat(ip, nullValue());
     }
 
 
@@ -109,7 +110,7 @@ public class InjectionPointInjectionTest
     {
         startContainer(InjectionPointOwnerInstance.class, InjectionPointOwnerProducer.class,
                        ProducerMethodInjectionPointOwner.class, AbstractInjectionPointOwner.class,
-                       MethodInjectionPointOwner.class);
+                       MethodInjectionPointOwner.class, ProducerInjectionPointInstanceOwner.class);
 
         InjectionPointOwnerInstance producedInstanceOwner = getInstance(InjectionPointOwnerInstance.class);
         assertThat(producedInstanceOwner, notNullValue());
@@ -121,6 +122,15 @@ public class InjectionPointInjectionTest
         assertNotNull(ip);
         assertNotNull(ip.getAnnotated());
         assertThat(ip.getAnnotated(), instanceOf(AnnotatedField.class));
+
+
+        ProducerInjectionPointInstanceOwner pipo = getInstance(ProducerInjectionPointInstanceOwner.class);
+        assertNotNull(pipo);
+        Instance<ProducerMethodInjectionPointOwner> ipOwnerInstance = pipo.getIpOwnerInstance();
+        assertNotNull(ipOwnerInstance);
+        ProducerMethodInjectionPointOwner pmp = ipOwnerInstance.select(DefaultLiteral.INSTANCE).get();
+        assertNotNull(pmp);
+        assertNotNull(pmp.getInjectionPoint());
     }
 
 

Modified: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/multiple/MultipleSpecializationTest.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/multiple/MultipleSpecializationTest.java?rev=1557050&r1=1557049&r2=1557050&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/multiple/MultipleSpecializationTest.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/multiple/MultipleSpecializationTest.java
Fri Jan 10 08:03:19 2014
@@ -48,6 +48,9 @@ public class MultipleSpecializationTest 
         beanA = getInstance("beanA");
         Assert.assertEquals(BeanC.class, beanA.getBeanClass());
 
+        BeanB beanB = getInstance(BeanB.class);
+        Assert.assertEquals(BeanC.class, beanB.getBeanClass());
+
         shutDownContainer();
     }
     



Mime
View raw message