Author: scabanovich
Date: 2011-04-15 16:56:22 -0400 (Fri, 15 Apr 2011)
New Revision: 30611
Added:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/resolution/Zoo.java
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/TCKTest.java
Log:
JBIDE-8736
https://issues.jboss.org/browse/JBIDE-8736
Added:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/resolution/Zoo.java
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/resolution/Zoo.java
(rev 0)
+++
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/resolution/Zoo.java 2011-04-15
20:56:22 UTC (rev 30611)
@@ -0,0 +1,43 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.jsr299.tck.tests.jbt.resolution;
+
+import java.util.List;
+import java.util.ArrayList;
+import javax.inject.Inject;
+import javax.enterprise.inject.Produces;
+import javax.enterprise.inject.Typed;
+
+import org.jboss.jsr299.tck.tests.lookup.typesafe.resolution.*;
+
+public class Zoo {
+
+ @Produces @Typed(List.class)
+ private ArrayList<Cat<European>> catsProducer = new
ArrayList<Cat<European>>();
+
+ @Produces @Typed(List.class)
+ public ArrayList<Lion> getLions() {
+ return new ArrayList<Lion>();
+ }
+
+ @Inject
+ List<Cat<European>> cats;
+
+ @Inject
+ List<Lion> lions;
+
+}
Property changes on:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/resolution/Zoo.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
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 2011-04-15
20:43:13 UTC (rev 30610)
+++
trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/ResolutionByTypeTest.java 2011-04-15
20:56:22 UTC (rev 30611)
@@ -18,7 +18,9 @@
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.IInjectionPointField;
import org.jboss.tools.cdi.core.IParametedType;
+import org.jboss.tools.cdi.core.IProducerField;
import org.jboss.tools.cdi.core.IProducerMethod;
import org.jboss.tools.cdi.core.IQualifierDeclaration;
import org.jboss.tools.common.EclipseUtil;
@@ -200,7 +202,7 @@
assertContainsBeanTypes(false, bean, "java.lang.Object");
assertContainsBeanTypes(false, bean,
"org.jboss.jsr299.tck.tests.lookup.typesafe.resolution.FlightlessBird");
- assertContainsBeanTypeSignatures(false, bean,
"Qorg.jboss.jsr299.tck.tests.lookup.typesafe.resolution.FlightlessBird<Qorg.jboss.jsr299.tck.tests.lookup.typesafe.resolution.Australian;>;");
+ assertContainsBeanTypeSignatures(false, bean,
"Lorg.jboss.jsr299.tck.tests.lookup.typesafe.resolution.FlightlessBird<Lorg.jboss.jsr299.tck.tests.lookup.typesafe.resolution.Australian;>;");
}
/**
@@ -235,7 +237,7 @@
assertContainsBeanTypes(false, bean, "java.lang.Object");
assertContainsBeanTypes(false, bean,
"org.jboss.jsr299.tck.tests.lookup.typesafe.resolution.Cat");
- assertContainsBeanTypeSignatures(false, bean,
"Qorg.jboss.jsr299.tck.tests.lookup.typesafe.resolution.Cat<Qorg.jboss.jsr299.tck.tests.lookup.typesafe.resolution.European;>;");
+ assertContainsBeanTypeSignatures(false, bean,
"Lorg.jboss.jsr299.tck.tests.lookup.typesafe.resolution.Cat<Lorg.jboss.jsr299.tck.tests.lookup.typesafe.resolution.European;>;");
beans =
getBeans("org.jboss.jsr299.tck.tests.lookup.typesafe.resolution.DomesticCat",
"org.jboss.jsr299.tck.tests.lookup.typesafe.resolution.Tame");
assertEquals("Wrong number of the beans", 0, beans.size());
@@ -258,7 +260,7 @@
assertContainsBeanTypes(false, bean, "java.lang.Object");
assertContainsBeanTypes(false, bean,
"org.jboss.jsr299.tck.tests.lookup.typesafe.resolution.Cat");
- assertContainsBeanTypeSignatures(false, bean,
"Qorg.jboss.jsr299.tck.tests.lookup.typesafe.resolution.Cat<Qorg.jboss.jsr299.tck.tests.lookup.typesafe.resolution.African;>;");
+ assertContainsBeanTypeSignatures(false, bean,
"Lorg.jboss.jsr299.tck.tests.lookup.typesafe.resolution.Cat<Lorg.jboss.jsr299.tck.tests.lookup.typesafe.resolution.African;>;");
beans =
getBeans("org.jboss.jsr299.tck.tests.lookup.typesafe.resolution.Lion",
"org.jboss.jsr299.tck.tests.lookup.typesafe.resolution.Wild");
assertEquals("Wrong number of the beans", 0, beans.size());
@@ -278,4 +280,21 @@
beans =
getBeans("org.jboss.jsr299.tck.tests.lookup.typesafe.resolution.Bird");
assertEquals("Wrong number of the beans", 0, beans.size());
}
+
+ public void testInjectionResolutionOfRestrictedProducerField() throws CoreException {
+ IInjectionPointField injection =
getInjectionPointField("JavaSource/org/jboss/jsr299/tck/tests/jbt/resolution/Zoo.java",
"cats");
+ Set<IBean> beans = cdiProject.getBeans(true, injection);
+ assertEquals("Wrong number of the beans", 1, beans.size());
+ IBean bean = beans.iterator().next();
+ assertTrue(bean instanceof IProducerField);
+ }
+
+ public void testInjectionResolutionOfRestrictedProducerMethod() throws CoreException {
+ IInjectionPointField injection =
getInjectionPointField("JavaSource/org/jboss/jsr299/tck/tests/jbt/resolution/Zoo.java",
"lions");
+ Set<IBean> beans = cdiProject.getBeans(true, injection);
+ assertEquals("Wrong number of the beans", 1, beans.size());
+ IBean bean = beans.iterator().next();
+ assertTrue(bean instanceof IProducerMethod);
+ }
+
}
\ No newline at end of file
Modified:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/TCKTest.java
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/TCKTest.java 2011-04-15
20:43:13 UTC (rev 30610)
+++
trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/TCKTest.java 2011-04-15
20:56:22 UTC (rev 30611)
@@ -3,6 +3,7 @@
import java.io.File;
import java.io.FileFilter;
import java.util.HashSet;
+import java.util.Iterator;
import java.util.Set;
import junit.framework.TestCase;
@@ -30,6 +31,7 @@
import org.jboss.tools.cdi.core.IInjectionPoint;
import org.jboss.tools.cdi.core.IInjectionPointField;
import org.jboss.tools.cdi.core.IParametedType;
+import org.jboss.tools.cdi.core.IProducer;
import org.jboss.tools.cdi.core.IQualifier;
import org.jboss.tools.cdi.core.IQualifierDeclaration;
import org.jboss.tools.cdi.core.test.tck.validation.CoreValidationTest;
@@ -295,6 +297,11 @@
protected IInjectionPointField getInjectionPointField(String beanClassFilePath, String
fieldName) {
IFile file = tckProject.getFile(beanClassFilePath);
Set<IBean> beans = cdiProject.getBeans(file.getFullPath());
+ Iterator<IBean> it = beans.iterator();
+ while(it.hasNext()) {
+ IBean b = it.next();
+ if(b instanceof IProducer) it.remove();
+ }
assertEquals("Wrong number of the beans", 1, beans.size());
Set<IInjectionPoint> injections = beans.iterator().next().getInjectionPoints();
for (IInjectionPoint injectionPoint : injections) {