[jbosstools-commits] JBoss Tools SVN: r43448 - trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/project.
jbosstools-commits at lists.jboss.org
jbosstools-commits at lists.jboss.org
Wed Sep 5 20:36:23 EDT 2012
Author: scabanovich
Date: 2012-09-05 20:36:23 -0400 (Wed, 05 Sep 2012)
New Revision: 43448
Modified:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/project/CDIProjectAsYouTypeTest.java
Log:
JBIDE-12546
https://issues.jboss.org/browse/JBIDE-12546
Implement in CDIProjectAsYouType ICDIElement, and set it as the parent to class bean of the modified resource.
Test is modified.
Modified: trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/project/CDIProjectAsYouTypeTest.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/project/CDIProjectAsYouTypeTest.java 2012-09-06 00:34:57 UTC (rev 43447)
+++ trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/project/CDIProjectAsYouTypeTest.java 2012-09-06 00:36:23 UTC (rev 43448)
@@ -45,7 +45,7 @@
try {
CDIProjectAsYouType ayt = new CDIProjectAsYouType(cdiProject, f);
- Collection<IBean> bs = getInjectedBeans(ayt);
+ Collection<IBean> bs = getInjectedBeans(ayt, false);
assertEquals(2, bs.size());
ISourceViewer s = getTextViewer(editorPart);
@@ -53,24 +53,36 @@
modifyDocument(s.getDocument(), "create()", "_create()");
ayt = new CDIProjectAsYouType(cdiProject, f);
- bs = getInjectedBeans(ayt);
+ //1. 'ayt' will be used both to find the injection point and to request beans.
+ bs = getInjectedBeans(ayt, false);
assertEquals(1, bs.size());
+ //2. 'ayt' will be used to find the injection point, but beans will be requested
+ //from CDI project referenced by that injection point.
+ //Current implementation (JBIDE-12546) sets to class bean 'ayt' as parent,
+ //so that now this check does not seem necessary, but implementation may be changed in future.
+ bs = getInjectedBeans(ayt, true);
+ assertEquals(1, bs.size());
modifyDocument(s.getDocument(), "_create()", "create()");
ayt = new CDIProjectAsYouType(cdiProject, f);
- bs = getInjectedBeans(ayt);
+ bs = getInjectedBeans(ayt, false);
assertEquals(2, bs.size());
+ bs = getInjectedBeans(ayt, true);
+ assertEquals(2, bs.size());
} finally {
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().closeEditor(editorPart, false);
}
}
- private Collection<IBean> getInjectedBeans(CDIProjectAsYouType ayt) {
+ private Collection<IBean> getInjectedBeans(CDIProjectAsYouType ayt, boolean testProjectOfInjectedPoint) {
Collection<IBean> bs = ayt.getBeans(true, "org.jboss.jsr299.tck.tests.jbt.lookup.duplicateName.TwoNamedProducers");
IBean b = bs.iterator().next();
Collection<IInjectionPoint> ps = b.getInjectionPoints();
IInjectionPoint p = ps.iterator().next();
+ if(testProjectOfInjectedPoint) {
+ return p.getCDIProject().getBeans(true, p);
+ }
return ayt.getBeans(true, p);
}
More information about the jbosstools-commits
mailing list