You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openwebbeans.apache.org by ge...@apache.org on 2010/02/10 21:14:58 UTC

svn commit: r908655 - in /openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/portable/injectiontarget: ./ InjectionTargetTest.java PersonModel.java

Author: gerdogdu
Date: Wed Feb 10 20:14:39 2010
New Revision: 908655

URL: http://svn.apache.org/viewvc?rev=908655&view=rev
Log:
[OWB-268] Test for Implementation of BeanManager#createInjectionTarget

Added:
    openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/portable/injectiontarget/
    openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/portable/injectiontarget/InjectionTargetTest.java   (with props)
    openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/portable/injectiontarget/PersonModel.java   (with props)

Added: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/portable/injectiontarget/InjectionTargetTest.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/portable/injectiontarget/InjectionTargetTest.java?rev=908655&view=auto
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/portable/injectiontarget/InjectionTargetTest.java (added)
+++ openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/portable/injectiontarget/InjectionTargetTest.java Wed Feb 10 20:14:39 2010
@@ -0,0 +1,66 @@
+/*
+ * 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.portable.injectiontarget;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import javax.enterprise.context.spi.Contextual;
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.inject.spi.InjectionTarget;
+
+import junit.framework.Assert;
+
+import org.apache.webbeans.newtests.AbstractUnitTest;
+import org.junit.Test;
+
+public class InjectionTargetTest extends AbstractUnitTest
+{
+    public static class MyContextual<T> implements Contextual<T>
+    {
+
+        @Override
+        public T create(CreationalContext<T> context)
+        {
+            return null;
+        }
+
+        @Override
+        public void destroy(T instance, CreationalContext<T> context)
+        {
+            
+        }
+        
+    }
+    
+    @Test
+    public void testInjectionTarget()
+    {
+        Collection<Class<?>> classes = new ArrayList<Class<?>>();
+        startContainer(classes);
+        
+        InjectionTarget<PersonModel> model = getBeanManager().createInjectionTarget(getBeanManager().createAnnotatedType(PersonModel.class));
+        PersonModel person = model.produce(getBeanManager().createCreationalContext(new InjectionTargetTest.MyContextual<PersonModel>()));
+        Assert.assertNotNull(person);
+        
+        shutDownContainer();
+        
+    }
+
+}

Propchange: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/portable/injectiontarget/InjectionTargetTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/portable/injectiontarget/PersonModel.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/portable/injectiontarget/PersonModel.java?rev=908655&view=auto
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/portable/injectiontarget/PersonModel.java (added)
+++ openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/portable/injectiontarget/PersonModel.java Wed Feb 10 20:14:39 2010
@@ -0,0 +1,24 @@
+/*
+ * 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.portable.injectiontarget;
+
+public class PersonModel
+{
+
+}

Propchange: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/portable/injectiontarget/PersonModel.java
------------------------------------------------------------------------------
    svn:eol-style = native