[jbosstools-commits] JBoss Tools SVN: r35912 - in trunk/cdi/tests/org.jboss.tools.cdi.core.test: src/org/jboss/tools/cdi/core/test/tck and 1 other directory.

jbosstools-commits at lists.jboss.org jbosstools-commits at lists.jboss.org
Fri Oct 21 15:49:36 EDT 2011


Author: scabanovich
Date: 2011-10-21 15:49:36 -0400 (Fri, 21 Oct 2011)
New Revision: 35912

Modified:
   trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/core/TestInjection2.java
   trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/CDIUtilTest.java
Log:
JBIDE-9989
https://issues.jboss.org/browse/JBIDE-9989
Test CDIUtilTest is improved.

Modified: trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/core/TestInjection2.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/core/TestInjection2.java	2011-10-21 19:33:17 UTC (rev 35911)
+++ trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/core/TestInjection2.java	2011-10-21 19:49:36 UTC (rev 35912)
@@ -33,9 +33,18 @@
 	@Inject
 	public void initialize(FooBean children, TestBean children2) {
 	}
+	
+	@Inject TestBean children;
+	@Inject FooBean children2;
 
-	static class TestBean {}
+	static class TestBean {
+		@Inject TestBean children;
+		@Inject FooBean children2;
+	}
 
-	static class FooBean {}
+	static class FooBean {
+		@Inject TestBean children2;
+		@Inject FooBean children;
+	}
 
 }

Modified: 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	2011-10-21 19:33:17 UTC (rev 35911)
+++ trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/CDIUtilTest.java	2011-10-21 19:49:36 UTC (rev 35912)
@@ -10,17 +10,20 @@
  ******************************************************************************/
 package org.jboss.tools.cdi.core.test.tck;
 
+import java.util.HashSet;
 import java.util.Set;
 
 import org.eclipse.core.runtime.Path;
 import org.eclipse.jdt.core.IJavaElement;
 import org.eclipse.jdt.core.ILocalVariable;
+import org.eclipse.jdt.core.IMember;
 import org.eclipse.jdt.core.IMethod;
 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;
+import org.jboss.tools.cdi.internal.core.impl.Parameter;
 import org.jboss.tools.common.java.IAnnotationDeclaration;
 
 /**
@@ -82,4 +85,23 @@
 		//Double length of all injected parameter ranges.  
 		assertEquals("Unexpected double length of all injected parameter ranges.", 358, testcount);
 	}
+
+	public void testFindInjectionPoint2() throws Exception {
+		String path = "JavaSource/org/jboss/jsr299/tck/tests/jbt/core/TestInjection2.java";
+		Set<IBean> bs = cdiProject.getBeans(new Path("/tck/" + path));
+		Set<IInjectionPoint> ps = new HashSet<IInjectionPoint>();
+		for (IBean b: bs) {
+			ps.addAll(b.getInjectionPoints());
+		}
+		IInjectionPoint[] array = ps.toArray(new IInjectionPoint[ps.size()]);
+		for (int i = 0; i < array.length; i++) {
+			IJavaElement element = array[i] instanceof Parameter 
+					? ((Parameter)array[i]).getDefinition().getVariable()
+					: array[i].getSourceMember();
+			for (int j = 0; j < array.length; j++) {
+				assertEquals(i == j, array[j].isDeclaredFor(element));
+			}
+		}		
+	}
+
 }
\ No newline at end of file



More information about the jbosstools-commits mailing list