Author: scabanovich
Date: 2012-08-03 21:23:40 -0400 (Fri, 03 Aug 2012)
New Revision: 42854
Modified:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/validation/DeploymentProblemsValidationTests.java
Log:
JBIDE-12199
https://issues.jboss.org/browse/JBIDE-12199
Verifying legal types of a normal scoped bean. Tests are added.
Modified:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/validation/DeploymentProblemsValidationTests.java
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/validation/DeploymentProblemsValidationTests.java 2012-08-03
19:36:35 UTC (rev 42853)
+++
trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/validation/DeploymentProblemsValidationTests.java 2012-08-04
01:23:40 UTC (rev 42854)
@@ -172,6 +172,12 @@
AbstractResourceMarkerTest.assertMarkerIsNotCreated(file,
MessageFormat.format(CDIValidationMessages.UNPROXYABLE_BEAN_ARRAY_TYPE,
"TestType[]", "ArrayProducer.produce2()"), 8);
}
+ public void testNormalBeanWithArrayType() throws Exception {
+ IFile file =
tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/jbt/validation/unproxyable/ArrayProducer.java");
+ AbstractResourceMarkerTest.assertMarkerIsCreated(file,
MessageFormat.format(CDIValidationMessages.UNPROXYABLE_BEAN_ARRAY_TYPE_2,
"TestType[]", "ArrayProducer.produce()"), 8);
+ AbstractResourceMarkerTest.assertMarkerIsNotCreated(file,
MessageFormat.format(CDIValidationMessages.UNPROXYABLE_BEAN_ARRAY_TYPE_2,
"TestType[]", "ArrayProducer.produce2()"), 8);
+ }
+
/**
* 5.4.1. Unproxyable bean types
* - Primitive types cannot be proxied by the container.
@@ -188,6 +194,14 @@
AbstractResourceMarkerTest.assertMarkerIsNotCreated(file,
MessageFormat.format(CDIValidationMessages.UNPROXYABLE_BEAN_PRIMITIVE_TYPE,
"boolean", "NumberProducer.foo3"), 21);
}
+ public void testNormalScopedBeanWithUnproxyableType() throws Exception {
+ IFile file =
tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/jbt/validation/unproxyable/NumberProducer.java");
+ AbstractResourceMarkerTest.assertMarkerIsCreated(file,
MessageFormat.format(CDIValidationMessages.UNPROXYABLE_BEAN_PRIMITIVE_TYPE_2,
"int", "NumberProducer.produce()"), 9);
+ AbstractResourceMarkerTest.assertMarkerIsCreated(file,
MessageFormat.format(CDIValidationMessages.UNPROXYABLE_BEAN_PRIMITIVE_TYPE_2,
"long", "NumberProducer.foo"), 16);
+ AbstractResourceMarkerTest.assertMarkerIsNotCreated(file,
MessageFormat.format(CDIValidationMessages.UNPROXYABLE_BEAN_PRIMITIVE_TYPE_2,
"Short", "NumberProducer.foo2"), 21);
+ AbstractResourceMarkerTest.assertMarkerIsNotCreated(file,
MessageFormat.format(CDIValidationMessages.UNPROXYABLE_BEAN_PRIMITIVE_TYPE_2,
"boolean", "NumberProducer.foo3"), 21);
+ }
+
/**
* 5.4.1. Unproxyable bean types
* - Classes which don't have a non-private constructor with no parameters cannot
be proxied by the container.
@@ -228,6 +242,14 @@
AbstractResourceMarkerTest.assertMarkerIsCreated(file,
MessageFormat.format(CDIValidationMessages.UNPROXYABLE_BEAN_FINAL_TYPE,
"String", "Opportunity.t"), 26);
}
+ public void testNormalScopedFinalBean() throws Exception {
+ IFile file =
tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/lookup/clientProxy/unproxyable/finalClass/Tuna_Broken.java");
+ AbstractResourceMarkerTest.assertMarkerIsCreated(file,
MessageFormat.format(CDIValidationMessages.UNPROXYABLE_BEAN_FINAL_TYPE_2,
"Tuna_Broken", "Tuna_Broken"), 21);
+
+ file =
tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/lookup/clientProxy/unproxyable/finalClass/Opportunity.java");
+ AbstractResourceMarkerTest.assertMarkerIsCreated(file,
MessageFormat.format(CDIValidationMessages.UNPROXYABLE_BEAN_FINAL_TYPE_2,
"String", "Opportunity.t"), 32);
+ }
+
/**
* 5.4.1. Unproxyable bean types
* - Classes which have final methods cannot be proxied by the container.
@@ -240,6 +262,10 @@
IFile file =
tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/lookup/clientProxy/unproxyable/finalMethod/FishFarm.java");
AbstractResourceMarkerTest.assertMarkerIsCreated(file,
MessageFormat.format(CDIValidationMessages.UNPROXYABLE_BEAN_TYPE_WITH_FM,
"Tuna_Broken", "Tuna_Broken"), 23);
AbstractResourceMarkerTest.assertMarkerIsNotCreated(file,
CDIValidationMessages.UNPROXYABLE_BEAN_TYPE_WITH_FM.substring(0, 0) + ".*",
25);
+
+ file =
tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/lookup/clientProxy/unproxyable/finalMethod/Tuna_Broken.java");
+ AbstractResourceMarkerTest.assertMarkerIsCreated(file,
MessageFormat.format(CDIValidationMessages.UNPROXYABLE_BEAN_TYPE_WITH_FM_2,
"Tuna_Broken", "Tuna_Broken"), 21);
+
}
/**