[jbosstools-commits] JBoss Tools SVN: r22636 - 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
Tue Jun 8 10:27:18 EDT 2010


Author: akazakov
Date: 2010-06-08 10:27:17 -0400 (Tue, 08 Jun 2010)
New Revision: 22636

Modified:
   trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/lookup/typesafe/resolution/NumberProducer.java
   trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/ResolutionByTypeTest.java
   trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/ValidationTest.java
Log:
https://jira.jboss.org/browse/JBIDE-6418

Modified: trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/lookup/typesafe/resolution/NumberProducer.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/lookup/typesafe/resolution/NumberProducer.java	2010-06-08 13:57:24 UTC (rev 22635)
+++ trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/lookup/typesafe/resolution/NumberProducer.java	2010-06-08 14:27:17 UTC (rev 22636)
@@ -17,6 +17,7 @@
 package org.jboss.jsr299.tck.tests.lookup.typesafe.resolution;
 
 import javax.enterprise.inject.Produces;
+import javax.inject.Inject;
 
 class NumberProducer
 {
@@ -31,4 +32,12 @@
       return max;
    }
 
-}
+   // JBT
+   @Inject
+   @Min
+   public double minInjection;
+
+   @Inject
+   @Max
+   public Double maxInjection;
+}
\ No newline at end of file

Modified: trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/ResolutionByTypeTest.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/ResolutionByTypeTest.java	2010-06-08 13:57:24 UTC (rev 22635)
+++ trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/ResolutionByTypeTest.java	2010-06-08 14:27:17 UTC (rev 22636)
@@ -15,6 +15,8 @@
 import org.eclipse.core.runtime.CoreException;
 import org.eclipse.jdt.core.IType;
 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.IParametedType;
 import org.jboss.tools.cdi.core.IProducerMethod;
 import org.jboss.tools.cdi.core.IQualifierDeclaration;
@@ -96,6 +98,26 @@
 
 	/**
 	 * Section 5.2 - Typesafe resolution
+	 *   i) Test with a primitive type.
+	 *   
+	 * @throws CoreException 
+	 */
+	public void testResolveByTypeWithPrimitives() throws CoreException {
+		Set<IBean> beans = getBeans("java.lang.Double", "javax.enterprise.inject.Any");
+		// There is checks for 2 beans (not for 3) in TCK but actually there is one more bean in another package which matches. So let's check for 3 beans.
+		assertEquals("Wrong number of the beans", 3, beans.size());
+		IClassBean bean = getClassBean("JavaSource/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/NumberProducer.java");
+		assertNotNull("Bean can't be a null", bean);
+		Set<IInjectionPoint> injections = bean.getInjectionPoints();
+		assertEquals("Wrong number of the injection points", 2, injections.size());
+		for (IInjectionPoint injectionPoint : injections) {
+			beans = cdiProject.getBeans(true, injectionPoint);
+			assertEquals("Wrong number of the beans", 1, beans.size());
+		}
+	}
+
+	/**
+	 * Section 5.2 - Typesafe resolution
 	 *   ld) Test with matching beans with matching qualifier with same annotation member value for each member which is not annotated @javax.enterprise.util.NonBinding.
 	 *   
 	 * @throws CoreException 

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-06-08 13:57:24 UTC (rev 22635)
+++ trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/ValidationTest.java	2010-06-08 14:27:17 UTC (rev 22636)
@@ -886,6 +886,32 @@
 	}
 
 	/**
+	 * 5.2.1. Unsatisfied and ambiguous dependencies
+	 *  - If an unresolvable ambiguous dependency exists, the container automatically detects the problem and treats it as a deployment problem.
+	 * 
+	 * @throws Exception
+	 */
+	public void testAmbiguousDependency() throws Exception {
+		IFile file = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/lookup/dependency/resolution/broken/ambiguous/Farm_Broken.java");
+		AbstractResourceMarkerTest.assertMarkerIsCreated(file, AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.AMBIGUOUS_INJECTION_POINTS, 25);
+		file = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/decorators/definition/inject/delegateField/TimestampLogger.java");
+		AbstractResourceMarkerTest.assertMarkerIsNotCreated(file, AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.AMBIGUOUS_INJECTION_POINTS, 34);
+	}
+
+	/**
+	 * 5.2.1. Unsatisfied and ambiguous dependencies
+	 *  - If an unsatisfied dependency exists, the container automatically detects the problem and treats it as a deployment problem.
+	 * 
+	 * @throws Exception
+	 */
+	public void testUnsatisfiedDependency() throws Exception {
+		IFile file = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/lookup/dependency/resolution/broken/unsatisfied/Bean_Broken.java");
+		AbstractResourceMarkerTest.assertMarkerIsCreated(file, AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.UNSATISFIED_INJECTION_POINTS, 25);
+		file = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/decorators/definition/inject/delegateField/TimestampLogger.java");
+		AbstractResourceMarkerTest.assertMarkerIsNotCreated(file, AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.UNSATISFIED_INJECTION_POINTS, 34);
+	}
+
+	/**
 	 * 5.2.2. Legal injection point types
 	 *  - injection point type is a type variable
 	 * 
@@ -919,18 +945,6 @@
 	}
 
 	/**
-	 * 5.2.1. Unsatisfied and ambiguous dependencies
-	 *  - If an unsatisfied or unresolvable ambiguous dependency exists, the container automatically detects the problem and treats it as a deployment problem.
-	 * 
-	 * @throws Exception
-	 */
-	public void testAmbiguousDependency() throws Exception {
-		IFile file = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/decorators/definition/inject/delegateField/TimestampLogger.java");
-		AbstractResourceMarkerTest.assertMarkerIsNotCreated(file, AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.AMBIGUOUS_INJECTION_POINTS, 34);
-		AbstractResourceMarkerTest.assertMarkerIsNotCreated(file, AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.UNSATISFIED_INJECTION_POINTS, 34);
-	}
-
-	/**
 	 * 10.4.2. Declaring an observer method
 	 *  - method has more than one parameter annotated @Observes
 	 *  



More information about the jbosstools-commits mailing list