Author: scabanovich
Date: 2011-07-12 14:16:23 -0400 (Tue, 12 Jul 2011)
New Revision: 32866
Modified:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/DecoratorDefinitionTest.java
trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/InterceptorDefinitionTest.java
trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/validation/DefenitionErrorsValidationTest.java
Log:
JBIDE-9313
https://issues.jboss.org/browse/JBIDE-9313
Modified:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/DecoratorDefinitionTest.java
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/DecoratorDefinitionTest.java 2011-07-12
18:05:15 UTC (rev 32865)
+++
trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/DecoratorDefinitionTest.java 2011-07-12
18:16:23 UTC (rev 32866)
@@ -17,8 +17,10 @@
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.jdt.core.JavaModelException;
+import org.jboss.tools.cdi.core.IBean;
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.internal.core.impl.CDIProject;
import org.jboss.tools.cdi.internal.core.impl.ClassBean;
import org.jboss.tools.common.java.IParametedType;
@@ -86,6 +88,21 @@
}
}
+ public void testDecoratorIsNotInjected() throws CoreException {
+ IInjectionPointField f =
getInjectionPointField("JavaSource/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/decorator/House.java",
"decorator");
+ /*
+ * Invocation getBeans(false, f) returns all beans that match type and qualifiers.
+ */
+ Set<IBean> bs = cdiProject.getBeans(false, f);
+ assertEquals(1, bs.size());
+ assertTrue(bs.iterator().next() instanceof IDecorator);
+ /*
+ * Invocation getBeans(true, f) filters away all beans that are not available for
injection.
+ */
+ bs = cdiProject.getBeans(true, f);
+ assertTrue(bs.isEmpty());
+ }
+
public void testCustomDecorator() throws CoreException {
getDecorator("JavaSource/org/jboss/jsr299/tck/tests/decorators/custom/VehicleDecorator.java");
}
Modified:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/InterceptorDefinitionTest.java
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/InterceptorDefinitionTest.java 2011-07-12
18:05:15 UTC (rev 32865)
+++
trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/InterceptorDefinitionTest.java 2011-07-12
18:16:23 UTC (rev 32866)
@@ -21,6 +21,8 @@
import org.eclipse.jdt.core.JavaModelException;
import org.jboss.tools.cdi.core.IBean;
import org.jboss.tools.cdi.core.IClassBean;
+import org.jboss.tools.cdi.core.IDecorator;
+import org.jboss.tools.cdi.core.IInjectionPointField;
import org.jboss.tools.cdi.core.IInterceptor;
import org.jboss.tools.cdi.core.IInterceptorBinding;
import org.jboss.tools.cdi.core.IInterceptorBindingDeclaration;
@@ -102,6 +104,20 @@
}
+ public void testInterceptorIsNotInjected() throws CoreException {
+ IInjectionPointField f =
getInjectionPointField("JavaSource/org/jboss/jsr299/tck/tests/jbt/validation/interceptors/InjectInterceptorBroken.java",
"cat");
+ /*
+ * Invocation getBeans(false, f) returns all beans that match type and qualifiers.
+ */
+ Set<IBean> bs = cdiProject.getBeans(false, f);
+ assertEquals(1, bs.size());
+ assertTrue(bs.iterator().next() instanceof IInterceptor);
+ /*
+ * Invocation getBeans(true, f) filters away all beans that are not available for
injection.
+ */
+ bs = cdiProject.getBeans(true, f);
+ assertTrue(bs.isEmpty());
+ }
void assertContainsBindings(Set<IInterceptorBinding> bs, String... classNames) {
Set<String> bsn = new HashSet<String>();
Modified:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/validation/DefenitionErrorsValidationTest.java
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/validation/DefenitionErrorsValidationTest.java 2011-07-12
18:05:15 UTC (rev 32865)
+++
trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/validation/DefenitionErrorsValidationTest.java 2011-07-12
18:16:23 UTC (rev 32866)
@@ -979,29 +979,20 @@
* 5.1.4. Inter-module injection
* - a decorator can not be injected
*
- * @throws Exception
- */
public void testDecoratorNotResolved() throws Exception {
- /* Now we exclude decorators from resolved beans.
- * Another test is required - that getBeans(false) - returns decorator, and
getBeans(true) does not.
- */
-// IFile file =
tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/decorator/House.java");
-// AbstractResourceMarkerTest.assertMarkerIsCreated(file,
CDIValidationMessages.INJECTED_DECORATOR, 23);
+ Now we exclude decorators from resolved beans.
+ This test is replaced with DecoratorDefinitionTest.testDecoratorIsNotInjected()
}
+ */
/**
* 5.1.4. Inter-module injection
* - an interceptor can not be injected
- *
- * @throws Exception
- */
public void testInterceptorNotResolved() throws Exception {
-/* Now we exclude interceptors from resolved beans.
- * Another test is required - that getBeans(false) - returns interceptor, and
getBeans(true) does not.
- */
-// IFile file =
tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/jbt/validation/interceptors/InjectInterceptorBroken.java");
-// AbstractResourceMarkerTest.assertMarkerIsCreated(file,
CDIValidationMessages.INJECTED_INTERCEPTOR, 7);
+ Now we exclude interceptors from resolved beans.
+ This test is replaced with InterceptorDefinitionTest.testInterceptorIsNotInjected()
}
+ */
/**
* 5.2.2. Legal injection point types