[weld-commits] Weld SVN: r4131 - in cdi-tck/trunk/impl/src/main: java/org/jboss/jsr299/tck/tests/decorators/invocation/producer/method and 14 other directories.
weld-commits at lists.jboss.org
weld-commits at lists.jboss.org
Thu Oct 15 22:59:09 EDT 2009
Author: norman.richards at jboss.com
Date: 2009-10-15 22:59:08 -0400 (Thu, 15 Oct 2009)
New Revision: 4131
Added:
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/invocation/PigStyDecorator.java
Modified:
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/invocation/EJBDecoratorInvocationTest.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/invocation/producer/method/ProducerDecorator.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/bean/BeanDefinitionTest.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/name/NameDefinitionTest.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/scope/ScopeDefinitionTest.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/stereotype/HighlandCow.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/stereotype/Springbok.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/stereotype/StereotypeDefinitionTest.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/stereotype/broken/scopeConflict/IncompatibleStereotypesTest.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/disposal/method/definition/DisposalMethodDefinitionTest.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/enterprise/lifecycle/EnterpriseBeanLifecycleTest.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/enterprise/lifecycle/Giessen.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/field/lifecycle/ProducerFieldLifecycleTest.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/lifecycle/Lays.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/lifecycle/ProducerMethodLifecycleTest.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/simple/lifecycle/SimpleBeanLifecycleTest.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/simple/lifecycle/Tuna.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/simple/lifecycle/TunaFarm.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/InterceptorDefinitionTest.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/Missile.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/ResolutionByTypeTest.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/parameterized/AssignabilityOfRawAndParameterizedTypesTest.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/parameterized/DaoProducer.java
cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/decorators/invocation/beans.xml
Log:
tck updates
Modified: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/invocation/EJBDecoratorInvocationTest.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/invocation/EJBDecoratorInvocationTest.java 2009-10-16 00:17:50 UTC (rev 4130)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/invocation/EJBDecoratorInvocationTest.java 2009-10-16 02:59:08 UTC (rev 4131)
@@ -43,8 +43,7 @@
@SpecAssertion(section="8.5", id="b"),
@SpecAssertion(section="8.1.3", id="d"),
@SpecAssertion(section="8.1.2", id="f"),
- @SpecAssertion(section="8.1.2", id="b"),
- @SpecAssertion(section="7.2", id="d")
+ @SpecAssertion(section="8.1.2", id="b")
})
public void testDecoratorInvocation()
{
@@ -57,6 +56,18 @@
@Test
@SpecAssertions({
+ @SpecAssertion(section="7.2", id="d")
+ })
+ public void testEJBDecoratorInvocation() {
+ // testDecoratorInvocation tests decorators of normal beans called from an EJB
+ // it doesn't test actual decoration of the EJB
+ PigStyDecorator.decoratorCalled = false;
+ getInstanceByType(PigSty.class).clean();
+ assert PigStyDecorator.decoratorCalled;
+ }
+
+ @Test
+ @SpecAssertions({
@SpecAssertion(section="8.5", id="d"),
@SpecAssertion(section="8.5", id="e"),
@SpecAssertion(section="8.5", id="f"),
Added: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/invocation/PigStyDecorator.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/invocation/PigStyDecorator.java (rev 0)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/invocation/PigStyDecorator.java 2009-10-16 02:59:08 UTC (rev 4131)
@@ -0,0 +1,22 @@
+package org.jboss.jsr299.tck.tests.decorators.invocation;
+
+import javax.decorator.Decorates;
+import javax.decorator.Decorator;
+
+ at Decorator
+public class PigStyDecorator implements PigSty {
+ public static boolean decoratorCalled = false;
+
+ @Decorates PigSty pigSty;
+
+ public void clean() {
+ decoratorCalled = true;
+ pigSty.clean();
+ }
+
+ public void washDown() {
+ decoratorCalled = true;
+ pigSty.washDown();
+ }
+
+}
Modified: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/invocation/producer/method/ProducerDecorator.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/invocation/producer/method/ProducerDecorator.java 2009-10-16 00:17:50 UTC (rev 4130)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/invocation/producer/method/ProducerDecorator.java 2009-10-16 02:59:08 UTC (rev 4131)
@@ -29,11 +29,11 @@
{
@Decorates
- private Producer logger;
+ private Producer producer;
public Foo produce()
{
- return new Foo(logger.produce().getFoo() + "!!");
+ return new Foo(producer.produce().getFoo() + "!!");
}
/**
@@ -46,7 +46,7 @@
public void dispose(Foo foo)
{
- logger.dispose(new Foo("decorated"));
+ producer.dispose(new Foo("decorated"));
}
Modified: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/bean/BeanDefinitionTest.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/bean/BeanDefinitionTest.java 2009-10-16 00:17:50 UTC (rev 4130)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/bean/BeanDefinitionTest.java 2009-10-16 02:59:08 UTC (rev 4131)
@@ -42,7 +42,7 @@
@SpecAssertion(section = "2", id = "b"),
@SpecAssertion(section = "11.1", id = "ba")
})
- public void testBindingTypesNonEmpty()
+ public void testQualifiersNonEmpty()
{
assert getBeans(RedSnapper.class).size() == 1;
assert getBeans(RedSnapper.class).iterator().next().getQualifiers().size() > 0;
Modified: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/name/NameDefinitionTest.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/name/NameDefinitionTest.java 2009-10-16 00:17:50 UTC (rev 4130)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/name/NameDefinitionTest.java 2009-10-16 02:59:08 UTC (rev 4131)
@@ -46,7 +46,7 @@
@SpecAssertion(section = "2.7", id = "a"),
@SpecAssertion(section = "2.7.1.3", id = "aaa")
})
- public void testSterotypeDefaultsName()
+ public void testStereotypeDefaultsName()
{
assert getBeans(RedSnapper.class).size() == 1;
Bean<RedSnapper> bean = getBeans(RedSnapper.class).iterator().next();
Modified: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/scope/ScopeDefinitionTest.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/scope/ScopeDefinitionTest.java 2009-10-16 00:17:50 UTC (rev 4130)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/scope/ScopeDefinitionTest.java 2009-10-16 02:59:08 UTC (rev 4131)
@@ -82,7 +82,7 @@
}
@Test @SpecAssertion(section="2.4.4", id = "da")
- public void testMutipleIncompatibleScopeStereotypesWithScopeSpecified()
+ public void testMultipleIncompatibleScopeStereotypesWithScopeSpecified()
{
assert getBeans(Pollock.class).size() == 1;
Bean<Pollock> bean = getBeans(Pollock.class).iterator().next();
@@ -90,7 +90,7 @@
}
@Test @SpecAssertion(section="2.4.4", id = "c")
- public void testMutipleCompatibleScopeStereotypes()
+ public void testMultipleCompatibleScopeStereotypes()
{
assert getBeans(Grayling.class).size() == 1;
Bean<Grayling> bean = getBeans(Grayling.class).iterator().next();
@@ -102,7 +102,7 @@
@SpecAssertion(section = "2.7.2", id = "db"),
@SpecAssertion(section = "4.1", id = "ab")
})
- public void testCDIScopeTypeOverridesStereotype()
+ public void testWebBeanScopeTypeOverridesStereotype()
{
assert getBeans(RedSnapper.class).size() == 1;
Bean<RedSnapper> bean = getBeans(RedSnapper.class).iterator().next();
Modified: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/stereotype/HighlandCow.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/stereotype/HighlandCow.java 2009-10-16 00:17:50 UTC (rev 4130)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/stereotype/HighlandCow.java 2009-10-16 02:59:08 UTC (rev 4131)
@@ -1,9 +1,7 @@
package org.jboss.jsr299.tck.tests.definition.stereotype;
-import javax.enterprise.context.RequestScoped;
-
@HornedMammalStereotype
- at RequestScoped
+ at AnimalStereotype
@Tame
class HighlandCow implements Animal
{
Modified: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/stereotype/Springbok.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/stereotype/Springbok.java 2009-10-16 00:17:50 UTC (rev 4130)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/stereotype/Springbok.java 2009-10-16 02:59:08 UTC (rev 4131)
@@ -1,9 +1,9 @@
package org.jboss.jsr299.tck.tests.definition.stereotype;
-import javax.enterprise.context.ApplicationScoped;
+import javax.enterprise.context.RequestScoped;
@ApplicationScopedHornedMammalStereotype
- at ApplicationScoped
+ at RequestScoped
class Springbok implements Animal
{
Modified: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/stereotype/StereotypeDefinitionTest.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/stereotype/StereotypeDefinitionTest.java 2009-10-16 00:17:50 UTC (rev 4130)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/stereotype/StereotypeDefinitionTest.java 2009-10-16 02:59:08 UTC (rev 4131)
@@ -71,7 +71,7 @@
public void testExplicitScopeOverridesMergedScopesFromMultipleStereotype()
{
assert getBeans(Springbok.class).size() == 1;
- assert getBeans(Springbok.class).iterator().next().getScope().equals(ApplicationScoped.class);
+ assert getBeans(Springbok.class).iterator().next().getScope().equals(RequestScoped.class);
}
@Test
Modified: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/stereotype/broken/scopeConflict/IncompatibleStereotypesTest.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/stereotype/broken/scopeConflict/IncompatibleStereotypesTest.java 2009-10-16 00:17:50 UTC (rev 4130)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/stereotype/broken/scopeConflict/IncompatibleStereotypesTest.java 2009-10-16 02:59:08 UTC (rev 4131)
@@ -18,7 +18,7 @@
@SpecAssertions( {
@SpecAssertion(section = "2.4.4", id = "da")
})
- public void testMutipleIncompatibleScopeStereotypes()
+ public void testMultipleIncompatibleScopeStereotypes()
{
assert false;
}
Modified: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/disposal/method/definition/DisposalMethodDefinitionTest.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/disposal/method/definition/DisposalMethodDefinitionTest.java 2009-10-16 00:17:50 UTC (rev 4130)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/disposal/method/definition/DisposalMethodDefinitionTest.java 2009-10-16 02:59:08 UTC (rev 4131)
@@ -35,11 +35,14 @@
})
public void testBindingTypesAppliedToDisposalMethodParameters() throws Exception
{
+ assert !SpiderProducer.isTameSpiderDestroyed();
+ assert !SpiderProducer.isDeadliestSpiderDestroyed();
Bean<Tarantula> tarantula = getBeans(Tarantula.class, DEADLIEST_LITERAL).iterator().next();
CreationalContext<Tarantula> creationalContext = getCurrentManager().createCreationalContext(tarantula);
Tarantula instance = tarantula.create(creationalContext);
tarantula.destroy(instance, creationalContext);
assert SpiderProducer.isTameSpiderDestroyed();
+ assert SpiderProducer.isDeadliestSpiderDestroyed();
}
@Test
Modified: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/enterprise/lifecycle/EnterpriseBeanLifecycleTest.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/enterprise/lifecycle/EnterpriseBeanLifecycleTest.java 2009-10-16 00:17:50 UTC (rev 4130)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/enterprise/lifecycle/EnterpriseBeanLifecycleTest.java 2009-10-16 02:59:08 UTC (rev 4131)
@@ -44,7 +44,7 @@
@SpecAssertions( {
@SpecAssertion(section = "7.3.2", id = "aa"),
@SpecAssertion(section = "7.3.2", id = "bb"),
- @SpecAssertion(section = "7.3.3", id = "b"),
+ //@SpecAssertion(section = "7.3.3", id = "b"),
@SpecAssertion(section = "6.5.3", id = "b"),
@SpecAssertion(section = "12.1", id="bba")
})
@@ -103,6 +103,7 @@
Context requestContext = getCurrentManager().getContext(RequestScoped.class);
CreationalContext<KleinStadt> creationalContext = getCurrentManager().createCreationalContext(stadtBean);
KleinStadt kassel = stadtBean.create(creationalContext);
+ assert requestContext.get(stadtBean) != null : "bean exists in request context";
kassel.ping();
stadtBean.destroy(kassel, creationalContext);
@@ -119,6 +120,7 @@
})
public void testRemovedEjbIgnored()
{
+ assert false;
KleinStadt stadtInstance = getInstanceByType(KleinStadt.class, new AnnotationLiteral<Important>() {});
assert stadtInstance != null : "Expected instance to be created by container";
stadtInstance.setName("Kassel-Wilhelmshoehe");
@@ -131,7 +133,8 @@
}
@Test(groups = { "enterpriseBeans", "lifecycle", "integration" })
- @SpecAssertion(section = "7.3.3", id = "a")
+ @SpecAssertions({
+ @SpecAssertion(section = "7.3.3", id = "b")})
public void testCreateSLSB()
{
Bean<NeueStadt> stadtBean = getBeans(NeueStadt.class).iterator().next();
@@ -145,6 +148,16 @@
assert interfaces.contains(NeueStadt.class);
assert interfaces.contains(GeschichtslosStadt.class);
}
+
+ @Test(groups = { "enterpriseBeans", "clientProxy", "lifecycle", "integration" })
+ @SpecAssertions({
+ @SpecAssertion(section = "7.3.3", id = "c")
+ })
+ public void testDestroyDiscardsSLSB() throws Exception
+ {
+ // stub for test
+ assert false;
+ }
@Test(groups = { "enterpriseBeans", "lifecycle", "integration" })
@SpecAssertion(section = "3.9.2", id = "b")
Modified: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/enterprise/lifecycle/Giessen.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/enterprise/lifecycle/Giessen.java 2009-10-16 00:17:50 UTC (rev 4130)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/enterprise/lifecycle/Giessen.java 2009-10-16 02:59:08 UTC (rev 4131)
@@ -1,5 +1,9 @@
package org.jboss.jsr299.tck.tests.implementation.enterprise.lifecycle;
+
+import javax.ejb.Stateless;
+
+ at Stateless
public class Giessen implements NeueStadt, GeschichtslosStadt
{
Modified: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/field/lifecycle/ProducerFieldLifecycleTest.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/field/lifecycle/ProducerFieldLifecycleTest.java 2009-10-16 00:17:50 UTC (rev 4130)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/field/lifecycle/ProducerFieldLifecycleTest.java 2009-10-16 02:59:08 UTC (rev 4131)
@@ -1,6 +1,10 @@
package org.jboss.jsr299.tck.tests.implementation.producer.field.lifecycle;
import javax.enterprise.inject.IllegalProductException;
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.BeanManager;
+import javax.enterprise.inject.AnnotationLiteral;
+import javax.enterprise.context.spi.CreationalContext;
import org.jboss.jsr299.tck.AbstractJSR299Test;
import org.jboss.test.audit.annotations.SpecAssertion;
@@ -15,7 +19,9 @@
@SpecVersion(spec="cdi", version="PFD2")
public class ProducerFieldLifecycleTest extends AbstractJSR299Test
{
-
+ private AnnotationLiteral<Null> NULL_LITERAL = new AnnotationLiteral<Null>() {};
+ private AnnotationLiteral<Broken> BROKEN_LITERAL = new AnnotationLiteral<Broken>() {};
+
@Test(groups = { "producerField" })
@SpecAssertions({
@SpecAssertion(section = "3.4", id = "aa") // removed from spec
@@ -69,7 +75,20 @@
NullSpiderConsumer consumerBean = getInstanceByType(NullSpiderConsumer.class);
assert consumerBean.getInjectedSpider() == null;
}
+
+ @Test(groups = { "producerField" }, expectedExceptions = IllegalProductException.class)
+ @SpecAssertions({
+ @SpecAssertion(section = "7.3.5", id = "n")
+ })
+ public void testProducerFieldForNullValueNotDependent() throws Exception {
+ Bean<BlackWidow> spiderBean = getBeans(BlackWidow.class, NULL_LITERAL, BROKEN_LITERAL).iterator().next();
+ CreationalContext<BlackWidow> spiderContext = getCurrentManager().createCreationalContext(spiderBean);
+ spiderBean.create(spiderContext);
+
+ assert false;
+ }
+
@Test(groups = { "producerField" }, expectedExceptions = IllegalProductException.class)
@SpecAssertions({
@SpecAssertion(section = "3.4", id = "e"),
Modified: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/lifecycle/Lays.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/lifecycle/Lays.java 2009-10-16 00:17:50 UTC (rev 4130)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/lifecycle/Lays.java 2009-10-16 02:59:08 UTC (rev 4131)
@@ -5,8 +5,8 @@
class Lays
{
- public @Produces @RequestScoped PotatoChip makeChip()
- {
+ public @Produces @Null @RequestScoped PotatoChip makeChip()
+ {
return null;
}
}
Modified: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/lifecycle/ProducerMethodLifecycleTest.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/lifecycle/ProducerMethodLifecycleTest.java 2009-10-16 00:17:50 UTC (rev 4130)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/lifecycle/ProducerMethodLifecycleTest.java 2009-10-16 02:59:08 UTC (rev 4131)
@@ -105,18 +105,9 @@
})
public void testCreateFailsIfProducerReturnsNullAndNotDependent()
{
- // QUESTION is there an easier way to get the producer method bean instead of the top-level (dependent) type?
- Bean<PotatoChip> potatoChipBean = null;
- for (Bean<PotatoChip> candidate : getBeans(PotatoChip.class))
- {
- if (candidate.getScope().equals(RequestScoped.class))
- {
- potatoChipBean = candidate;
- break;
- }
- }
-
+ Bean<PotatoChip> potatoChipBean = getBeans(PotatoChip.class, NULL_LITERAL).iterator().next();
assert potatoChipBean != null;
+
CreationalContext<PotatoChip> chipCc = getCurrentManager().createCreationalContext(potatoChipBean);
potatoChipBean.create(chipCc);
assert false;
Modified: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/simple/lifecycle/SimpleBeanLifecycleTest.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/simple/lifecycle/SimpleBeanLifecycleTest.java 2009-10-16 00:17:50 UTC (rev 4130)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/simple/lifecycle/SimpleBeanLifecycleTest.java 2009-10-16 02:59:08 UTC (rev 4131)
@@ -173,7 +173,11 @@
{
assert getBeans(TunaFarm.class).size() == 1;
TunaFarm tunaFarm = getInstanceByType(TunaFarm.class);
- assert tunaFarm.tuna != null;
+ assert tunaFarm.tuna != null;
+ assert tunaFarm.tuna.getName().equals("Ophir");
+
+ assert tunaFarm.qualifiedTuna != null;
+ assert tunaFarm.qualifiedTuna.getName().equals("qualifiedTuna");
}
@Test(groups = "beanLifecycle")
Modified: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/simple/lifecycle/Tuna.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/simple/lifecycle/Tuna.java 2009-10-16 00:17:50 UTC (rev 4130)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/simple/lifecycle/Tuna.java 2009-10-16 02:59:08 UTC (rev 4131)
@@ -5,7 +5,6 @@
@RequestScoped
class Tuna
{
-
public String getName()
{
return "Ophir";
Modified: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/simple/lifecycle/TunaFarm.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/simple/lifecycle/TunaFarm.java 2009-10-16 00:17:50 UTC (rev 4130)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/simple/lifecycle/TunaFarm.java 2009-10-16 02:59:08 UTC (rev 4131)
@@ -9,7 +9,11 @@
@Inject
public Tuna tuna;
+
+ @SuppressWarnings("unused")
+ @Inject @Tame
+ public Tuna qualifiedTuna;
+
public Tuna notInjectedTuna = new Tuna();
-
}
Modified: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/InterceptorDefinitionTest.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/InterceptorDefinitionTest.java 2009-10-16 00:17:50 UTC (rev 4130)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/InterceptorDefinitionTest.java 2009-10-16 02:59:08 UTC (rev 4131)
@@ -20,14 +20,15 @@
import java.lang.annotation.Annotation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Target;
+import java.lang.reflect.AnnotatedElement;
import java.lang.reflect.Type;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
-import java.util.ArrayList;
import javax.enterprise.inject.AnnotationLiteral;
+import javax.enterprise.inject.spi.Bean;
import javax.enterprise.inject.spi.InterceptionType;
import javax.enterprise.inject.spi.Interceptor;
@@ -36,8 +37,6 @@
import org.jboss.test.audit.annotations.SpecAssertions;
import org.jboss.test.audit.annotations.SpecVersion;
import org.jboss.testharness.impl.packaging.Artifact;
-import org.jboss.testharness.impl.packaging.jsr299.BeansXml;
-
import org.testng.annotations.Test;
/**
@@ -45,24 +44,23 @@
* their execution.
*
* @author David Allen
- * @author Marius Bogoevici
+ *
*/
@Artifact
- at SpecVersion(spec = "cdi", version = "PFD2")
- at BeansXml("beans.xml")
+ at SpecVersion(spec="cdi", version="PFD2")
public class InterceptorDefinitionTest extends AbstractJSR299Test
{
- @Test
+ @Test(groups = "ri-broken")
@SpecAssertions({
- @SpecAssertion(section = "11.1.2", id = "a")
+ @SpecAssertion(section = "11.1.2", id = "a")
})
// WBRI-59
public void testInterceptorsImplementInterceptorInterface()
{
boolean interfaceFound = false;
- for (Type type : getInterfacesImplemented(getTransactionalInterceptor().getClass()))
+ for (Type type : getInterfacesImplemented(getBeans(TransactionalInterceptor.class).iterator().next().getClass()))
{
- if (type instanceof ParameterizedTypeImpl && ((ParameterizedTypeImpl)type).getRawType().equals(Interceptor.class))
+ if (type.equals(Interceptor.class))
{
interfaceFound = true;
break;
@@ -70,28 +68,35 @@
}
assert interfaceFound;
}
-
- @Test
+
+ private Set<Type> getInterfacesImplemented(Class<?> clazz)
+ {
+ Set<Type> interfaces = new HashSet<Type>();
+ interfaces.addAll(new HierarchyDiscovery(clazz).getFlattenedTypes());
+ return interfaces;
+ }
+
+ @Test(groups = "ri-broken")
@SpecAssertions({
- @SpecAssertion(section = "11.1.2", id = "b")
+ @SpecAssertion(section = "11.1.2", id = "b")
})
// WBRI-59
public void testInterceptorBindingTypes()
{
- Interceptor<?> interceptorBean = getTransactionalInterceptor();
+ Interceptor<?> interceptorBean = (Interceptor<?>) getBeans(TransactionalInterceptor.class).iterator().next();
assert interceptorBean.getInterceptorBindingTypes().size() == 1;
- assert interceptorBean.getInterceptorBindingTypes().contains(new AnnotationLiteral<Transactional>(){});
+ assert interceptorBean.getInterceptorBindingTypes().contains(Transactional.class);
}
- @Test
+ @Test(groups = "ri-broken")
@SpecAssertions({
- @SpecAssertion(section = "11.1.2", id = "c"),
- @SpecAssertion(section = "11.1.2", id = "e")
+ @SpecAssertion(section = "11.1.2", id = "c"),
+ @SpecAssertion(section = "11.1.2", id = "e")
})
// WBRI-59
public void testInterceptionType()
{
- Interceptor<?> interceptorBean = getTransactionalInterceptor();
+ Interceptor<?> interceptorBean = (Interceptor<?>) getBeans(TransactionalInterceptor.class).iterator().next();
assert interceptorBean.intercepts(InterceptionType.AROUND_INVOKE);
assert !interceptorBean.intercepts(InterceptionType.POST_ACTIVATE);
assert !interceptorBean.intercepts(InterceptionType.POST_CONSTRUCT);
@@ -99,61 +104,24 @@
assert !interceptorBean.intercepts(InterceptionType.PRE_PASSIVATE);
}
- @Test
+ @Test(groups = "ri-broken")
@SpecAssertion(section = "11.1.2", id = "f")
// WBRI-59
public void testInstanceOfInterceptorForEveryEnabledInterceptor()
{
- List<AnnotationLiteral<?>> annotationLiterals = Arrays.<AnnotationLiteral<?>>asList(
- new AnnotationLiteral<Transactional>(){},
- new AnnotationLiteral<Secure>(){},
- new AnnotationLiteral<MissileBinding>(){},
- new AnnotationLiteral<Logged>(){});
-
- List<Class<?>> interceptorClasses = new ArrayList<Class<?>>(Arrays.<Class<?>>asList(
- AtomicInterceptor.class,
- MissileInterceptor.class,
- SecureInterceptor.class,
- TransactionalInterceptor.class,
- NetworkLogger.class,
- FileLogger.class,
- NotEnabledAtomicInterceptor.class
- ));
-
- for (AnnotationLiteral<?> annotationLiteral: annotationLiterals)
- {
- List<Interceptor<?>> interceptors = getCurrentManager().resolveInterceptors(InterceptionType.AROUND_INVOKE, annotationLiteral);
- for (Interceptor<?> interceptor: interceptors)
- {
- interceptorClasses.remove(interceptor.getBeanClass());
- }
- }
-
- List<Interceptor<?>> interceptors = getCurrentManager().resolveInterceptors(InterceptionType.AROUND_INVOKE,
- new AnnotationLiteral<Atomic>(){},
- new AnnotationLiteral<MissileBinding>(){});
- for (Interceptor<?> interceptor : interceptors)
- {
- interceptorClasses.remove(interceptor.getBeanClass());
- }
-
- assert interceptorClasses.size() == 1;
- assert interceptorClasses.get(0).equals(NotEnabledAtomicInterceptor.class);
+ assert !getBeans(TransactionalInterceptor.class).isEmpty();
+ assert !getBeans(SecureInterceptor.class).isEmpty();
}
- @Test
+ @Test(groups = "ri-broken")
@SpecAssertions({
- @SpecAssertion(section = "11.3.12", id = "a")
+ @SpecAssertion(section = "11.3.12", id = "a")
})
// WBRI-59
public void testResolveInterceptorsReturnsOrderedList()
{
- Annotation transactionalBinding = new AnnotationLiteral<Transactional>()
- {
- };
- Annotation secureBinding = new AnnotationLiteral<Secure>()
- {
- };
+ Annotation transactionalBinding = new AnnotationLiteral<Transactional>() {};
+ Annotation secureBinding = new AnnotationLiteral<Secure>() {};
List<Interceptor<?>> interceptors = getCurrentManager().resolveInterceptors(
InterceptionType.AROUND_INVOKE,
transactionalBinding,
@@ -161,158 +129,126 @@
);
assert interceptors.size() == 2;
assert interceptors.get(0).getInterceptorBindingTypes().size() == 1;
- assert interceptors.get(0).getInterceptorBindingTypes().contains(secureBinding);
+ assert interceptors.get(0).getInterceptorBindingTypes().contains(transactionalBinding);
assert interceptors.get(1).getInterceptorBindingTypes().size() == 1;
- assert interceptors.get(1).getInterceptorBindingTypes().contains(transactionalBinding);
+ assert interceptors.get(1).getInterceptorBindingTypes().contains(secureBinding);
}
-
- @Test(expectedExceptions = {IllegalArgumentException.class})
+
+ @Test(groups = "ri-broken")
@SpecAssertions({
- @SpecAssertion(section = "11.3.12", id = "b")
+ @SpecAssertion(section = "11.3.12", id = "b")
})
// WBRI-59
public void testSameBindingTypesToResolveInterceptorsFails()
{
- Annotation transactionalBinding = new AnnotationLiteral<Transactional>()
- {
- };
+ Annotation transactionalBinding = new AnnotationLiteral<Transactional>() {};
getCurrentManager().resolveInterceptors(InterceptionType.AROUND_INVOKE, transactionalBinding, transactionalBinding);
}
-
- @Test(expectedExceptions = {IllegalArgumentException.class})
+
+ @Test(groups = "ri-broken")
@SpecAssertions({
- @SpecAssertion(section = "11.3.12", id = "c")
+ @SpecAssertion(section = "11.3.12", id = "c")
})
// WBRI-59
public void testNoBindingTypesToResolveInterceptorsFails()
{
getCurrentManager().resolveInterceptors(InterceptionType.AROUND_INVOKE);
}
-
- @Test(expectedExceptions = {IllegalArgumentException.class})
+
+ @Test(groups = "ri-broken")
@SpecAssertions({
- @SpecAssertion(section = "11.3.12", id = "d")
+ @SpecAssertion(section = "11.3.12", id = "d")
})
// WBRI-59
public void testNonBindingTypeToResolveInterceptorsFails()
{
- Annotation nonBinding = new AnnotationLiteral<NonBindingType>()
- {
- };
+ Annotation nonBinding = new AnnotationLiteral<NonBindingType>() {};
getCurrentManager().resolveInterceptors(InterceptionType.AROUND_INVOKE, nonBinding);
}
-
- @Test
+
+ @Test(groups = "ri-broken")
@SpecAssertions({
- @SpecAssertion(section = "7.2", id = "a"),
- @SpecAssertion(section = "9.2", id = "a"),
- @SpecAssertion(section = "12.3", id = "kb")
+ @SpecAssertion(section = "7.2", id = "a"),
+ @SpecAssertion(section = "9.2", id = "a"),
+ @SpecAssertion(section = "12.3", id = "kb")
})
public void testManagedBeanIsIntercepted()
{
MissileInterceptor.intercepted = false;
-
+
Missile missile = getInstanceByType(Missile.class);
missile.fire();
-
+
assert MissileInterceptor.intercepted;
}
-
+
@Test
@SpecAssertion(section = "7.2", id = "a1")
public void testInitializerMethodsNotIntercepted()
{
MissileInterceptor.intercepted = false;
-
- getInstanceByType(Missile.class);
-
+
+ Missile missile = getInstanceByType(Missile.class);
+ assert missile.initCalled;
assert !MissileInterceptor.intercepted;
}
-
- @Test
+
+ @Test(groups = "ri-broken")
@SpecAssertion(section = "7.2", id = "ia")
public void testProducerMethodsAreIntercepted()
{
MissileInterceptor.intercepted = false;
-
+
getInstanceByType(Wheat.class);
-
+
assert MissileInterceptor.intercepted;
}
-
- @Test
+
+ @Test(groups = "ri-broken")
@SpecAssertions({
- @SpecAssertion(section = "9.1", id = "a"),
- @SpecAssertion(section = "9.1", id = "b"),
- @SpecAssertion(section = "9.1", id = "c"),
- @SpecAssertion(section = "9.3", id = "a")
+ @SpecAssertion(section = "9.1", id = "a"),
+ @SpecAssertion(section = "9.1", id = "b"),
+ @SpecAssertion(section = "9.1", id = "c"),
+ @SpecAssertion(section = "9.3", id = "a")
})
public void testInterceptorBindingAnnotation()
- {
- Interceptor<?> interceptorBean = getLoggedInterceptors().iterator().next();
+ {
+ Interceptor<?> interceptorBean = (Interceptor<?>) getBeans(FileLogger.class).iterator().next();
assert interceptorBean.getInterceptorBindingTypes().size() == 1;
- assert interceptorBean.getInterceptorBindingTypes().contains(new AnnotationLiteral<Logged>(){});
+ assert interceptorBean.getInterceptorBindingTypes().contains(Logged.class);
- Target target = (interceptorBean.getInterceptorBindingTypes().iterator().next()).annotationType().getAnnotation(Target.class);
+ Target target = ((AnnotatedElement) interceptorBean.getInterceptorBindingTypes().iterator().next()).getAnnotation(Target.class);
List<ElementType> elements = Arrays.asList(target.value());
assert elements.contains(ElementType.TYPE);
- assert elements.contains(ElementType.METHOD);
+ assert elements.contains(ElementType.METHOD);
}
-
- @Test
+
+ @Test(groups = "ri-broken")
@SpecAssertions({
- @SpecAssertion(section = "9.1.2", id = "a"),
- @SpecAssertion(section = "9.1.2", id = "b"),
- @SpecAssertion(section = "2.7.1.2", id = "b")
+ @SpecAssertion(section = "9.1.2", id = "a"),
+ @SpecAssertion(section = "9.1.2", id = "b"),
+ @SpecAssertion(section = "2.7.1.2", id = "b")
})
public void testStereotypeInterceptorBindings()
- {
- FileLogger.intercepted = false;
- NetworkLogger.intercepted = false;
-
- SecureTransaction secureTransaction = getInstanceByType(SecureTransaction.class);
- secureTransaction.transact();
-
- assert FileLogger.intercepted;
- assert NetworkLogger.intercepted;
+ {
+ Bean<SecureTransaction> bean = getBeans(SecureTransaction.class).iterator().next();
+ assert bean.getQualifiers().contains(Logged.class);
}
-
- @Test
+
+ @Test(groups = "ri-broken")
@SpecAssertions({
- @SpecAssertion(section = "9.1.1", id = "a"),
- @SpecAssertion(section = "9.1.1", id = "b")
+ @SpecAssertion(section = "9.1.1", id = "a"),
+ @SpecAssertion(section = "9.1.1", id = "b")
})
public void testInterceptorBindingsCanDeclareOtherInterceptorBindings()
{
AtomicInterceptor.intercepted = false;
MissileInterceptor.intercepted = false;
-
+
AtomicFoo foo = getInstanceByType(AtomicFoo.class);
foo.doAction();
-
+
assert AtomicInterceptor.intercepted;
assert MissileInterceptor.intercepted;
}
-
- private Interceptor<?> getTransactionalInterceptor()
- {
- return getCurrentManager().resolveInterceptors(InterceptionType.AROUND_INVOKE, new AnnotationLiteral<Transactional>()
- {
- }).iterator().next();
- }
-
- private List<Interceptor<?>> getLoggedInterceptors()
- {
- return getCurrentManager().resolveInterceptors(InterceptionType.AROUND_INVOKE, new AnnotationLiteral<Logged>()
- {
- });
- }
-
- private Set<Type> getInterfacesImplemented(Class<?> clazz)
- {
- Set<Type> interfaces = new HashSet<Type>();
- interfaces.addAll(new HierarchyDiscovery(clazz).getFlattenedTypes());
- return interfaces;
- }
-
}
Modified: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/Missile.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/Missile.java 2009-10-16 00:17:50 UTC (rev 4130)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/Missile.java 2009-10-16 02:59:08 UTC (rev 4131)
@@ -5,8 +5,16 @@
@MissileBinding
class Missile
{
+ boolean initCalled = false;
+
@Inject
- public void init() { }
+ public void init() {
+ initCalled = true;
+ }
+ public boolean initCalled() {
+ return initCalled;
+ }
+
public void fire() { }
}
Modified: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/ResolutionByTypeTest.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/ResolutionByTypeTest.java 2009-10-16 00:17:50 UTC (rev 4130)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/ResolutionByTypeTest.java 2009-10-16 02:59:08 UTC (rev 4131)
@@ -91,7 +91,7 @@
@SpecAssertion(section = "5.3", id = "la"),
@SpecAssertion(section = "5.3.6", id = "a"),
@SpecAssertion(section = "5.3.6", id = "d") })
- public void testAllBindingTypesSpecifiedForResolutionMustAppearOnBean()
+ public void testAllQualifiersSpecifiedForResolutionMustAppearOnBean()
{
assert getBeans(Animal.class, new ChunkyLiteral(), new AnnotationLiteral<Whitefish>()
{
@@ -209,38 +209,4 @@
assert getCurrentManager().getBeans("crabSpider").size() == 0;
}
-
- @Test
- @SpecAssertion(section = "TBD", id = "TBD")
- public void testBeanTypesOnManagedBean()
- {
- assert getBeans(Canary.class).size() == 1;
- Set<Bean<Bird>> beans = getBeans(Bird.class);
- Bean<Canary> bean = getUniqueBean(Canary.class);
- assert getBeans(Bird.class).isEmpty();
- assert bean.getTypes().size() == 1;
- assert bean.getTypes().iterator().next().equals(Canary.class);
- }
-
- @Test
- @SpecAssertion(section = "TBD", id = "TBD")
- public void testBeanTypesOnProducerMethod()
- {
- assert getBeans(Parrot.class).size() == 1;
- assert getBeans(Bird.class).isEmpty();
- Bean<Parrot> bean = getUniqueBean(Parrot.class);
- assert bean.getTypes().size() == 1;
- assert bean.getTypes().iterator().next().equals(Parrot.class);
- }
-
- @Test
- @SpecAssertion(section = "TBD", id = "TBD")
- public void testBeanTypesOnProducerField()
- {
- assert getBeans(Dove.class).size() == 1;
- assert getBeans(Bird.class).isEmpty();
- Bean<Dove> bean = getUniqueBean(Dove.class);
- assert bean.getTypes().size() == 1;
- assert bean.getTypes().iterator().next().equals(Dove.class);
- }
}
Modified: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/parameterized/AssignabilityOfRawAndParameterizedTypesTest.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/parameterized/AssignabilityOfRawAndParameterizedTypesTest.java 2009-10-16 00:17:50 UTC (rev 4130)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/parameterized/AssignabilityOfRawAndParameterizedTypesTest.java 2009-10-16 02:59:08 UTC (rev 4131)
@@ -44,7 +44,7 @@
public void testAssignabilityToRawType()
{
Set<Bean<Dao>> beans = getBeans(Dao.class);
- assert getBeans(Dao.class).size() == 3; // Dao, DaoProducer.getDao() and ObjectDao
+ assert getBeans(Dao.class).size() == 4; // Dao, DaoProducer.getDao(), DaoProducer.getRawDao and ObjectDao
}
@Test(groups= {"resolution"})
Modified: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/parameterized/DaoProducer.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/parameterized/DaoProducer.java 2009-10-16 00:17:50 UTC (rev 4130)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/parameterized/DaoProducer.java 2009-10-16 02:59:08 UTC (rev 4131)
@@ -31,4 +31,9 @@
return new Dao<Object, Object>();
}
+ @SuppressWarnings("unchecked")
+ @Produces Dao getRawDao() {
+ return getDao();
+ }
+
}
Modified: cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/decorators/invocation/beans.xml
===================================================================
--- cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/decorators/invocation/beans.xml 2009-10-16 00:17:50 UTC (rev 4130)
+++ cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/decorators/invocation/beans.xml 2009-10-16 02:59:08 UTC (rev 4131)
@@ -3,5 +3,6 @@
<class>org.jboss.jsr299.tck.tests.decorators.invocation.TimestampLogger</class>
<class>org.jboss.jsr299.tck.tests.decorators.invocation.FooDecorator1</class>
<class>org.jboss.jsr299.tck.tests.decorators.invocation.FooDecorator2</class>
+ <class>org.jboss.jsr299.tck.tests.decorators.invocation.PigStyDecorator</class>
</decorators>
</beans>
More information about the weld-commits
mailing list