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 2014/01/30 09:33:57 UTC
svn commit: r1562723 [1/3] - in
/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test:
managed/ managed/generic/ managed/instance/ managed/instance/beans/
managed/multipleinterfaces/ managed/newcomp/ managed/specialized/ producer/
pr...
Author: struberg
Date: Thu Jan 30 08:33:55 2014
New Revision: 1562723
URL: http://svn.apache.org/r1562723
Log:
OWB-763 add tests which have gone missing in SVN during the refactoring
Added:
openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/managed/
openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/managed/ProxyFactoryTest.java (with props)
openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/managed/generic/
openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/managed/generic/GenericInjectionTest.java (with props)
openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/managed/instance/
openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/managed/instance/InjectedInstanceComponentTest.java (with props)
openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/managed/instance/beans/
openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/managed/instance/beans/DependentBean.java (with props)
openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/managed/instance/beans/DependentBeanProducer.java (with props)
openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/managed/instance/beans/InstanceForDependentBean.java (with props)
openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/managed/instance/beans/InstanceInjectedComponent.java (with props)
openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/managed/instance/beans/MeaningOfLife.java (with props)
openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/managed/multipleinterfaces/
openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/managed/multipleinterfaces/AbstractCrudService.java (with props)
openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/managed/multipleinterfaces/GenericCrudService.java (with props)
openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/managed/multipleinterfaces/MyEntity.java (with props)
openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/managed/multipleinterfaces/MyEntityService.java (with props)
openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/managed/multipleinterfaces/MyEntityServiceImpl.java (with props)
openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/managed/multipleinterfaces/package.html (with props)
openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/managed/newcomp/
openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/managed/newcomp/NewComponent.java (with props)
openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/managed/newcomp/NewComponentTest.java (with props)
openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/managed/newcomp/ProducerNewComponent.java (with props)
openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/managed/specialized/
openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/managed/specialized/SpecializeDeactivationTest.java (with props)
openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/producer/
openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/producer/AmbigousProducerTest.java (with props)
openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/producer/ConsumerBean.java (with props)
openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/producer/HiddenProducerMethodTest.java (with props)
openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/producer/ListProducerTest.java (with props)
openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/producer/NamedProducerTest.java (with props)
openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/producer/ProducerBean.java (with props)
openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/producer/ProducerBean2.java (with props)
openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/producer/StringProducerTest.java (with props)
openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/producer/beans/
openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/producer/beans/ListConsumerBean.java (with props)
openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/producer/beans/MultipleListProducerBean.java (with props)
openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/producer/beans/PrivateProducedBean.java (with props)
openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/producer/beans/ProtectedProducedBean.java (with props)
openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/producer/beans/SampleProducerOwner.java (with props)
openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/producer/beans/SomeUserBean.java (with props)
openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/producer/specializes/
openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/producer/specializes/SpecializesProducer1Test.java (with props)
openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/proxy/
openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/proxy/DecoratorInterceptorProxySerializationTest.java (with props)
openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/proxy/DecoratorProxySerializationTest.java (with props)
openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/proxy/InnerClassProxyTest.java (with props)
openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/proxy/InterceptorProxySerializationTest.java (with props)
openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/proxy/ProxyMappingTest.java (with props)
openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/proxy/beans/
openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/proxy/beans/ApplicationBean.java (with props)
openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/proxy/beans/ConversationBean.java (with props)
openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/proxy/beans/DummyBean.java (with props)
openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/proxy/beans/DummyScoped.java (with props)
openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/proxy/beans/DummyScopedContext.java (with props)
openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/proxy/beans/DummyScopedExtension.java (with props)
openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/specalization/
openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/specalization/AdvancedPenProducer.java (with props)
openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/specalization/AlternativeSpecializesProducerTest.java (with props)
openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/specalization/DefaultPenProducer.java (with props)
openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/specalization/IPen.java (with props)
openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/specalization/Pen.java (with props)
openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/specalization/PremiumPenProducer.java (with props)
openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/specalization/QualifierSpecialized.java (with props)
openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/specalization/disabledspecialization/
openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/specalization/disabledspecialization/DisabledSpecializationTest.java (with props)
openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/specalization/disabledspecialization/LoginService.java (with props)
openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/specalization/disabledspecialization/MockLoginService.java (with props)
openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/specalization/disabledspecialization/VetoMe.java (with props)
openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/specalization/disabledspecialization/VetoMeExtension.java (with props)
openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/specalization/multiple/
openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/specalization/multiple/BeanA.java (with props)
openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/specalization/multiple/BeanB.java (with props)
openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/specalization/multiple/BeanC.java (with props)
openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/specalization/multiple/BeanD.java (with props)
openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/specalization/multiple/MultipleSpecializationTest.java (with props)
openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/specalization/observer/
openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/specalization/observer/BeanA.java (with props)
openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/specalization/observer/BeanB.java (with props)
openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/specalization/observer/BeanC.java (with props)
openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/specalization/observer/BeanD.java (with props)
openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/specalization/observer/BeanE.java (with props)
openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/specalization/observer/ObserverTest.java (with props)
openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/specalization/observer/TestEvent.java (with props)
openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/specalization/passivation/
openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/specalization/passivation/DefaultXyBean.java (with props)
openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/specalization/passivation/SpecializedXyBean.java (with props)
openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/specalization/passivation/SpecializesPassivationTest.java (with props)
Added: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/managed/ProxyFactoryTest.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/managed/ProxyFactoryTest.java?rev=1562723&view=auto
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/managed/ProxyFactoryTest.java (added)
+++ openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/managed/ProxyFactoryTest.java Thu Jan 30 08:33:55 2014
@@ -0,0 +1,60 @@
+/*
+ * 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.test.managed;
+
+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 junit.framework.Assert;
+
+import org.apache.webbeans.test.AbstractUnitTest;
+import org.apache.webbeans.test.managed.multipleinterfaces.MyEntityServiceImpl;
+import org.junit.Test;
+
+public class ProxyFactoryTest extends AbstractUnitTest {
+
+ @SuppressWarnings("unchecked")
+ @Test
+ public void testProxyFactoryWithMultipleInterfaces() {
+ Collection<String> beanXmls = new ArrayList<String>();
+
+ Collection<Class<?>> beanClasses = new ArrayList<Class<?>>();
+ beanClasses.add(MyEntityServiceImpl.class);
+
+ startContainer(beanClasses, beanXmls);
+
+ Set<Bean<?>> beans = getBeanManager().getBeans(MyEntityServiceImpl.class);
+ Assert.assertNotNull(beans);
+
+ Bean<MyEntityServiceImpl> bean = (Bean<MyEntityServiceImpl>) beans.iterator().next();
+ Assert.assertNotNull(bean);
+
+ CreationalContext<MyEntityServiceImpl> ctx = getBeanManager().createCreationalContext(bean);
+
+ Object reference = getBeanManager().getReference(bean, MyEntityServiceImpl.class, ctx);
+ Assert.assertNotNull(reference);
+
+ shutDownContainer();
+ }
+}
Propchange: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/managed/ProxyFactoryTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/managed/generic/GenericInjectionTest.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/managed/generic/GenericInjectionTest.java?rev=1562723&view=auto
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/managed/generic/GenericInjectionTest.java (added)
+++ openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/managed/generic/GenericInjectionTest.java Thu Jan 30 08:33:55 2014
@@ -0,0 +1,87 @@
+/*
+ * 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.test.managed.generic;
+
+import org.apache.webbeans.test.AbstractUnitTest;
+import org.junit.Test;
+
+import javax.enterprise.inject.spi.Bean;
+import javax.inject.Inject;
+import java.net.InetAddress;
+import java.util.ArrayList;
+import java.util.Collection;
+
+import static org.junit.Assert.assertNotNull;
+
+public class GenericInjectionTest extends AbstractUnitTest
+{
+ @Test
+ public void testGenericInjection()
+ {
+ final Collection<Class<?>> beanClasses = new ArrayList<Class<?>>();
+ beanClasses.add(StringIntAddress.class);
+ beanClasses.add(AddressStringInt.class);
+ beanClasses.add(IntStringAddress.class);
+ beanClasses.add(Helper.class);
+
+ startContainer(beanClasses);
+
+ // will fail if generics are not handled properly
+ final Bean<Helper> bean = getBean(Helper.class);
+ final Helper helper = Helper.class.cast(getBeanManager().getReference(bean, Helper.class, null));
+ helper.checkAll();
+
+ shutDownContainer();
+ }
+
+ public static interface InterfaceWithMultipleGenerics<A, B, C>
+ {
+ }
+
+ public static class StringIntAddress implements InterfaceWithMultipleGenerics<String, Integer, InetAddress>
+ {
+ }
+
+ public static class AddressStringInt implements InterfaceWithMultipleGenerics<Integer, InetAddress, String>
+ {
+ }
+
+ public static class IntStringAddress implements InterfaceWithMultipleGenerics<Integer, String, InetAddress>
+ {
+ }
+
+ public static class Helper
+ {
+ @Inject
+ private InterfaceWithMultipleGenerics<String, Integer, InetAddress> sia;
+
+ @Inject
+ private InterfaceWithMultipleGenerics<Integer, InetAddress, String> ias;
+
+ @Inject
+ private InterfaceWithMultipleGenerics<Integer, String, InetAddress> isa;
+
+ public void checkAll()
+ {
+ assertNotNull(sia);
+ assertNotNull(ias);
+ assertNotNull(isa);
+ }
+ }
+}
Propchange: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/managed/generic/GenericInjectionTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/managed/instance/InjectedInstanceComponentTest.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/managed/instance/InjectedInstanceComponentTest.java?rev=1562723&view=auto
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/managed/instance/InjectedInstanceComponentTest.java (added)
+++ openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/managed/instance/InjectedInstanceComponentTest.java Thu Jan 30 08:33:55 2014
@@ -0,0 +1,148 @@
+/*
+ * 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.test.managed.instance;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Set;
+
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.inject.Instance;
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.util.TypeLiteral;
+
+import junit.framework.Assert;
+
+import org.apache.webbeans.test.AbstractUnitTest;
+import org.apache.webbeans.test.managed.instance.beans.DependentBean;
+import org.apache.webbeans.test.managed.instance.beans.DependentBeanProducer;
+import org.apache.webbeans.test.managed.instance.beans.InstanceForDependentBean;
+import org.apache.webbeans.test.managed.instance.beans.InstanceInjectedComponent;
+import org.apache.webbeans.test.component.CheckWithCheckPayment;
+import org.apache.webbeans.test.component.CheckWithMoneyPayment;
+import org.apache.webbeans.test.component.IPayment;
+import org.apache.webbeans.test.component.PaymentProcessorComponent;
+import org.junit.Test;
+
+
+public class InjectedInstanceComponentTest extends AbstractUnitTest
+{
+
+ @Test
+ public void testInstanceInjectedComponent()
+ {
+ Collection<Class<?>> beanClasses = new ArrayList<Class<?>>();
+ beanClasses.add(PaymentProcessorComponent.class);
+ beanClasses.add(InstanceInjectedComponent.class);
+ beanClasses.add(CheckWithCheckPayment.class);
+ beanClasses.add(CheckWithMoneyPayment.class);
+ beanClasses.add(IPayment.class);
+
+ startContainer(beanClasses, null);
+
+ InstanceInjectedComponent instance = getInstance(InstanceInjectedComponent.class);
+
+ org.junit.Assert.assertNotNull(instance);
+ org.junit.Assert.assertNotNull(instance.getInstance());
+ org.junit.Assert.assertNotNull(instance.getPaymentComponent());
+
+ Instance<PaymentProcessorComponent> ins = instance.getInstance();
+
+ boolean ambigious = ins.isAmbiguous();
+
+ Assert.assertFalse(ambigious);
+
+ boolean unsatisfied = ins.isUnsatisfied();
+
+ Assert.assertFalse(unsatisfied);
+
+ shutDownContainer();
+ }
+
+ @Test
+ public void testInstanceProducedWithInjectionPoint()
+ {
+ Collection<Class<?>> beanClasses = new ArrayList<Class<?>>();
+
+ beanClasses.add(InstanceForDependentBean.class);
+ beanClasses.add(DependentBean.class);
+ beanClasses.add(DependentBeanProducer.class);
+ startContainer(beanClasses, null);
+
+ InstanceForDependentBean holder = getInstance(InstanceForDependentBean.class);
+ Assert.assertNotNull(holder);
+
+ Assert.assertEquals(42, holder.getMeaningOfLife());
+ Assert.assertEquals(0, holder.getSecondaryMeaning());
+
+ shutDownContainer();
+ }
+
+ @Test
+ public void testInstanceDestroyal()
+ {
+ Collection<Class<?>> beanClasses = new ArrayList<Class<?>>();
+
+ beanClasses.add(InstanceForDependentBean.class);
+ beanClasses.add(DependentBean.class);
+ startContainer(beanClasses, null);
+
+ InstanceForDependentBean holder = getInstance(InstanceForDependentBean.class);
+ Assert.assertNotNull(holder);
+
+ Assert.assertEquals(42, holder.getMeaningOfLife());
+
+ DependentBean.properlyDestroyed = false;
+
+ shutDownContainer();
+
+ Assert.assertTrue(DependentBean.properlyDestroyed);
+ }
+
+ @Test
+ public void testManualInstanceResolving()
+ {
+ Collection<Class<?>> beanClasses = new ArrayList<Class<?>>();
+
+ beanClasses.add(PaymentProcessorComponent.class);
+ beanClasses.add(CheckWithCheckPayment.class);
+ beanClasses.add(CheckWithMoneyPayment.class);
+ beanClasses.add(IPayment.class);
+
+ startContainer(beanClasses, null);
+
+ Set<Bean<?>> beans =
+ getBeanManager().getBeans(new TypeLiteral<Instance<PaymentProcessorComponent>>() {}.getType());
+ Bean<Instance<PaymentProcessorComponent>> bean =
+ (Bean<Instance<PaymentProcessorComponent>>) getBeanManager().resolve(beans);
+ CreationalContext<Instance<PaymentProcessorComponent>> creationalContext =
+ getBeanManager().createCreationalContext(bean);
+ Instance<PaymentProcessorComponent> provider = bean.create(creationalContext);
+ Assert.assertNotNull(provider);
+
+ // please note that the provider will NOT create a PaymentProcessorComponent
+ // because the Bean doesn't know this information! This is compatible with Weld
+ // which also doesn't handle this case. This is due to the fact that the spec
+ // defines that there is only one InstanceBean.
+
+ shutDownContainer();
+ }
+
+}
Propchange: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/managed/instance/InjectedInstanceComponentTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/managed/instance/beans/DependentBean.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/managed/instance/beans/DependentBean.java?rev=1562723&view=auto
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/managed/instance/beans/DependentBean.java (added)
+++ openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/managed/instance/beans/DependentBean.java Thu Jan 30 08:33:55 2014
@@ -0,0 +1,45 @@
+/*
+ * 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.test.managed.instance.beans;
+
+import javax.annotation.PreDestroy;
+import javax.enterprise.context.Dependent;
+
+/**
+ * Test for properly destroying dependent contextual instances
+ */
+@Dependent
+public class DependentBean
+{
+
+ public static boolean properlyDestroyed = false;
+
+ int meaningOfLife = 42;
+
+ public int getMeaningOfLife()
+ {
+ return meaningOfLife;
+ }
+
+ @PreDestroy
+ protected void destroy()
+ {
+ properlyDestroyed = true;
+ }
+}
Propchange: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/managed/instance/beans/DependentBean.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/managed/instance/beans/DependentBeanProducer.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/managed/instance/beans/DependentBeanProducer.java?rev=1562723&view=auto
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/managed/instance/beans/DependentBeanProducer.java (added)
+++ openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/managed/instance/beans/DependentBeanProducer.java Thu Jan 30 08:33:55 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.test.managed.instance.beans;
+
+import javax.enterprise.context.Dependent;
+import javax.enterprise.inject.Produces;
+import javax.enterprise.inject.spi.InjectionPoint;
+
+public class DependentBeanProducer {
+
+ @Produces
+ @Dependent
+ @MeaningOfLife
+ public DependentBean produce(InjectionPoint ip, DependentBean bean) {
+ bean.meaningOfLife = ip.getAnnotated().getAnnotation(MeaningOfLife.class).value();
+ return bean;
+ }
+}
Propchange: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/managed/instance/beans/DependentBeanProducer.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/managed/instance/beans/InstanceForDependentBean.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/managed/instance/beans/InstanceForDependentBean.java?rev=1562723&view=auto
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/managed/instance/beans/InstanceForDependentBean.java (added)
+++ openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/managed/instance/beans/InstanceForDependentBean.java Thu Jan 30 08:33:55 2014
@@ -0,0 +1,48 @@
+/*
+ * 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.test.managed.instance.beans;
+
+import javax.enterprise.context.RequestScoped;
+import javax.enterprise.inject.Instance;
+import javax.inject.Inject;
+
+/**
+ * Test for properly destroying dependent contextual instances
+ */
+@RequestScoped
+public class InstanceForDependentBean
+{
+
+ @Inject
+ private Instance<DependentBean> instance;
+
+ @Inject
+ @MeaningOfLife(0)
+ private Instance<DependentBean> secondaryInstance;
+
+ public int getMeaningOfLife()
+ {
+ return instance.get().getMeaningOfLife();
+ }
+
+ public int getSecondaryMeaning()
+ {
+ return secondaryInstance.get().getMeaningOfLife();
+ }
+}
Propchange: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/managed/instance/beans/InstanceForDependentBean.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/managed/instance/beans/InstanceInjectedComponent.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/managed/instance/beans/InstanceInjectedComponent.java?rev=1562723&view=auto
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/managed/instance/beans/InstanceInjectedComponent.java (added)
+++ openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/managed/instance/beans/InstanceInjectedComponent.java Thu Jan 30 08:33:55 2014
@@ -0,0 +1,49 @@
+/*
+ * 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.test.managed.instance.beans;
+
+
+import javax.enterprise.context.RequestScoped;
+import javax.enterprise.inject.Default;
+import javax.enterprise.inject.Instance;
+import javax.inject.Inject;
+
+import org.apache.webbeans.test.component.PaymentProcessorComponent;
+
+@RequestScoped
+public class InstanceInjectedComponent
+{
+ @Inject @Default Instance<PaymentProcessorComponent> instance;
+
+ public InstanceInjectedComponent()
+ {
+
+ }
+
+ public Instance<PaymentProcessorComponent> getInstance()
+ {
+ return instance;
+ }
+
+ public PaymentProcessorComponent getPaymentComponent()
+ {
+ return instance.get();
+ }
+
+}
Propchange: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/managed/instance/beans/InstanceInjectedComponent.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/managed/instance/beans/MeaningOfLife.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/managed/instance/beans/MeaningOfLife.java?rev=1562723&view=auto
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/managed/instance/beans/MeaningOfLife.java (added)
+++ openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/managed/instance/beans/MeaningOfLife.java Thu Jan 30 08:33:55 2014
@@ -0,0 +1,41 @@
+/*
+ * 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.test.managed.instance.beans;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.PARAMETER;
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import javax.enterprise.util.Nonbinding;
+import javax.inject.Qualifier;
+
+@Target( { TYPE, METHOD, PARAMETER, FIELD })
+@Retention(RUNTIME)
+@Documented
+@Qualifier
+public @interface MeaningOfLife
+{
+ @Nonbinding int value() default 42;
+}
Propchange: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/managed/instance/beans/MeaningOfLife.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/managed/instance/beans/MeaningOfLife.java
------------------------------------------------------------------------------
svn:executable = *
Added: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/managed/multipleinterfaces/AbstractCrudService.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/managed/multipleinterfaces/AbstractCrudService.java?rev=1562723&view=auto
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/managed/multipleinterfaces/AbstractCrudService.java (added)
+++ openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/managed/multipleinterfaces/AbstractCrudService.java Thu Jan 30 08:33:55 2014
@@ -0,0 +1,48 @@
+/*
+ * 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.test.managed.multipleinterfaces;
+
+public abstract class AbstractCrudService<T> implements GenericCrudService<T> {
+
+ @Override
+ public T create(T entity) {
+ // em.create(type)
+ return null;
+ }
+
+ @Override
+ public void delete(T entity) {
+ // em.delete...
+
+ }
+
+ @Override
+ public T getById(Object id) {
+ // em.find...
+ return null;
+ }
+
+ @Override
+ public T update(T entity) {
+ // em.merge...
+ return null;
+ }
+
+}
Propchange: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/managed/multipleinterfaces/AbstractCrudService.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/managed/multipleinterfaces/GenericCrudService.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/managed/multipleinterfaces/GenericCrudService.java?rev=1562723&view=auto
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/managed/multipleinterfaces/GenericCrudService.java (added)
+++ openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/managed/multipleinterfaces/GenericCrudService.java Thu Jan 30 08:33:55 2014
@@ -0,0 +1,28 @@
+/*
+ * 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.test.managed.multipleinterfaces;
+
+public interface GenericCrudService<T> {
+
+ public T create(T type);
+ public T update(T entity);
+ public T getById(Object id);
+ public void delete(T entity);
+}
Propchange: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/managed/multipleinterfaces/GenericCrudService.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/managed/multipleinterfaces/MyEntity.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/managed/multipleinterfaces/MyEntity.java?rev=1562723&view=auto
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/managed/multipleinterfaces/MyEntity.java (added)
+++ openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/managed/multipleinterfaces/MyEntity.java Thu Jan 30 08:33:55 2014
@@ -0,0 +1,35 @@
+/*
+ * 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.test.managed.multipleinterfaces;
+
+// @Entity ...
+public class MyEntity {
+
+ private int id;
+
+ public int getId() {
+ return id;
+ }
+
+ public void setId(int id) {
+ this.id = id;
+ }
+
+}
Propchange: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/managed/multipleinterfaces/MyEntity.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/managed/multipleinterfaces/MyEntityService.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/managed/multipleinterfaces/MyEntityService.java?rev=1562723&view=auto
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/managed/multipleinterfaces/MyEntityService.java (added)
+++ openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/managed/multipleinterfaces/MyEntityService.java Thu Jan 30 08:33:55 2014
@@ -0,0 +1,25 @@
+/*
+ * 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.test.managed.multipleinterfaces;
+
+public interface MyEntityService extends GenericCrudService<MyEntity> {
+
+ public void specialMyEntityFunction(MyEntity e);
+}
Propchange: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/managed/multipleinterfaces/MyEntityService.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/managed/multipleinterfaces/MyEntityServiceImpl.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/managed/multipleinterfaces/MyEntityServiceImpl.java?rev=1562723&view=auto
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/managed/multipleinterfaces/MyEntityServiceImpl.java (added)
+++ openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/managed/multipleinterfaces/MyEntityServiceImpl.java Thu Jan 30 08:33:55 2014
@@ -0,0 +1,31 @@
+/*
+ * 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.test.managed.multipleinterfaces;
+
+import javax.enterprise.context.ApplicationScoped;
+
+@ApplicationScoped
+public class MyEntityServiceImpl extends AbstractCrudService<MyEntity> implements MyEntityService {
+
+ @Override
+ public void specialMyEntityFunction(MyEntity e) {
+ // do something very special ;)
+ }
+}
Propchange: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/managed/multipleinterfaces/MyEntityServiceImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/managed/multipleinterfaces/package.html
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/managed/multipleinterfaces/package.html?rev=1562723&view=auto
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/managed/multipleinterfaces/package.html (added)
+++ openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/managed/multipleinterfaces/package.html Thu Jan 30 08:33:55 2014
@@ -0,0 +1,28 @@
+<!--
+ ~ 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.
+ -->
+<html>
+<body>
+<h2>Test classes for demonstrating OWB-210</h2>
+<p>This package contains a realworld scenario of a CRUD Service Framework.</p>
+<p>We left away the entity etc, but show the important structure. The original
+problem was that <code>GenericCrudSerive</code> is contained twice in the
+class definition chain which caused the JavassistProxyFactory to fail while
+creating the proxy.</p>
+</body>
+</html>
\ No newline at end of file
Propchange: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/managed/multipleinterfaces/package.html
------------------------------------------------------------------------------
svn:eol-style = native
Added: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/managed/newcomp/NewComponent.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/managed/newcomp/NewComponent.java?rev=1562723&view=auto
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/managed/newcomp/NewComponent.java (added)
+++ openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/managed/newcomp/NewComponent.java Thu Jan 30 08:33:55 2014
@@ -0,0 +1,43 @@
+/*
+ * 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.test.managed.newcomp;
+
+import javax.enterprise.context.Dependent;
+import javax.enterprise.inject.New;
+import javax.inject.Inject;
+
+import org.apache.webbeans.test.component.dependent.DependentOwnerComponent;
+
+@Dependent
+public class NewComponent
+{
+ private @Inject @New DependentOwnerComponent owner;
+
+ private @Inject @New(DependentOwnerComponent.class) DependentOwnerComponent grandParent;
+
+ public DependentOwnerComponent owner()
+ {
+ return owner;
+ }
+
+ public DependentOwnerComponent getGrandParent()
+ {
+ return grandParent;
+ }
+}
Propchange: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/managed/newcomp/NewComponent.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/managed/newcomp/NewComponentTest.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/managed/newcomp/NewComponentTest.java?rev=1562723&view=auto
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/managed/newcomp/NewComponentTest.java (added)
+++ openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/managed/newcomp/NewComponentTest.java Thu Jan 30 08:33:55 2014
@@ -0,0 +1,74 @@
+/*
+ * 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.test.managed.newcomp;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+
+import org.apache.webbeans.test.AbstractUnitTest;
+import org.apache.webbeans.test.component.CheckWithCheckPayment;
+import org.apache.webbeans.test.component.IPayment;
+import org.apache.webbeans.test.component.dependent.DependentComponent;
+import org.apache.webbeans.test.component.dependent.DependentOwnerComponent;
+import org.junit.Test;
+import org.junit.Assert;
+
+
+public class NewComponentTest extends AbstractUnitTest
+{
+ @Test
+ public void testDependent()
+ {
+ Collection<Class<?>> beanClasses = new ArrayList<Class<?>>();
+ beanClasses.add(DependentComponent.class);
+ beanClasses.add(DependentOwnerComponent.class);
+ beanClasses.add(NewComponent.class);
+
+ startContainer(beanClasses, null);
+
+ NewComponent newComponent = getInstance(NewComponent.class);
+ Assert.assertNotNull(newComponent);
+
+ Assert.assertNotNull(newComponent.owner());
+ Assert.assertNotNull(newComponent.getGrandParent());
+ Assert.assertNotSame(newComponent.owner(), newComponent.getGrandParent());
+
+
+ shutDownContainer();
+ }
+
+ @Test
+ public void testDepedent2()
+ {
+ Collection<Class<?>> beanClasses = new ArrayList<Class<?>>();
+ beanClasses.add(CheckWithCheckPayment.class);
+ beanClasses.add(IPayment.class);
+ beanClasses.add(ProducerNewComponent.class);
+ beanClasses.add(NewComponent.class);
+
+ startContainer(beanClasses, null);
+
+ IPayment payment = getInstance(IPayment.class);
+ Assert.assertNotNull(payment);
+ Assert.assertTrue(payment instanceof CheckWithCheckPayment);
+
+ shutDownContainer();
+ }
+}
Propchange: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/managed/newcomp/NewComponentTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/managed/newcomp/ProducerNewComponent.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/managed/newcomp/ProducerNewComponent.java?rev=1562723&view=auto
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/managed/newcomp/ProducerNewComponent.java (added)
+++ openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/managed/newcomp/ProducerNewComponent.java Thu Jan 30 08:33:55 2014
@@ -0,0 +1,49 @@
+/*
+ * 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.test.managed.newcomp;
+
+import javax.enterprise.context.Dependent;
+import javax.enterprise.context.RequestScoped;
+import javax.enterprise.inject.New;
+import javax.enterprise.inject.Produces;
+import javax.inject.Named;
+
+import org.apache.webbeans.test.component.CheckWithCheckPayment;
+import org.apache.webbeans.test.component.IPayment;
+
+@RequestScoped
+@Named
+public class ProducerNewComponent
+{
+ private IPayment component;
+
+ @Produces
+ @Dependent
+ @Named("paymentProducer")
+ public IPayment create(@New CheckWithCheckPayment comp)
+ {
+ this.component = comp;
+ return comp;
+ }
+
+ public IPayment getComponent()
+ {
+ return this.component;
+ }
+}
Propchange: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/managed/newcomp/ProducerNewComponent.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/managed/specialized/SpecializeDeactivationTest.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/managed/specialized/SpecializeDeactivationTest.java?rev=1562723&view=auto
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/managed/specialized/SpecializeDeactivationTest.java (added)
+++ openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/managed/specialized/SpecializeDeactivationTest.java Thu Jan 30 08:33:55 2014
@@ -0,0 +1,166 @@
+/*
+ * 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.test.managed.specialized;
+
+import org.apache.webbeans.test.AbstractUnitTest;
+import org.junit.Before;
+import org.junit.Test;
+
+import javax.enterprise.inject.Any;
+import javax.enterprise.inject.Instance;
+import javax.enterprise.inject.Produces;
+import javax.enterprise.inject.Specializes;
+import javax.inject.Inject;
+import java.util.Arrays;
+import java.util.Collections;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+public class SpecializeDeactivationTest extends AbstractUnitTest
+{
+ @Inject
+ private Init init;
+
+ @Before
+ public void reset() {
+ Impl1.called = false;
+ Impl2.called = false;
+ SpeImpl1.called = false;
+ }
+
+ @Test
+ public void normal()
+ {
+ startContainer(Arrays.<Class<?>>asList(Init.class, API.class, Impl1.class, Impl2.class),
+ Collections.<String>emptyList(), true);
+
+ assertEquals(2, init.init());
+ assertTrue(Impl1.called);
+ assertTrue(Impl2.called);
+ }
+
+ @Test
+ public void specialize()
+ {
+ startContainer(Arrays.<Class<?>>asList(Init.class, API.class, Impl1.class, Impl2.class, SpeImpl1.class),
+ Collections.<String>emptyList(), true);
+
+ assertEquals(2, init.init());
+ assertTrue(SpeImpl1.called);
+ assertTrue(Impl2.called);
+ }
+
+ @Test
+ public void specializeProducers()
+ {
+ startContainer(Arrays.<Class<?>>asList(Init.class, API.class, Prod1.class, Prod2.class, Spe1.class),
+ Collections.<String>emptyList(), true);
+
+ assertEquals(2, init.init());
+ assertTrue(SpeImpl1.called);
+ assertTrue(Impl2.called);
+ }
+
+ public static interface API
+ {
+ void init();
+ }
+
+ public static class Prod1
+ {
+ @Produces
+ public API api1()
+ {
+ return new Impl1();
+ }
+ }
+
+ public static class Spe1 extends Prod1
+ {
+ @Produces
+ @Override
+ @Specializes
+ public API api1()
+ {
+ return new SpeImpl1();
+ }
+ }
+
+ public static class Prod2
+ {
+ @Produces
+ public API api1()
+ {
+ return new Impl2();
+ }
+ }
+
+ public static class Impl1 implements API
+ {
+ public static boolean called = false;
+
+ @Override
+ public void init()
+ {
+ called = true;
+ }
+ }
+
+ @Specializes
+ public static class SpeImpl1 extends Impl1
+ {
+ public static boolean called = false;
+
+ @Override
+ public void init()
+ {
+ called = true;
+ }
+ }
+
+ public static class Impl2 implements API
+ {
+ public static boolean called = false;
+
+ @Override
+ public void init()
+ {
+ called = true;
+ }
+ }
+
+ public static class Init
+ {
+ @Inject
+ @Any
+ private Instance<API> impls;
+
+ public int init()
+ {
+ int i = 0;
+ for (final API api : impls)
+ {
+ api.init();
+ i++;
+ }
+ return i;
+ }
+ }
+}
Propchange: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/managed/specialized/SpecializeDeactivationTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/producer/AmbigousProducerTest.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/producer/AmbigousProducerTest.java?rev=1562723&view=auto
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/producer/AmbigousProducerTest.java (added)
+++ openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/producer/AmbigousProducerTest.java Thu Jan 30 08:33:55 2014
@@ -0,0 +1,57 @@
+/*
+ * 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.test.producer;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import javax.enterprise.inject.AmbiguousResolutionException;
+
+import junit.framework.Assert;
+
+import org.apache.webbeans.exception.WebBeansConfigurationException;
+import javax.enterprise.inject.spi.DeploymentException;
+import org.apache.webbeans.test.AbstractUnitTest;
+import org.junit.Test;
+
+public class AmbigousProducerTest extends AbstractUnitTest
+{
+
+ @Test
+ public void testAmbiguousProducer()
+ {
+ Collection<String> beanXmls = new ArrayList<String>();
+ Collection<Class<?>> beanClasses = new ArrayList<Class<?>>();
+
+ beanClasses.add(ProducerBean.class);
+ beanClasses.add(ProducerBean2.class);
+
+ try {
+ startContainer(beanClasses, beanXmls);
+ Assert.fail("Should have thrown AmbiguousResoultionException");
+ }
+ catch (WebBeansConfigurationException e)
+ {
+ Assert.assertEquals(DeploymentException.class, e.getCause().getClass());
+ Assert.assertEquals(AmbiguousResolutionException.class, e.getCause().getCause().getClass());
+ }
+ shutDownContainer();
+
+ }
+}
Propchange: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/producer/AmbigousProducerTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/producer/ConsumerBean.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/producer/ConsumerBean.java?rev=1562723&view=auto
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/producer/ConsumerBean.java (added)
+++ openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/producer/ConsumerBean.java Thu Jan 30 08:33:55 2014
@@ -0,0 +1,73 @@
+/*
+ * 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.test.producer;
+
+import javax.inject.Inject;
+import javax.inject.Named;
+
+public class ConsumerBean {
+
+ @Inject
+ @Named("name1")
+ private String name1;
+
+ @Inject
+ @Named("name2")
+ private String name2;
+
+ @Inject
+ @Named("name3")
+ private boolean name3;
+
+ @Inject
+ @Named("name4")
+ private String name4;
+
+ @Inject
+ @Named("name5")
+ private String name5;
+
+ @Inject
+ @Named("name6")
+ private boolean name6;
+
+ public String getName1() {
+ return name1;
+ }
+
+ public String getName2() {
+ return name2;
+ }
+
+ public boolean isName3() {
+ return name3;
+ }
+
+ public String getName4() {
+ return name4;
+ }
+
+ public String getName5() {
+ return name5;
+ }
+
+ public boolean isName6() {
+ return name6;
+ }
+}
Propchange: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/producer/ConsumerBean.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/producer/HiddenProducerMethodTest.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/producer/HiddenProducerMethodTest.java?rev=1562723&view=auto
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/producer/HiddenProducerMethodTest.java (added)
+++ openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/producer/HiddenProducerMethodTest.java Thu Jan 30 08:33:55 2014
@@ -0,0 +1,49 @@
+/*
+ * 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.test.producer;
+
+import org.apache.webbeans.test.AbstractUnitTest;
+
+import org.apache.webbeans.test.producer.beans.PrivateProducedBean;
+import org.apache.webbeans.test.producer.beans.ProtectedProducedBean;
+import org.apache.webbeans.test.producer.beans.SampleProducerOwner;
+import org.apache.webbeans.test.producer.beans.SomeUserBean;
+import org.junit.Assert;
+import org.junit.Test;
+
+/**
+ * Test for protected and private producer methods
+ */
+public class HiddenProducerMethodTest extends AbstractUnitTest
+{
+ @Test
+ public void testHiddenProducerMethods()
+ {
+ startContainer(PrivateProducedBean.class, ProtectedProducedBean.class, SampleProducerOwner.class, SomeUserBean.class);
+
+ PrivateProducedBean privateProducedBean = getInstance(PrivateProducedBean.class);
+ Assert.assertNotNull(privateProducedBean);
+ Assert.assertEquals(42, privateProducedBean.getMeaningOfLife());
+
+ ProtectedProducedBean protectedProducedBean = getInstance(ProtectedProducedBean.class);
+ Assert.assertNotNull(protectedProducedBean);
+ Assert.assertEquals(42, privateProducedBean.getMeaningOfLife());
+ }
+
+}
Propchange: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/producer/HiddenProducerMethodTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/producer/ListProducerTest.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/producer/ListProducerTest.java?rev=1562723&view=auto
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/producer/ListProducerTest.java (added)
+++ openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/producer/ListProducerTest.java Thu Jan 30 08:33:55 2014
@@ -0,0 +1,53 @@
+/*
+ * 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.test.producer;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import junit.framework.Assert;
+
+import org.apache.webbeans.exception.WebBeansConfigurationException;
+import org.apache.webbeans.test.AbstractUnitTest;
+import org.apache.webbeans.test.producer.beans.ListConsumerBean;
+import org.apache.webbeans.test.producer.beans.MultipleListProducerBean;
+import org.junit.Test;
+
+public class ListProducerTest extends AbstractUnitTest
+{
+ @Test
+ public void testListProducersWithDifferentParameterizedTypes()
+ {
+ Collection<String> beanXmls = new ArrayList<String>();
+ Collection<Class<?>> beanClasses = new ArrayList<Class<?>>();
+
+ beanClasses.add(ListConsumerBean.class);
+ beanClasses.add(MultipleListProducerBean.class);
+
+ try
+ {
+ startContainer(beanClasses, beanXmls);
+ }
+ catch (WebBeansConfigurationException e)
+ {
+ Assert.fail("Should not have thrown AmbiguousResoultionException");
+ }
+ shutDownContainer();
+ }
+}
\ No newline at end of file
Propchange: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/producer/ListProducerTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/producer/NamedProducerTest.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/producer/NamedProducerTest.java?rev=1562723&view=auto
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/producer/NamedProducerTest.java (added)
+++ openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/producer/NamedProducerTest.java Thu Jan 30 08:33:55 2014
@@ -0,0 +1,59 @@
+/*
+ * 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.test.producer;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.inject.spi.Bean;
+
+import org.apache.webbeans.test.AbstractUnitTest;
+import org.junit.Assert;
+import org.junit.Test;
+
+public class NamedProducerTest extends AbstractUnitTest
+{
+
+ @Test
+ public void testNamedProducer()
+ {
+ Collection<String> beanXmls = new ArrayList<String>();
+ Collection<Class<?>> beanClasses = new ArrayList<Class<?>>();
+
+ beanClasses.add(ProducerBean.class);
+ beanClasses.add(ConsumerBean.class);
+
+ startContainer(beanClasses, beanXmls);
+
+ Bean<?> consumerBean = getBeanManager().getBeans(ConsumerBean.class).iterator().next();
+ CreationalContext<?> context = getBeanManager().createCreationalContext(consumerBean);
+ ConsumerBean consumer = (ConsumerBean) getBeanManager().getReference(consumerBean, ConsumerBean.class, context);
+
+ Assert.assertEquals("name1", consumer.getName1());
+ Assert.assertEquals("name2", consumer.getName2());
+ Assert.assertEquals(true, consumer.isName3());
+ Assert.assertEquals("name4", consumer.getName4());
+ Assert.assertEquals("name5", consumer.getName5());
+ Assert.assertEquals(true, consumer.isName6());
+
+ shutDownContainer();
+
+ }
+}
Propchange: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/producer/NamedProducerTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/producer/NamedProducerTest.java
------------------------------------------------------------------------------
svn:executable = *
Added: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/producer/ProducerBean.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/producer/ProducerBean.java?rev=1562723&view=auto
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/producer/ProducerBean.java (added)
+++ openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/producer/ProducerBean.java Thu Jan 30 08:33:55 2014
@@ -0,0 +1,61 @@
+/*
+ * 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.test.producer;
+
+import javax.enterprise.inject.Produces;
+import javax.inject.Named;
+
+public class ProducerBean {
+
+ @Produces
+ @Named
+ public String name1() {
+ return "name1";
+ }
+
+ @Produces
+ @Named
+ public String getName2() {
+ return "name2";
+ }
+
+ @Produces
+ @Named
+ public boolean isName3() {
+ return true;
+ }
+
+ @Produces
+ @Named("name4")
+ public String producesName4() {
+ return "name4";
+ }
+
+ @Produces
+ @Named("name5")
+ public String getName5() {
+ return "name5";
+ }
+
+ @Produces
+ @Named("name6")
+ public boolean isName6() {
+ return true;
+ }
+}
Propchange: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/producer/ProducerBean.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/producer/ProducerBean2.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/producer/ProducerBean2.java?rev=1562723&view=auto
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/producer/ProducerBean2.java (added)
+++ openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/producer/ProducerBean2.java Thu Jan 30 08:33:55 2014
@@ -0,0 +1,30 @@
+/*
+ * 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.test.producer;
+
+import javax.enterprise.inject.Produces;
+import javax.inject.Named;
+
+public class ProducerBean2 {
+ @Produces
+ @Named
+ public String name1() {
+ return "name1 of ProducerBean2";
+ }
+}
Propchange: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/producer/ProducerBean2.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/producer/StringProducerTest.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/producer/StringProducerTest.java?rev=1562723&view=auto
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/producer/StringProducerTest.java (added)
+++ openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/producer/StringProducerTest.java Thu Jan 30 08:33:55 2014
@@ -0,0 +1,56 @@
+/*
+ * 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.test.producer;
+
+import org.apache.webbeans.test.AbstractUnitTest;
+import org.junit.Assert;
+import org.junit.Test;
+
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.inject.Produces;
+import javax.enterprise.inject.spi.Bean;
+
+public class StringProducerTest extends AbstractUnitTest
+{
+
+ @Test
+ public void testNamedProducer()
+ {
+ startContainer(StringProducer.class);
+
+ final Bean<?> bean = getBeanManager().getBeans(String.class).iterator().next();
+ final CreationalContext<?> context = getBeanManager().createCreationalContext(bean);
+ final String produced = String.class.cast(getBeanManager().getReference(bean, String.class, context));
+
+ Assert.assertEquals("string", produced);
+
+ shutDownContainer();
+
+ }
+
+ public static class StringProducer
+ {
+ @Produces
+ public String produces()
+ {
+ return "string";
+ }
+ }
+
+}
Propchange: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/producer/StringProducerTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/producer/StringProducerTest.java
------------------------------------------------------------------------------
svn:executable = *
Added: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/producer/beans/ListConsumerBean.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/producer/beans/ListConsumerBean.java?rev=1562723&view=auto
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/producer/beans/ListConsumerBean.java (added)
+++ openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/producer/beans/ListConsumerBean.java Thu Jan 30 08:33:55 2014
@@ -0,0 +1,32 @@
+/*
+ * 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.test.producer.beans;
+
+import java.util.List;
+
+import javax.inject.Inject;
+import javax.inject.Named;
+
+@Named
+public class ListConsumerBean {
+
+ @Inject
+ public List<Integer> listInteger;
+
+}
\ No newline at end of file
Propchange: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/producer/beans/ListConsumerBean.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/producer/beans/MultipleListProducerBean.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/producer/beans/MultipleListProducerBean.java?rev=1562723&view=auto
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/producer/beans/MultipleListProducerBean.java (added)
+++ openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/producer/beans/MultipleListProducerBean.java Thu Jan 30 08:33:55 2014
@@ -0,0 +1,43 @@
+/*
+ * 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.test.producer.beans;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.enterprise.inject.Produces;
+import javax.inject.Named;
+
+public class MultipleListProducerBean
+{
+
+ @Produces
+ @Named("list1")
+ public ArrayList<String> getList1()
+ {
+ return null;
+ }
+
+ @Produces
+ @Named("list2")
+ public List<Integer> getList2()
+ {
+ return null;
+ }
+}
\ No newline at end of file
Propchange: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/producer/beans/MultipleListProducerBean.java
------------------------------------------------------------------------------
svn:eol-style = native