openwebbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From strub...@apache.org
Subject svn commit: r1432491 - in /openwebbeans/trunk/webbeans-impl/src: main/java/org/apache/webbeans/inject/ test/java/org/apache/webbeans/newtests/interceptors/resolution/ test/java/org/apache/webbeans/newtests/interceptors/resolution/beans/ test/java/org/a...
Date Sat, 12 Jan 2013 18:56:04 GMT
Author: struberg
Date: Sat Jan 12 18:56:04 2013
New Revision: 1432491

URL: http://svn.apache.org/viewvc?rev=1432491&view=rev
Log:
OWB-344 add test for ct injection and field injection in interceptors

Added:
    openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/resolution/beans/
    openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/resolution/beans/UtilitySampleBean.java
Modified:
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/AbstractInjectable.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/InjectableConstructor.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/InjectableField.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/InjectableMethod.java
    openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/resolution/InterceptorBeanBuilderTest.java
    openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/resolution/interceptors/TestInterceptor1.java
    openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/resolution/interceptors/TestInterceptorParent.java

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/AbstractInjectable.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/AbstractInjectable.java?rev=1432491&r1=1432490&r2=1432491&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/AbstractInjectable.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/AbstractInjectable.java
Sat Jan 12 18:56:04 2013
@@ -168,7 +168,7 @@ public abstract class AbstractInjectable
      * @param member java member
      * @return injection points related with given member type
      */
-    protected List<InjectionPoint> getInjectedPoints(Member member)
+    protected List<InjectionPoint> getInjectionPoints(Member member)
     {
         List<InjectionPoint> injectionPoints = new ArrayList<InjectionPoint>();
         for (InjectionPoint injectionPoint : owner.getInjectionPoints())

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/InjectableConstructor.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/InjectableConstructor.java?rev=1432491&r1=1432490&r2=1432491&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/InjectableConstructor.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/InjectableConstructor.java
Sat Jan 12 18:56:04 2013
@@ -59,9 +59,9 @@ public class InjectableConstructor<T> ex
      */
     public T doInjection()
     {
-        T instance = null;
+        T instance;
         
-        List<InjectionPoint> injectedPoints = getInjectedPoints(con);
+        List<InjectionPoint> injectedPoints = getInjectionPoints(con);
         List<Object> list = new ArrayList<Object>();
                 
         

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/InjectableField.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/InjectableField.java?rev=1432491&r1=1432490&r2=1432491&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/InjectableField.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/InjectableField.java
Sat Jan 12 18:56:04 2013
@@ -48,7 +48,7 @@ public class InjectableField<T> extends 
     {
         try
         {
-            InjectionPoint injectedField = getInjectedPoints(field).get(0);
+            InjectionPoint injectedField = getInjectionPoints(field).get(0);
             
             if (!field.isAccessible())
             {

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/InjectableMethod.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/InjectableMethod.java?rev=1432491&r1=1432490&r2=1432491&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/InjectableMethod.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/InjectableMethod.java
Sat Jan 12 18:56:04 2013
@@ -74,7 +74,7 @@ public class InjectableMethod<T> extends
      */
     public T doInjection()
     {
-        List<InjectionPoint> injectedPoints = getInjectedPoints(method);
+        List<InjectionPoint> injectedPoints = getInjectionPoints(method);
         List<Object> list = new ArrayList<Object>();
                 
         

Modified: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/resolution/InterceptorBeanBuilderTest.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/resolution/InterceptorBeanBuilderTest.java?rev=1432491&r1=1432490&r2=1432491&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/resolution/InterceptorBeanBuilderTest.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/resolution/InterceptorBeanBuilderTest.java
Sat Jan 12 18:56:04 2013
@@ -30,6 +30,7 @@ import org.apache.webbeans.component.Int
 import org.apache.webbeans.component.creation.CdiInterceptorBeanBuilder;
 import org.apache.webbeans.newtests.AbstractUnitTest;
 import org.apache.webbeans.newtests.interceptors.factory.beans.ClassInterceptedClass;
+import org.apache.webbeans.newtests.interceptors.resolution.beans.UtilitySampleBean;
 import org.apache.webbeans.newtests.interceptors.resolution.interceptors.TestIntercepted1;
 import org.apache.webbeans.newtests.interceptors.resolution.interceptors.TestInterceptor1;
 import org.apache.webbeans.newtests.interceptors.resolution.interceptors.TestInterceptorParent;
@@ -57,6 +58,7 @@ public class InterceptorBeanBuilderTest 
         beanClasses.add(TestIntercepted1.class);
         beanClasses.add(TestInterceptor1.class);
         beanClasses.add(TestInterceptorParent.class);
+        beanClasses.add(UtilitySampleBean.class);
 
         startContainer(beanClasses, beanXmls);
 
@@ -100,6 +102,7 @@ public class InterceptorBeanBuilderTest 
         beanClasses.add(TestIntercepted1.class);
         beanClasses.add(TestInterceptor1.class);
         beanClasses.add(TestInterceptorParent.class);
+        beanClasses.add(UtilitySampleBean.class);
 
         startContainer(beanClasses, beanXmls);
 

Added: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/resolution/beans/UtilitySampleBean.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/resolution/beans/UtilitySampleBean.java?rev=1432491&view=auto
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/resolution/beans/UtilitySampleBean.java
(added)
+++ openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/resolution/beans/UtilitySampleBean.java
Sat Jan 12 18:56:04 2013
@@ -0,0 +1,40 @@
+/*
+ * 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.interceptors.resolution.beans;
+
+import javax.enterprise.context.RequestScoped;
+
+/**
+ * Some trivial sample bean which can get injected into various places
+ */
+@RequestScoped
+public class UtilitySampleBean
+{
+    private int i;
+
+    public int getI()
+    {
+        return i;
+    }
+
+    public void setI(int i)
+    {
+        this.i = i;
+    }
+}

Modified: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/resolution/interceptors/TestInterceptor1.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/resolution/interceptors/TestInterceptor1.java?rev=1432491&r1=1432490&r2=1432491&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/resolution/interceptors/TestInterceptor1.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/resolution/interceptors/TestInterceptor1.java
Sat Jan 12 18:56:04 2013
@@ -20,11 +20,13 @@ package org.apache.webbeans.newtests.int
 
 import javax.annotation.PostConstruct;
 import javax.annotation.PreDestroy;
+import javax.inject.Inject;
 import javax.interceptor.AroundInvoke;
 import javax.interceptor.AroundTimeout;
 import javax.interceptor.Interceptor;
 import javax.interceptor.InvocationContext;
 
+import org.apache.webbeans.newtests.interceptors.resolution.beans.UtilitySampleBean;
 import org.apache.webbeans.util.ExceptionUtil;
 
 
@@ -36,6 +38,15 @@ public class TestInterceptor1 extends Te
     public static int exceptionCount = 0;
     public static int postConstructCount = 0;
 
+    @Inject
+    public TestInterceptor1(UtilitySampleBean ctUtility)
+    {
+        super();
+        ctUtility.setI(42);
+    }
+
+
+
     @AroundInvoke
     public Object caller(InvocationContext context) throws Exception
     {

Modified: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/resolution/interceptors/TestInterceptorParent.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/resolution/interceptors/TestInterceptorParent.java?rev=1432491&r1=1432490&r2=1432491&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/resolution/interceptors/TestInterceptorParent.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/resolution/interceptors/TestInterceptorParent.java
Sat Jan 12 18:56:04 2013
@@ -20,9 +20,11 @@ package org.apache.webbeans.newtests.int
 
 import javax.annotation.PostConstruct;
 import javax.annotation.PreDestroy;
+import javax.inject.Inject;
 import javax.interceptor.AroundTimeout;
 import javax.interceptor.InvocationContext;
 
+import org.apache.webbeans.newtests.interceptors.resolution.beans.UtilitySampleBean;
 import org.apache.webbeans.util.ExceptionUtil;
 
 
@@ -32,6 +34,14 @@ public class TestInterceptorParent
     public static int preDestroyCount = 0;
     public static int aroundTimeoutCount = 0;
 
+    @Inject
+    private UtilitySampleBean fieldUtility;
+
+    public UtilitySampleBean getFieldUtility()
+    {
+        return fieldUtility;
+    }
+
     @PostConstruct
     public void postConstruct(InvocationContext context)
     {



Mime
View raw message