Author: akazakov
Date: 2010-04-09 11:43:09 -0400 (Fri, 09 Apr 2010)
New Revision: 21401
Added:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/resources/PaymentService.java
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/resources/ProducerFieldsBroken.java
Modified:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/ValidationTest.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-2708 Added test for J2EE resource validation.
Added:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/resources/PaymentService.java
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/resources/PaymentService.java
(rev 0)
+++
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/resources/PaymentService.java 2010-04-09
15:43:09 UTC (rev 21401)
@@ -0,0 +1,5 @@
+package org.jboss.jsr299.tck.tests.jbt.validation.resources;
+
+public class PaymentService {
+
+}
Property changes on:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/resources/PaymentService.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/resources/ProducerFieldsBroken.java
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/resources/ProducerFieldsBroken.java
(rev 0)
+++
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/resources/ProducerFieldsBroken.java 2010-04-09
15:43:09 UTC (rev 21401)
@@ -0,0 +1,33 @@
+package org.jboss.jsr299.tck.tests.jbt.validation.resources;
+
+import javax.annotation.Resource;
+import javax.ejb.EJB;
+import javax.enterprise.inject.Produces;
+import javax.inject.Named;
+import javax.persistence.EntityManager;
+import javax.persistence.EntityManagerFactory;
+import javax.persistence.PersistenceContext;
+import javax.persistence.PersistenceUnit;
+import javax.xml.ws.WebServiceRef;
+
+public class ProducerFieldsBroken {
+
+ @Named
+ @Produces @Resource //(lookup="java:global/env/jdbc/CustomerDatasource")
+ Object customerDatabaseResourceBroken;
+
+ @Named("service")
+ @Produces @WebServiceRef(lookup="java:app/service/PaymentService")
+ PaymentService paymentServiceResourceBroken;
+
+ @Named
+ @Produces @EJB //(ejbLink="../their.jar#PaymentService")
+ PaymentService paymentServiceEjbResourceBroken;
+
+ @Named
+ @Produces @PersistenceContext(unitName="CustomerDatabase")
+ EntityManager customerDatabasePersistenceContextResourceBroken;
+
+ @Named @Produces @PersistenceUnit(unitName="CustomerDatabase")
+ EntityManagerFactory customerDatabasePersistenceUnitResourceBroken;
+}
\ No newline at end of file
Property changes on:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/resources/ProducerFieldsBroken.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/ValidationTest.java
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/ValidationTest.java 2010-04-09
15:05:28 UTC (rev 21400)
+++
trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/ValidationTest.java 2010-04-09
15:43:09 UTC (rev 21401)
@@ -19,14 +19,7 @@
*/
public class ValidationTest extends TCKTest {
- public void testLegalTypesInTyped() throws Exception {
- IFile petShopFile =
tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/PetShop.java");
- AbstractResourceMarkerTest.assertMarkerIsCreated(petShopFile,
AbstractResourceMarkerTest.MARKER_TYPE, "Bean class or producer method or field
specifies a @Typed annotation, and the value member specifies a class which does not
correspond to a type in the unrestricted set of bean types of a bean", 25);
- int markerNumbers = getMarkersNumber(petShopFile);
- assertEquals("PetShop.java should has the only error marker.", markerNumbers,
1);
- }
-
- /*
+ /**
* 2.7.1.3. Stereotype declares a non-empty @Named annotation (Non-Portable behavior)
*/
public void testNonEmptyNamedForStereotype() throws Exception {
@@ -36,7 +29,29 @@
assertEquals("StereotypeWithNonEmptyNamed_Broken.java should has the only error
marker.", markerNumbers, 1);
}
- /*
+ /**
+ * 3.5.1. Declaring a resource
+ * - producer field declaration specifies an EL name (together with one of @Resource,
@PersistenceContext, @PersistenceUnit, @EJB, @WebServiceRef)
+ *
+ * @throws Exception
+ */
+ public void testResourceWithELName() throws Exception {
+ IFile file =
tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/jbt/validation/resources/ProducerFieldsBroken.java");
+ AbstractResourceMarkerTest.assertMarkerIsCreated(file,
AbstractResourceMarkerTest.MARKER_TYPE, "Producer field declaration of Java EE
resource specifies an EL name", 15);
+ AbstractResourceMarkerTest.assertMarkerIsCreated(file,
AbstractResourceMarkerTest.MARKER_TYPE, "Producer field declaration of Java EE
resource specifies an EL name", 19);
+ AbstractResourceMarkerTest.assertMarkerIsCreated(file,
AbstractResourceMarkerTest.MARKER_TYPE, "Producer field declaration of Java EE
resource specifies an EL name", 23);
+ AbstractResourceMarkerTest.assertMarkerIsCreated(file,
AbstractResourceMarkerTest.MARKER_TYPE, "Producer field declaration of Java EE
resource specifies an EL name", 27);
+ AbstractResourceMarkerTest.assertMarkerIsCreated(file,
AbstractResourceMarkerTest.MARKER_TYPE, "Producer field declaration of Java EE
resource specifies an EL name", 31);
+ }
+
+ public void testLegalTypesInTyped() throws Exception {
+ IFile petShopFile =
tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/PetShop.java");
+ AbstractResourceMarkerTest.assertMarkerIsCreated(petShopFile,
AbstractResourceMarkerTest.MARKER_TYPE, "Bean class or producer method or field
specifies a @Typed annotation, and the value member specifies a class which does not
correspond to a type in the unrestricted set of bean types of a bean", 25);
+ int markerNumbers = getMarkersNumber(petShopFile);
+ assertEquals("PetShop.java should has the only error marker.", markerNumbers,
1);
+ }
+
+ /**
* 2.7.1.3. Stereotype declares any other qualifier annotation
*/
public void testAnnotatedStereotype() throws Exception {
@@ -46,7 +61,7 @@
assertEquals("StereotypeWithBindingTypes_Broken.java should has the only error
marker.", markerNumbers, 1);
}
- /*
+ /**
* 2.7.1.3. Stereotype is annotated @Typed
*/
public void testTypedStereotype() throws Exception {
@@ -56,7 +71,7 @@
assertEquals("StereotypeWithTyped_Broken.java should has the only error
marker.", markerNumbers, 1);
}
- /*
+ /**
* 2.7.1.1. Declaring the default scope for a stereotype
* - stereotype declares more than one scope
*/
@@ -67,7 +82,7 @@
assertEquals("StereotypeWithTooManyScopeTypes_Broken.java should has two error
markers.", markerNumbers, 2);
}
- /*
+ /**
* 2.4.3. Declaring the bean scope
* - bean class or producer method or field specifies multiple scope type
annotations
*/
@@ -78,7 +93,7 @@
assertEquals("StereotypeWithTyped_Broken.java should has two error markers.",
markerNumbers, 2);
}
- /*
+ /**
* 2.4.4. Default scope
* - bean does not explicitly declare a scope when there is no default scope
* (there are two different stereotypes declared by the bean that declare
different default scopes)