Author: dallen6
Date: 2009-05-24 16:17:54 -0400 (Sun, 24 May 2009)
New Revision: 2700
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/SpiderProducer.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/disposal/method/definition/broken1/MultipleDisposeParametersDefinitionTest.java
Log:
Additional disposes tests
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-05-22
20:17:39 UTC (rev 2699)
+++
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/disposal/method/definition/DisposalMethodDefinitionTest.java 2009-05-24
20:17:54 UTC (rev 2700)
@@ -3,7 +3,6 @@
import java.lang.annotation.Annotation;
import javax.inject.AnnotationLiteral;
-import javax.inject.DefinitionException;
import javax.inject.manager.Bean;
import org.hibernate.tck.annotations.SpecAssertion;
@@ -26,11 +25,11 @@
@SpecAssertion(section = "3.4.6", id = "c"),
@SpecAssertion(section = "3.4.6", id = "e"),
@SpecAssertion(section = "3.4.7", id = "b"),
- @SpecAssertion(section = "3.4.8", id = "a")
+ @SpecAssertion(section = "3.4.8", id = "a"),
+ @SpecAssertion(section = "3.4.11", id = "a")
})
public void testBindingTypesAppliedToDisposalMethodParameters() throws Exception
{
- SpiderProducer spiderProducer =
getCurrentManager().getInstanceByType(SpiderProducer.class);
new RunInDependentContext()
{
@@ -43,8 +42,8 @@
}
}.run();
- assert spiderProducer.isTameSpiderDestroyed();
- assert spiderProducer.isCurrentSpiderDestroyed();
+ assert SpiderProducer.isTameSpiderDestroyed();
+ assert SpiderProducer.isCurrentSpiderDestroyed();
}
@Test
@@ -75,36 +74,25 @@
* calls Manager.getInstanceToInject() to determine a value for each
* parameter of a disposal method and calls the disposal method with those
* parameter values
+ * @throws Exception
*/
- @Test(groups = { "stub", "disposalMethod" })
+ @Test(groups = { "disposalMethod" })
@SpecAssertion(section = "3.4.10", id = "a")
- public void testDisposalMethodParametersGetInjected()
+ public void testDisposalMethodParametersGetInjected() throws Exception
{
- assert false;
- }
+ new RunInDependentContext()
+ {
- /**
- * When searching for disposal methods for a producer method, the container
- * searches for disposal methods which are declared by an enabled bean, and
- * for which the disposed parameter must resolve to the producer method,
- * according to the typesafe resolution algorithm
- */
- @Test(groups = { "stub", "disposalMethod" })
- @SpecAssertion(section = "3.4.11", id = "a")
- public void testDisposalMethodTypeSafeResolution()
- {
- assert false;
+ @Override
+ protected void execute() throws Exception
+ {
+ Bean<Tarantula> tarantula =
getCurrentManager().resolveByType(Tarantula.class, DEADLIEST_LITERAL).iterator().next();
+ Tarantula instance = getCurrentManager().getInstance(tarantula);
+ tarantula.destroy(instance);
+ }
+
+ }.run();
+ assert SpiderProducer.isDeadliestSpiderDestroyed();
}
- /**
- * If there are multiple disposal methods for a producer method, a
- * DefinitionException is thrown by the container at deployment time
- */
- @Test(groups = { "stub", "disposalMethod" }, expectedExceptions =
{ DefinitionException.class })
- @SpecAssertion(section = "3.4.11", id = "b")
- public void testMultipleDisposalMethodsFails()
- {
- assert false;
- }
-
}
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-05-22
20:17:39 UTC (rev 2699)
+++
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/disposal/method/definition/SpiderProducer.java 2009-05-24
20:17:54 UTC (rev 2700)
@@ -9,6 +9,7 @@
{
private static boolean tameSpiderDestroyed = false;
private static boolean currentSpiderDestroyed = false;
+ private static boolean deadliestSpiderDestroyed = false;
@Produces public Tarantula produceTarantula()
{
@@ -37,13 +38,24 @@
SpiderProducer.currentSpiderDestroyed = true;
}
- public boolean isTameSpiderDestroyed()
+ public static void destroyDeadliestSpider(@Disposes @Deadliest Tarantula spider,
@Current Tarantula anotherSpider)
{
+ assert spider != anotherSpider;
+ SpiderProducer.deadliestSpiderDestroyed = true;
+ }
+
+ public static boolean isTameSpiderDestroyed()
+ {
return tameSpiderDestroyed;
}
- public boolean isCurrentSpiderDestroyed()
+ 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/disposal/method/definition/broken1/MultipleDisposeParametersDefinitionTest.java
===================================================================
---
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/disposal/method/definition/broken1/MultipleDisposeParametersDefinitionTest.java 2009-05-22
20:17:39 UTC (rev 2699)
+++
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/disposal/method/definition/broken1/MultipleDisposeParametersDefinitionTest.java 2009-05-24
20:17:54 UTC (rev 2700)
@@ -23,7 +23,8 @@
@Test
@SpecAssertions({
@SpecAssertion(section = "3.4.7", id = "a"),
- @SpecAssertion(section = "3.4.8", id = "b")
+ @SpecAssertion(section = "3.4.8", id = "b"),
+ @SpecAssertion(section = "3.4.11", id = "b")
})
public void testMultipleDisposeParameters()
{
Show replies by date