Author: shane.bryzak(a)jboss.com
Date: 2009-03-16 01:18:54 -0400 (Mon, 16 Mar 2009)
New Revision: 2023
Added:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/definition/Deadliest.java
Modified:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/binding/BindingDefinitionTest.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/definition/DefangedTarantula.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/definition/ProducerMethodDefinitionTest.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/definition/Spider.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/definition/SpiderProducer.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/definition/Tarantula.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/InjectionTest.java
tck/trunk/impl/src/main/resources/tck-audit.xml
Log:
test for 2.3.6.a, removed empty test for untestable assertion
Modified:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/binding/BindingDefinitionTest.java
===================================================================
---
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/binding/BindingDefinitionTest.java 2009-03-16
01:42:30 UTC (rev 2022)
+++
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/binding/BindingDefinitionTest.java 2009-03-16
05:18:54 UTC (rev 2023)
@@ -41,16 +41,6 @@
assert
injectionPoint.getBean().getBindings().iterator().next().annotationType().equals(Current.class);
}
- @Test(groups = { "annotationDefinition", "stub" })
- @SpecAssertion(section = "2.3.2", id = "aa")
- public void testBindingHasCorrectTarget()
- {
- // TODO This is only a definition without any real assertion about a given
- // binding type
- // If there are many binding types, how do we find them?
- assert false;
- }
-
@Test(groups = { "annotationDefinition" })
@SpecAssertion(section = "2.3.2", id = "b")
public void testBindingDeclaresBindingAnnotation()
Added:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/definition/Deadliest.java
===================================================================
---
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/definition/Deadliest.java
(rev 0)
+++
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/definition/Deadliest.java 2009-03-16
05:18:54 UTC (rev 2023)
@@ -0,0 +1,22 @@
+package org.jboss.jsr299.tck.tests.implementation.producer.method.definition;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.PARAMETER;
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import javax.inject.BindingType;
+
+@Target( { TYPE, METHOD, PARAMETER, FIELD })
+@Retention(RUNTIME)
+@Documented
+@BindingType
+@interface Deadliest
+{
+
+}
\ No newline at end of file
Modified:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/definition/DefangedTarantula.java
===================================================================
---
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/definition/DefangedTarantula.java 2009-03-16
01:42:30 UTC (rev 2022)
+++
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/definition/DefangedTarantula.java 2009-03-16
05:18:54 UTC (rev 2023)
@@ -2,5 +2,5 @@
class DefangedTarantula extends Tarantula
{
-
+ @Override public int getDeathsCaused() { return 0; }
}
Modified:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/definition/ProducerMethodDefinitionTest.java
===================================================================
---
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/definition/ProducerMethodDefinitionTest.java 2009-03-16
01:42:30 UTC (rev 2022)
+++
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/definition/ProducerMethodDefinitionTest.java 2009-03-16
05:18:54 UTC (rev 2023)
@@ -26,6 +26,7 @@
{
private static final Annotation TAME_LITERAL = new AnnotationLiteral<Tame>() {};
+ private static final Annotation DEADLIEST_LITERAL = new
AnnotationLiteral<Deadliest>() {};
@Test(groups = "producerMethod")
@SpecAssertion(section = "2.5.3", id = "g")
@@ -203,4 +204,13 @@
System.out.println(getCurrentManager().getInstanceByType(Egg.class, new
AnnotationLiteral<Yummy>() {}).getMother().getClass());
assert getCurrentManager().getInstanceByType(Egg.class, new
AnnotationLiteral<Yummy>() {}).getMother().getClass().equals(Chicken.class);
}
+
+ @Test
+ @SpecAssertion(section = "2.3.6", id = "a")
+ public void testBindingTypesAppliedToProducerMethodParameters()
+ {
+ Bean<Tarantula> tarantula =
getCurrentManager().resolveByType(Tarantula.class, DEADLIEST_LITERAL).iterator().next();
+ Tarantula instance = getCurrentManager().getInstance(tarantula);
+ assert instance.getDeathsCaused() == 1;
+ }
}
Modified:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/definition/Spider.java
===================================================================
---
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/definition/Spider.java 2009-03-16
01:42:30 UTC (rev 2022)
+++
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/definition/Spider.java 2009-03-16
05:18:54 UTC (rev 2023)
@@ -3,5 +3,5 @@
class Spider implements Animal
{
-
+
}
Modified:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/definition/SpiderProducer.java
===================================================================
---
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/definition/SpiderProducer.java 2009-03-16
01:42:30 UTC (rev 2022)
+++
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/definition/SpiderProducer.java 2009-03-16
05:18:54 UTC (rev 2023)
@@ -2,6 +2,7 @@
import javax.annotation.Named;
import javax.context.RequestScoped;
+import javax.inject.Current;
import javax.inject.Produces;
@AnotherDeploymentType
@@ -15,6 +16,13 @@
return new DefangedTarantula();
}
+ @Produces @Deadliest public Tarantula producesDeadliestTarantula(@Tame Tarantula
tameTarantula,
+ @Current Tarantula tarantula)
+ {
+ return tameTarantula.getDeathsCaused() >= tarantula.getDeathsCaused() ?
+ tameTarantula : tarantula;
+ }
+
@Produces public Tarantula produceTarantula()
{
return new Tarantula();
Modified:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/definition/Tarantula.java
===================================================================
---
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/definition/Tarantula.java 2009-03-16
01:42:30 UTC (rev 2022)
+++
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/definition/Tarantula.java 2009-03-16
05:18:54 UTC (rev 2023)
@@ -1,6 +1,6 @@
package org.jboss.jsr299.tck.tests.implementation.producer.method.definition;
class Tarantula extends Spider implements DeadlySpider
-{
-
+{
+ public int getDeathsCaused() { return 1; }
}
Modified:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/InjectionTest.java
===================================================================
---
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/InjectionTest.java 2009-03-16
01:42:30 UTC (rev 2022)
+++
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/InjectionTest.java 2009-03-16
05:18:54 UTC (rev 2023)
@@ -49,10 +49,10 @@
assert foxRun.fox.getName().equals("gavin");
}
- @Test @SpecAssertion(section="4.2", id = "aa")
+ @Test
+ @SpecAssertion(section="4.2", id = "aa")
public void testFieldDeclaredInSuperclassInjected() throws Exception
- {
-
+ {
new RunInDependentContext()
{
@Override
Modified: tck/trunk/impl/src/main/resources/tck-audit.xml
===================================================================
--- tck/trunk/impl/src/main/resources/tck-audit.xml 2009-03-16 01:42:30 UTC (rev 2022)
+++ tck/trunk/impl/src/main/resources/tck-audit.xml 2009-03-16 05:18:54 UTC (rev 2023)
@@ -112,7 +112,7 @@
</section>
<section id="2.3.2" title="Defining new binding types">
- <assertion id="aa">
+ <assertion id="aa" testable="false">
<text>A binding type is a Java annotation defined as @Target({METHOD, FIELD,
PARAMETER, TYPE})~ and @Retention(RUNTIME)~.</text>
</assertion>
Show replies by date