Author: dallen6
Date: 2009-07-21 18:21:05 -0400 (Tue, 21 Jul 2009)
New Revision: 3121
Added:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/dependent/Pet.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/field/definition/Pet.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/field/lifecycle/Tame.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/lifecycle/Pet.java
Removed:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/field/definition/TameAnnotationLiteral.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/inheritance/specialization/enterprise/broken/samePrecedence/
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/inheritance/specialization/producer/method/broken/lowerPrecedence/
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/inheritance/specialization/simple/broken/precedence/
Modified:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/dependent/DependentContextTest.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/dependent/SpiderProducer.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/definition/DecoratorDefinitionTest.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/disposal/method/definition/DefangedTarantula.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/disposal/method/definition/DisposalMethodDefinitionTest.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/disposal/method/definition/SpiderProducer.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/field/definition/OtherSpiderProducer.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/field/definition/ProducerFieldDefinitionTest.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/field/definition/TarantulaProducer.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/field/lifecycle/BlackWidowConsumer.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/field/lifecycle/BlackWidowProducer.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/field/lifecycle/TarantulaConsumer.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/field/lifecycle/TarantulaProducer.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/lifecycle/Lays.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/lifecycle/ProducerMethodLifecycleTest.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/lifecycle/SpiderProducer.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/simple/lifecycle/SimpleBeanLifecycleTest.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/inheritance/specialization/enterprise/EnterpriseBeanSpecializationTest.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/inheritance/specialization/producer/method/JewelryShop.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/inheritance/specialization/producer/method/ProducerMethodSpecializationTest.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/inheritance/specialization/producer/method/Shop.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/inheritance/specialization/simple/SimpleBeanSpecializationTest.java
Log:
Fixed remaining broken tests due to bean specialization changes in the spec
Modified:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/dependent/DependentContextTest.java
===================================================================
---
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/dependent/DependentContextTest.java 2009-07-21
22:13:24 UTC (rev 3120)
+++
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/dependent/DependentContextTest.java 2009-07-21
22:21:05 UTC (rev 3121)
@@ -27,6 +27,7 @@
{
private static final Annotation TAME_LITERAL = new AnnotationLiteral<Tame> ()
{};
+ private static final Annotation PET_LITERAL = new AnnotationLiteral<Pet> () {};
@Test(groups = { "contexts", "injection" })
@SpecAssertion(section = "6.4", id = "a")
@@ -65,7 +66,7 @@
@SpecAssertion(section = "6.4", id = "da")
public void testInstanceUsedForProducerMethodNotShared() throws Exception
{
- Bean<Tarantula> tarantulaBean = getBeans(Tarantula.class).iterator().next();
+ Bean<Tarantula> tarantulaBean = getBeans(Tarantula.class,
PET_LITERAL).iterator().next();
CreationalContext<Tarantula> creationalContext =
getCurrentManager().createCreationalContext(tarantulaBean);
Tarantula tarantula = tarantulaBean.create(creationalContext);
@@ -90,96 +91,59 @@
@Test(groups = { "contexts", "disposalMethod" })
@SpecAssertion(section = "6.4", id = "dc")
- public void testInstanceUsedForDisposalMethodNotShared() throws Exception
+ public void testInstanceUsedForDisposalMethodNotShared()
{
- new RunInDependentContext()
- {
-
- @Override
- protected void execute() throws Exception
- {
- SpiderProducer spiderProducer = getInstanceByType(SpiderProducer.class);
- Bean<Tarantula> tarantulaBean =
getBeans(Tarantula.class).iterator().next();
- CreationalContext<Tarantula> creationalContext =
getCurrentManager().createCreationalContext(tarantulaBean);
- Tarantula tarantula = tarantulaBean.create(creationalContext);
- assert tarantula != null;
- tarantulaBean.destroy(tarantula, creationalContext);
- assert SpiderProducer.getInstanceUsedForDisposal() != null;
- assert SpiderProducer.getInstanceUsedForDisposal() != spiderProducer;
- }
-
- }.run();
+ SpiderProducer spiderProducer = getInstanceByType(SpiderProducer.class);
+ Bean<Tarantula> tarantulaBean = getBeans(Tarantula.class).iterator().next();
+ CreationalContext<Tarantula> creationalContext =
getCurrentManager().createCreationalContext(tarantulaBean);
+ Tarantula tarantula = tarantulaBean.create(creationalContext);
+ assert tarantula != null;
+ tarantulaBean.destroy(tarantula, creationalContext);
+ assert SpiderProducer.getInstanceUsedForDisposal() != null;
+ assert SpiderProducer.getInstanceUsedForDisposal() != spiderProducer;
}
@Test(groups = { "contexts", "observerMethod" })
@SpecAssertion(section = "6.4", id = "dd")
- public void testInstanceUsedForObserverMethodNotShared() throws Exception
+ public void testInstanceUsedForObserverMethodNotShared()
{
- new RunInDependentContext()
- {
-
- @Override
- protected void execute() throws Exception
- {
- HorseStable firstStableInstance = getInstanceByType(HorseStable.class);
- getCurrentManager().fireEvent(new HorseInStableEvent());
- assert HorseStable.getInstanceThatObservedEvent() != null;
- assert HorseStable.getInstanceThatObservedEvent() != firstStableInstance;
- }
-
- }.run();
+ HorseStable firstStableInstance = getInstanceByType(HorseStable.class);
+ getCurrentManager().fireEvent(new HorseInStableEvent());
+ assert HorseStable.getInstanceThatObservedEvent() != null;
+ assert HorseStable.getInstanceThatObservedEvent() != firstStableInstance;
}
@Test(groups = "contexts")
@SpecAssertion(section = "6.4", id = "e")
- public void testContextGetWithCreationalContextReturnsNewInstance() throws Exception
+ public void testContextGetWithCreationalContextReturnsNewInstance()
{
- new RunInDependentContext()
- {
-
- @Override
- protected void execute() throws Exception
- {
- Set<Bean<Fox>> foxBeans = getBeans(Fox.class);
- assert foxBeans.size() == 1;
- Bean<Fox> foxBean = foxBeans.iterator().next();
- Context context = getCurrentManager().getContext(Dependent.class);
- assert context.get(foxBean, new MockCreationalContext<Fox>()) != null;
- assert context.get(foxBean, new MockCreationalContext<Fox>())
instanceof Fox;
- }
-
- }.run();
+ Set<Bean<Fox>> foxBeans = getBeans(Fox.class);
+ assert foxBeans.size() == 1;
+ Bean<Fox> foxBean = foxBeans.iterator().next();
+ Context context = getCurrentManager().getContext(Dependent.class);
+ assert context.get(foxBean, new MockCreationalContext<Fox>()) != null;
+ assert context.get(foxBean, new MockCreationalContext<Fox>()) instanceof
Fox;
}
@Test(groups = "contexts")
@SpecAssertion(section = "6.4", id = "f")
- public void testContextGetWithCreateFalseReturnsNull() throws Exception
+ public void testContextGetWithCreateFalseReturnsNull()
{
- new RunInDependentContext()
- {
-
- @Override
- protected void execute() throws Exception
- {
- Set<Bean<Fox>> foxBeans = getBeans(Fox.class);
- assert foxBeans.size() == 1;
- Bean<Fox> foxBean = foxBeans.iterator().next();
- Context context = getCurrentManager().getContext(Dependent.class);
- assert context.get(foxBean, null) == null;
- }
-
- }.run();
+ Set<Bean<Fox>> foxBeans = getBeans(Fox.class);
+ assert foxBeans.size() == 1;
+ Bean<Fox> foxBean = foxBeans.iterator().next();
+ Context context = getCurrentManager().getContext(Dependent.class);
+ assert context.get(foxBean, null) == null;
}
- @Test(groups = { "contexts", "ri-broken" }, expectedExceptions =
ContextNotActiveException.class)
+ @Test(groups = { "contexts" })
@SpecAssertions({
@SpecAssertion(section = "6.2", id = "ha"),
- @SpecAssertion(section = "6.4", id = "g") // Dependent context
is now always active
+ @SpecAssertion(section = "6.4", id = "g")
})
public void testContextIsInactive()
{
- // The RI test harness is broken here, it just enables the dependent context
blindly
- getCurrentManager().getContext(Dependent.class);
+ assert getCurrentManager().getContext(Dependent.class).isActive();
}
@Test(groups = { "contexts", "producerMethod" })
@@ -213,7 +177,7 @@
})
public void testContextIsActiveWhenInvokingDisposalMethod()
{
- Bean<Tarantula> tarantulaBean = getBeans(Tarantula.class).iterator().next();
+ Bean<Tarantula> tarantulaBean = getBeans(Tarantula.class,
PET_LITERAL).iterator().next();
CreationalContext<Tarantula> creationalContext =
getCurrentManager().createCreationalContext(tarantulaBean);
Tarantula tarantula = tarantulaBean.create(creationalContext);
assert tarantula != null;
@@ -232,38 +196,22 @@
@Test(groups = { "contexts", "el" })
@SpecAssertion(section = "6.4", id = "g") // Dependent context is
now always active
- public void testContextIsActiveWhenEvaluatingElExpression() throws Exception
+ public void testContextIsActiveWhenEvaluatingElExpression()
{
SensitiveFox.setManager(getCurrentManager());
- new RunInDependentContext()
- {
- @Override
- protected void execute() throws Exception
- {
- String foxName =
getCurrentConfiguration().getEl().evaluateMethodExpression("#{sensitiveFox.getName}",
String.class, new Class[0], new Object[0]);
- assert foxName != null;
- assert SensitiveFox.isDependentContextActiveDuringEval();
- }
- }.run();
+ String foxName =
getCurrentConfiguration().getEl().evaluateMethodExpression("#{sensitiveFox.getName}",
String.class, new Class[0], new Object[0]);
+ assert foxName != null;
+ assert SensitiveFox.isDependentContextActiveDuringEval();
}
@Test(groups = { "contexts", "beanLifecycle" })
@SpecAssertion(section = "6.4", id = "g") // Dependent context is
now always active
- public void testContextIsActiveDuringBeanCreation() throws Exception
+ public void testContextIsActiveDuringBeanCreation()
{
SensitiveFox.setManager(getCurrentManager());
- new RunInDependentContext()
- {
-
- @Override
- protected void execute() throws Exception
- {
- SensitiveFox fox1 = getInstanceByType(SensitiveFox.class);
- assert fox1 != null;
- assert fox1.isDependentContextActiveDuringCreate();
- }
-
- }.run();
+ SensitiveFox fox1 = getInstanceByType(SensitiveFox.class);
+ assert fox1 != null;
+ assert fox1.isDependentContextActiveDuringCreate();
}
@Test(groups = { "contexts", "injection" })
@@ -280,27 +228,18 @@
@SpecAssertion(section = "6.4.2", id = "aaa"),
@SpecAssertion(section = "6.4", id = "b")
})
- public void testDestroyingSimpleParentDestroysDependents() throws Exception
+ public void testDestroyingSimpleParentDestroysDependents()
{
- new RunInDependentContext()
- {
-
- @Override
- protected void execute() throws Exception
- {
- assert getBeans(Farm.class).size() == 1;
- Bean<Farm> farmBean = getBeans(Farm.class).iterator().next();
- CreationalContext<Farm> creationalContext =
getCurrentManager().createCreationalContext(farmBean);
- Farm farm = farmBean.create(creationalContext);
- farm.open();
- Stable.destroyed = false;
- Horse.destroyed = false;
- farmBean.destroy(farm, creationalContext);
- assert Stable.destroyed;
- assert Horse.destroyed;
- }
-
- }.run();
+ assert getBeans(Farm.class).size() == 1;
+ Bean<Farm> farmBean = getBeans(Farm.class).iterator().next();
+ CreationalContext<Farm> creationalContext =
getCurrentManager().createCreationalContext(farmBean);
+ Farm farm = farmBean.create(creationalContext);
+ farm.open();
+ Stable.destroyed = false;
+ Horse.destroyed = false;
+ farmBean.destroy(farm, creationalContext);
+ assert Stable.destroyed;
+ assert Horse.destroyed;
}
@Test(groups = { "contexts", "beanDestruction"})
@@ -308,130 +247,84 @@
@SpecAssertion(section = "6.4.2", id = "aaa"),
@SpecAssertion(section = "6.4", id = "b")
})
- public void testDestroyingManagedParentDestroysDependentsOfSameBean() throws
Exception
+ public void testDestroyingManagedParentDestroysDependentsOfSameBean()
{
- new RunInDependentContext()
- {
+ // Reset test class
+ Fox.setDestroyed(false);
+ Fox.setDestroyCount(0);
- @Override
- protected void execute() throws Exception
- {
- // Reset test class
- Fox.setDestroyed(false);
- Fox.setDestroyCount(0);
-
- assert getCurrentManager().getBeans(FoxRun.class).size() == 1;
- Bean<FoxRun> bean = getBeans(FoxRun.class).iterator().next();
- CreationalContext<FoxRun> creationalContext =
getCurrentManager().createCreationalContext(bean);
- FoxRun instance = bean.create(creationalContext);
- assert instance.fox != instance.anotherFox;
- bean.destroy(instance, creationalContext);
- assert Fox.isDestroyed();
- assert Fox.getDestroyCount() == 2;
- }
-
- }.run();
+ assert getCurrentManager().getBeans(FoxRun.class).size() == 1;
+ Bean<FoxRun> bean = getBeans(FoxRun.class).iterator().next();
+ CreationalContext<FoxRun> creationalContext =
getCurrentManager().createCreationalContext(bean);
+ FoxRun instance = bean.create(creationalContext);
+ assert instance.fox != instance.anotherFox;
+ bean.destroy(instance, creationalContext);
+ assert Fox.isDestroyed();
+ assert Fox.getDestroyCount() == 2;
}
@Test(groups = { "contexts", "el"})
@SpecAssertion(section = "6.4.2", id = "eee")
public void testDependentsDestroyedWhenElEvaluationCompletes() throws Exception
{
- new RunInDependentContext()
- {
- @Override
- protected void execute() throws Exception
- {
- // Reset test class
- Fox.setDestroyed(false);
- FoxRun.setDestroyed(false);
-
-
getCurrentConfiguration().getEl().evaluateValueExpression("#{foxRun}",
FoxRun.class);
- assert FoxRun.isDestroyed();
- assert Fox.isDestroyed();
- }
- }.run();
+ // Reset test class
+ Fox.setDestroyed(false);
+ FoxRun.setDestroyed(false);
+
+ getCurrentConfiguration().getEl().evaluateValueExpression("#{foxRun}",
FoxRun.class);
+ assert FoxRun.isDestroyed();
+ assert Fox.isDestroyed();
}
@Test(groups = { "contexts", "producerMethod" })
@SpecAssertion(section = "6.4.2", id = "ddd")
- public void testDependentsDestroyedWhenProducerMethodCompletes() throws Exception
+ public void testDependentsDestroyedWhenProducerMethodCompletes()
{
// Reset the test class
SpiderProducer.setDestroyed(false);
- Tarantula spiderInstance = getInstanceByType(Tarantula.class);
+ Tarantula spiderInstance = getInstanceByType(Tarantula.class, PET_LITERAL);
spiderInstance.ping();
- assert spiderInstance != null;
assert SpiderProducer.isDestroyed();
}
@Test(groups = { "contexts", "producerField" })
@SpecAssertion(section = "6.4.2", id = "ddd")
- public void testDependentsDestroyedWhenProducerFieldCompletes() throws Exception
+ public void testDependentsDestroyedWhenProducerFieldCompletes()
{
- new RunInDependentContext()
- {
+ // Reset the test class
+ OtherSpiderProducer.setDestroyed(false);
- @Override
- protected void execute() throws Exception
- {
- // Reset the test class
- OtherSpiderProducer.setDestroyed(false);
-
- Tarantula spiderInstance = getInstanceByType(Tarantula.class,TAME_LITERAL);
- assert spiderInstance != null;
- assert OtherSpiderProducer.isDestroyed();
-
- }
-
- }.run();
+ Tarantula spiderInstance = getInstanceByType(Tarantula.class,TAME_LITERAL);
+ assert spiderInstance != null;
+ assert OtherSpiderProducer.isDestroyed();
}
- @Test(groups = { "contexts", "disposalMethod",
"ri-broken" })
+ @Test(groups = { "contexts", "disposalMethod" })
@SpecAssertion(section = "6.4.2", id = "ddd")
- public void testDependentsDestroyedWhenDisposerMethodCompletes() throws Exception
+ public void testDependentsDestroyedWhenDisposerMethodCompletes()
{
- new RunInDependentContext()
- {
+ Bean<Tarantula> tarantulaBean = getBeans(Tarantula.class,
PET_LITERAL).iterator().next();
+ CreationalContext<Tarantula> creationalContext =
getCurrentManager().createCreationalContext(tarantulaBean);
+ Tarantula tarantula = tarantulaBean.create(creationalContext);
+ assert tarantula != null;
- @Override
- protected void execute() throws Exception
- {
- Bean<Tarantula> tarantulaBean =
getBeans(Tarantula.class).iterator().next();
- CreationalContext<Tarantula> creationalContext =
getCurrentManager().createCreationalContext(tarantulaBean);
- Tarantula tarantula = tarantulaBean.create(creationalContext);
- assert tarantula != null;
-
- // Reset test class state
- SpiderProducer.setDestroyed(false);
-
- tarantulaBean.destroy(tarantula, creationalContext);
- assert SpiderProducer.isDestroyed();
- }
+ // Reset test class state
+ SpiderProducer.setDestroyed(false);
- }.run();
+ tarantulaBean.destroy(tarantula, creationalContext);
+ assert SpiderProducer.isDestroyed();
}
@Test(groups = { "contexts", "observerMethod" })
@SpecAssertion(section = "6.4.2", id = "ddd")
- public void testDependentsDestroyedWhenObserverMethodEvaluationCompletes() throws
Exception
+ public void testDependentsDestroyedWhenObserverMethodEvaluationCompletes()
{
- new RunInDependentContext()
- {
+ // Reset test class state...
+ HorseStable.setInstanceThatObservedEvent(null);
+ HorseStable.setDestroyed(false);
- @Override
- protected void execute() throws Exception
- {
- // Reset test class state...
- HorseStable.setInstanceThatObservedEvent(null);
- HorseStable.setDestroyed(false);
-
- getCurrentManager().fireEvent(new HorseInStableEvent());
- assert HorseStable.getInstanceThatObservedEvent() != null;
- assert HorseStable.isDestroyed();
- }
-
- }.run();
+ getCurrentManager().fireEvent(new HorseInStableEvent());
+ assert HorseStable.getInstanceThatObservedEvent() != null;
+ assert HorseStable.isDestroyed();
}
-
}
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/dependent/Pet.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/dependent/Pet.java
(rev 0)
+++
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/dependent/Pet.java 2009-07-21
22:21:05 UTC (rev 3121)
@@ -0,0 +1,22 @@
+package org.jboss.jsr299.tck.tests.context.dependent;
+
+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.enterprise.inject.BindingType;
+
+@Target( { TYPE, METHOD, PARAMETER, FIELD })
+@Retention(RUNTIME)
+@Documented
+@BindingType
+public @interface Pet
+{
+
+}
Property changes on:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/dependent/Pet.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/dependent/SpiderProducer.java
===================================================================
---
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/dependent/SpiderProducer.java 2009-07-21
22:13:24 UTC (rev 3120)
+++
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/dependent/SpiderProducer.java 2009-07-21
22:21:05 UTC (rev 3121)
@@ -2,6 +2,7 @@
import javax.annotation.PreDestroy;
import javax.enterprise.context.Dependent;
+import javax.enterprise.inject.Any;
import javax.enterprise.inject.Current;
import javax.enterprise.inject.Disposes;
import javax.enterprise.inject.Produces;
@@ -15,15 +16,15 @@
private static boolean dependentContextActive = false;
private static boolean destroyed = false;
private static SpiderProducer instanceUsedForDisposal = null;
-
-
- @Produces public Tarantula produceTarantula()
+
+
+ @Produces @Pet public Tarantula produceTarantula(@Current Tarantula spider)
{
dependentContextActive = beanManager.getContext(Dependent.class).isActive();
- return new Tarantula();
+ return spider;
}
- public void disposeTarantula(@Disposes Tarantula tarantula)
+ public void disposeTarantula(@Disposes @Pet Tarantula tarantula)
{
dependentContextActive = beanManager.getContext(Dependent.class).isActive();
instanceUsedForDisposal = this;
Modified:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/definition/DecoratorDefinitionTest.java
===================================================================
---
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/definition/DecoratorDefinitionTest.java 2009-07-21
22:13:24 UTC (rev 3120)
+++
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/definition/DecoratorDefinitionTest.java 2009-07-21
22:21:05 UTC (rev 3121)
@@ -148,7 +148,7 @@
assert !getCurrentManager().resolveDecorators(FooBar.TYPES).isEmpty();
assert !getCurrentManager().resolveDecorators(Logger.TYPES).isEmpty();
assert getCurrentManager().resolveDecorators(Bazt.TYPES).size() == 2;
- assert !getCurrentManager().resolveDecorators(Field.TYPES).isEmpty();
+ assert getCurrentManager().resolveDecorators(Field.TYPES).isEmpty();
}
Modified:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/disposal/method/definition/DefangedTarantula.java
===================================================================
---
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/disposal/method/definition/DefangedTarantula.java 2009-07-21
22:13:24 UTC (rev 3120)
+++
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/disposal/method/definition/DefangedTarantula.java 2009-07-21
22:21:05 UTC (rev 3121)
@@ -2,5 +2,12 @@
class DefangedTarantula extends Tarantula
{
- @Override public int getDeathsCaused() { return 0; }
+ private int deaths;
+
+ public DefangedTarantula(int deaths)
+ {
+ this.deaths = deaths;
+ }
+
+ @Override public int getDeathsCaused() { return deaths; }
}
Modified:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/disposal/method/definition/DisposalMethodDefinitionTest.java
===================================================================
---
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/disposal/method/definition/DisposalMethodDefinitionTest.java 2009-07-21
22:13:24 UTC (rev 3120)
+++
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/disposal/method/definition/DisposalMethodDefinitionTest.java 2009-07-21
22:21:05 UTC (rev 3121)
@@ -49,7 +49,6 @@
}.run();
assert SpiderProducer.isTameSpiderDestroyed();
- assert SpiderProducer.isCurrentSpiderDestroyed();
}
@Test
Modified:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/disposal/method/definition/SpiderProducer.java
===================================================================
---
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/disposal/method/definition/SpiderProducer.java 2009-07-21
22:13:24 UTC (rev 3120)
+++
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/disposal/method/definition/SpiderProducer.java 2009-07-21
22:21:05 UTC (rev 3121)
@@ -7,17 +7,11 @@
class SpiderProducer
{
private static boolean tameSpiderDestroyed = false;
- private static boolean currentSpiderDestroyed = false;
private static boolean deadliestSpiderDestroyed = false;
- @Produces public Tarantula produceTarantula()
- {
- return new Tarantula();
- }
-
@Produces @Tame public Tarantula produceTameTarantula()
{
- return new DefangedTarantula();
+ return new DefangedTarantula(0);
}
@Produces @Deadliest public Tarantula producesDeadliestTarantula(@Tame Tarantula
tameTarantula,
@@ -32,11 +26,6 @@
SpiderProducer.tameSpiderDestroyed = true;
}
- public static void destroyCurrentSpider(@Disposes @Current Tarantula spider)
- {
- SpiderProducer.currentSpiderDestroyed = true;
- }
-
public static void destroyDeadliestSpider(@Disposes @Deadliest Tarantula spider,
@Current Tarantula anotherSpider)
{
assert spider != anotherSpider;
@@ -48,11 +37,6 @@
return tameSpiderDestroyed;
}
- public static boolean isCurrentSpiderDestroyed()
- {
- return currentSpiderDestroyed;
- }
-
public static boolean isDeadliestSpiderDestroyed()
{
return deadliestSpiderDestroyed;
Modified:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/field/definition/OtherSpiderProducer.java
===================================================================
---
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/field/definition/OtherSpiderProducer.java 2009-07-21
22:13:24 UTC (rev 3120)
+++
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/field/definition/OtherSpiderProducer.java 2009-07-21
22:21:05 UTC (rev 3121)
@@ -6,10 +6,10 @@
class OtherSpiderProducer
{
- public static final Tarantula TARANTULA = new Tarantula();
public static final BlackWidow BLACK_WIDOW = new BlackWidow();
+ public static final WolfSpider WOLF_SPIDER = new WolfSpider();
- @Produces @Tame public Tarantula produceTarantula = TARANTULA;
+ @Produces @Pet public WolfSpider produceWolfSpider = WOLF_SPIDER;
@Produces @Tame private BlackWidow produceBlackWidow = BLACK_WIDOW;
Added:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/field/definition/Pet.java
===================================================================
---
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/field/definition/Pet.java
(rev 0)
+++
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/field/definition/Pet.java 2009-07-21
22:21:05 UTC (rev 3121)
@@ -0,0 +1,22 @@
+package org.jboss.jsr299.tck.tests.implementation.producer.field.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.enterprise.inject.BindingType;
+
+@Target( { TYPE, METHOD, PARAMETER, FIELD })
+@Retention(RUNTIME)
+@Documented
+@BindingType
+public @interface Pet
+{
+
+}
Property changes on:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/field/definition/Pet.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/field/definition/ProducerFieldDefinitionTest.java
===================================================================
---
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/field/definition/ProducerFieldDefinitionTest.java 2009-07-21
22:13:24 UTC (rev 3120)
+++
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/field/definition/ProducerFieldDefinitionTest.java 2009-07-21
22:21:05 UTC (rev 3121)
@@ -26,6 +26,7 @@
public class ProducerFieldDefinitionTest extends AbstractJSR299Test
{
private static final Annotation TAME_LITERAL = new AnnotationLiteral<Tame>()
{};
+ private static final Annotation PET_LITERAL = new AnnotationLiteral<Pet>() {};
private static final Annotation FOO_LITERAL = new AnnotationLiteral<Foo>() {};
private static final Annotation STATIC_LITERAL = new AnnotationLiteral<Static>()
{};
@@ -54,7 +55,7 @@
public void testBeanDeclaresMultipleProducerFields()
{
assert getBeans(Tarantula.class, TAME_LITERAL).size() == 1;
- assert
getInstanceByType(Tarantula.class,TAME_LITERAL).equals(OtherSpiderProducer.TARANTULA) ;
+ assert
getInstanceByType(WolfSpider.class,PET_LITERAL).equals(OtherSpiderProducer.WOLF_SPIDER) ;
assert getBeans(BlackWidow.class, TAME_LITERAL).size() == 1;
assert
getInstanceByType(BlackWidow.class,TAME_LITERAL).equals(OtherSpiderProducer.BLACK_WIDOW)
;
}
@@ -65,8 +66,8 @@
})
public void testDefaultBindingType()
{
- Set<Bean<Tarantula>> tarantulaBeans = getBeans(Tarantula.class);
- assert tarantulaBeans.size() == 1;
+ Set<Bean<Tarantula>> tarantulaBeans = getBeans(Tarantula.class, new
CurrentLiteral());
+ assert tarantulaBeans.size() == 2;
assert tarantulaBeans.iterator().next().getBindings().contains(new
CurrentLiteral());
}
@@ -74,7 +75,7 @@
@SpecAssertion(section = "3.4.1", id = "c")
public void testApiTypeForClassReturn()
{
- Set<Bean<Tarantula>> tarantulaBeans = getBeans(Tarantula.class);
+ Set<Bean<Tarantula>> tarantulaBeans = getBeans(Tarantula.class,
PET_LITERAL);
assert tarantulaBeans.size() == 1;
Bean<Tarantula> tarantulaBean = tarantulaBeans.iterator().next();
assert tarantulaBean.getTypes().size() == 6;
@@ -132,10 +133,10 @@
})
public void testBindingType()
{
- Set<Bean<Tarantula>> tarantulaBeans = getBeans(Tarantula.class, new
TameAnnotationLiteral());
+ Set<Bean<Tarantula>> tarantulaBeans = getBeans(Tarantula.class,
TAME_LITERAL);
assert tarantulaBeans.size() == 1;
Bean<Tarantula> tarantulaModel = tarantulaBeans.iterator().next();
- assert tarantulaModel.getBindings().size() == 2;
+ assert tarantulaModel.getBindings().size() == 3;
assert tarantulaModel.getBindings().contains(TAME_LITERAL);
}
Deleted:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/field/definition/TameAnnotationLiteral.java
===================================================================
---
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/field/definition/TameAnnotationLiteral.java 2009-07-21
22:13:24 UTC (rev 3120)
+++
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/field/definition/TameAnnotationLiteral.java 2009-07-21
22:21:05 UTC (rev 3121)
@@ -1,8 +0,0 @@
-package org.jboss.jsr299.tck.tests.implementation.producer.field.definition;
-
-import javax.enterprise.inject.AnnotationLiteral;
-
-class TameAnnotationLiteral extends AnnotationLiteral<Tame> implements Tame
-{
-
-}
Modified:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/field/definition/TarantulaProducer.java
===================================================================
---
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/field/definition/TarantulaProducer.java 2009-07-21
22:13:24 UTC (rev 3120)
+++
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/field/definition/TarantulaProducer.java 2009-07-21
22:21:05 UTC (rev 3121)
@@ -4,6 +4,6 @@
class TarantulaProducer
{
- @Produces public Tarantula produceTarantula = new Tarantula();
+ @Produces @Pet public Tarantula produceTarantula = new Tarantula();
}
Modified:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/field/lifecycle/BlackWidowConsumer.java
===================================================================
---
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/field/lifecycle/BlackWidowConsumer.java 2009-07-21
22:13:24 UTC (rev 3120)
+++
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/field/lifecycle/BlackWidowConsumer.java 2009-07-21
22:21:05 UTC (rev 3121)
@@ -17,7 +17,6 @@
package org.jboss.jsr299.tck.tests.implementation.producer.field.lifecycle;
-import javax.enterprise.inject.Current;
/**
* This simple bean contains an injection point to receive the value of a
@@ -28,7 +27,7 @@
*/
public class BlackWidowConsumer
{
- @Current
+ @Tame
private BlackWidow injectedSpider;
public BlackWidow getInjectedSpider()
Modified:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/field/lifecycle/BlackWidowProducer.java
===================================================================
---
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/field/lifecycle/BlackWidowProducer.java 2009-07-21
22:13:24 UTC (rev 3120)
+++
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/field/lifecycle/BlackWidowProducer.java 2009-07-21
22:21:05 UTC (rev 3121)
@@ -6,7 +6,7 @@
public class BlackWidowProducer
{
public static BlackWidow blackWidow = new BlackWidow();
- @Produces
+ @Produces @Tame
@Named("blackWidow")
public BlackWidow produceBlackWidow = blackWidow;
Copied:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/field/lifecycle/Tame.java
(from rev 3118,
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/field/definition/Tame.java)
===================================================================
---
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/field/lifecycle/Tame.java
(rev 0)
+++
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/field/lifecycle/Tame.java 2009-07-21
22:21:05 UTC (rev 3121)
@@ -0,0 +1,22 @@
+package org.jboss.jsr299.tck.tests.implementation.producer.field.lifecycle;
+
+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.enterprise.inject.BindingType;
+
+@Target( { TYPE, METHOD, PARAMETER, FIELD })
+@Retention(RUNTIME)
+@Documented
+@BindingType
+@interface Tame
+{
+
+}
Modified:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/field/lifecycle/TarantulaConsumer.java
===================================================================
---
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/field/lifecycle/TarantulaConsumer.java 2009-07-21
22:13:24 UTC (rev 3120)
+++
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/field/lifecycle/TarantulaConsumer.java 2009-07-21
22:21:05 UTC (rev 3121)
@@ -17,7 +17,6 @@
package org.jboss.jsr299.tck.tests.implementation.producer.field.lifecycle;
-import javax.enterprise.inject.Current;
/**
* This bean contains an injection point for a Tarantula that must be provided
@@ -28,7 +27,7 @@
*/
public class TarantulaConsumer
{
- @Current
+ @Tame
private Tarantula consumedTarantula;
public Tarantula getConsumedTarantula()
Modified:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/field/lifecycle/TarantulaProducer.java
===================================================================
---
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/field/lifecycle/TarantulaProducer.java 2009-07-21
22:13:24 UTC (rev 3120)
+++
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/field/lifecycle/TarantulaProducer.java 2009-07-21
22:21:05 UTC (rev 3121)
@@ -4,6 +4,6 @@
public class TarantulaProducer
{
- @Produces public Tarantula produceTarantula = new Tarantula();
+ @Produces @Tame public Tarantula produceTarantula = new DefangedTarantula();
}
Modified:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/lifecycle/Lays.java
===================================================================
---
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/lifecycle/Lays.java 2009-07-21
22:13:24 UTC (rev 3120)
+++
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/lifecycle/Lays.java 2009-07-21
22:21:05 UTC (rev 3121)
@@ -5,7 +5,7 @@
class Lays
{
- @Produces @RequestScoped
+ @Produces @Delicious @RequestScoped
public PotatoChip makeChip()
{
return null;
Added:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/lifecycle/Pet.java
===================================================================
---
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/lifecycle/Pet.java
(rev 0)
+++
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/lifecycle/Pet.java 2009-07-21
22:21:05 UTC (rev 3121)
@@ -0,0 +1,22 @@
+package org.jboss.jsr299.tck.tests.implementation.producer.method.lifecycle;
+
+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.enterprise.inject.BindingType;
+
+@Target( { TYPE, METHOD, PARAMETER, FIELD })
+@Retention(RUNTIME)
+@Documented
+@BindingType
+public @interface Pet
+{
+
+}
Property changes on:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/lifecycle/Pet.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/lifecycle/ProducerMethodLifecycleTest.java
===================================================================
---
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/lifecycle/ProducerMethodLifecycleTest.java 2009-07-21
22:13:24 UTC (rev 3120)
+++
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/lifecycle/ProducerMethodLifecycleTest.java 2009-07-21
22:21:05 UTC (rev 3121)
@@ -1,6 +1,9 @@
package org.jboss.jsr299.tck.tests.implementation.producer.method.lifecycle;
+import java.lang.annotation.Annotation;
+
import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.inject.AnnotationLiteral;
import javax.enterprise.inject.IllegalProductException;
import javax.enterprise.inject.spi.Bean;
@@ -21,64 +24,40 @@
public class ProducerMethodLifecycleTest extends AbstractJSR299Test
{
+ private static final Annotation PET_LITERAL = new AnnotationLiteral<Pet> () {};
+ private static final Annotation DELICIOUS_LITERAL = new
AnnotationLiteral<Delicious> () {};
+
@Test(groups = { "producerMethod", "disposalMethod" })
@SpecAssertion(section = "7.3.4", id = "ma")
- public void testProducerMethodBeanDestroy() throws Exception
+ public void testProducerMethodBeanDestroy()
{
- new RunInDependentContext()
- {
-
- @Override
- protected void execute() throws Exception
- {
- SpiderProducer.setTarantulaDestroyed(false);
- Tarantula tarantula = getInstanceByType(Tarantula.class);
- Bean<Tarantula> tarantulaBean =
getBeans(Tarantula.class).iterator().next();
- CreationalContext<Tarantula> creationalContext =
getCurrentManager().createCreationalContext(tarantulaBean);
- tarantulaBean.destroy(tarantula, creationalContext);
- assert SpiderProducer.isTarantulaDestroyed();
- assert SpiderProducer.isDestroyArgumentsSet();
- assert !SpiderProducerNotUsed.isTarantulaDestroyed();
- }
-
- }.run();
+ SpiderProducer.setTarantulaDestroyed(false);
+ Tarantula tarantula = getInstanceByType(Tarantula.class, PET_LITERAL);
+ Bean<Tarantula> tarantulaBean = getBeans(Tarantula.class,
PET_LITERAL).iterator().next();
+ CreationalContext<Tarantula> creationalContext =
getCurrentManager().createCreationalContext(tarantulaBean);
+ tarantulaBean.destroy(tarantula, creationalContext);
+ assert SpiderProducer.isTarantulaDestroyed();
+ assert SpiderProducer.isDestroyArgumentsSet();
+ assert !SpiderProducerNotUsed.isTarantulaDestroyed();
}
@Test(groups = { "producerMethod" })
@SpecAssertion(section = "7.3.4", id = "review")
- public void testProducerMethodBeanCreate() throws Exception
+ public void testProducerMethodBeanCreate()
{
- new RunInDependentContext()
- {
-
- @Override
- protected void execute() throws Exception
- {
- getInstanceByType(Tarantula.class);
- assert SpiderProducer.isTarantulaCreated();
- }
-
- }.run();
+ getInstanceByType(Tarantula.class, PET_LITERAL);
+ assert SpiderProducer.isTarantulaCreated();
}
@Test(groups = { "producerMethod" })
@SpecAssertions({
@SpecAssertion(section = "7.3.4", id = "ea")
})
- public void testProducerMethodInvokedOnCreate() throws Exception
+ public void testProducerMethodInvokedOnCreate()
{
- new RunInDependentContext()
- {
-
- @Override
- protected void execute() throws Exception
- {
- Bean<SpiderEgg> eggBean = getBeans(SpiderEgg.class).iterator().next();
- CreationalContext<SpiderEgg> creationalContext =
getCurrentManager().createCreationalContext(eggBean);
- assert eggBean.create(creationalContext) != null;
- }
-
- }.run();
+ Bean<SpiderEgg> eggBean = getBeans(SpiderEgg.class).iterator().next();
+ CreationalContext<SpiderEgg> creationalContext =
getCurrentManager().createCreationalContext(eggBean);
+ assert eggBean.create(creationalContext) != null;
}
@Test(groups = { "producerMethod", "rewrite" })
@@ -86,21 +65,14 @@
@SpecAssertions({
@SpecAssertion(section = "review", id = "review")
})
- public void testProducerMethodFromMostSpecializedBeanUsed() throws Exception
+ public void testProducerMethodFromMostSpecializedBeanUsed()
{
- new RunInDependentContext()
- {
- @Override
- protected void execute() throws Exception
- {
- Tarantula.setNumberCreated(0);
- Bean<Tarantula> spiderBean =
getBeans(Tarantula.class).iterator().next();
- CreationalContext<Tarantula> creationalContext =
getCurrentManager().createCreationalContext(spiderBean);
- Tarantula tarantula = spiderBean.create(creationalContext);
- assert tarantula.getValue().equals("Pete");
- assert Tarantula.getNumberCreated() == 1;
- }
- }.run();
+ Tarantula.setNumberCreated(0);
+ Bean<Tarantula> spiderBean = getBeans(Tarantula.class,
PET_LITERAL).iterator().next();
+ CreationalContext<Tarantula> creationalContext =
getCurrentManager().createCreationalContext(spiderBean);
+ Tarantula tarantula = spiderBean.create(creationalContext);
+ assert tarantula.getValue().equals("Pete");
+ assert Tarantula.getNumberCreated() == 1;
}
@Test(groups = { "producerMethod" })
@@ -121,7 +93,7 @@
// TODO I'm not quite sure what this test is currently doing!
public void testCreateFailsIfProducerReturnsNullAndNotDependent() throws Exception
{
- Bean<PotatoChip> chipBean = getBeans(PotatoChip.class).iterator().next();
+ Bean<PotatoChip> chipBean = getBeans(PotatoChip.class,
DELICIOUS_LITERAL).iterator().next();
CreationalContext<PotatoChip> creationalContext =
getCurrentManager().createCreationalContext(chipBean);
assert chipBean.create(creationalContext) == null;
}
Modified:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/lifecycle/SpiderProducer.java
===================================================================
---
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/lifecycle/SpiderProducer.java 2009-07-21
22:13:24 UTC (rev 3120)
+++
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/lifecycle/SpiderProducer.java 2009-07-21
22:21:05 UTC (rev 3121)
@@ -11,7 +11,7 @@
private static boolean tarantulaDestroyed;
private static boolean destroyArgumentsSet;
- @Produces public Tarantula produceTarantula()
+ @Produces @Pet public Tarantula produceTarantula()
{
tarantulaCreated = true;
tarantulaDestroyed = false;
@@ -24,7 +24,7 @@
return null;
}
- public static void destroyTarantula(@Disposes Tarantula spider, @Current BeanManager
beanManager)
+ public static void destroyTarantula(@Disposes @Pet Tarantula spider, @Current
BeanManager beanManager)
{
tarantulaDestroyed = true;
if (beanManager != null)
Modified:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/simple/lifecycle/SimpleBeanLifecycleTest.java
===================================================================
---
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/simple/lifecycle/SimpleBeanLifecycleTest.java 2009-07-21
22:13:24 UTC (rev 3120)
+++
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/simple/lifecycle/SimpleBeanLifecycleTest.java 2009-07-21
22:21:05 UTC (rev 3121)
@@ -49,33 +49,17 @@
@Test
@SpecAssertion(section = "3.1.4.2", id = "b")
- public void testBindingTypeAnnotatedConstructor() throws Exception
+ public void testBindingTypeAnnotatedConstructor()
{
- new RunInDependentContext()
- {
- @Override
- protected void execute() throws Exception
- {
- getInstanceByType(Duck.class);
- assert Duck.constructedCorrectly;
- }
- }.run();
+ getInstanceByType(Duck.class);
+ assert Duck.constructedCorrectly;
}
@Test(groups = { "specialization" })
@SpecAssertion(section = "3.1.5", id = "aa")
- public void testSpecializedBeanAlwaysUsed() throws Exception
+ public void testSpecializedBeanSpecializesAnotherBean()
{
- new RunInDependentContext()
- {
-
- @Override
- protected void execute() throws Exception
- {
- assert getInstanceByType(Lion.class,TAME_LITERAL) instanceof MountainLion;
- }
-
- }.run();
+ assert !getBeans(MountainLion.class, TAME_LITERAL).isEmpty();
}
@Test(groups = "beanLifecycle")
@@ -84,25 +68,16 @@
@SpecAssertion(section = "6.1.1", id = "d"),
@SpecAssertion(section = "6.1.1", id = "e")
})
- public void testCreateReturnsSameBeanPushed() throws Exception
+ public void testCreateReturnsSameBeanPushed()
{
final CreationalContext<ShoeFactory> creationalContext = new
MockCreationalContext<ShoeFactory>();
final Contextual<ShoeFactory> bean =
getBeans(ShoeFactory.class).iterator().next();
MockCreationalContext.reset();
- new RunInDependentContext()
+ ShoeFactory instance = getCurrentManager().getContext(Dependent.class).get(bean,
creationalContext);
+ if (MockCreationalContext.isPushCalled())
{
-
- @Override
- protected void execute() throws Exception
- {
- ShoeFactory instance =
getCurrentManager().getContext(Dependent.class).get(bean, creationalContext);
- if (MockCreationalContext.isPushCalled())
- {
- assert instance.equals(MockCreationalContext.getLastBeanPushed());
- }
- }
-
- }.run();
+ assert instance.equals(MockCreationalContext.getLastBeanPushed());
+ }
}
@Test(groups = "beanLifecycle")
@@ -205,148 +180,88 @@
@Test
@SpecAssertion(section = "4.2", id = "baa")
- public void testSubClassInheritsPostConstructOnSuperclass() throws Exception
+ public void testSubClassInheritsPostConstructOnSuperclass()
{
OrderProcessor.postConstructCalled = false;
assert getBeans(CdOrderProcessor.class).size() == 1;
- new RunInDependentContext()
- {
- @Override
- protected void execute() throws Exception
- {
- getInstanceByType(CdOrderProcessor.class).order();
- }
- }.run();
+ getInstanceByType(CdOrderProcessor.class).order();
assert OrderProcessor.postConstructCalled;
}
@Test
@SpecAssertion(section = "4.2", id = "bac")
- public void testIndirectSubClassInheritsPostConstructOnSuperclass() throws Exception
+ public void testIndirectSubClassInheritsPostConstructOnSuperclass()
{
OrderProcessor.postConstructCalled = false;
assert getBeans(IndirectOrderProcessor.class).size() == 1;
- new RunInDependentContext()
- {
- @Override
- protected void execute() throws Exception
- {
- getInstanceByType(IndirectOrderProcessor.class).order();
- }
- }.run();
+ getInstanceByType(IndirectOrderProcessor.class).order();
assert OrderProcessor.postConstructCalled;
}
@Test
@SpecAssertion(section = "4.2", id = "bba")
- public void testSubClassInheritsPreDestroyOnSuperclass() throws Exception
+ public void testSubClassInheritsPreDestroyOnSuperclass()
{
OrderProcessor.preDestroyCalled = false;
assert getBeans(CdOrderProcessor.class).size() == 1;
- new RunInDependentContext()
- {
- @Override
- protected void execute() throws Exception
- {
- Bean<CdOrderProcessor> bean =
getBeans(CdOrderProcessor.class).iterator().next();
- CreationalContext<CdOrderProcessor> creationalContext =
getCurrentManager().createCreationalContext(bean);
- CdOrderProcessor instance = getInstanceByType(CdOrderProcessor.class);
- bean.destroy(instance, creationalContext);
- }
- }.run();
+ Bean<CdOrderProcessor> bean =
getBeans(CdOrderProcessor.class).iterator().next();
+ CreationalContext<CdOrderProcessor> creationalContext =
getCurrentManager().createCreationalContext(bean);
+ CdOrderProcessor instance = getInstanceByType(CdOrderProcessor.class);
+ bean.destroy(instance, creationalContext);
assert OrderProcessor.preDestroyCalled;
}
@Test
@SpecAssertion(section = "4.2", id = "bbc")
- public void testIndirectSubClassInheritsPreDestroyOnSuperclass() throws Exception
+ public void testIndirectSubClassInheritsPreDestroyOnSuperclass()
{
OrderProcessor.preDestroyCalled = false;
assert getBeans(IndirectOrderProcessor.class).size() == 1;
- new RunInDependentContext()
- {
- @Override
- protected void execute() throws Exception
- {
- Bean<IndirectOrderProcessor> bean =
getBeans(IndirectOrderProcessor.class).iterator().next();
- CreationalContext<IndirectOrderProcessor> creationalContext =
getCurrentManager().createCreationalContext(bean);
- IndirectOrderProcessor instance =
getInstanceByType(IndirectOrderProcessor.class);
- bean.destroy(instance, creationalContext);
- }
- }.run();
+ Bean<IndirectOrderProcessor> bean =
getBeans(IndirectOrderProcessor.class).iterator().next();
+ CreationalContext<IndirectOrderProcessor> creationalContext =
getCurrentManager().createCreationalContext(bean);
+ IndirectOrderProcessor instance = getInstanceByType(IndirectOrderProcessor.class);
+ bean.destroy(instance, creationalContext);
assert OrderProcessor.preDestroyCalled;
}
@Test
@SpecAssertion(section = "4.2", id = "baa")
- public void
testSubClassDoesNotInheritPostConstructOnSuperclassBlockedByIntermediateClass() throws
Exception
+ public void
testSubClassDoesNotInheritPostConstructOnSuperclassBlockedByIntermediateClass()
{
assert getBeans(NovelOrderProcessor.class).size() == 1;
OrderProcessor.postConstructCalled = false;
- new RunInDependentContext()
- {
- @Override
- protected void execute() throws Exception
- {
- getInstanceByType(NovelOrderProcessor.class).order();
- }
- }.run();
+ getInstanceByType(NovelOrderProcessor.class).order();
assert !OrderProcessor.postConstructCalled;
}
@Test
@SpecAssertion(section = "4.2", id = "bba")
- public void
testSubClassDoesNotInheritPreDestroyConstructOnSuperclassBlockedByIntermediateClass()
throws Exception
+ public void
testSubClassDoesNotInheritPreDestroyConstructOnSuperclassBlockedByIntermediateClass()
{
OrderProcessor.preDestroyCalled = false;
assert getBeans(NovelOrderProcessor.class).size() == 1;
- new RunInDependentContext()
- {
- @Override
- protected void execute() throws Exception
- {
- Bean<NovelOrderProcessor> bean =
getBeans(NovelOrderProcessor.class).iterator().next();
- CreationalContext<NovelOrderProcessor> creationalContext =
getCurrentManager().createCreationalContext(bean);
- NovelOrderProcessor instance = getInstanceByType(NovelOrderProcessor.class);
- bean.destroy(instance, creationalContext);
- }
- }.run();
+ Bean<NovelOrderProcessor> bean =
getBeans(NovelOrderProcessor.class).iterator().next();
+ CreationalContext<NovelOrderProcessor> creationalContext =
getCurrentManager().createCreationalContext(bean);
+ NovelOrderProcessor instance = getInstanceByType(NovelOrderProcessor.class);
+ bean.destroy(instance, creationalContext);
assert !OrderProcessor.preDestroyCalled;
}
@Test(expectedExceptions = CreationException.class)
@SpecAssertion(section = "review", id = "review") // removed from
spec?
- public void testCreationExceptionWrapsCheckedExceptionThrownFromCreate() throws
Exception
+ public void testCreationExceptionWrapsCheckedExceptionThrownFromCreate()
{
assert getBeans(Lorry_Broken.class).size() == 1;
- new RunInDependentContext()
- {
-
- @Override
- protected void execute() throws Exception
- {
- getInstanceByType(Lorry_Broken.class);
- }
-
- }.run();
+ getInstanceByType(Lorry_Broken.class);
}
@Test(expectedExceptions = FooException.class)
@SpecAssertion(section = "review", id = "review") // removed from
spec?
- public void testUncheckedExceptionThrownFromCreateNotWrapped() throws Exception
+ public void testUncheckedExceptionThrownFromCreateNotWrapped()
{
assert getBeans(Van_Broken.class).size() == 1;
- new RunInDependentContext()
- {
-
- @Override
- protected void execute() throws Exception
- {
- getInstanceByType(Van_Broken.class);
- }
-
- }.run();
+ getInstanceByType(Van_Broken.class);
}
}
Modified:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/inheritance/specialization/enterprise/EnterpriseBeanSpecializationTest.java
===================================================================
---
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/inheritance/specialization/enterprise/EnterpriseBeanSpecializationTest.java 2009-07-21
22:13:24 UTC (rev 3120)
+++
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/inheritance/specialization/enterprise/EnterpriseBeanSpecializationTest.java 2009-07-21
22:21:05 UTC (rev 3121)
@@ -33,11 +33,11 @@
})
public void testSpecializingBeanHasBindingsOfSpecializedAndSpecializingBean()
{
- assert getCurrentManager().getBeans(FarmerLocal.class, LANDOWNER_LITERAL).size() ==
1;
- Bean<FarmerLocal> bean = getBeans(FarmerLocal.class,
LANDOWNER_LITERAL).iterator().next();
- assert getCurrentManager().getBeans(FarmerLocal.class,
LANDOWNER_LITERAL).iterator().next().getTypes().contains(LazyFarmerLocal.class);
- assert getCurrentManager().getBeans(FarmerLocal.class,
LANDOWNER_LITERAL).iterator().next().getBindings().size() == 3;
- assert annotationSetMatches( getCurrentManager().getBeans(FarmerLocal.class,
LANDOWNER_LITERAL).iterator().next().getBindings(), Landowner.class, Lazy.class,
Any.class);
+ assert getCurrentManager().getBeans(LazyFarmerLocal.class,
LANDOWNER_LITERAL).size() == 1;
+ Bean<LazyFarmerLocal> bean = getBeans(LazyFarmerLocal.class,
LANDOWNER_LITERAL).iterator().next();
+ assert getCurrentManager().getBeans(LazyFarmerLocal.class,
LANDOWNER_LITERAL).iterator().next().getTypes().contains(FarmerLocal.class);
+ assert getCurrentManager().getBeans(LazyFarmerLocal.class,
LANDOWNER_LITERAL).iterator().next().getBindings().size() == 3;
+ assert annotationSetMatches( getCurrentManager().getBeans(LazyFarmerLocal.class,
LANDOWNER_LITERAL).iterator().next().getBindings(), Landowner.class, Lazy.class,
Any.class);
}
@Test
@@ -46,9 +46,8 @@
})
public void testSpecializingBeanHasNameOfSpecializedBean()
{
- assert getBeans(FarmerLocal.class, LANDOWNER_LITERAL).size() == 1;
- assert getBeans(FarmerLocal.class,
LANDOWNER_LITERAL).iterator().next().getTypes().contains(LazyFarmerLocal.class);
- assert getBeans(FarmerLocal.class,
LANDOWNER_LITERAL).iterator().next().getName().equals("farmer");
+ assert getBeans(LazyFarmerLocal.class, LANDOWNER_LITERAL).size() == 1;
+ assert getBeans(LazyFarmerLocal.class,
LANDOWNER_LITERAL).iterator().next().getName().equals("farmer");
}
}
Modified:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/inheritance/specialization/producer/method/JewelryShop.java
===================================================================
---
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/inheritance/specialization/producer/method/JewelryShop.java 2009-07-21
22:13:24 UTC (rev 3120)
+++
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/inheritance/specialization/producer/method/JewelryShop.java 2009-07-21
22:21:05 UTC (rev 3121)
@@ -6,7 +6,7 @@
class JewelryShop extends Shop
{
@Override @Produces @Specializes @Sparkly
- public Product getExpensiveGift()
+ public Necklace getExpensiveGift()
{
return new Necklace();
}
Modified:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/inheritance/specialization/producer/method/ProducerMethodSpecializationTest.java
===================================================================
---
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/inheritance/specialization/producer/method/ProducerMethodSpecializationTest.java 2009-07-21
22:13:24 UTC (rev 3120)
+++
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/inheritance/specialization/producer/method/ProducerMethodSpecializationTest.java 2009-07-21
22:21:05 UTC (rev 3121)
@@ -13,7 +13,7 @@
import org.testng.annotations.Test;
/**
- * Spec version: 20090519
+ * Spec version: 20090625
*
*/
@Artifact
@@ -22,29 +22,21 @@
{
private static Annotation EXPENSIVE_LITERAL = new AnnotationLiteral<Expensive>()
{};
+ private static Annotation SPARKLY_LITERAL = new AnnotationLiteral<Sparkly>()
{};
@Test
@SpecAssertions({
- @SpecAssertion(section = "3.4.4", id = "aa")
+ @SpecAssertion(section = "5.6.6", id = "c")
})
- public void testSpecializingBeanHasBindingsOfSpecializedAndSpecializingBean() throws
Exception
+ public void testSpecializingBeanHasBindingsOfSpecializedAndSpecializingBean()
{
- assert getCurrentManager().getBeans(Product.class, EXPENSIVE_LITERAL).size() == 1;
- assert getCurrentManager().getBeans(Product.class,
EXPENSIVE_LITERAL).iterator().next().getBindings().size() == 3;
- assert annotationSetMatches( getCurrentManager().getBeans(Product.class,
EXPENSIVE_LITERAL).iterator().next().getBindings(), Expensive.class, Sparkly.class,
Any.class);
- assert getBeans(Product.class, new AnnotationLiteral<Sparkly>(){}).size() ==
1;
- assert getBeans(Product.class, new
AnnotationLiteral<Sparkly>(){}).iterator().next().getName().equals("expensiveGift");
- new RunInDependentContext()
- {
-
- @Override
- protected void execute() throws Exception
- {
- Product product = getInstanceByType(Product.class,EXPENSIVE_LITERAL);
- assert product instanceof Necklace;
- }
-
- }.run();
+ assert getCurrentManager().getBeans(Necklace.class, EXPENSIVE_LITERAL,
SPARKLY_LITERAL).size() == 1;
+ assert getCurrentManager().getBeans(Necklace.class, EXPENSIVE_LITERAL,
SPARKLY_LITERAL).iterator().next().getBindings().size() == 3;
+ assert annotationSetMatches( getCurrentManager().getBeans(Necklace.class,
EXPENSIVE_LITERAL, SPARKLY_LITERAL).iterator().next().getBindings(), Expensive.class,
Sparkly.class, Any.class);
+ assert getBeans(Necklace.class, new AnnotationLiteral<Sparkly>(){}).size() ==
1;
+ assert getBeans(Necklace.class, new
AnnotationLiteral<Sparkly>(){}).iterator().next().getName().equals("expensiveGift");
+ Product product = getInstanceByType(Product.class,EXPENSIVE_LITERAL,
SPARKLY_LITERAL);
+ assert product instanceof Necklace;
}
}
Modified:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/inheritance/specialization/producer/method/Shop.java
===================================================================
---
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/inheritance/specialization/producer/method/Shop.java 2009-07-21
22:13:24 UTC (rev 3120)
+++
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/inheritance/specialization/producer/method/Shop.java 2009-07-21
22:21:05 UTC (rev 3121)
@@ -8,9 +8,9 @@
{
@Produces @Expensive @Named
- public Product getExpensiveGift()
+ public Necklace getExpensiveGift()
{
- return new Product();
+ return new Necklace();
}
}
Modified:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/inheritance/specialization/simple/SimpleBeanSpecializationTest.java
===================================================================
---
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/inheritance/specialization/simple/SimpleBeanSpecializationTest.java 2009-07-21
22:13:24 UTC (rev 3120)
+++
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/inheritance/specialization/simple/SimpleBeanSpecializationTest.java 2009-07-21
22:21:05 UTC (rev 3121)
@@ -35,9 +35,9 @@
})
public void testSpecializingBeanHasBindingsOfSpecializedAndSpecializingBean()
{
- assert getBeans(Farmer.class, LANDOWNER_LITERAL).size() == 1;
- Bean<?> bean = getBeans(Farmer.class, LANDOWNER_LITERAL).iterator().next();
- assert bean.getTypes().contains(LazyFarmer.class);
+ assert getBeans(LazyFarmer.class, LANDOWNER_LITERAL).size() == 1;
+ Bean<?> bean = getBeans(LazyFarmer.class,
LANDOWNER_LITERAL).iterator().next();
+ assert bean.getTypes().contains(Farmer.class);
assert bean.getBindings().size() == 3;
assert annotationSetMatches(bean.getBindings(), Landowner.class, Lazy.class,
Any.class);
}
@@ -49,43 +49,17 @@
})
public void testSpecializingBeanHasNameOfSpecializedBean()
{
- assert getBeans(Farmer.class, LANDOWNER_LITERAL).size() == 1;
- assert getBeans(Farmer.class,
LANDOWNER_LITERAL).iterator().next().getTypes().contains(LazyFarmer.class);
- assert "farmer".equals(getBeans(Farmer.class,
LANDOWNER_LITERAL).iterator().next().getName());
+ assert getBeans(LazyFarmer.class, LANDOWNER_LITERAL).size() == 1;
+ assert "farmer".equals(getBeans(LazyFarmer.class,
LANDOWNER_LITERAL).iterator().next().getName());
}
@Test
- public void testSpecializedBeanNotInstantiated() throws Exception
- {
- new RunInDependentContext()
- {
-
- @Override
- protected void execute() throws Exception
- {
- Farmer farmer = getInstanceByType(Farmer.class,LANDOWNER_LITERAL);
- assert farmer.getClassName().equals(LazyFarmer.class.getName());
- }
-
- }.run();
- }
-
- @Test
@SpecAssertions( {
@SpecAssertion(section = "4.3.2", id = "a")
})
- public void testProducerMethodOnSpecializedBeanCalledOnSpecializingBean() throws
Exception
+ public void testProducerMethodOnSpecializedBeanCalledOnSpecializingBean()
{
- new RunInDependentContext()
- {
-
- @Override
- protected void execute() throws Exception
- {
- assert getBeans(Waste.class).size() == 1;
- assert
getInstanceByType(Waste.class).getFrom().equals(Office.class.getName());
- }
-
- }.run();
+ assert getBeans(Waste.class).size() == 1;
+ assert getInstanceByType(Waste.class).getFrom().equals(Office.class.getName());
}
}