Author: dallen6
Date: 2009-08-07 14:54:14 -0400 (Fri, 07 Aug 2009)
New Revision: 3408
Added:
tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/extensions/
tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/extensions/producer/
tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/extensions/producer/javax.enterprise.inject.spi.Extension
Modified:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/producer/DogProducer.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/producer/PreferredDogProducer.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/producer/ProducerProcessor.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/producer/ProducerTest.java
tck/trunk/impl/src/main/resources/tck-audit.xml
Log:
Assigned more assertions in chapter 11, fixed a few typos, and fixed up ProcessProducer
tests.
Modified:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/producer/DogProducer.java
===================================================================
---
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/producer/DogProducer.java 2009-08-07
18:02:55 UTC (rev 3407)
+++
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/producer/DogProducer.java 2009-08-07
18:54:14 UTC (rev 3408)
@@ -1,5 +1,6 @@
package org.jboss.jsr299.tck.tests.extensions.producer;
+import javax.enterprise.inject.Current;
import javax.enterprise.inject.Disposes;
import javax.enterprise.inject.Produces;
@@ -12,7 +13,7 @@
private Dog quietDog = new Dog(DOG_COLOR);
@Produces @Noisy
- public Dog produceNoisyDog()
+ public Dog produceNoisyDog(@Current DogBed dogBed)
{
noisyDogProducerCalled = true;
return new Dog();
Modified:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/producer/PreferredDogProducer.java
===================================================================
---
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/producer/PreferredDogProducer.java 2009-08-07
18:02:55 UTC (rev 3407)
+++
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/producer/PreferredDogProducer.java 2009-08-07
18:54:14 UTC (rev 3408)
@@ -1,5 +1,6 @@
package org.jboss.jsr299.tck.tests.extensions.producer;
+import javax.enterprise.inject.Current;
import javax.enterprise.inject.Disposes;
import javax.enterprise.inject.Produces;
import javax.enterprise.inject.Specializes;
@@ -22,8 +23,8 @@
return preferredQuietDog;
}
- @Override
- public Dog produceNoisyDog()
+ @Override @Produces @Noisy
+ public Dog produceNoisyDog(@Current DogBed dogBed)
{
return new Dog(DOG_COLOR);
}
Modified:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/producer/ProducerProcessor.java
===================================================================
---
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/producer/ProducerProcessor.java 2009-08-07
18:02:55 UTC (rev 3407)
+++
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/producer/ProducerProcessor.java 2009-08-07
18:54:14 UTC (rev 3408)
@@ -1,6 +1,8 @@
package org.jboss.jsr299.tck.tests.extensions.producer;
import javax.enterprise.event.Observes;
+import javax.enterprise.inject.spi.AnnotatedField;
+import javax.enterprise.inject.spi.AnnotatedMethod;
import javax.enterprise.inject.spi.ProcessProducer;
import javax.enterprise.inject.spi.Producer;
@@ -13,18 +15,21 @@
public void processDogProducer(@Observes ProcessProducer<Dog, Dog>
producerEvent)
{
+ dogProducer = producerEvent.getProducer();
+ }
+
+ public void processDogProducerProducer(@Observes
ProcessProducer<PreferredDogProducer, Dog> producerEvent)
+ {
if (producerEvent.getAnnotatedMember().isAnnotationPresent(Noisy.class))
{
noisyDogProducer = producerEvent.getProducer();
+ assert producerEvent.getAnnotatedMember() instanceof AnnotatedMethod<?>;
}
else if (producerEvent.getAnnotatedMember().isAnnotationPresent(Quiet.class))
{
quietDogProducer = producerEvent.getProducer();
+ assert producerEvent.getAnnotatedMember() instanceof AnnotatedField<?>;
}
- else
- {
- dogProducer = producerEvent.getProducer();
- }
}
public void processCatProducer(@Observes ProcessProducer<Cat, Cat>
producerEvent)
Modified:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/producer/ProducerTest.java
===================================================================
---
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/producer/ProducerTest.java 2009-08-07
18:02:55 UTC (rev 3407)
+++
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/producer/ProducerTest.java 2009-08-07
18:54:14 UTC (rev 3408)
@@ -22,7 +22,8 @@
{
@Test(groups = "ri-broken")
@SpecAssertions({
- @SpecAssertion(section = "11.2", id = "ba")
+ @SpecAssertion(section = "11.2", id = "ba"),
+ @SpecAssertion(section = "11.5.7", id = "b")
})
public void testProduceCallsInitializer()
{
@@ -108,7 +109,11 @@
@Test(groups = "ri-broken")
@SpecAssertions({
- @SpecAssertion(section = "11.2", id = "ea")
+ @SpecAssertion(section = "11.2", id = "ea"),
+ @SpecAssertion(section = "11.5.7", id = "a"),
+ @SpecAssertion(section = "11.5.7", id = "b"),
+ @SpecAssertion(section = "11.5.7", id = "c"),
+ @SpecAssertion(section = "11.5.7", id = "d")
})
public void testProduceCallsProducerMethod()
{
@@ -121,7 +126,11 @@
@Test(groups = "ri-broken")
@SpecAssertions({
- @SpecAssertion(section = "11.2", id = "eb")
+ @SpecAssertion(section = "11.2", id = "eb"),
+ @SpecAssertion(section = "11.5.7", id = "a"),
+ @SpecAssertion(section = "11.5.7", id = "b"),
+ @SpecAssertion(section = "11.5.7", id = "c"),
+ @SpecAssertion(section = "11.5.7", id = "d")
})
public void testProduceAccessesProducerField()
{
@@ -129,7 +138,7 @@
Dog dog = (Dog) producer.produce(new CreationalContextImpl<Dog>());
assert dog.getColor().equals(PreferredDogProducer.DOG_COLOR);
}
-
+
@Test(groups = "ri-broken")
@SpecAssertions({
@SpecAssertion(section = "11.2", id = "fa")
@@ -142,7 +151,7 @@
producer.dispose(dog);
assert PreferredDogProducer.isNoisyDogDisposed();
}
-
+
@Test(groups = "ri-broken")
@SpecAssertions({
@SpecAssertion(section = "11.2", id = "fb")
@@ -155,4 +164,15 @@
producer.dispose(dog);
assert PreferredDogProducer.isQuietDogDisposed();
}
+
+ @Test(groups = "ri-broken")
+ @SpecAssertions({
+ @SpecAssertion(section = "11.2", id = "g")
+ })
+ public void testInjectionPointsForProducerMethod()
+ {
+ Producer<Dog> producer = ProducerProcessor.getNoisyDogProducer();
+ assert producer.getInjectionPoints().size() == 1;
+ assert
producer.getInjectionPoints().iterator().next().getType().equals(DogBed.class);
+ }
}
Copied:
tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/extensions/producer/javax.enterprise.inject.spi.Extension
(from rev 3405,
tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/deployment/lifecycle/javax.enterprise.inject.spi.Extension)
===================================================================
---
tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/extensions/producer/javax.enterprise.inject.spi.Extension
(rev 0)
+++
tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/extensions/producer/javax.enterprise.inject.spi.Extension 2009-08-07
18:54:14 UTC (rev 3408)
@@ -0,0 +1 @@
+org.jboss.jsr299.tck.tests.extensions.producer.ProducerProcessor
Modified: tck/trunk/impl/src/main/resources/tck-audit.xml
===================================================================
--- tck/trunk/impl/src/main/resources/tck-audit.xml 2009-08-07 18:02:55 UTC (rev 3407)
+++ tck/trunk/impl/src/main/resources/tck-audit.xml 2009-08-07 18:54:14 UTC (rev 3408)
@@ -4376,7 +4376,7 @@
</assertion>
<assertion id="g">
- <text>For a Producer that represents a producer method or field,
|getInjectionPoints()| returns the set of |InjectionPoint| objects representing all
parameters of the producer method.</text>
+ <text>For a Producer that represents a producer method,
|getInjectionPoints()| returns the set of |InjectionPoint| objects representing all
parameters of the producer method.</text>
</assertion>
<assertion id="h">
@@ -4909,7 +4909,7 @@
</assertion>
<assertion id="h">
- <text>If any observer method of a |ProcessInjectionTarget| event throws an
exception, the exception is treated as a definition error by the container.</text>
+ <text>If any observer method of a |ProcessProducer| event throws an
exception, the exception is treated as a definition error by the container.</text>
</assertion>
</section>