Author: scabanovich
Date: 2011-04-29 20:40:32 -0400 (Fri, 29 Apr 2011)
New Revision: 30989
Added:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/lookup/injection/NamedParameters.java
Modified:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/InjectionPointTest.java
trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/TCKTest.java
Log:
JBIDE-8825
https://issues.jboss.org/browse/JBIDE-8825
Added:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/lookup/injection/NamedParameters.java
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/lookup/injection/NamedParameters.java
(rev 0)
+++
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/lookup/injection/NamedParameters.java 2011-04-30
00:40:32 UTC (rev 30989)
@@ -0,0 +1,19 @@
+package org.jboss.jsr299.tck.tests.lookup.injection;
+
+import javax.enterprise.inject.Produces;
+import javax.inject.Inject;
+import javax.inject.Named;
+
+public class NamedParameters {
+ @Produces
+ @Named("uniqueName16728")
+ String abc;
+
+ @Inject
+ void setA(@Named("anotherName63916") String s) {
+ }
+
+ @Inject
+ void setABC(@Named("uniqueName16728") String s) {
+ }
+}
Property changes on:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/lookup/injection/NamedParameters.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/InjectionPointTest.java
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/InjectionPointTest.java 2011-04-30
00:39:38 UTC (rev 30988)
+++
trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/InjectionPointTest.java 2011-04-30
00:40:32 UTC (rev 30989)
@@ -15,6 +15,7 @@
import org.eclipse.jdt.core.ITypeParameter;
import org.jboss.tools.cdi.core.CDIUtil;
+import org.jboss.tools.cdi.core.IBean;
import org.jboss.tools.cdi.core.IClassBean;
import org.jboss.tools.cdi.core.IInjectionPoint;
import org.jboss.tools.cdi.core.IInjectionPointParameter;
@@ -75,4 +76,17 @@
assertTrue(!ps.isEmpty());
}
+ public void testParameterInjectionsWithQualifierWithMemberValues() {
+ IInjectionPointParameter injectionPoint =
getInjectionPointParameter("JavaSource/org/jboss/jsr299/tck/tests/lookup/injection/NamedParameters.java",
"setA");
+ assertNotNull(injectionPoint);
+ Set<IBean> resolved = cdiProject.getBeans(false, injectionPoint);
+ assertTrue(resolved.isEmpty());
+
+ injectionPoint =
getInjectionPointParameter("JavaSource/org/jboss/jsr299/tck/tests/lookup/injection/NamedParameters.java",
"setABC");
+ assertNotNull(injectionPoint);
+ resolved = cdiProject.getBeans(false, injectionPoint);
+ assertFalse(resolved.isEmpty());
+
+ }
+
}
\ No newline at end of file
Modified:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/TCKTest.java
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/TCKTest.java 2011-04-30
00:39:38 UTC (rev 30988)
+++
trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/TCKTest.java 2011-04-30
00:40:32 UTC (rev 30989)
@@ -17,19 +17,17 @@
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Platform;
import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jdt.core.IMember;
-import org.eclipse.jdt.core.IMemberValuePair;
import org.eclipse.jdt.core.IType;
import org.eclipse.jdt.core.JavaModelException;
import org.jboss.tools.cdi.core.CDICorePlugin;
import org.jboss.tools.cdi.core.IAnnotationDeclaration;
import org.jboss.tools.cdi.core.IBean;
-import org.jboss.tools.cdi.core.ICDIAnnotation;
import org.jboss.tools.cdi.core.ICDIProject;
import org.jboss.tools.cdi.core.IClassBean;
import org.jboss.tools.cdi.core.IDecorator;
import org.jboss.tools.cdi.core.IInjectionPoint;
import org.jboss.tools.cdi.core.IInjectionPointField;
+import org.jboss.tools.cdi.core.IInjectionPointParameter;
import org.jboss.tools.cdi.core.IParametedType;
import org.jboss.tools.cdi.core.IProducer;
import org.jboss.tools.cdi.core.IQualifier;
@@ -316,6 +314,28 @@
return null;
}
+ protected IInjectionPointParameter getInjectionPointParameter(String beanClassFilePath,
String methodName) {
+ IFile file = tckProject.getFile(beanClassFilePath);
+ Set<IBean> beans = cdiProject.getBeans(file.getFullPath());
+ Iterator<IBean> it = beans.iterator();
+ while(it.hasNext()) {
+ IBean b = it.next();
+ if(b instanceof IProducer) it.remove();
+ }
+ assertEquals("Wrong number of the beans", 1, beans.size());
+ Set<IInjectionPoint> injections = beans.iterator().next().getInjectionPoints();
+ for (IInjectionPoint injectionPoint : injections) {
+ if(injectionPoint instanceof IInjectionPointParameter) {
+ IInjectionPointParameter param = (IInjectionPointParameter)injectionPoint;
+ if(methodName.equals(param.getBeanMethod().getMethod().getElementName())) {
+ return param;
+ }
+ }
+ }
+ fail("Can't find injection point parameter in method \"" +
methodName + "\" in " + beanClassFilePath);
+ return null;
+ }
+
public static void assertContainsBeanClasses(Set<IBean> beans, String...
beanClassNames) throws CoreException {
assertContainsBeanClasses(true, beans, beanClassNames);
}