Author: nickarls
Date: 2008-12-13 17:17:48 -0500 (Sat, 13 Dec 2008)
New Revision: 514
Added:
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/contexts/
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/contexts/DependentContextTest.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/contexts/NormalContextTest.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/contexts/PassivatingContextTest.java
Removed:
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/DependentContextTest.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/NormalContextTest.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/PassivatingContextTest.java
Log:
Move contexts test into own package.
Update dependent context tests to 20081206
Deleted:
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/DependentContextTest.java
===================================================================
---
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/DependentContextTest.java 2008-12-13
21:51:48 UTC (rev 513)
+++
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/DependentContextTest.java 2008-12-13
22:17:48 UTC (rev 514)
@@ -1,578 +0,0 @@
-package org.jboss.webbeans.test;
-
-import static org.jboss.webbeans.util.BeanFactory.createProducerMethodBean;
-import static org.jboss.webbeans.util.BeanFactory.createSimpleBean;
-
-import java.lang.reflect.Method;
-
-import javax.webbeans.ContextNotActiveException;
-import javax.webbeans.Dependent;
-import javax.webbeans.manager.Bean;
-
-import org.jboss.webbeans.bean.ProducerMethodBean;
-import org.jboss.webbeans.bean.SimpleBean;
-import org.jboss.webbeans.contexts.DependentContext;
-import org.jboss.webbeans.test.beans.Fox;
-import org.jboss.webbeans.test.beans.FoxRun;
-import org.jboss.webbeans.test.beans.SpiderProducer;
-import org.jboss.webbeans.test.beans.Tarantula;
-import org.testng.annotations.Test;
-
-@SpecVersion("20081206")
-public class DependentContextTest extends AbstractTest
-{
-
- /**
- * No injected instance of the Web Bean is ever shared between multiple
- * injection points.
- */
- @Test(groups = { "contexts", "injection" })
- @SpecAssertion(section = "9.4")
- public void testInstanceNotSharedBetweenInjectionPoints()
- {
- Bean<FoxRun> foxRunBean = createSimpleBean(FoxRun.class);
- Bean<Fox> foxBean = createSimpleBean(Fox.class);
- manager.addBean(foxBean);
- FoxRun foxRun = foxRunBean.create();
- assert !foxRun.fox.equals(foxRun.anotherFox);
- }
-
- /**
- * Any instance of the Web Bean that is used to evaluate a Unified EL
- * expression exists to service that evaluation only.
- */
- @Test(groups = { "stub", "contexts", "el" })
- @SpecAssertion(section = "9.4")
- public void testInstanceUsedForElEvalutionNotShared()
- {
- assert false;
- }
-
- /**
- * Any instance of the Web Bean that receives a producer method, producer
- * field, disposal method or observer method invocation exists to service
- * that invocation only
- */
- @Test(groups = { "contexts", "producerMethod" })
- @SpecAssertion(section = "9.4")
- public void testInstanceUsedForProducerMethodNotShared() throws Exception
- {
- SimpleBean<SpiderProducer> spiderProducer =
createSimpleBean(SpiderProducer.class);
- manager.addBean(spiderProducer);
- Method method = SpiderProducer.class.getMethod("produceTarantula");
- ProducerMethodBean<Tarantula> tarantulaBean =
createProducerMethodBean(Tarantula.class, method, spiderProducer);
- Tarantula tarantula = tarantulaBean.create();
- Tarantula tarantula2 = tarantulaBean.create();
- assert tarantula != null;
- assert tarantula2 != null;
- assert tarantula != tarantula2;
- }
-
- /**
- * Any instance of the Web Bean that receives a producer method, producer
- * field, disposal method or observer method invocation exists to service
- * that invocation only
- */
- @Test(groups = { "contexts", "producerMethod", "stub"
})
- @SpecAssertion(section = "9.4")
- public void testInstanceUsedForProducerFieldNotShared() throws Exception
- {
- assert false;
- }
-
- /**
- * Any instance of the Web Bean that receives a producer method, producer
- * field, disposal method or observer method invocation exists to service
- * that invocation only
- */
- @Test(groups = { "stub", "contexts", "disposalMethod"
})
- @SpecAssertion(section = "9.4")
- public void testInstanceUsedForDisposalMethodNotShared()
- {
- assert false;
- }
-
- /**
- * Any instance of the Web Bean that receives a producer method, producer
- * field, disposal method or observer method invocation exists to service
- * that invocation only
- */
- @Test(groups = { "stub", "contexts", "observerMethod"
})
- @SpecAssertion(section = "9.4")
- public void testInstanceUsedForObserverMethodNotShared()
- {
- assert false;
- }
-
- /**
- * Every invocation of the get() operation of the Context object for the @Dependent
- * scope with the value true for the create parameter returns a new instance
- * of the given Web Bean
- */
- @Test(groups = "contexts")
- @SpecAssertion(section = "9.4")
- public void testContextGetWithCreateTrueReturnsNewInstance()
- {
- Bean<Fox> foxBean = createSimpleBean(Fox.class);
- manager.addBean(foxBean);
- DependentContext context = new DependentContext();
- context.setActive(true);
- assert context.get(foxBean, true) != null;
- assert context.get(foxBean, true) instanceof Fox;
- }
-
- /**
- * Every invocation of the get() operation of the Context object for the @Dependent
- * scope with the value false for the create parameter returns a null value
- */
- @Test(groups = "contexts")
- @SpecAssertion(section = "9.4")
- public void testContextGetWithCreateFalseReturnsNull()
- {
- Bean<Fox> foxBean = createSimpleBean(Fox.class);
- manager.addBean(foxBean);
- DependentContext context = new DependentContext();
- context.setActive(true);
- assert context.get(foxBean, false) == null;
- }
-
- /**
- * The @Dependent scope is inactive except:
- */
- @Test(groups = "contexts", expectedExceptions =
ContextNotActiveException.class)
- @SpecAssertion(section = "9.4")
- public void testContextIsInactive()
- {
- manager.getContext(Dependent.class).isActive();
- }
-
- /**
- * when an instance of a Web Bean with scope @Dependent is created by the Web
- * Bean manager to receive a producer method, producer field, disposal method
- * or observer method invocation, or
- */
- @Test(groups = { "stub", "contexts", "producerMethod"
})
- @SpecAssertion(section = "9.4")
- public void testContextIsActiveWhenInvokingProducerMethod()
- {
- assert false;
- }
-
- /**
- * when an instance of a Web Bean with scope @Dependent is created by the Web
- * Bean manager to receive a producer method, producer field, disposal method
- * or observer method invocation, or
- */
- @Test(groups = { "stub", "contexts", "producerField" })
- @SpecAssertion(section = "9.4")
- public void testContextIsActiveWhenInvokingProducerField()
- {
- assert false;
- }
-
- /**
- * when an instance of a Web Bean with scope @Dependent is created by the Web
- * Bean manager to receive a producer method, producer field, disposal method
- * or observer method invocation, or
- */
- @Test(groups = { "stub", "contexts", "disposalMethod"
})
- @SpecAssertion(section = "9.4")
- public void testContextIsActiveWhenInvokingDisposalMethod()
- {
- assert false;
- }
-
- /**
- * when an instance of a Web Bean with scope @Dependent is created by the Web
- * Bean manager to receive a producer method, producer field, disposal method
- * or observer method invocation, or
- */
- @Test(groups = { "stub", "contexts", "observerMethod"
})
- @SpecAssertion(section = "9.4")
- public void testContextIsActiveWhenInvokingObserverMethod()
- {
- assert false;
- }
-
- /**
- * while a Unified EL expression is evaluated, or
- */
- @Test(groups = { "stub", "contexts", "el" })
- @SpecAssertion(section = "9.4")
- public void testContextIsActiveWhenEvaluatingElExpression()
- {
- assert false;
- }
-
- /**
- * when the Web Bean manager is creating or destroying a Web Bean instance or
- * injecting its dependencies, or
- */
- @Test(groups = { "contexts", "beanLifecycle" })
- @SpecAssertion(section = "9.4")
- public void testContextIsActiveDuringBeanCreation()
- {
- // Slightly roundabout, but I can't see a better way to test atm
- Bean<FoxRun> foxRunBean = createSimpleBean(FoxRun.class);
- Bean<Fox> foxBean = createSimpleBean(Fox.class);
- manager.addBean(foxBean);
- FoxRun foxRun = foxRunBean.create();
- assert foxRun.fox != null;
- }
-
- /**
- * when the Web Bean manager is creating or destroying a Web Bean instance or
- * injecting its dependencies, or
- */
- @Test(groups = { "stub", "contexts", "beanDestruction"
})
- @SpecAssertion(section = "9.4")
- public void testContextIsActiveDuringBeanDestruction()
- {
- assert false;
- }
-
- /**
- * when the Web Bean manager is creating or destroying a Web Bean instance or
- * injecting its dependencies, or
- */
- @Test(groups = { "contexts", "injection" })
- @SpecAssertion(section = "9.4")
- public void testContextIsActiveDuringInjection()
- {
- Bean<FoxRun> foxRunBean = createSimpleBean(FoxRun.class);
- Bean<Fox> foxBean = createSimpleBean(Fox.class);
- manager.addBean(foxBean);
- FoxRun foxRun = foxRunBean.create();
- assert foxRun.fox != null;
- }
-
- /**
- * when the Web Bean manager is injecting dependencies of an EJB bean or
- * Servlet or when an EJB bean @PostConstruct or @PreDestroy callback is
- * invoked by the EJB container
- */
- @Test(groups = { "contexts", "injection", "stub",
"ejb3" })
- @SpecAssertion(section = "9.4")
- public void testContextIsActiveDuringEJBDependencyInjection()
- {
- assert false;
- }
-
- /**
- * when the Web Bean manager is injecting dependencies of an EJB bean or
- * Servlet or when an EJB bean @PostConstruct or @PreDestroy callback is
- * invoked by the EJB container
- */
- @Test(groups = { "contexts", "injection", "stub",
"servlet" })
- @SpecAssertion(section = "9.4")
- public void testContextIsActiveDuringServletDependencyInjection()
- {
- assert false;
- }
-
- /**
- * when the Web Bean manager is injecting dependencies of an EJB bean or
- * Servlet or when an EJB bean @PostConstruct or @PreDestroy callback is
- * invoked by the EJB container
- */
- @Test(groups = { "contexts", "postconstruct", "stub",
"ejb3" })
- @SpecAssertion(section = "9.4")
- public void testContextIsActiveDuringEJBPostConstruct()
- {
- assert false;
- }
-
- /**
- * when the Web Bean manager is injecting dependencies of an EJB bean or
- * Servlet or when an EJB bean @PostConstruct or @PreDestroy callback is
- * invoked by the EJB container
- */
- @Test(groups = { "contexts", "predestroy", "stub",
"ejb3" })
- @SpecAssertion(section = "9.4")
- public void testContextIsActiveDuringEJBPreDestroy()
- {
- assert false;
- }
-
- /**
- * A Web Bean may create an instance of a Web Bean with scope type @Dependent
- * by calling Manager.getInstance() from the Web Bean constructor, from the
- * Web Bean remove method, from initializer methods, from producer methods,
- * from disposal methods, from @PostConstruct and @PreDestroy callbacks and
- * from Web Beans interceptors or decorators for any of these methods
- */
- @Test(groups = { "stub", "contexts", "constructor" })
- @SpecAssertion(section = "9.4.1")
- public void testWebBeanMayCreateInstanceFromConstructor()
- {
- assert false;
- }
-
- /**
- * A Web Bean may create an instance of a Web Bean with scope type @Dependent
- * by calling Manager.getInstance() from the Web Bean constructor, from the
- * Web Bean remove method, from initializer methods, from producer methods,
- * from disposal methods, from @PostConstruct and @PreDestroy callbacks and
- * from Web Beans interceptors or decorators for any of these methods
- */
- @Test(groups = { "stub", "contexts", "removeMethod" })
- @SpecAssertion(section = "9.4.1")
- public void testWebBeanMayCreateInstanceFromRemoveMethod()
- {
- assert false;
- }
-
- /**
- * A Web Bean may create an instance of a Web Bean with scope type @Dependent
- * by calling Manager.getInstance() from the Web Bean constructor, from the
- * Web Bean remove method, from initializer methods, from producer methods,
- * from disposal methods, from @PostConstruct and @PreDestroy callbacks and
- * from Web Beans interceptors or decorators for any of these methods
- */
- @Test(groups = { "stub", "contexts", "initalizerMethod"
})
- @SpecAssertion(section = "9.4.1")
- public void testWebBeanMayCreateInstanceFromInitializerMethod()
- {
- assert false;
- }
-
- /**
- * A Web Bean may create an instance of a Web Bean with scope type @Dependent
- * by calling Manager.getInstance() from the Web Bean constructor, from the
- * Web Bean remove method, from initializer methods, from producer methods,
- * from disposal methods, from @PostConstruct and @PreDestroy callbacks and
- * from Web Beans interceptors or decorators for any of these methods
- */
- @Test(groups = { "stub", "contexts", "producerMethod"
})
- @SpecAssertion(section = "9.4.1")
- public void testWebBeanMayCreateInstanceFromProducerMethod()
- {
- assert false;
- }
-
- /**
- * A Web Bean may create an instance of a Web Bean with scope type @Dependent
- * by calling Manager.getInstance() from the Web Bean constructor, from the
- * Web Bean remove method, from initializer methods, from producer methods,
- * from disposal methods, from @PostConstruct and @PreDestroy callbacks and
- * from Web Beans interceptors or decorators for any of these methods
- */
- @Test(groups = { "stub", "contexts", "disposalMethod"
})
- @SpecAssertion(section = "9.4.1")
- public void testWebBeanMayCreateInstanceFromDisposalMethod()
- {
- assert false;
- }
-
- /**
- * A Web Bean may create an instance of a Web Bean with scope type @Dependent
- * by calling Manager.getInstance() from the Web Bean constructor, from the
- * Web Bean remove method, from initializer methods, from producer methods,
- * from disposal methods, from @PostConstruct and @PreDestroy callbacks and
- * from Web Beans interceptors or decorators for any of these methods
- */
- @Test(groups = { "stub", "contexts", "preDestroy" })
- @SpecAssertion(section = "9.4.1")
- public void testWebBeanMayCreateInstanceFromPreDestroy()
- {
- assert false;
- }
-
- /**
- * A Web Bean may create an instance of a Web Bean with scope type @Dependent
- * by calling Manager.getInstance() from the Web Bean constructor, from the
- * Web Bean remove method, from initializer methods, from producer methods,
- * from disposal methods, from @PostConstruct and @PreDestroy callbacks and
- * from Web Beans interceptors or decorators for any of these methods
- */
- @Test(groups = { "stub", "contexts", "postConstruct" })
- @SpecAssertion(section = "9.4.1")
- public void testWebBeanMayCreateInstanceFromPostConstruct()
- {
- assert false;
- }
-
- /**
- * A Web Bean may create an instance of a Web Bean with scope type @Dependent
- * by calling Manager.getInstance() from the Web Bean constructor, from the
- * Web Bean remove method, from initializer methods, from producer methods,
- * from disposal methods, from @PostConstruct and @PreDestroy callbacks and
- * from Web Beans interceptors or decorators for any of these methods
- */
- @Test(groups = { "stub", "contexts", "interceptor" })
- @SpecAssertion(section = "9.4.1")
- public void testWebBeanMayCreateInstanceFromInterceptorOfActiveMethod()
- {
- assert false;
- }
-
- /**
- * A Web Bean may create an instance of a Web Bean with scope type @Dependent
- * by calling Manager.getInstance() from the Web Bean constructor, from the
- * Web Bean remove method, from initializer methods, from producer methods,
- * from disposal methods, from @PostConstruct and @PreDestroy callbacks and
- * from Web Beans interceptors or decorators for any of these methods
- */
- @Test(groups = { "stub", "contexts", "decorator" })
- @SpecAssertion(section = "9.4.1")
- public void testWebBeanMayCreateInstanceFromDecoratorOfActiveMethod()
- {
- assert false;
- }
-
- /**
- * An EJB bean may create an instance of a Web Bean with scope type @Dependent
- * by calling Manager.getInstance() from initializer methods, from @PostConstruct
- * and @PreDestroy callbacks and from Web Beans interceptors for these
- * methods.
- */
- @Test(groups = { "stub", "contexts", "ejb3",
"initializerMethod" })
- @SpecAssertion(section = "9.4.1")
- public void testEjbBeanMayCreateInstanceFromInitializer()
- {
- assert false;
- }
-
- /**
- * An EJB bean may create an instance of a Web Bean with scope type @Dependent
- * by calling Manager.getInstance() from initializer methods, from @PostConstruct
- * and @PreDestroy callbacks and from Web Beans interceptors for these
- * methods.
- */
- @Test(groups = { "stub", "contexts", "ejb3",
"postConstruct" })
- @SpecAssertion(section = "9.4.1")
- public void testEjbBeanMayCreateInstanceFromPostConstruct()
- {
- assert false;
- }
-
- /**
- * An EJB bean may create an instance of a Web Bean with scope type @Dependent
- * by calling Manager.getInstance() from initializer methods, from @PostConstruct
- * and @PreDestroy callbacks and from Web Beans interceptors for these
- * methods.
- */
- @Test(groups = { "stub", "contexts", "ejb3",
"preDestroy" })
- @SpecAssertion(section = "9.4.1")
- public void testEjbBeanMayCreateInstanceFromPreDestroy()
- {
- assert false;
- }
-
- /**
- * An EJB bean may create an instance of a Web Bean with scope type @Dependent
- * by calling Manager.getInstance() from initializer methods, from @PostConstruct
- * and @PreDestroy callbacks and from Web Beans interceptors for these
- * methods.
- */
- @Test(groups = { "stub", "contexts", "ejb3",
"interceptor" })
- @SpecAssertion(section = "9.4.1")
- public void testEjbBeanMayCreateInstanceFromInterceptorOfActiveMethod()
- {
- assert false;
- }
-
- /**
- * A Servlet may create an instance of a Web Bean with scope type @Dependent
- * by calling Manager.getInstance() from initializer methods
- */
- @Test(groups = { "stub", "contexts", "servlet",
"initializerMethod" })
- @SpecAssertion(section = "9.4.1")
- public void testServletBeanMayCreateInstanceFromInitializer()
- {
- assert false;
- }
-
- /**
- * destroy all dependent objects of a Web Bean instance when the instance is
- * destroyed,
- */
- @Test(groups = { "stub", "contexts", "beanDestruction"
})
- @SpecAssertion(section = "9.4.2")
- public void testDestroyingParentDestroysDependents()
- {
- assert false;
- }
-
- /**
- * destroy all dependent objects of an EJB bean or Servlet when the EJB bean
- * or Servlet is destroyed,
- */
- @Test(groups = { "stub", "contexts", "ejb3" })
- @SpecAssertion(section = "9.4.2")
- public void testDestroyingEjbDestroysDependents()
- {
- assert false;
- }
-
- /**
- * destroy all dependent objects of an EJB bean or Servlet when the EJB bean
- * or Servlet is destroyed,
- */
- @Test(groups = { "stub", "contexts", "servlet" })
- @SpecAssertion(section = "9.4.2")
- public void testDestroyingServletDestroysDependents()
- {
- assert false;
- }
-
- /**
- * destroy all @Dependent scoped contextual instances created during an EL
- * expression evaluation when the evaluation completes, and
- */
- @Test(groups = { "stub", "contexts", "el" })
- @SpecAssertion(section = "9.4.2")
- public void testDependentsDestroyedWhenElEvaluationCompletes()
- {
- assert false;
- }
-
- /**
- * destroy any @Dependent scoped contextual instance created to receive a
- * producer method, producer field, disposal method or observer method
- * invocation when the invocation completes
- */
- @Test(groups = { "stub", "contexts", "producerMethod"
})
- @SpecAssertion(section = "9.4.2")
- public void testDependentsDestroyedWhenProducerMethodCompletes()
- {
- assert false;
- }
-
- /**
- * destroy any @Dependent scoped contextual instance created to receive a
- * producer method, producer field, disposal method or observer method
- * invocation when the invocation completes
- */
- @Test(groups = { "stub", "contexts", "producerField" })
- @SpecAssertion(section = "9.4.2")
- public void testDependentsDestroyedWhenProducerFieldCompletes()
- {
- assert false;
- }
-
- /**
- * destroy any @Dependent scoped contextual instance created to receive a
- * producer method, producer field, disposal method or observer method
- * invocation when the invocation completes
- */
- @Test(groups = { "stub", "contexts", "disposalMethod"
})
- @SpecAssertion(section = "9.4.2")
- public void testDependentsDestroyedWhenDisposalMethodCompletes()
- {
- assert false;
- }
-
- /**
- * destroy any @Dependent scoped contextual instance created to receive a
- * producer method, producer field, disposal method or observer method
- * invocation when the invocation completes
- */
- @Test(groups = { "stub", "contexts", "observerMethod"
})
- @SpecAssertion(section = "9.4")
- public void testDependentsDestroyedWhenObserverMethodEvaluationCompletes()
- {
- assert false;
- }
-
-}
Deleted:
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/NormalContextTest.java
===================================================================
---
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/NormalContextTest.java 2008-12-13
21:51:48 UTC (rev 513)
+++
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/NormalContextTest.java 2008-12-13
22:17:48 UTC (rev 514)
@@ -1,77 +0,0 @@
-package org.jboss.webbeans.test;
-
-import static org.jboss.webbeans.util.BeanFactory.createProducerMethodBean;
-import static org.jboss.webbeans.util.BeanFactory.createSimpleBean;
-
-import java.lang.reflect.Method;
-
-import javax.webbeans.ContextNotActiveException;
-import javax.webbeans.manager.Bean;
-import javax.webbeans.manager.Context;
-
-import org.jboss.webbeans.bean.ProducerMethodBean;
-import org.jboss.webbeans.bean.SimpleBean;
-import org.jboss.webbeans.contexts.AbstractContext;
-import org.jboss.webbeans.contexts.RequestContext;
-import org.jboss.webbeans.test.beans.SpiderProducer;
-import org.jboss.webbeans.test.beans.Tarantula;
-import org.jboss.webbeans.test.beans.Tuna;
-import org.jboss.webbeans.util.BeanFactory;
-import org.testng.annotations.BeforeMethod;
-import org.testng.annotations.Test;
-
-/**
- *
- * @author Nicklas Karlsson (nickarls(a)gmail.com)
- * @author Pete Muir
- *
- * This class tests a basic context against section 8 of the specification
- *
- */
-@SpecVersion("PDR")
-public class NormalContextTest extends AbstractTest
-{
- Context context;
-
- @BeforeMethod
- public void initContext() {
- context = new RequestContext() {};
- }
-
- @Test(groups="contexts") @SpecAssertion(section="8.1")
- public void testGetWithCreateFalseReturnsNull() {
- Bean<Tuna> tunaBean = BeanFactory.createSimpleBean(Tuna.class);
- assert context.get(tunaBean, false) == null;
- }
-
- @Test(groups="contexts") @SpecAssertion(section="8.1")
- public void testGetWithCreateTrueReturnsBean() {
- Bean<Tuna> tunaBean = BeanFactory.createSimpleBean(Tuna.class);
- assert context.get(tunaBean, true) != null;
- }
-
- @Test(groups="contexts", expectedExceptions=ContextNotActiveException.class)
@SpecAssertion(section="8.1")
- public void testInactiveContextThrowsContextNotActiveException() {
- ((AbstractContext)context).setActive(false);
- context.get(null, false);
- assert true;
- }
-
- @Test(groups="contexts") @SpecAssertion(section="8.1")
- public void testReturnsCorrectExistingBean() {
- Bean<Tuna> tunaBean = BeanFactory.createSimpleBean(Tuna.class);
- Tuna firstTuna = context.get(tunaBean, true);
- Tuna secondTuna = context.get(tunaBean, false);
- assert firstTuna == secondTuna;
- }
-
- @Test(groups={"contexts", "producerMethod"})
@SpecAssertion(section="8.1")
- public void testProducerMethodReturningNullOK() throws SecurityException,
NoSuchMethodException {
- SimpleBean<SpiderProducer> producer =
createSimpleBean(SpiderProducer.class);
- manager.addBean(producer);
- Method nullProducer = SpiderProducer.class.getMethod("produceShelob");
- ProducerMethodBean<Tarantula> shelobBean =
createProducerMethodBean(Tarantula.class, nullProducer, producer);
- assert shelobBean.create() == null;
- }
-
-}
Deleted:
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/PassivatingContextTest.java
===================================================================
---
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/PassivatingContextTest.java 2008-12-13
21:51:48 UTC (rev 513)
+++
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/PassivatingContextTest.java 2008-12-13
22:17:48 UTC (rev 514)
@@ -1,156 +0,0 @@
-package org.jboss.webbeans.test;
-
-import javax.webbeans.manager.Context;
-
-import org.jboss.webbeans.contexts.RequestContext;
-import org.testng.annotations.BeforeMethod;
-import org.testng.annotations.Test;
-
-/**
- *
- * @author Nicklas Karlsson (nickarls(a)gmail.com)
- *
- */
-@SpecVersion("20081029-PDR")
-public class PassivatingContextTest extends AbstractTest
-{
- Context context;
-
- @BeforeMethod
- public void initContext()
- {
- context = new RequestContext() {};
- }
-
- @Test(groups = {"stub", "contexts", "passivation" })
@SpecAssertion(section = "8.4")
- public void testIsSessionScopePassivating()
- {
- assert false;
- }
-
- @Test(groups = {"stub", "contexts", "passivation" })
@SpecAssertion(section = "8.4")
- public void testIsConversationScopePassivating()
- {
- assert false;
- }
-
- @Test(groups = {"stub", "contexts", "passivation" })
@SpecAssertion(section = "8.4")
- public void testIsApplicationScopeNonPassivating()
- {
- assert false;
- }
-
- @Test(groups = {"stub", "contexts", "passivation" })
@SpecAssertion(section = "8.4")
- public void testIsRequestScopePassivating()
- {
- assert false;
- }
-
- @Test(groups = {"stub", "contexts", "passivation" })
@SpecAssertion(section = "8.4")
- public void testEJBWebBeanCanDefinePassivatingScope()
- {
- assert false;
- }
-
- @Test(groups = {"stub", "contexts", "passivation" })
@SpecAssertion(section = "8.4")
- public void testSimpleWebBeanWithNonSerializableImplementationClassFails()
- {
- assert false;
- }
-
- @Test(groups = {"stub", "contexts", "passivation" })
@SpecAssertion(section = "8.4")
- public void
testProducerMethodDeclaringPassivatingScopeButReturningNonSerializableImplementationClassFails()
- {
- assert false;
- }
-
- @Test(groups = {"stub", "contexts", "passivation" })
@SpecAssertion(section = "8.4")
- public void
testSimpleWebBeanDeclaringPassivatingScopeIsSerializedWhenContextIsPassivated()
- {
- assert false;
- }
-
- @Test(groups = {"stub", "contexts", "passivation" })
@SpecAssertion(section = "8.4")
- public void testStatefulEJBIsSerializedWhenPassivatedByEJBContainer()
- {
- assert false;
- }
-
- @Test(groups = {"stub", "contexts", "passivation" })
@SpecAssertion(section = "8.4")
- public void testReferencesToWebBeansAreSerializable()
- {
- assert false;
- }
-
- @Test(groups = {"stub", "contexts", "passivation" })
@SpecAssertion(section = "8.4")
- public void testDependentEJBsAreSerializable()
- {
- assert false;
- }
-
- @Test(groups = {"stub", "contexts", "passivation" })
@SpecAssertion(section = "8.4")
- public void
testSimpleDependentWebBeanWithNonSerializableImplementationInjectedIntoStatefulSessionBeanWithPassivatingScopeFails()
- {
- assert false;
- }
-
- @Test(groups = {"stub", "contexts", "passivation" })
@SpecAssertion(section = "8.4")
- public void
testSimpleDependentWebBeanWithNonSerializableImplementationInjectedIntoNonTransientFieldOfWebBeanWithPassivatingScopeFails()
- {
- assert false;
- }
-
- @Test(groups = {"stub", "contexts", "passivation" })
@SpecAssertion(section = "8.4")
- public void
testSimpleDependentWebBeanWithNonSerializableImplementationInjectedIntoConstructorParameterOfWebBeanWithPassivatingScopeFails()
- {
- assert false;
- }
-
- @Test(groups = {"stub", "contexts", "passivation" })
@SpecAssertion(section = "8.4")
- public void
testSimpleDependentWebBeanWithNonSerializableImplementationInjectedIntoInitializerParameterOfWebBeanWithPassivatingScopeFails()
- {
- assert false;
- }
-
- @Test(groups = {"stub", "contexts", "passivation" })
@SpecAssertion(section = "8.4")
- public void
testSimpleDependentWebBeanWithNonSerializableImplementationInjectedIntoProducerMethodParameterWithPassivatingScopeFails()
- {
- assert false;
- }
-
- @Test(groups = {"stub", "contexts", "passivation" })
@SpecAssertion(section = "8.4")
- public void
testDependentScopedProducerMethodReturnsNonSerializableObjectForInjectionIntoStatefulSessionBeanWithPassivatingScopeFails()
- {
- assert false;
- }
-
- @Test(groups = {"stub", "contexts", "passivation" })
@SpecAssertion(section = "8.4")
- public void
testDependentScopedProducerMethodReturnsNonSerializableObjectForInjectionIntoNonTransientFieldOfWebBeanWithPassivatingScopeFails()
- {
- assert false;
- }
-
- @Test(groups = {"stub", "contexts", "passivation" })
@SpecAssertion(section = "8.4")
- public void
testDependentScopedProducerMethodReturnsNonSerializableObjectForInjectionIntoConstructorParameterOfWebBeanWithPassivatingScopeFails()
- {
- assert false;
- }
-
- @Test(groups = {"stub", "contexts", "passivation" })
@SpecAssertion(section = "8.4")
- public void
testDependentScopedProducerMethodReturnsNonSerializableObjectForInjectionIntoInitializerParameterOfWebBeanWithPassivatingScopeFails()
- {
- assert false;
- }
-
- @Test(groups = {"stub", "contexts", "passivation" })
@SpecAssertion(section = "8.4")
- public void
testDependentScopedProducerMethodReturnsNonSerializableObjectForInjectionIntoProducerMethodParameterWithPassivatingScopeFails()
- {
- assert false;
- }
-
- @Test(groups = {"stub", "contexts", "passivation" })
@SpecAssertion(section = "8.4")
- public void testJMSEndpointProxyIsSerializable()
- {
- assert false;
- }
-}
Copied:
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/contexts/DependentContextTest.java
(from rev 513,
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/DependentContextTest.java)
===================================================================
---
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/contexts/DependentContextTest.java
(rev 0)
+++
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/contexts/DependentContextTest.java 2008-12-13
22:17:48 UTC (rev 514)
@@ -0,0 +1,581 @@
+package org.jboss.webbeans.test.contexts;
+
+import static org.jboss.webbeans.util.BeanFactory.createProducerMethodBean;
+import static org.jboss.webbeans.util.BeanFactory.createSimpleBean;
+
+import java.lang.reflect.Method;
+
+import javax.webbeans.ContextNotActiveException;
+import javax.webbeans.Dependent;
+import javax.webbeans.manager.Bean;
+
+import org.jboss.webbeans.bean.ProducerMethodBean;
+import org.jboss.webbeans.bean.SimpleBean;
+import org.jboss.webbeans.contexts.DependentContext;
+import org.jboss.webbeans.test.AbstractTest;
+import org.jboss.webbeans.test.SpecAssertion;
+import org.jboss.webbeans.test.SpecVersion;
+import org.jboss.webbeans.test.beans.Fox;
+import org.jboss.webbeans.test.beans.FoxRun;
+import org.jboss.webbeans.test.beans.SpiderProducer;
+import org.jboss.webbeans.test.beans.Tarantula;
+import org.testng.annotations.Test;
+
+@SpecVersion("20081206")
+public class DependentContextTest extends AbstractTest
+{
+
+ /**
+ * No injected instance of the Web Bean is ever shared between multiple
+ * injection points.
+ */
+ @Test(groups = { "contexts", "injection" })
+ @SpecAssertion(section = "9.4")
+ public void testInstanceNotSharedBetweenInjectionPoints()
+ {
+ Bean<FoxRun> foxRunBean = createSimpleBean(FoxRun.class);
+ Bean<Fox> foxBean = createSimpleBean(Fox.class);
+ manager.addBean(foxBean);
+ FoxRun foxRun = foxRunBean.create();
+ assert !foxRun.fox.equals(foxRun.anotherFox);
+ }
+
+ /**
+ * Any instance of the Web Bean that is used to evaluate a Unified EL
+ * expression exists to service that evaluation only.
+ */
+ @Test(groups = { "stub", "contexts", "el" })
+ @SpecAssertion(section = "9.4")
+ public void testInstanceUsedForElEvalutionNotShared()
+ {
+ assert false;
+ }
+
+ /**
+ * Any instance of the Web Bean that receives a producer method, producer
+ * field, disposal method or observer method invocation exists to service
+ * that invocation only
+ */
+ @Test(groups = { "contexts", "producerMethod" })
+ @SpecAssertion(section = "9.4")
+ public void testInstanceUsedForProducerMethodNotShared() throws Exception
+ {
+ SimpleBean<SpiderProducer> spiderProducer =
createSimpleBean(SpiderProducer.class);
+ manager.addBean(spiderProducer);
+ Method method = SpiderProducer.class.getMethod("produceTarantula");
+ ProducerMethodBean<Tarantula> tarantulaBean =
createProducerMethodBean(Tarantula.class, method, spiderProducer);
+ Tarantula tarantula = tarantulaBean.create();
+ Tarantula tarantula2 = tarantulaBean.create();
+ assert tarantula != null;
+ assert tarantula2 != null;
+ assert tarantula != tarantula2;
+ }
+
+ /**
+ * Any instance of the Web Bean that receives a producer method, producer
+ * field, disposal method or observer method invocation exists to service
+ * that invocation only
+ */
+ @Test(groups = { "contexts", "producerMethod", "stub"
})
+ @SpecAssertion(section = "9.4")
+ public void testInstanceUsedForProducerFieldNotShared() throws Exception
+ {
+ assert false;
+ }
+
+ /**
+ * Any instance of the Web Bean that receives a producer method, producer
+ * field, disposal method or observer method invocation exists to service
+ * that invocation only
+ */
+ @Test(groups = { "stub", "contexts", "disposalMethod"
})
+ @SpecAssertion(section = "9.4")
+ public void testInstanceUsedForDisposalMethodNotShared()
+ {
+ assert false;
+ }
+
+ /**
+ * Any instance of the Web Bean that receives a producer method, producer
+ * field, disposal method or observer method invocation exists to service
+ * that invocation only
+ */
+ @Test(groups = { "stub", "contexts", "observerMethod"
})
+ @SpecAssertion(section = "9.4")
+ public void testInstanceUsedForObserverMethodNotShared()
+ {
+ assert false;
+ }
+
+ /**
+ * Every invocation of the get() operation of the Context object for the @Dependent
+ * scope with the value true for the create parameter returns a new instance
+ * of the given Web Bean
+ */
+ @Test(groups = "contexts")
+ @SpecAssertion(section = "9.4")
+ public void testContextGetWithCreateTrueReturnsNewInstance()
+ {
+ Bean<Fox> foxBean = createSimpleBean(Fox.class);
+ manager.addBean(foxBean);
+ DependentContext context = new DependentContext();
+ context.setActive(true);
+ assert context.get(foxBean, true) != null;
+ assert context.get(foxBean, true) instanceof Fox;
+ }
+
+ /**
+ * Every invocation of the get() operation of the Context object for the @Dependent
+ * scope with the value false for the create parameter returns a null value
+ */
+ @Test(groups = "contexts")
+ @SpecAssertion(section = "9.4")
+ public void testContextGetWithCreateFalseReturnsNull()
+ {
+ Bean<Fox> foxBean = createSimpleBean(Fox.class);
+ manager.addBean(foxBean);
+ DependentContext context = new DependentContext();
+ context.setActive(true);
+ assert context.get(foxBean, false) == null;
+ }
+
+ /**
+ * The @Dependent scope is inactive except:
+ */
+ @Test(groups = "contexts", expectedExceptions =
ContextNotActiveException.class)
+ @SpecAssertion(section = "9.4")
+ public void testContextIsInactive()
+ {
+ manager.getContext(Dependent.class).isActive();
+ }
+
+ /**
+ * when an instance of a Web Bean with scope @Dependent is created by the Web
+ * Bean manager to receive a producer method, producer field, disposal method
+ * or observer method invocation, or
+ */
+ @Test(groups = { "stub", "contexts", "producerMethod"
})
+ @SpecAssertion(section = "9.4")
+ public void testContextIsActiveWhenInvokingProducerMethod()
+ {
+ assert false;
+ }
+
+ /**
+ * when an instance of a Web Bean with scope @Dependent is created by the Web
+ * Bean manager to receive a producer method, producer field, disposal method
+ * or observer method invocation, or
+ */
+ @Test(groups = { "stub", "contexts", "producerField" })
+ @SpecAssertion(section = "9.4")
+ public void testContextIsActiveWhenInvokingProducerField()
+ {
+ assert false;
+ }
+
+ /**
+ * when an instance of a Web Bean with scope @Dependent is created by the Web
+ * Bean manager to receive a producer method, producer field, disposal method
+ * or observer method invocation, or
+ */
+ @Test(groups = { "stub", "contexts", "disposalMethod"
})
+ @SpecAssertion(section = "9.4")
+ public void testContextIsActiveWhenInvokingDisposalMethod()
+ {
+ assert false;
+ }
+
+ /**
+ * when an instance of a Web Bean with scope @Dependent is created by the Web
+ * Bean manager to receive a producer method, producer field, disposal method
+ * or observer method invocation, or
+ */
+ @Test(groups = { "stub", "contexts", "observerMethod"
})
+ @SpecAssertion(section = "9.4")
+ public void testContextIsActiveWhenInvokingObserverMethod()
+ {
+ assert false;
+ }
+
+ /**
+ * while a Unified EL expression is evaluated, or
+ */
+ @Test(groups = { "stub", "contexts", "el" })
+ @SpecAssertion(section = "9.4")
+ public void testContextIsActiveWhenEvaluatingElExpression()
+ {
+ assert false;
+ }
+
+ /**
+ * when the Web Bean manager is creating or destroying a Web Bean instance or
+ * injecting its dependencies, or
+ */
+ @Test(groups = { "contexts", "beanLifecycle" })
+ @SpecAssertion(section = "9.4")
+ public void testContextIsActiveDuringBeanCreation()
+ {
+ // Slightly roundabout, but I can't see a better way to test atm
+ Bean<FoxRun> foxRunBean = createSimpleBean(FoxRun.class);
+ Bean<Fox> foxBean = createSimpleBean(Fox.class);
+ manager.addBean(foxBean);
+ FoxRun foxRun = foxRunBean.create();
+ assert foxRun.fox != null;
+ }
+
+ /**
+ * when the Web Bean manager is creating or destroying a Web Bean instance or
+ * injecting its dependencies, or
+ */
+ @Test(groups = { "stub", "contexts", "beanDestruction"
})
+ @SpecAssertion(section = "9.4")
+ public void testContextIsActiveDuringBeanDestruction()
+ {
+ assert false;
+ }
+
+ /**
+ * when the Web Bean manager is creating or destroying a Web Bean instance or
+ * injecting its dependencies, or
+ */
+ @Test(groups = { "contexts", "injection" })
+ @SpecAssertion(section = "9.4")
+ public void testContextIsActiveDuringInjection()
+ {
+ Bean<FoxRun> foxRunBean = createSimpleBean(FoxRun.class);
+ Bean<Fox> foxBean = createSimpleBean(Fox.class);
+ manager.addBean(foxBean);
+ FoxRun foxRun = foxRunBean.create();
+ assert foxRun.fox != null;
+ }
+
+ /**
+ * when the Web Bean manager is injecting dependencies of an EJB bean or
+ * Servlet or when an EJB bean @PostConstruct or @PreDestroy callback is
+ * invoked by the EJB container
+ */
+ @Test(groups = { "contexts", "injection", "stub",
"ejb3" })
+ @SpecAssertion(section = "9.4")
+ public void testContextIsActiveDuringEJBDependencyInjection()
+ {
+ assert false;
+ }
+
+ /**
+ * when the Web Bean manager is injecting dependencies of an EJB bean or
+ * Servlet or when an EJB bean @PostConstruct or @PreDestroy callback is
+ * invoked by the EJB container
+ */
+ @Test(groups = { "contexts", "injection", "stub",
"servlet" })
+ @SpecAssertion(section = "9.4")
+ public void testContextIsActiveDuringServletDependencyInjection()
+ {
+ assert false;
+ }
+
+ /**
+ * when the Web Bean manager is injecting dependencies of an EJB bean or
+ * Servlet or when an EJB bean @PostConstruct or @PreDestroy callback is
+ * invoked by the EJB container
+ */
+ @Test(groups = { "contexts", "postconstruct", "stub",
"ejb3" })
+ @SpecAssertion(section = "9.4")
+ public void testContextIsActiveDuringEJBPostConstruct()
+ {
+ assert false;
+ }
+
+ /**
+ * when the Web Bean manager is injecting dependencies of an EJB bean or
+ * Servlet or when an EJB bean @PostConstruct or @PreDestroy callback is
+ * invoked by the EJB container
+ */
+ @Test(groups = { "contexts", "predestroy", "stub",
"ejb3" })
+ @SpecAssertion(section = "9.4")
+ public void testContextIsActiveDuringEJBPreDestroy()
+ {
+ assert false;
+ }
+
+ /**
+ * A Web Bean may create an instance of a Web Bean with scope type @Dependent
+ * by calling Manager.getInstance() from the Web Bean constructor, from the
+ * Web Bean remove method, from initializer methods, from producer methods,
+ * from disposal methods, from @PostConstruct and @PreDestroy callbacks and
+ * from Web Beans interceptors or decorators for any of these methods
+ */
+ @Test(groups = { "stub", "contexts", "constructor" })
+ @SpecAssertion(section = "9.4.1")
+ public void testWebBeanMayCreateInstanceFromConstructor()
+ {
+ assert false;
+ }
+
+ /**
+ * A Web Bean may create an instance of a Web Bean with scope type @Dependent
+ * by calling Manager.getInstance() from the Web Bean constructor, from the
+ * Web Bean remove method, from initializer methods, from producer methods,
+ * from disposal methods, from @PostConstruct and @PreDestroy callbacks and
+ * from Web Beans interceptors or decorators for any of these methods
+ */
+ @Test(groups = { "stub", "contexts", "removeMethod" })
+ @SpecAssertion(section = "9.4.1")
+ public void testWebBeanMayCreateInstanceFromRemoveMethod()
+ {
+ assert false;
+ }
+
+ /**
+ * A Web Bean may create an instance of a Web Bean with scope type @Dependent
+ * by calling Manager.getInstance() from the Web Bean constructor, from the
+ * Web Bean remove method, from initializer methods, from producer methods,
+ * from disposal methods, from @PostConstruct and @PreDestroy callbacks and
+ * from Web Beans interceptors or decorators for any of these methods
+ */
+ @Test(groups = { "stub", "contexts", "initalizerMethod"
})
+ @SpecAssertion(section = "9.4.1")
+ public void testWebBeanMayCreateInstanceFromInitializerMethod()
+ {
+ assert false;
+ }
+
+ /**
+ * A Web Bean may create an instance of a Web Bean with scope type @Dependent
+ * by calling Manager.getInstance() from the Web Bean constructor, from the
+ * Web Bean remove method, from initializer methods, from producer methods,
+ * from disposal methods, from @PostConstruct and @PreDestroy callbacks and
+ * from Web Beans interceptors or decorators for any of these methods
+ */
+ @Test(groups = { "stub", "contexts", "producerMethod"
})
+ @SpecAssertion(section = "9.4.1")
+ public void testWebBeanMayCreateInstanceFromProducerMethod()
+ {
+ assert false;
+ }
+
+ /**
+ * A Web Bean may create an instance of a Web Bean with scope type @Dependent
+ * by calling Manager.getInstance() from the Web Bean constructor, from the
+ * Web Bean remove method, from initializer methods, from producer methods,
+ * from disposal methods, from @PostConstruct and @PreDestroy callbacks and
+ * from Web Beans interceptors or decorators for any of these methods
+ */
+ @Test(groups = { "stub", "contexts", "disposalMethod"
})
+ @SpecAssertion(section = "9.4.1")
+ public void testWebBeanMayCreateInstanceFromDisposalMethod()
+ {
+ assert false;
+ }
+
+ /**
+ * A Web Bean may create an instance of a Web Bean with scope type @Dependent
+ * by calling Manager.getInstance() from the Web Bean constructor, from the
+ * Web Bean remove method, from initializer methods, from producer methods,
+ * from disposal methods, from @PostConstruct and @PreDestroy callbacks and
+ * from Web Beans interceptors or decorators for any of these methods
+ */
+ @Test(groups = { "stub", "contexts", "preDestroy" })
+ @SpecAssertion(section = "9.4.1")
+ public void testWebBeanMayCreateInstanceFromPreDestroy()
+ {
+ assert false;
+ }
+
+ /**
+ * A Web Bean may create an instance of a Web Bean with scope type @Dependent
+ * by calling Manager.getInstance() from the Web Bean constructor, from the
+ * Web Bean remove method, from initializer methods, from producer methods,
+ * from disposal methods, from @PostConstruct and @PreDestroy callbacks and
+ * from Web Beans interceptors or decorators for any of these methods
+ */
+ @Test(groups = { "stub", "contexts", "postConstruct" })
+ @SpecAssertion(section = "9.4.1")
+ public void testWebBeanMayCreateInstanceFromPostConstruct()
+ {
+ assert false;
+ }
+
+ /**
+ * A Web Bean may create an instance of a Web Bean with scope type @Dependent
+ * by calling Manager.getInstance() from the Web Bean constructor, from the
+ * Web Bean remove method, from initializer methods, from producer methods,
+ * from disposal methods, from @PostConstruct and @PreDestroy callbacks and
+ * from Web Beans interceptors or decorators for any of these methods
+ */
+ @Test(groups = { "stub", "contexts", "interceptor" })
+ @SpecAssertion(section = "9.4.1")
+ public void testWebBeanMayCreateInstanceFromInterceptorOfActiveMethod()
+ {
+ assert false;
+ }
+
+ /**
+ * A Web Bean may create an instance of a Web Bean with scope type @Dependent
+ * by calling Manager.getInstance() from the Web Bean constructor, from the
+ * Web Bean remove method, from initializer methods, from producer methods,
+ * from disposal methods, from @PostConstruct and @PreDestroy callbacks and
+ * from Web Beans interceptors or decorators for any of these methods
+ */
+ @Test(groups = { "stub", "contexts", "decorator" })
+ @SpecAssertion(section = "9.4.1")
+ public void testWebBeanMayCreateInstanceFromDecoratorOfActiveMethod()
+ {
+ assert false;
+ }
+
+ /**
+ * An EJB bean may create an instance of a Web Bean with scope type @Dependent
+ * by calling Manager.getInstance() from initializer methods, from @PostConstruct
+ * and @PreDestroy callbacks and from Web Beans interceptors for these
+ * methods.
+ */
+ @Test(groups = { "stub", "contexts", "ejb3",
"initializerMethod" })
+ @SpecAssertion(section = "9.4.1")
+ public void testEjbBeanMayCreateInstanceFromInitializer()
+ {
+ assert false;
+ }
+
+ /**
+ * An EJB bean may create an instance of a Web Bean with scope type @Dependent
+ * by calling Manager.getInstance() from initializer methods, from @PostConstruct
+ * and @PreDestroy callbacks and from Web Beans interceptors for these
+ * methods.
+ */
+ @Test(groups = { "stub", "contexts", "ejb3",
"postConstruct" })
+ @SpecAssertion(section = "9.4.1")
+ public void testEjbBeanMayCreateInstanceFromPostConstruct()
+ {
+ assert false;
+ }
+
+ /**
+ * An EJB bean may create an instance of a Web Bean with scope type @Dependent
+ * by calling Manager.getInstance() from initializer methods, from @PostConstruct
+ * and @PreDestroy callbacks and from Web Beans interceptors for these
+ * methods.
+ */
+ @Test(groups = { "stub", "contexts", "ejb3",
"preDestroy" })
+ @SpecAssertion(section = "9.4.1")
+ public void testEjbBeanMayCreateInstanceFromPreDestroy()
+ {
+ assert false;
+ }
+
+ /**
+ * An EJB bean may create an instance of a Web Bean with scope type @Dependent
+ * by calling Manager.getInstance() from initializer methods, from @PostConstruct
+ * and @PreDestroy callbacks and from Web Beans interceptors for these
+ * methods.
+ */
+ @Test(groups = { "stub", "contexts", "ejb3",
"interceptor" })
+ @SpecAssertion(section = "9.4.1")
+ public void testEjbBeanMayCreateInstanceFromInterceptorOfActiveMethod()
+ {
+ assert false;
+ }
+
+ /**
+ * A Servlet may create an instance of a Web Bean with scope type @Dependent
+ * by calling Manager.getInstance() from initializer methods
+ */
+ @Test(groups = { "stub", "contexts", "servlet",
"initializerMethod" })
+ @SpecAssertion(section = "9.4.1")
+ public void testServletBeanMayCreateInstanceFromInitializer()
+ {
+ assert false;
+ }
+
+ /**
+ * destroy all dependent objects of a Web Bean instance when the instance is
+ * destroyed,
+ */
+ @Test(groups = { "stub", "contexts", "beanDestruction"
})
+ @SpecAssertion(section = "9.4.2")
+ public void testDestroyingParentDestroysDependents()
+ {
+ assert false;
+ }
+
+ /**
+ * destroy all dependent objects of an EJB bean or Servlet when the EJB bean
+ * or Servlet is destroyed,
+ */
+ @Test(groups = { "stub", "contexts", "ejb3" })
+ @SpecAssertion(section = "9.4.2")
+ public void testDestroyingEjbDestroysDependents()
+ {
+ assert false;
+ }
+
+ /**
+ * destroy all dependent objects of an EJB bean or Servlet when the EJB bean
+ * or Servlet is destroyed,
+ */
+ @Test(groups = { "stub", "contexts", "servlet" })
+ @SpecAssertion(section = "9.4.2")
+ public void testDestroyingServletDestroysDependents()
+ {
+ assert false;
+ }
+
+ /**
+ * destroy all @Dependent scoped contextual instances created during an EL
+ * expression evaluation when the evaluation completes, and
+ */
+ @Test(groups = { "stub", "contexts", "el" })
+ @SpecAssertion(section = "9.4.2")
+ public void testDependentsDestroyedWhenElEvaluationCompletes()
+ {
+ assert false;
+ }
+
+ /**
+ * destroy any @Dependent scoped contextual instance created to receive a
+ * producer method, producer field, disposal method or observer method
+ * invocation when the invocation completes
+ */
+ @Test(groups = { "stub", "contexts", "producerMethod"
})
+ @SpecAssertion(section = "9.4.2")
+ public void testDependentsDestroyedWhenProducerMethodCompletes()
+ {
+ assert false;
+ }
+
+ /**
+ * destroy any @Dependent scoped contextual instance created to receive a
+ * producer method, producer field, disposal method or observer method
+ * invocation when the invocation completes
+ */
+ @Test(groups = { "stub", "contexts", "producerField" })
+ @SpecAssertion(section = "9.4.2")
+ public void testDependentsDestroyedWhenProducerFieldCompletes()
+ {
+ assert false;
+ }
+
+ /**
+ * destroy any @Dependent scoped contextual instance created to receive a
+ * producer method, producer field, disposal method or observer method
+ * invocation when the invocation completes
+ */
+ @Test(groups = { "stub", "contexts", "disposalMethod"
})
+ @SpecAssertion(section = "9.4.2")
+ public void testDependentsDestroyedWhenDisposalMethodCompletes()
+ {
+ assert false;
+ }
+
+ /**
+ * destroy any @Dependent scoped contextual instance created to receive a
+ * producer method, producer field, disposal method or observer method
+ * invocation when the invocation completes
+ */
+ @Test(groups = { "stub", "contexts", "observerMethod"
})
+ @SpecAssertion(section = "9.4")
+ public void testDependentsDestroyedWhenObserverMethodEvaluationCompletes()
+ {
+ assert false;
+ }
+
+}
Property changes on:
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/contexts/DependentContextTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:mergeinfo
+
Copied:
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/contexts/NormalContextTest.java
(from rev 511,
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/NormalContextTest.java)
===================================================================
---
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/contexts/NormalContextTest.java
(rev 0)
+++
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/contexts/NormalContextTest.java 2008-12-13
22:17:48 UTC (rev 514)
@@ -0,0 +1,80 @@
+package org.jboss.webbeans.test.contexts;
+
+import static org.jboss.webbeans.util.BeanFactory.createProducerMethodBean;
+import static org.jboss.webbeans.util.BeanFactory.createSimpleBean;
+
+import java.lang.reflect.Method;
+
+import javax.webbeans.ContextNotActiveException;
+import javax.webbeans.manager.Bean;
+import javax.webbeans.manager.Context;
+
+import org.jboss.webbeans.bean.ProducerMethodBean;
+import org.jboss.webbeans.bean.SimpleBean;
+import org.jboss.webbeans.contexts.AbstractContext;
+import org.jboss.webbeans.contexts.RequestContext;
+import org.jboss.webbeans.test.AbstractTest;
+import org.jboss.webbeans.test.SpecAssertion;
+import org.jboss.webbeans.test.SpecVersion;
+import org.jboss.webbeans.test.beans.SpiderProducer;
+import org.jboss.webbeans.test.beans.Tarantula;
+import org.jboss.webbeans.test.beans.Tuna;
+import org.jboss.webbeans.util.BeanFactory;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
+/**
+ *
+ * @author Nicklas Karlsson (nickarls(a)gmail.com)
+ * @author Pete Muir
+ *
+ * This class tests a basic context against section 8 of the specification
+ *
+ */
+@SpecVersion("PDR")
+public class NormalContextTest extends AbstractTest
+{
+ Context context;
+
+ @BeforeMethod
+ public void initContext() {
+ context = new RequestContext() {};
+ }
+
+ @Test(groups="contexts") @SpecAssertion(section="8.1")
+ public void testGetWithCreateFalseReturnsNull() {
+ Bean<Tuna> tunaBean = BeanFactory.createSimpleBean(Tuna.class);
+ assert context.get(tunaBean, false) == null;
+ }
+
+ @Test(groups="contexts") @SpecAssertion(section="8.1")
+ public void testGetWithCreateTrueReturnsBean() {
+ Bean<Tuna> tunaBean = BeanFactory.createSimpleBean(Tuna.class);
+ assert context.get(tunaBean, true) != null;
+ }
+
+ @Test(groups="contexts", expectedExceptions=ContextNotActiveException.class)
@SpecAssertion(section="8.1")
+ public void testInactiveContextThrowsContextNotActiveException() {
+ ((AbstractContext)context).setActive(false);
+ context.get(null, false);
+ assert true;
+ }
+
+ @Test(groups="contexts") @SpecAssertion(section="8.1")
+ public void testReturnsCorrectExistingBean() {
+ Bean<Tuna> tunaBean = BeanFactory.createSimpleBean(Tuna.class);
+ Tuna firstTuna = context.get(tunaBean, true);
+ Tuna secondTuna = context.get(tunaBean, false);
+ assert firstTuna == secondTuna;
+ }
+
+ @Test(groups={"contexts", "producerMethod"})
@SpecAssertion(section="8.1")
+ public void testProducerMethodReturningNullOK() throws SecurityException,
NoSuchMethodException {
+ SimpleBean<SpiderProducer> producer =
createSimpleBean(SpiderProducer.class);
+ manager.addBean(producer);
+ Method nullProducer = SpiderProducer.class.getMethod("produceShelob");
+ ProducerMethodBean<Tarantula> shelobBean =
createProducerMethodBean(Tarantula.class, nullProducer, producer);
+ assert shelobBean.create() == null;
+ }
+
+}
Copied:
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/contexts/PassivatingContextTest.java
(from rev 511,
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/PassivatingContextTest.java)
===================================================================
---
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/contexts/PassivatingContextTest.java
(rev 0)
+++
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/contexts/PassivatingContextTest.java 2008-12-13
22:17:48 UTC (rev 514)
@@ -0,0 +1,322 @@
+package org.jboss.webbeans.test.contexts;
+
+import javax.webbeans.DefinitionException;
+import javax.webbeans.IllegalProductException;
+import javax.webbeans.UnserializableDependencyException;
+import javax.webbeans.manager.Context;
+
+import org.jboss.webbeans.contexts.RequestContext;
+import org.jboss.webbeans.test.AbstractTest;
+import org.jboss.webbeans.test.SpecAssertion;
+import org.jboss.webbeans.test.SpecVersion;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
+/**
+ *
+ * @author Nicklas Karlsson (nickarls(a)gmail.com)
+ *
+ */
+@SpecVersion("20081206")
+public class PassivatingContextTest extends AbstractTest
+{
+ Context context;
+
+ @BeforeMethod
+ public void initContext()
+ {
+ context = new RequestContext()
+ {
+ };
+ }
+
+ /**
+ * EJB local objects are serializable. Therefore, an enterprise Web Bean may
+ * declare any passivating scope.
+ */
+ @Test(groups = { "stub", "contexts", "passivation",
"enterpriseBean" })
+ @SpecAssertion(section = "9.5")
+ public void testEJBWebBeanCanDeclarePassivatingScope()
+ {
+ assert false;
+ }
+
+ /**
+ * Simple Web Beans are not required to be serializable. If a simple Web Bean
+ * declares a passivating scope, and the implementation class is not
+ * serializable, a DefinitionException is thrown by the Web Bean manager at
+ * initialization time.
+ */
+ @Test(groups = { "stub", "contexts", "passivation" },
expectedExceptions = DefinitionException.class)
+ @SpecAssertion(section = "9.5")
+ public void testSimpleWebBeanWithNonSerializableImplementationClassFails()
+ {
+ assert false;
+ }
+
+ /**
+ * If a producer method or field declares a passivating scope and returns a
+ * non-serializable object at runtime, an Illegal- ProductException is thrown
+ * by the Web Bean manager.
+ */
+ @Test(groups = { "stub", "contexts", "passivation" },
expectedExceptions = IllegalProductException.class)
+ @SpecAssertion(section = "9.5")
+ public void
testProducerMethodDeclaringPassivatingScopeButReturningNonSerializableImplementationClassFails()
+ {
+ assert false;
+ }
+
+ /**
+ * The built-in session and conversation scopes are passivating. No other
+ * built-in scope is passivating.
+ */
+ @Test(groups = { "stub", "contexts", "passivation" })
+ @SpecAssertion(section = "9.5")
+ public void testIsSessionScopePassivating()
+ {
+ assert false;
+ }
+
+ /**
+ * The built-in session and conversation scopes are passivating. No other
+ * built-in scope is passivating.
+ */
+ @Test(groups = { "stub", "contexts", "passivation" })
+ @SpecAssertion(section = "9.5")
+ public void testIsConversationScopePassivating()
+ {
+ assert false;
+ }
+
+ /**
+ * The built-in session and conversation scopes are passivating. No other
+ * built-in scope is passivating.
+ */
+ @Test(groups = { "stub", "contexts", "passivation" })
+ @SpecAssertion(section = "9.5")
+ public void testIsApplicationScopeNonPassivating()
+ {
+ assert false;
+ }
+
+ /**
+ * The built-in session and conversation scopes are passivating. No other
+ * built-in scope is passivating.
+ */
+ @Test(groups = { "stub", "contexts", "passivation" })
+ @SpecAssertion(section = "9.5")
+ public void testIsRequestScopeNonPassivating()
+ {
+ assert false;
+ }
+
+ /**
+ * the Web Bean declares a passivating scope type, and context passivation
+ * occurs, or
+ */
+ @Test(groups = { "stub", "contexts", "passivation" })
+ @SpecAssertion(section = "9.5")
+ public void
testSimpleWebBeanDeclaringPassivatingScopeIsSerializedWhenContextIsPassivated()
+ {
+ assert false;
+ }
+
+ /**
+ * the Web Bean is an EJB stateful session bean, and it is passivated by the
+ * EJB container.
+ */
+ @Test(groups = { "stub", "contexts", "passivation" })
+ @SpecAssertion(section = "9.5")
+ public void testStatefulEJBIsSerializedWhenPassivatedByEJBContainer()
+ {
+ assert false;
+ }
+
+ /**
+ * Therefore, any reference to a Web Bean which declares a normal scope type
+ * is serializable.
+ */
+ @Test(groups = { "stub", "contexts", "passivation" })
+ @SpecAssertion(section = "9.5")
+ public void testReferencesToWebBeansWithNormalScopeAreSerializable()
+ {
+ assert false;
+ }
+
+ /**
+ * EJB local objects are serializable. Therefore, any reference to an
+ * enterprise Web Bean of scope @Dependent is serializable.
+ */
+ @Test(groups = { "stub", "contexts", "passivation" })
+ @SpecAssertion(section = "9.5")
+ public void testDependentEJBsAreSerializable()
+ {
+ assert false;
+ }
+
+ /**
+ * If a simple Web Bean of scope @Dependent and a non-serializable
+ * implementation class is injected into a stateful session bean, into a
+ * non-transient field, Web Bean constructor parameter or initializer method
+ * parameter of a Web Bean which declares a passivating scope type, or into a
+ * parameter of a producer method which declares a passivating scope type, an
+ * UnserializableDependencyException must be thrown by the Web Bean manager
+ * at initialization time.
+ */
+ @Test(groups = { "stub", "contexts", "passivation" },
expectedExceptions = UnserializableDependencyException.class)
+ @SpecAssertion(section = "9.5")
+ public void
testSimpleDependentWebBeanWithNonSerializableImplementationInjectedIntoStatefulSessionBeanWithPassivatingScopeFails()
+ {
+ assert false;
+ }
+
+ /**
+ * If a simple Web Bean of scope @Dependent and a non-serializable
+ * implementation class is injected into a stateful session bean, into a
+ * non-transient field, Web Bean constructor parameter or initializer method
+ * parameter of a Web Bean which declares a passivating scope type, or into a
+ * parameter of a producer method which declares a passivating scope type, an
+ * UnserializableDependencyException must be thrown by the Web Bean manager
+ * at initialization time.
+ */
+ @Test(groups = { "stub", "contexts", "passivation" },
expectedExceptions = UnserializableDependencyException.class)
+ @SpecAssertion(section = "9.5")
+ public void
testSimpleDependentWebBeanWithNonSerializableImplementationInjectedIntoNonTransientFieldOfWebBeanWithPassivatingScopeFails()
+ {
+ assert false;
+ }
+
+ /**
+ * If a simple Web Bean of scope @Dependent and a non-serializable
+ * implementation class is injected into a stateful session bean, into a
+ * non-transient field, Web Bean constructor parameter or initializer method
+ * parameter of a Web Bean which declares a passivating scope type, or into a
+ * parameter of a producer method which declares a passivating scope type, an
+ * UnserializableDependencyException must be thrown by the Web Bean manager
+ * at initialization time.
+ */
+ @Test(groups = { "stub", "contexts", "passivation" },
expectedExceptions = UnserializableDependencyException.class)
+ @SpecAssertion(section = "9.5")
+ public void
testSimpleDependentWebBeanWithNonSerializableImplementationInjectedIntoConstructorParameterOfWebBeanWithPassivatingScopeFails()
+ {
+ assert false;
+ }
+
+ /**
+ * If a simple Web Bean of scope @Dependent and a non-serializable
+ * implementation class is injected into a stateful session bean, into a
+ * non-transient field, Web Bean constructor parameter or initializer method
+ * parameter of a Web Bean which declares a passivating scope type, or into a
+ * parameter of a producer method which declares a passivating scope type, an
+ * UnserializableDependencyException must be thrown by the Web Bean manager
+ * at initialization time.
+ */
+ @Test(groups = { "stub", "contexts", "passivation" },
expectedExceptions = UnserializableDependencyException.class)
+ @SpecAssertion(section = "9.5")
+ public void
testSimpleDependentWebBeanWithNonSerializableImplementationInjectedIntoInitializerParameterOfWebBeanWithPassivatingScopeFails()
+ {
+ assert false;
+ }
+
+ /**
+ * If a simple Web Bean of scope @Dependent and a non-serializable
+ * implementation class is injected into a stateful session bean, into a
+ * non-transient field, Web Bean constructor parameter or initializer method
+ * parameter of a Web Bean which declares a passivating scope type, or into a
+ * parameter of a producer method which declares a passivating scope type, an
+ * UnserializableDependencyException must be thrown by the Web Bean manager
+ * at initialization time.
+ */
+ @Test(groups = { "stub", "contexts", "passivation" },
expectedExceptions = UnserializableDependencyException.class)
+ @SpecAssertion(section = "9.5")
+ public void
testSimpleDependentWebBeanWithNonSerializableImplementationInjectedIntoProducerMethodParameterWithPassivatingScopeFails()
+ {
+ assert false;
+ }
+
+ /**
+ * If a producer method or field of scope @Dependent returns a
+ * non-serializable object for injection into a stateful session bean, into a
+ * non-transient field, Web Bean constructor parameter or initializer method
+ * parameter of a Web Bean which declares a passivating scope type, or into a
+ * parameter of a producer method which declares a passivating scope type, an
+ * IllegalProductException is thrown by the Web Bean manager.
+ */
+ @Test(groups = { "stub", "contexts", "passivation" },
expectedExceptions = IllegalProductException.class)
+ @SpecAssertion(section = "9.5")
+ public void
testDependentScopedProducerMethodReturnsNonSerializableObjectForInjectionIntoStatefulSessionBeanWithPassivatingScopeFails()
+ {
+ assert false;
+ }
+
+ /**
+ * If a producer method or field of scope @Dependent returns a
+ * non-serializable object for injection into a stateful session bean, into a
+ * non-transient field, Web Bean constructor parameter or initializer method
+ * parameter of a Web Bean which declares a passivating scope type, or into a
+ * parameter of a producer method which declares a passivating scope type, an
+ * IllegalProductException is thrown by the Web Bean manager.
+ */
+ @Test(groups = { "stub", "contexts", "passivation" },
expectedExceptions = IllegalProductException.class)
+ @SpecAssertion(section = "9.5")
+ public void
testDependentScopedProducerMethodReturnsNonSerializableObjectForInjectionIntoNonTransientFieldOfWebBeanWithPassivatingScopeFails()
+ {
+ assert false;
+ }
+
+ /**
+ * If a producer method or field of scope @Dependent returns a
+ * non-serializable object for injection into a stateful session bean, into a
+ * non-transient field, Web Bean constructor parameter or initializer method
+ * parameter of a Web Bean which declares a passivating scope type, or into a
+ * parameter of a producer method which declares a passivating scope type, an
+ * IllegalProductException is thrown by the Web Bean manager.
+ */
+ @Test(groups = { "stub", "contexts", "passivation" },
expectedExceptions = IllegalProductException.class)
+ @SpecAssertion(section = "9.5")
+ public void
testDependentScopedProducerMethodReturnsNonSerializableObjectForInjectionIntoConstructorParameterOfWebBeanWithPassivatingScopeFails()
+ {
+ assert false;
+ }
+
+ /**
+ * If a producer method or field of scope @Dependent returns a
+ * non-serializable object for injection into a stateful session bean, into a
+ * non-transient field, Web Bean constructor parameter or initializer method
+ * parameter of a Web Bean which declares a passivating scope type, or into a
+ * parameter of a producer method which declares a passivating scope type, an
+ * IllegalProductException is thrown by the Web Bean manager.
+ */
+ @Test(groups = { "stub", "contexts", "passivation" },
expectedExceptions = IllegalProductException.class)
+ @SpecAssertion(section = "9.5")
+ public void
testDependentScopedProducerMethodReturnsNonSerializableObjectForInjectionIntoInitializerParameterOfWebBeanWithPassivatingScopeFails()
+ {
+ assert false;
+ }
+
+ /**
+ * If a producer method or field of scope @Dependent returns a
+ * non-serializable object for injection into a stateful session bean, into a
+ * non-transient field, Web Bean constructor parameter or initializer method
+ * parameter of a Web Bean which declares a passivating scope type, or into a
+ * parameter of a producer method which declares a passivating scope type, an
+ * IllegalProductException is thrown by the Web Bean manager.
+ */
+ @Test(groups = { "stub", "contexts", "passivation" },
expectedExceptions = IllegalProductException.class)
+ @SpecAssertion(section = "9.5")
+ public void
testDependentScopedProducerMethodReturnsNonSerializableObjectForInjectionIntoProducerMethodParameterWithPassivatingScopeFails()
+ {
+ assert false;
+ }
+
+ /**
+ * The Web Bean manager must guarantee that JMS endpoint proxy objects are
+ * serializable.
+ */
+ @Test(groups = { "stub", "contexts", "passivation" })
+ @SpecAssertion(section = "9.5")
+ public void testJMSEndpointProxyIsSerializable()
+ {
+ assert false;
+ }
+}
Property changes on:
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/contexts/PassivatingContextTest.java
___________________________________________________________________
Name: svn:mergeinfo
+