Author: scabanovich
Date: 2011-05-27 18:01:24 -0400 (Fri, 27 May 2011)
New Revision: 31554
Modified:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/event/fires/DogWhisperer.java
trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/ObserverMethodResolutionTest.java
Log:
JBIDE-9020
https://issues.jboss.org/browse/JBIDE-9020
Modified:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/event/fires/DogWhisperer.java
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/event/fires/DogWhisperer.java 2011-05-27
22:00:57 UTC (rev 31553)
+++
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/event/fires/DogWhisperer.java 2011-05-27
22:01:24 UTC (rev 31554)
@@ -43,4 +43,6 @@
{
praiseEvent.fire(new Praise());
}
+
+ @Inject void foo(Object o) {}
}
Modified:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/ObserverMethodResolutionTest.java
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/ObserverMethodResolutionTest.java 2011-05-27
22:00:57 UTC (rev 31553)
+++
trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/ObserverMethodResolutionTest.java 2011-05-27
22:01:24 UTC (rev 31554)
@@ -12,10 +12,13 @@
import java.util.Set;
+import org.eclipse.core.resources.IFile;
import org.eclipse.jdt.core.IMethod;
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.IInjectionPointField;
+import org.jboss.tools.cdi.core.IInjectionPointMethod;
import org.jboss.tools.cdi.core.IInjectionPointParameter;
import org.jboss.tools.cdi.core.IObserverMethod;
import org.jboss.tools.cdi.core.IParameter;
@@ -112,7 +115,31 @@
assertTrue(points.contains(friendlyEvent));
}
+ public void testResolveObserverMethod() {
+ IFile file =
tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/event/fires/DogWhisperer.java");
+ Set<IBean> beans = cdiProject.getBeans(file.getFullPath());
+ IClassBean cb = null;
+ for (IBean b: beans) {
+ if(b instanceof IClassBean) {
+ cb = (IClassBean)b;
+ }
+ }
+ assertNotNull(cb);
+ Set<IInjectionPoint> ps = cb.getInjectionPoints();
+ IInjectionPointMethod mp = null;
+ for (IInjectionPoint p: ps) {
+ if(p instanceof IInjectionPointMethod) {
+ mp = (IInjectionPointMethod)p;
+ }
+ }
+ assertNotNull(mp);
+ assertEquals("foo", mp.getMethod().getElementName());
+ //no exception should happen on invoking resolveObserverMethods
+ cdiProject.resolveObserverMethods(mp);
+
+ }
+
public void testEventBean() {
IInjectionPointField tamingEvent =
getInjectionPointField("JavaSource/org/jboss/jsr299/tck/tests/event/fires/DogWhisperer.java",
"tamingEvent");
assertNotNull(tamingEvent);