@Artifact @IntegrationTest @SpecVersion(spec = "cdi", version = "20091101") public class ManagerTest extends AbstractJSR299Test { @Test(groups = { "manager", "ejb3", "integration"}) @SpecAssertion(section = "11.3", id = "da") public void testManagerLookupInJndi() throws Exception { BeanManager beanManager = getInstanceByType(JndiBeanManagerInjected.class).getManagerFromJndi(); assert beanManager != null; assert beanManager.equals(getCurrentManager()); } }
@Artifact @Packaging(PackagingType.EAR) @IntegrationTest @SpecVersion(spec="cdi", version="20091101") public class EjbInitializerMethodTest extends AbstractJSR299Test { @Test(groups = { "initializerMethod", "ejb3" }) @SpecAssertions({ @SpecAssertion(section = "3.9", id = "e") }) // This DOES NOT TEST initializer methods on Java EE component classes PLM public void testInitializerMethodNotABusinessMethod() { AndalusianChicken.nonBusinessMethodCalled = false; getInstanceByType(LocalChicken.class).cluck(); assert AndalusianChicken.nonBusinessMethodCalled; } }
@Artifact @IntegrationTest(runLocally = true) @SpecVersion(spec="cdi", version="20091101") @WebXml("web.xml") public class ClientProxyTest extends AbstractJSR299Test { @Test @SpecAssertion(section = "5.4", id = "d") public void testInvocationIsProcessedOnCurrentInstance() throws Exception { WebClient webClient = new WebClient(); webClient.setThrowExceptionOnFailingStatusCode(true); String response; response = webClient.getPage(getContextPath() + "Test/Garage?make=Honda").getWebResponse().getContentAsString(); assert response.contains("Honda"); response = webClient.getPage(getContextPath() + "Test/Garage?make=Toyota").getWebResponse().getContentAsString(); assert response.contains("Toyota"); } }
@Artifact @ExpectedDeploymentException(DeploymentFailure.class) @Resource(source = "javax.enterprise.inject.spi.Extension", destination = "WEB-INF/classes/META-INF/services/javax.enterprise.inject.spi.Extension") @IntegrationTest @SpecVersion(spec = "cdi", version = "20091101") public class ThrowExceptionInProcessBeanObserverTest extends AbstractJSR299Test { @Test @SpecAssertion(section = "11.5.8", id = "hd") public void testProcessBeanObserverThrowsException() { assert false; } }
@Artifact @SpecVersion(spec = "cdi", version = "20091101") @ExpectedDeploymentException(DeploymentFailure.class) @IntegrationTest @WebXml("web.xml") public class InjectionPointTest extends AbstractJSR299Test { @Test @SpecAssertion(section = "5.5.7", id = "ga") public void testDefinitionErrorDetected() { assert false; } }
@Artifact @ExpectedDeploymentException(DeploymentFailure.class) @Extension("javax.enterprise.inject.spi.Extension") @IntegrationTest @SpecVersion(spec = "cdi", version = "20091101") public class AddDefinitionErrorTest extends AbstractJSR299Test { @Test @SpecAssertion(section = "11.5.8", id = "h") public void testAddDefinitionError() { assert false; } }
@Artifact @Packaging(PackagingType.WAR) @IntegrationTest @BeansXml("beans.xml") @SpecVersion(spec="cdi", version="20091101") public class SessionBeanPolicyTest extends AbstractJSR299Test { @Test(groups = { "policy"}) @SpecAssertion(section = "5.1.1", id = "eb") public void testEnabledPolicyAvailable() { assert getBeans(EjbInterface.class).size() == 1; assert getBeans(EjbInterface.class).iterator().next().getTypes().contains(EjbInterface.class); } }
/** * @author pmuir */ @Artifact @Extension("javax.enterprise.inject.spi.Extension") @IntegrationTest @ExpectedDeploymentException(DeploymentFailure.class) @SpecVersion(spec="cdi", version="20091101") public class BeforeBeanDiscoveryThrowsExceptionTest extends AbstractJSR299Test { @Test @SpecAssertion(section="11.5.1", id="ag") public void testThrowsException() { assert false; } }
@IntegrationTest @Artifact @Packaging(PackagingType.EAR) @SpecVersion(spec="cdi", version="20091101") @BeansXml("beans.xml") public class SessionBeanInterceptorOnNonContextualEjbReferenceTest extends AbstractJSR299Test { @Test @SpecAssertion(section = "7.2", id = "h") public void testNonContextualSessionBeanReferenceIsIntercepted() { MissileInterceptor.intercepted = false; Ship cruiser = getInstanceByType(Ship.class); cruiser.defend(); assert MissileInterceptor.intercepted; } }
/** * @author pmuir */ @Artifact @Extension("javax.enterprise.inject.spi.Extension") @IntegrationTest @ExpectedDeploymentException(DeploymentFailure.class) @SpecVersion(spec="cdi", version="20091101") public class AddingPassivatingScopeTest extends AbstractJSR299Test { @Test @SpecAssertion(section="11.5.1", id="ac") public void testAddingScopeType() { assert false; } }
@IntegrationTest @Artifact @Packaging(PackagingType.EAR) @SpecVersion(spec="cdi", version="20091101") @BeansXml("beans.xml") public class SessionBeanInterceptorDefinitionTest extends AbstractJSR299Test { @Test @SpecAssertion(section = "7.2", id = "c") public void testSessionBeanIsIntercepted() { MissileInterceptor.intercepted = false; MissileLocal missile = getInstanceByType(MissileLocal.class); missile.fire(); assert MissileInterceptor.intercepted; } }
@Artifact @ExpectedDeploymentException(DeploymentFailure.class) @IntegrationTest @Packaging(PackagingType.EAR) @SpecVersion(spec="cdi", version="20091101") public class DisposalMethodOnSessionBean extends AbstractJSR299Test { @Test @SpecAssertions({ @SpecAssertion(section = "3.3.4", id = "d"), @SpecAssertion(section = "3.3.6", id = "fa") }) public void testDisposalMethodNotBusinessOrStatic() { assert false; } }
/** * @author pmuir * */ @Artifact @Extension("javax.enterprise.inject.spi.Extension") @IntegrationTest @ExpectedDeploymentException(DeploymentFailure.class) @SpecVersion(spec="cdi", version="20091101") public class AddingNormalScopeTest extends AbstractJSR299Test { @Test @SpecAssertion(section="11.5.1", id="ac") public void testAddingScopeType() { assert false; } }
@Artifact @IntegrationTest @Packaging(PackagingType.EAR) @BeansXml("beans.xml") @SpecVersion(spec="cdi", version="20091101") public class EnterpriseProducerFieldDefinitionTest extends AbstractJSR299Test { @Test @SpecAssertions({ @SpecAssertion(section = "3.4", id = "ab"), @SpecAssertion(section = "3.4", id = "ca") }) public void testStaticProducerField() { assert getInstanceByType(Egg.class, new AnnotationLiteral<Foo>() {}) != null; assert getInstanceByType(Egg.class, new AnnotationLiteral<Foo>() {}).getSize() == Chicken.SIZE; } }
/** * Tests that an exception thrown by a ProcessAnnotatedType event observer * is treated as a deployment error * * */ @Artifact @ExpectedDeploymentException(DeploymentFailure.class) @Extension("javax.enterprise.inject.spi.Extension") @IntegrationTest @SpecVersion(spec="cdi", version="20091101") public class ProcessInjectionTargetEventThrowsExceptionTest extends AbstractJSR299Test { @Test @SpecAssertion(section = "11.5.6", id = "f") public void testProcessInjectionTargetEventThrowsExceptionNotOk() { assert false; } }
/** * Tests that an exception thrown by a ProcessAnnotatedType event observer * is treated as a deployment error * * */ @Artifact @ExpectedDeploymentException(DeploymentFailure.class) @Extension("javax.enterprise.inject.spi.Extension") @IntegrationTest @SpecVersion(spec="cdi", version="20091101") public class ProcessAnnotatedTypeEventThrowsExceptionTest extends AbstractJSR299Test { @Test @SpecAssertion(section = "11.5.5", id = "e") public void testProcessAnnotatedTypeEventThrowsExceptionNotOk() { assert false; } }
/** * Tests adding definition errors to the event object. * * @author David Allen * */ @Artifact @ExpectedDeploymentException(DeploymentFailure.class) @Extension("javax.enterprise.inject.spi.Extension") @IntegrationTest @SpecVersion(spec="cdi", version="20091101") public class ProcessObserverMethodErrorTest extends AbstractJSR299Test { @Test @SpecAssertion(section = "11.5.9", id = "da") public void testAddDefinitionError() { assert false; } }
/** * Tests event observer throwing exception causes container to produce * a definition error. * * @author David Allen * */ @Artifact @ExpectedDeploymentException(DeploymentFailure.class) @Extension("javax.enterprise.inject.spi.Extension") @IntegrationTest @SpecVersion(spec="cdi", version="20091101") public class ProcessObserverMethodExceptionTest extends AbstractJSR299Test { @Test @SpecAssertion(section = "11.5.9", id = "db") public void testExceptionIsDefinitionError() { assert false; } }
@Artifact @BeansXml("beans.xml") @SpecVersion(spec = "cdi", version = "20091101") @IntegrationTest @Extension("javax.enterprise.inject.spi.Extension") @ExpectedDeploymentException(DeploymentFailure.class) public class CustomDecoratorMatchingBeanWithFinalClassTest extends AbstractJSR299Test { @Test @SpecAssertion(section = "8.3", id = "ab") public void testCustomDecoratorDecoratingFinalBean() { assert false; } }
@Artifact @IntegrationTest @Packaging(PackagingType.EAR) @BeansXml("beans.xml") @SpecVersion(spec="cdi", version="20091101") @EjbJarXml("ejb-jar.xml") public class EnterpriseBeanSpecializationIntegrationTest extends AbstractJSR299Test { private static Annotation LANDOWNER_LITERAL = new AnnotationLiteral<Landowner>() {}; @Test @SpecAssertions({ @SpecAssertion(section = "4.3", id = "ca") }) public void testSpecializedBeanNotInstantiated() throws Exception { Bean<?> farmerBean = getCurrentManager().resolve(getCurrentManager().getBeans(FarmerLocal.class,LANDOWNER_LITERAL)); FarmerLocal farmer = (FarmerLocal) getCurrentManager().getReference(farmerBean, Object.class, getCurrentManager().createCreationalContext(farmerBean)); assert farmer.getClassName().equals(LazyFarmer.class.getName()); } }