Author: scabanovich
Date: 2011-05-27 16:47:50 -0400 (Fri, 27 May 2011)
New Revision: 31551
Added:
trunk/cdi/tests/org.jboss.tools.cdi.seam.solder.core.test/projects/CDISolderTest/src/org/jboss/generic/
trunk/cdi/tests/org.jboss.tools.cdi.seam.solder.core.test/projects/CDISolderTest/src/org/jboss/generic/MyBean.java
trunk/cdi/tests/org.jboss.tools.cdi.seam.solder.core.test/projects/CDISolderTest/src/org/jboss/generic/MyBean2.java
trunk/cdi/tests/org.jboss.tools.cdi.seam.solder.core.test/projects/CDISolderTest/src/org/jboss/generic/MyBean3.java
trunk/cdi/tests/org.jboss.tools.cdi.seam.solder.core.test/projects/CDISolderTest/src/org/jboss/generic/MyBean4.java
trunk/cdi/tests/org.jboss.tools.cdi.seam.solder.core.test/projects/CDISolderTest/src/org/jboss/generic/MyBeanInjections.java
trunk/cdi/tests/org.jboss.tools.cdi.seam.solder.core.test/projects/CDISolderTest/src/org/jboss/generic/MyConfiguration.java
trunk/cdi/tests/org.jboss.tools.cdi.seam.solder.core.test/projects/CDISolderTest/src/org/jboss/generic/MyConfigurationProducer.java
trunk/cdi/tests/org.jboss.tools.cdi.seam.solder.core.test/projects/CDISolderTest/src/org/jboss/generic/MyEvent.java
trunk/cdi/tests/org.jboss.tools.cdi.seam.solder.core.test/projects/CDISolderTest/src/org/jboss/generic/MyExtendedConfiguration.java
trunk/cdi/tests/org.jboss.tools.cdi.seam.solder.core.test/projects/CDISolderTest/src/org/jboss/generic/MyGenericBean.java
trunk/cdi/tests/org.jboss.tools.cdi.seam.solder.core.test/projects/CDISolderTest/src/org/jboss/generic/MyGenericBean2.java
trunk/cdi/tests/org.jboss.tools.cdi.seam.solder.core.test/projects/CDISolderTest/src/org/jboss/generic/MyGenericType.java
trunk/cdi/tests/org.jboss.tools.cdi.seam.solder.core.test/projects/CDISolderTest/src/org/jboss/generic/Qualifier1.java
trunk/cdi/tests/org.jboss.tools.cdi.seam.solder.core.test/projects/CDISolderTest/src/org/jboss/generic/Qualifier2.java
trunk/cdi/tests/org.jboss.tools.cdi.seam.solder.core.test/projects/CDISolderTest/src/org/jboss/generic/Qualifier3.java
trunk/cdi/tests/org.jboss.tools.cdi.seam.solder.core.test/projects/CDISolderTest/src/org/jboss/generic/Qualifier4.java
trunk/cdi/tests/org.jboss.tools.cdi.seam.solder.core.test/src/org/jboss/tools/cdi/seam/solder/core/test/GenericBeanTest.java
Modified:
trunk/cdi/tests/org.jboss.tools.cdi.seam.solder.core.test/src/org/jboss/tools/cdi/seam/solder/core/test/CDISeamSolderCoreAllTests.java
Log:
JBIDE-8674
https://issues.jboss.org/browse/JBIDE-8674
Added:
trunk/cdi/tests/org.jboss.tools.cdi.seam.solder.core.test/projects/CDISolderTest/src/org/jboss/generic/MyBean.java
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.seam.solder.core.test/projects/CDISolderTest/src/org/jboss/generic/MyBean.java
(rev 0)
+++
trunk/cdi/tests/org.jboss.tools.cdi.seam.solder.core.test/projects/CDISolderTest/src/org/jboss/generic/MyBean.java 2011-05-27
20:47:50 UTC (rev 31551)
@@ -0,0 +1,17 @@
+package org.jboss.generic;
+
+/**
+ * Beans of this type are produced by MyGenericBean.createMyFirstBean()
+ * for every of 5 configurations.
+ * It is injected
+ * - into fields first1, first2, first3, first4, first5 of MyBeanInjections
+ * to check each configuration.
+ * - into generic injection field 'c' of MyGenericField2.
+ * - into generic parameter of injection method setMyBean
+ * - into type parameter of Event typed fields event1 and event2 of MyBeanInjections.
+ */
+public class MyBean {
+
+ public MyBean(String s) {}
+
+}
Property changes on:
trunk/cdi/tests/org.jboss.tools.cdi.seam.solder.core.test/projects/CDISolderTest/src/org/jboss/generic/MyBean.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added:
trunk/cdi/tests/org.jboss.tools.cdi.seam.solder.core.test/projects/CDISolderTest/src/org/jboss/generic/MyBean2.java
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.seam.solder.core.test/projects/CDISolderTest/src/org/jboss/generic/MyBean2.java
(rev 0)
+++
trunk/cdi/tests/org.jboss.tools.cdi.seam.solder.core.test/projects/CDISolderTest/src/org/jboss/generic/MyBean2.java 2011-05-27
20:47:50 UTC (rev 31551)
@@ -0,0 +1,14 @@
+package org.jboss.generic;
+
+/**
+ * Beans of this type are produced by MyGenericBean.createMySecondBean()
+ * for every of 5 configurations.
+ * It is injected into fields second1, second2, second3 of MyBeanInjections
+ * to check some configurations.
+ *
+ */
+public class MyBean2 {
+
+ public MyBean2(String s) {}
+
+}
Property changes on:
trunk/cdi/tests/org.jboss.tools.cdi.seam.solder.core.test/projects/CDISolderTest/src/org/jboss/generic/MyBean2.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added:
trunk/cdi/tests/org.jboss.tools.cdi.seam.solder.core.test/projects/CDISolderTest/src/org/jboss/generic/MyBean3.java
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.seam.solder.core.test/projects/CDISolderTest/src/org/jboss/generic/MyBean3.java
(rev 0)
+++
trunk/cdi/tests/org.jboss.tools.cdi.seam.solder.core.test/projects/CDISolderTest/src/org/jboss/generic/MyBean3.java 2011-05-27
20:47:50 UTC (rev 31551)
@@ -0,0 +1,15 @@
+package org.jboss.generic;
+
+/**
+ * Beans of this type are produced by MyGenericBean.myThirdBean
+ * for every of 5 configurations.
+ * It is injected
+ * - into fields third1, third2, third3, third4, third5 of MyBeanInjections
+ * to check each configuration.
+ *
+ */
+public class MyBean3 {
+
+ public MyBean3(String s) {}
+
+}
Property changes on:
trunk/cdi/tests/org.jboss.tools.cdi.seam.solder.core.test/projects/CDISolderTest/src/org/jboss/generic/MyBean3.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added:
trunk/cdi/tests/org.jboss.tools.cdi.seam.solder.core.test/projects/CDISolderTest/src/org/jboss/generic/MyBean4.java
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.seam.solder.core.test/projects/CDISolderTest/src/org/jboss/generic/MyBean4.java
(rev 0)
+++
trunk/cdi/tests/org.jboss.tools.cdi.seam.solder.core.test/projects/CDISolderTest/src/org/jboss/generic/MyBean4.java 2011-05-27
20:47:50 UTC (rev 31551)
@@ -0,0 +1,15 @@
+package org.jboss.generic;
+
+/**
+ * Beans of this type are produced by MyGenericBean2.myFourthBean
+ * for every of 5 configurations.
+ * It is injected
+ * - into parameters fourth1, fourth2, fourth3, fourth4, fourth5 of
+ * method MyBeanInjections.setAllMyBean4 to check each configuration.
+ *
+ */
+public class MyBean4 {
+
+ public MyBean4(String s) {}
+
+}
Property changes on:
trunk/cdi/tests/org.jboss.tools.cdi.seam.solder.core.test/projects/CDISolderTest/src/org/jboss/generic/MyBean4.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added:
trunk/cdi/tests/org.jboss.tools.cdi.seam.solder.core.test/projects/CDISolderTest/src/org/jboss/generic/MyBeanInjections.java
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.seam.solder.core.test/projects/CDISolderTest/src/org/jboss/generic/MyBeanInjections.java
(rev 0)
+++
trunk/cdi/tests/org.jboss.tools.cdi.seam.solder.core.test/projects/CDISolderTest/src/org/jboss/generic/MyBeanInjections.java 2011-05-27
20:47:50 UTC (rev 31551)
@@ -0,0 +1,122 @@
+package org.jboss.generic;
+
+import javax.enterprise.event.Event;
+import javax.enterprise.inject.Any;
+import javax.enterprise.inject.Default;
+import javax.inject.Inject;
+
+public class MyBeanInjections {
+
+ /**
+ * Injected method producer MyGenericBean.createMyFirstBean()
+ * Configuration produced by MyConfigurationProducer.getOneConfig()
+ */
+ @Inject
+ MyBean first1;
+
+ /**
+ * Injected method producer MyGenericBean.createMyFirstBean()
+ * Configuration produced by MyConfigurationProducer.getSecondConfig()
+ */
+ @Inject
+ @Qualifier1
+ MyBean first2;
+
+ /**
+ * Injected method producer MyGenericBean.createMyFirstBean()
+ * Configuration produced by MyExtendedConfiguration
+ */
+ @Inject
+ @Qualifier2
+ MyBean first3;
+
+ /**
+ * Injected method producer MyGenericBean.createMyFirstBean()
+ * Configuration produced by MyConfigurationProducer.fourthConfig
+ */
+ @Inject
+ @Qualifier4("Fourth")
+ MyBean first4;
+
+ /**
+ * Injected method producer MyGenericBean.createMyFirstBean()
+ * Configuration produced by MyConfigurationProducer.fifthConfig
+ */
+ @Inject
+ @Qualifier4("Fifth")
+ MyBean first5;
+
+ @Inject
+ MyBean2 second1;
+
+ @Inject
+ @Qualifier1
+ MyBean2 second2;
+
+ @Inject
+ @Qualifier2
+ MyBean2 second3;
+
+ /**
+ * Injected field producer MyGenericBean.myThirdBean
+ * Configuration produced by MyConfigurationProducer.getOneConfig()
+ */
+ @Inject
+ MyBean3 third1;
+
+ /**
+ * Injected field producer MyGenericBean.myThirdBean
+ * Configuration produced by MyConfigurationProducer.getSecondConfig()
+ */
+ @Inject
+ @Qualifier1
+ MyBean3 third2;
+
+ /**
+ * Injected field producer MyGenericBean.myThirdBean
+ * Configuration produced by MyExtendedConfiguration
+ */
+ @Inject
+ @Qualifier2
+ MyBean3 third3;
+
+ /**
+ * Injected field producer MyGenericBean.myThirdBean
+ * Configuration produced by MyConfigurationProducer.fourthConfig
+ */
+ @Inject
+ @Qualifier4("Fourth")
+ MyBean3 third4;
+
+ /**
+ * Injected field producer MyGenericBean.myThirdBean
+ * Configuration produced by MyConfigurationProducer.fifthConfig
+ */
+ @Inject
+ @Qualifier4("Fifth")
+ MyBean3 third5;
+
+ @Inject
+ void setAllMyBean4(@Default MyBean4 fourth1,
+ @Qualifier1 MyBean4 fourth2,
+ @Qualifier2 MyBean4 fourth3,
+ @Qualifier4("Fourth") MyBean4 fourth4,
+ @Qualifier4("Fifth") MyBean4 fourth5
+ ) {
+
+ }
+
+ @Inject
+ @Any
+ Event<MyBean> event1;
+
+ @Inject
+ @Qualifier1
+ Event<MyBean> event2;
+
+ @Inject
+ @Qualifier2
+ Event<MyBean> event3;
+
+
+}
Property changes on:
trunk/cdi/tests/org.jboss.tools.cdi.seam.solder.core.test/projects/CDISolderTest/src/org/jboss/generic/MyBeanInjections.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added:
trunk/cdi/tests/org.jboss.tools.cdi.seam.solder.core.test/projects/CDISolderTest/src/org/jboss/generic/MyConfiguration.java
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.seam.solder.core.test/projects/CDISolderTest/src/org/jboss/generic/MyConfiguration.java
(rev 0)
+++
trunk/cdi/tests/org.jboss.tools.cdi.seam.solder.core.test/projects/CDISolderTest/src/org/jboss/generic/MyConfiguration.java 2011-05-27
20:47:50 UTC (rev 31551)
@@ -0,0 +1,8 @@
+package org.jboss.generic;
+
+public class MyConfiguration {
+ public MyConfiguration(String s) {
+ // TODO Auto-generated constructor stub
+ }
+
+}
Property changes on:
trunk/cdi/tests/org.jboss.tools.cdi.seam.solder.core.test/projects/CDISolderTest/src/org/jboss/generic/MyConfiguration.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added:
trunk/cdi/tests/org.jboss.tools.cdi.seam.solder.core.test/projects/CDISolderTest/src/org/jboss/generic/MyConfigurationProducer.java
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.seam.solder.core.test/projects/CDISolderTest/src/org/jboss/generic/MyConfigurationProducer.java
(rev 0)
+++
trunk/cdi/tests/org.jboss.tools.cdi.seam.solder.core.test/projects/CDISolderTest/src/org/jboss/generic/MyConfigurationProducer.java 2011-05-27
20:47:50 UTC (rev 31551)
@@ -0,0 +1,47 @@
+package org.jboss.generic;
+
+import javax.enterprise.context.SessionScoped;
+import javax.enterprise.inject.Default;
+import javax.enterprise.inject.Produces;
+
+public class MyConfigurationProducer {
+
+ /**
+ * Configuration created by field producer.
+ */
+ @Produces
+ @MyGenericType("first")
+ @Default
+ MyConfiguration getOneConfig() {
+ return null;
+ }
+
+ /**
+ * Configuration created by method producer with specified scope.
+ */
+ @Produces
+ @MyGenericType("second")
+ @Qualifier1
+ @SessionScoped
+ MyConfiguration getSecondConfig() {
+ return null;
+ }
+
+ /**
+ * Configuration created by field producer; qualifier has value.
+ */
+ @Produces
+ @MyGenericType("fourth")
+ @Qualifier4("Fourth")
+ MyConfiguration fourthConfig = new MyConfiguration("fourth");
+
+ /**
+ * Configuration created by field producer with specified scope; qualifier has value.
+ */
+ @Produces
+ @MyGenericType("fifth")
+ @Qualifier4("Fifth")
+ @SessionScoped
+ MyConfiguration fifthConfig = new MyConfiguration("fifth");
+
+}
Property changes on:
trunk/cdi/tests/org.jboss.tools.cdi.seam.solder.core.test/projects/CDISolderTest/src/org/jboss/generic/MyConfigurationProducer.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added:
trunk/cdi/tests/org.jboss.tools.cdi.seam.solder.core.test/projects/CDISolderTest/src/org/jboss/generic/MyEvent.java
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.seam.solder.core.test/projects/CDISolderTest/src/org/jboss/generic/MyEvent.java
(rev 0)
+++
trunk/cdi/tests/org.jboss.tools.cdi.seam.solder.core.test/projects/CDISolderTest/src/org/jboss/generic/MyEvent.java 2011-05-27
20:47:50 UTC (rev 31551)
@@ -0,0 +1,5 @@
+package org.jboss.generic;
+
+public class MyEvent {
+
+}
Property changes on:
trunk/cdi/tests/org.jboss.tools.cdi.seam.solder.core.test/projects/CDISolderTest/src/org/jboss/generic/MyEvent.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added:
trunk/cdi/tests/org.jboss.tools.cdi.seam.solder.core.test/projects/CDISolderTest/src/org/jboss/generic/MyExtendedConfiguration.java
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.seam.solder.core.test/projects/CDISolderTest/src/org/jboss/generic/MyExtendedConfiguration.java
(rev 0)
+++
trunk/cdi/tests/org.jboss.tools.cdi.seam.solder.core.test/projects/CDISolderTest/src/org/jboss/generic/MyExtendedConfiguration.java 2011-05-27
20:47:50 UTC (rev 31551)
@@ -0,0 +1,12 @@
+package org.jboss.generic;
+
+/**
+ * Configuration created by bean extending config type.
+ */
+@MyGenericType("third")
+@Qualifier2
+public class MyExtendedConfiguration extends MyConfiguration {
+ public MyExtendedConfiguration() {
+ super("");
+ }
+}
Property changes on:
trunk/cdi/tests/org.jboss.tools.cdi.seam.solder.core.test/projects/CDISolderTest/src/org/jboss/generic/MyExtendedConfiguration.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added:
trunk/cdi/tests/org.jboss.tools.cdi.seam.solder.core.test/projects/CDISolderTest/src/org/jboss/generic/MyGenericBean.java
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.seam.solder.core.test/projects/CDISolderTest/src/org/jboss/generic/MyGenericBean.java
(rev 0)
+++
trunk/cdi/tests/org.jboss.tools.cdi.seam.solder.core.test/projects/CDISolderTest/src/org/jboss/generic/MyGenericBean.java 2011-05-27
20:47:50 UTC (rev 31551)
@@ -0,0 +1,29 @@
+package org.jboss.generic;
+
+import javax.enterprise.inject.Produces;
+import javax.inject.Inject;
+
+import org.jboss.seam.solder.bean.generic.ApplyScope;
+import org.jboss.seam.solder.bean.generic.Generic;
+import org.jboss.seam.solder.bean.generic.GenericConfiguration;
+
+(a)GenericConfiguration(MyGenericType.class)
+public class MyGenericBean {
+ @Inject
+ @Generic
+ MyConfiguration config;
+
+ @Inject
+ MyGenericType type;
+
+ @Produces @ApplyScope
+ MyBean createMyFirstBean() {
+ //use config here
+ return new MyBean("bean1");
+ }
+
+ @Produces @ApplyScope
+ MyBean3 myThirdBean = new MyBean3("bean3");
+
+ //add other producers
+}
Property changes on:
trunk/cdi/tests/org.jboss.tools.cdi.seam.solder.core.test/projects/CDISolderTest/src/org/jboss/generic/MyGenericBean.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added:
trunk/cdi/tests/org.jboss.tools.cdi.seam.solder.core.test/projects/CDISolderTest/src/org/jboss/generic/MyGenericBean2.java
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.seam.solder.core.test/projects/CDISolderTest/src/org/jboss/generic/MyGenericBean2.java
(rev 0)
+++
trunk/cdi/tests/org.jboss.tools.cdi.seam.solder.core.test/projects/CDISolderTest/src/org/jboss/generic/MyGenericBean2.java 2011-05-27
20:47:50 UTC (rev 31551)
@@ -0,0 +1,47 @@
+package org.jboss.generic;
+
+import javax.enterprise.event.Event;
+import javax.enterprise.event.Observes;
+import javax.enterprise.inject.Default;
+import javax.enterprise.inject.Produces;
+import javax.inject.Inject;
+
+import org.jboss.seam.solder.bean.generic.ApplyScope;
+import org.jboss.seam.solder.bean.generic.Generic;
+import org.jboss.seam.solder.bean.generic.GenericConfiguration;
+
+(a)GenericConfiguration(MyGenericType.class)
+public class MyGenericBean2 {
+ @Inject
+ @Generic
+ MyConfiguration config;
+
+ @Inject
+ @Generic
+ MyBean c;
+
+ @Inject
+ void setMyBean(@Generic MyBean c) {}
+
+ @Inject
+ @Generic
+ MyBean3 c3;
+
+ @Inject
+ MyGenericType type;
+
+ @Produces
+ MyBean2 createMySecondBean() {
+ //use config here
+ return new MyBean2("");
+ }
+
+ @Produces @ApplyScope
+ MyBean4 myFourthBean = new MyBean4("bean4");
+
+ void myObserver(@Observes MyBean bean) {
+
+ }
+
+ //add other producers
+}
Property changes on:
trunk/cdi/tests/org.jboss.tools.cdi.seam.solder.core.test/projects/CDISolderTest/src/org/jboss/generic/MyGenericBean2.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added:
trunk/cdi/tests/org.jboss.tools.cdi.seam.solder.core.test/projects/CDISolderTest/src/org/jboss/generic/MyGenericType.java
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.seam.solder.core.test/projects/CDISolderTest/src/org/jboss/generic/MyGenericType.java
(rev 0)
+++
trunk/cdi/tests/org.jboss.tools.cdi.seam.solder.core.test/projects/CDISolderTest/src/org/jboss/generic/MyGenericType.java 2011-05-27
20:47:50 UTC (rev 31551)
@@ -0,0 +1,8 @@
+package org.jboss.generic;
+
+import org.jboss.seam.solder.bean.generic.GenericType;
+
+(a)GenericType(MyConfiguration.class)
+public @interface MyGenericType {
+ String value();
+}
Property changes on:
trunk/cdi/tests/org.jboss.tools.cdi.seam.solder.core.test/projects/CDISolderTest/src/org/jboss/generic/MyGenericType.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added:
trunk/cdi/tests/org.jboss.tools.cdi.seam.solder.core.test/projects/CDISolderTest/src/org/jboss/generic/Qualifier1.java
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.seam.solder.core.test/projects/CDISolderTest/src/org/jboss/generic/Qualifier1.java
(rev 0)
+++
trunk/cdi/tests/org.jboss.tools.cdi.seam.solder.core.test/projects/CDISolderTest/src/org/jboss/generic/Qualifier1.java 2011-05-27
20:47:50 UTC (rev 31551)
@@ -0,0 +1,21 @@
+package org.jboss.generic;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import javax.inject.Qualifier;
+
+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;
+
+@Qualifier
+@Target({ TYPE, METHOD, PARAMETER, FIELD })
+@Retention(RUNTIME)
+@Documented
+public @interface Qualifier1 {
+
+}
Property changes on:
trunk/cdi/tests/org.jboss.tools.cdi.seam.solder.core.test/projects/CDISolderTest/src/org/jboss/generic/Qualifier1.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added:
trunk/cdi/tests/org.jboss.tools.cdi.seam.solder.core.test/projects/CDISolderTest/src/org/jboss/generic/Qualifier2.java
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.seam.solder.core.test/projects/CDISolderTest/src/org/jboss/generic/Qualifier2.java
(rev 0)
+++
trunk/cdi/tests/org.jboss.tools.cdi.seam.solder.core.test/projects/CDISolderTest/src/org/jboss/generic/Qualifier2.java 2011-05-27
20:47:50 UTC (rev 31551)
@@ -0,0 +1,21 @@
+package org.jboss.generic;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import javax.inject.Qualifier;
+
+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;
+
+@Qualifier
+@Target({ TYPE, METHOD, PARAMETER, FIELD })
+@Retention(RUNTIME)
+@Documented
+public @interface Qualifier2 {
+
+}
Property changes on:
trunk/cdi/tests/org.jboss.tools.cdi.seam.solder.core.test/projects/CDISolderTest/src/org/jboss/generic/Qualifier2.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added:
trunk/cdi/tests/org.jboss.tools.cdi.seam.solder.core.test/projects/CDISolderTest/src/org/jboss/generic/Qualifier3.java
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.seam.solder.core.test/projects/CDISolderTest/src/org/jboss/generic/Qualifier3.java
(rev 0)
+++
trunk/cdi/tests/org.jboss.tools.cdi.seam.solder.core.test/projects/CDISolderTest/src/org/jboss/generic/Qualifier3.java 2011-05-27
20:47:50 UTC (rev 31551)
@@ -0,0 +1,21 @@
+package org.jboss.generic;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import javax.inject.Qualifier;
+
+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;
+
+@Qualifier
+@Target({ TYPE, METHOD, PARAMETER, FIELD })
+@Retention(RUNTIME)
+@Documented
+public @interface Qualifier3 {
+
+}
Property changes on:
trunk/cdi/tests/org.jboss.tools.cdi.seam.solder.core.test/projects/CDISolderTest/src/org/jboss/generic/Qualifier3.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added:
trunk/cdi/tests/org.jboss.tools.cdi.seam.solder.core.test/projects/CDISolderTest/src/org/jboss/generic/Qualifier4.java
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.seam.solder.core.test/projects/CDISolderTest/src/org/jboss/generic/Qualifier4.java
(rev 0)
+++
trunk/cdi/tests/org.jboss.tools.cdi.seam.solder.core.test/projects/CDISolderTest/src/org/jboss/generic/Qualifier4.java 2011-05-27
20:47:50 UTC (rev 31551)
@@ -0,0 +1,21 @@
+package org.jboss.generic;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import javax.inject.Qualifier;
+
+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;
+
+@Qualifier
+@Target({ TYPE, METHOD, PARAMETER, FIELD })
+@Retention(RUNTIME)
+@Documented
+public @interface Qualifier4 {
+ String value();
+}
Property changes on:
trunk/cdi/tests/org.jboss.tools.cdi.seam.solder.core.test/projects/CDISolderTest/src/org/jboss/generic/Qualifier4.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified:
trunk/cdi/tests/org.jboss.tools.cdi.seam.solder.core.test/src/org/jboss/tools/cdi/seam/solder/core/test/CDISeamSolderCoreAllTests.java
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.seam.solder.core.test/src/org/jboss/tools/cdi/seam/solder/core/test/CDISeamSolderCoreAllTests.java 2011-05-27
18:04:38 UTC (rev 31550)
+++
trunk/cdi/tests/org.jboss.tools.cdi.seam.solder.core.test/src/org/jboss/tools/cdi/seam/solder/core/test/CDISeamSolderCoreAllTests.java 2011-05-27
20:47:50 UTC (rev 31551)
@@ -25,6 +25,7 @@
TestSuite suiteAll = new TestSuite("CDI Solder Core Tests");
+ suiteAll.addTestSuite(GenericBeanTest.class);
suiteAll.addTestSuite(BeanNamingTest.class);
suiteAll.addTestSuite(VetoTest.class);
suiteAll.addTestSuite(ExactTest.class);
Added:
trunk/cdi/tests/org.jboss.tools.cdi.seam.solder.core.test/src/org/jboss/tools/cdi/seam/solder/core/test/GenericBeanTest.java
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.seam.solder.core.test/src/org/jboss/tools/cdi/seam/solder/core/test/GenericBeanTest.java
(rev 0)
+++
trunk/cdi/tests/org.jboss.tools.cdi.seam.solder.core.test/src/org/jboss/tools/cdi/seam/solder/core/test/GenericBeanTest.java 2011-05-27
20:47:50 UTC (rev 31551)
@@ -0,0 +1,112 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.cdi.seam.solder.core.test;
+
+import java.io.IOException;
+import java.util.Set;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jdt.core.IType;
+import org.jboss.tools.cdi.core.CDICorePlugin;
+import org.jboss.tools.cdi.core.IBean;
+import org.jboss.tools.cdi.core.ICDIProject;
+import org.jboss.tools.cdi.core.IClassBean;
+import org.jboss.tools.cdi.core.IInjectionPointField;
+import org.jboss.tools.cdi.core.IProducerMethod;
+import org.jboss.tools.cdi.seam.solder.core.generic.GenericBeanProducerMethod;
+import org.jboss.tools.cdi.seam.solder.core.generic.GenericClassBean;
+
+/**
+ *
+ * @author Viacheslav Kabanovich
+ *
+ */
+public class GenericBeanTest extends SeamSolderTest {
+
+ public GenericBeanTest() {}
+
+ public void testGenericBeanEndPointInjections() throws CoreException {
+ ICDIProject cdi = CDICorePlugin.getCDIProject(project, true);
+
+ /*
+ * Case 1. (default qualifier case)
+ * Injection point: in class MyBeanInjections
+ * @Inject MyBean first1
+ * Generic bean producer method: MyGenericBean.createMyFirstBean()
+ * Configuration producer method: MyConfigurationProducer.getOneConfig()
+ */
+ IInjectionPointField injection = getInjectionPointField(cdi,
"src/org/jboss/generic/MyBeanInjections.java", "first1");
+
+ Set<IBean> bs = cdi.getBeans(false, injection);
+ assertEquals(1, bs.size());
+ IBean b = bs.iterator().next();
+ assertTrue(b instanceof IProducerMethod);
+ IProducerMethod m = (IProducerMethod)b;
+ assertEquals("createMyFirstBean", m.getMethod().getElementName());
+ assertTrue(b instanceof GenericBeanProducerMethod);
+ GenericBeanProducerMethod gm = (GenericBeanProducerMethod)b;
+ GenericClassBean cb = (GenericClassBean)gm.getClassBean();
+ IBean gb = cb.getGenericProducerBean();
+ assertTrue(gb instanceof IProducerMethod);
+ IProducerMethod gbm = (IProducerMethod)gb;
+ assertEquals("getOneConfig", gbm.getMethod().getElementName());
+
+ /*
+ * Case 2. (non-default qualifier case)
+ * Injection point: in class MyBeanInjections
+ * @Inject @Qualifier1 MyBean first2
+ * Generic bean producer method: MyGenericBean.createMyFirstBean()
+ * Configuration producer method: MyConfigurationProducer.getSecondConfig()
+ */
+ injection = getInjectionPointField(cdi,
"src/org/jboss/generic/MyBeanInjections.java", "first2");
+
+ bs = cdi.getBeans(false, injection);
+ assertEquals(1, bs.size());
+ b = bs.iterator().next();
+ assertTrue(b instanceof IProducerMethod);
+ m = (IProducerMethod)b;
+ assertEquals("createMyFirstBean", m.getMethod().getElementName());
+ assertTrue(b instanceof GenericBeanProducerMethod);
+ gm = (GenericBeanProducerMethod)b;
+ cb = (GenericClassBean)gm.getClassBean();
+ gb = cb.getGenericProducerBean();
+ assertTrue(gb instanceof IProducerMethod);
+ gbm = (IProducerMethod)gb;
+ assertEquals("getSecondConfig", gbm.getMethod().getElementName());
+
+ /*
+ * Case 3. (case of configuration provided by extending config class)
+ * Injection point: in class MyBeanInjections
+ * @Inject @Qualifier2 MyBean first3
+ * Generic bean producer method: MyGenericBean.createMyFirstBean()
+ * Configuration bean: by MyExtendedConfiguration
+ */
+ injection = getInjectionPointField(cdi,
"src/org/jboss/generic/MyBeanInjections.java", "first3");
+
+ bs = cdi.getBeans(false, injection);
+ assertEquals(1, bs.size());
+ b = bs.iterator().next();
+ assertTrue(b instanceof IProducerMethod);
+ m = (IProducerMethod)b;
+ assertEquals("createMyFirstBean", m.getMethod().getElementName());
+ assertTrue(b instanceof GenericBeanProducerMethod);
+ gm = (GenericBeanProducerMethod)b;
+ cb = (GenericClassBean)gm.getClassBean();
+ gb = cb.getGenericProducerBean();
+ assertTrue(gb instanceof IClassBean);
+ IClassBean gbc = (IClassBean)gb;
+ assertEquals("MyExtendedConfiguration",
gbc.getBeanClass().getElementName());
+
+ }
+
+ //TODO - more tests
+
+}
Property changes on:
trunk/cdi/tests/org.jboss.tools.cdi.seam.solder.core.test/src/org/jboss/tools/cdi/seam/solder/core/test/GenericBeanTest.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain