Author: akazakov
Date: 2011-09-12 15:49:42 -0400 (Mon, 12 Sep 2011)
New Revision: 34643
Added:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/core/
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/core/TestInjection.java
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/core/TestQualifier.java
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/core/TestQualifier1.java
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/core/TestQualifier2.java
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/core/TestQualifier3.java
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/core/TestStereotype.java
trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/CDIUtilTest.java
Log:
https://issues.jboss.org/browse/JBIDE-9685 Seam JMS: CDI validator should be aware of JMS
resource injections
Added:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/core/TestInjection.java
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/core/TestInjection.java
(rev 0)
+++
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/core/TestInjection.java 2011-09-12
19:49:42 UTC (rev 34643)
@@ -0,0 +1,21 @@
+package org.jboss.jsr299.tck.tests.jbt.test.core;
+
+import javax.inject.Inject;
+
+public class TestInjection {
+
+ @Inject @TestQualifier Object i1; // has @TestQualifier
+ @Inject @TestQualifier1 Object i2; // has @TestQualifier and @TestQualifier1
+ @Inject @TestQualifier2 Object i3; // has @TestQualifier, @TestQualifier1 and
@TestQualifier2
+ @Inject @TestQualifier3 Object i4; // @TestQualifier3
+
+ @Inject @TestQualifier3 @TestQualifier2 Object i5; // has @TestQualifier,
@TestQualifier1, @TestQualifier2 and @TestQualifier3
+ @Inject @TestQualifier2 @TestQualifier3 Object i6; // has @TestQualifier,
@TestQualifier1, @TestQualifier2 and @TestQualifier3
+ @Inject @TestQualifier Object i7;
+
+ @Inject @TestStereotype Object i8; // has @TestQualifier, @TestQualifier1,
@TestQualifier2 and @TestQualifier3
+
+ @Inject
+ public void foo(@TestQualifier2 @TestQualifier3 Object i8) { // has @TestQualifier,
@TestQualifier1, @TestQualifier2 and @TestQualifier3
+ }
+}
\ No newline at end of file
Property changes on:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/core/TestInjection.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/core/TestQualifier.java
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/core/TestQualifier.java
(rev 0)
+++
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/core/TestQualifier.java 2011-09-12
19:49:42 UTC (rev 34643)
@@ -0,0 +1,21 @@
+package org.jboss.jsr299.tck.tests.jbt.test.core;
+
+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 TestQualifier {
+
+}
\ No newline at end of file
Property changes on:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/core/TestQualifier.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/core/TestQualifier1.java
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/core/TestQualifier1.java
(rev 0)
+++
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/core/TestQualifier1.java 2011-09-12
19:49:42 UTC (rev 34643)
@@ -0,0 +1,22 @@
+package org.jboss.jsr299.tck.tests.jbt.test.core;
+
+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
+@TestQualifier
+public @interface TestQualifier1 {
+
+}
Property changes on:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/core/TestQualifier1.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/core/TestQualifier2.java
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/core/TestQualifier2.java
(rev 0)
+++
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/core/TestQualifier2.java 2011-09-12
19:49:42 UTC (rev 34643)
@@ -0,0 +1,22 @@
+package org.jboss.jsr299.tck.tests.jbt.test.core;
+
+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
+@TestQualifier1
+public @interface TestQualifier2 {
+
+}
\ No newline at end of file
Property changes on:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/core/TestQualifier2.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/core/TestQualifier3.java
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/core/TestQualifier3.java
(rev 0)
+++
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/core/TestQualifier3.java 2011-09-12
19:49:42 UTC (rev 34643)
@@ -0,0 +1,21 @@
+package org.jboss.jsr299.tck.tests.jbt.test.core;
+
+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 TestQualifier3 {
+
+}
\ No newline at end of file
Property changes on:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/core/TestQualifier3.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/core/TestStereotype.java
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/core/TestStereotype.java
(rev 0)
+++
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/core/TestStereotype.java 2011-09-12
19:49:42 UTC (rev 34643)
@@ -0,0 +1,22 @@
+package org.jboss.jsr299.tck.tests.jbt.test.core;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import javax.enterprise.inject.Stereotype;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+@Stereotype
+@Target({ TYPE, METHOD, FIELD })
+@Retention(RUNTIME)
+@Documented
+@TestQualifier3
+@TestQualifier2
+public @interface TestStereotype {
+
+}
\ No newline at end of file
Property changes on:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/core/TestStereotype.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/CDIUtilTest.java
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/CDIUtilTest.java
(rev 0)
+++
trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/CDIUtilTest.java 2011-09-12
19:49:42 UTC (rev 34643)
@@ -0,0 +1,52 @@
+/*******************************************************************************
+ * 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.core.test.tck;
+
+import java.util.Set;
+
+import org.jboss.tools.cdi.core.CDIUtil;
+import org.jboss.tools.cdi.core.IClassBean;
+import org.jboss.tools.cdi.core.IInjectionPoint;
+import org.jboss.tools.cdi.core.IInjectionPointMethod;
+import org.jboss.tools.common.java.IAnnotationDeclaration;
+
+/**
+ * @author Alexey Kazakov
+ */
+public class CDIUtilTest extends TCKTest {
+
+ /**
+ * See
https://issues.jboss.org/browse/JBIDE-9685 Seam JMS: CDI validator should be
aware of JMS resource injections
+ */
+ public void testMethodParameter() {
+ IClassBean bean =
getClassBean("JavaSource/org/jboss/jsr299/tck/tests/jbt/core/TestInjection.java");
+ assertNotNull("Can't find the bean.", bean);
+ Set<IInjectionPoint> injections = bean.getInjectionPoints();
+ for (IInjectionPoint injectionPoint : injections) {
+ if(injectionPoint instanceof IInjectionPointMethod) { // TODO Remove this check when
https://issues.jboss.org/browse/JBIDE-9698 (Replace interface IInjectionPointMethod by
IInitializerMethod) is fixed
+ continue;
+ }
+ IAnnotationDeclaration declaration = CDIUtil.getAnnotationDeclaration(injectionPoint,
"org.jboss.jsr299.tck.tests.jbt.test.core.TestQualifier");
+ String elementName = injectionPoint.getSourceMember().getElementName();
+ if(elementName.equals("i4")) {
+ assertNull(declaration);
+ } else {
+ assertNotNull(declaration);
+ }
+ declaration = CDIUtil.getAnnotationDeclaration(injectionPoint,
"org.jboss.jsr299.tck.tests.jbt.test.core.TestQualifier3");
+ if(elementName.equals("i1") || elementName.equals("i2") ||
elementName.equals("i3")) {
+ assertNull(declaration);
+ } else {
+ assertNotNull(declaration);
+ }
+ }
+ }
+}
\ No newline at end of file
Property changes on:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/CDIUtilTest.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain