Search in sources :

Example 1 with ShouldThrowException

use of org.jboss.arquillian.container.test.api.ShouldThrowException in project core by weld.

the class BeanDiscoveryDecorator03Test method getDeployment.

/**
 * Throw exception because of the decorator ClassicRepresentDecorator not discovered, because it has not a bean defining annotation.
 */
@Deployment
@ShouldThrowException(DeploymentException.class)
public static Archive<?> getDeployment() {
    WeldSEClassPath archives = ShrinkWrap.create(WeldSEClassPath.class);
    JavaArchive archive01 = ShrinkWrap.create(BeanArchive.class).addAsManifestResource(new BeansXml(BeanDiscoveryMode.ALL).decorators(ClassicRepresentDecorator.class, ScopedRepresentDecorator.class), "beans.xml").addClasses(Dog.class, Cat.class);
    JavaArchive archive02 = ShrinkWrap.create(BeanArchive.class).addAsManifestResource(new BeansXml(BeanDiscoveryMode.ANNOTATED).decorators(ClassicRepresentDecorator.class, ScopedRepresentDecorator.class), "beans.xml").addClasses(Plant.class, Tree.class, Stone.class, ScopedRepresentDecorator.class);
    JavaArchive archive03 = ShrinkWrap.create(BeanArchive.class).addAsManifestResource(new BeansXml(BeanDiscoveryMode.NONE).decorators(ClassicRepresentDecorator.class, ScopedRepresentDecorator.class), "beans.xml").addClasses(Flat.class, House.class, ClassicRepresentDecorator.class);
    archives.add(archive01);
    archives.add(archive02);
    archives.add(archive03);
    return archives;
}
Also used : BeansXml(org.jboss.shrinkwrap.impl.BeansXml) JavaArchive(org.jboss.shrinkwrap.api.spec.JavaArchive) WeldSEClassPath(org.jboss.weld.environment.se.test.arquillian.WeldSEClassPath) ShouldThrowException(org.jboss.arquillian.container.test.api.ShouldThrowException) Deployment(org.jboss.arquillian.container.test.api.Deployment)

Example 2 with ShouldThrowException

use of org.jboss.arquillian.container.test.api.ShouldThrowException in project core by weld.

the class UnproxyableTest method deploy.

@Deployment
@ShouldThrowException(DeploymentException.class)
public static JavaArchive deploy() {
    BeanArchive archive = ShrinkWrap.create(BeanArchive.class, Utils.getDeploymentNameAsHash(UnproxyableTest.class));
    archive.addPackage(UnproxyableTest.class.getPackage());
    return archive;
}
Also used : BeanArchive(org.jboss.shrinkwrap.api.BeanArchive) ShouldThrowException(org.jboss.arquillian.container.test.api.ShouldThrowException) Deployment(org.jboss.arquillian.container.test.api.Deployment)

Example 3 with ShouldThrowException

use of org.jboss.arquillian.container.test.api.ShouldThrowException in project core by weld.

the class BeanDiscoveryInterceptor03Test method getDeployment.

/**
 * Throw exception because of the interceptor ClassicInterceptor not accessible.
 */
@Deployment
@ShouldThrowException(DeploymentException.class)
public static Archive<?> getDeployment() {
    WeldSEClassPath archives = ShrinkWrap.create(WeldSEClassPath.class);
    JavaArchive archive01 = ShrinkWrap.create(BeanArchive.class).addAsManifestResource(new BeansXml(BeanDiscoveryMode.ALL).interceptors(ScopedInterceptor.class, ClassicInterceptor.class), "beans.xml").addClasses(Dog.class, Cat.class, InterceptorBindingAnnotation.class);
    JavaArchive archive02 = ShrinkWrap.create(BeanArchive.class).addAsManifestResource(new BeansXml(BeanDiscoveryMode.ANNOTATED).interceptors(ScopedInterceptor.class, ClassicInterceptor.class), "beans.xml").addClasses(Plant.class, Tree.class, Stone.class, ScopedInterceptor.class);
    JavaArchive archive03 = ShrinkWrap.create(BeanArchive.class).addAsManifestResource(new BeansXml(BeanDiscoveryMode.NONE).interceptors(ScopedInterceptor.class, ClassicInterceptor.class), "beans.xml").addClasses(Flat.class, House.class, ClassicInterceptor.class);
    archives.add(archive01);
    archives.add(archive02);
    archives.add(archive03);
    return archives;
}
Also used : BeansXml(org.jboss.shrinkwrap.impl.BeansXml) JavaArchive(org.jboss.shrinkwrap.api.spec.JavaArchive) WeldSEClassPath(org.jboss.weld.environment.se.test.arquillian.WeldSEClassPath) ShouldThrowException(org.jboss.arquillian.container.test.api.ShouldThrowException) Deployment(org.jboss.arquillian.container.test.api.Deployment)

Example 4 with ShouldThrowException

use of org.jboss.arquillian.container.test.api.ShouldThrowException in project core by weld.

the class ConfigurationKeyHasDifferentValuesTest method createTestArchive.

@ShouldThrowException(org.jboss.weld.exceptions.IllegalStateException.class)
@Deployment
public static Archive<?> createTestArchive() {
    BeanArchive ejbJar = ShrinkWrap.create(BeanArchive.class);
    ejbJar.addClass(DummySessionBean.class).addAsResource(PropertiesBuilder.newBuilder().set(ConfigurationKey.CONCURRENT_DEPLOYMENT.get(), "false").build(), "weld.properties");
    WebArchive war1 = Testable.archiveToTest(ShrinkWrap.create(WebArchive.class).addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml")).addAsResource(PropertiesBuilder.newBuilder().set(ConfigurationKey.CONCURRENT_DEPLOYMENT.get(), "true").build(), "weld.properties");
    WebArchive war2 = ShrinkWrap.create(WebArchive.class).addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml").addAsResource(PropertiesBuilder.newBuilder().set(ConfigurationKey.CONCURRENT_DEPLOYMENT.get(), "false").build(), "weld.properties");
    return ShrinkWrap.create(EnterpriseArchive.class, Utils.getDeploymentNameAsHash(ConfigurationKeyHasDifferentValuesTest.class, Utils.ARCHIVE_TYPE.EAR)).addAsModules(ejbJar, war1, war2);
}
Also used : EnterpriseArchive(org.jboss.shrinkwrap.api.spec.EnterpriseArchive) BeanArchive(org.jboss.shrinkwrap.api.BeanArchive) WebArchive(org.jboss.shrinkwrap.api.spec.WebArchive) ShouldThrowException(org.jboss.arquillian.container.test.api.ShouldThrowException) Deployment(org.jboss.arquillian.container.test.api.Deployment)

Example 5 with ShouldThrowException

use of org.jboss.arquillian.container.test.api.ShouldThrowException in project core by weld.

the class MultiwarProjectNameValidation2Test method getDeployment.

@Deployment(testable = false)
@ShouldThrowException(DeploymentException.class)
public static Archive<?> getDeployment() {
    WebArchive war1 = ShrinkWrap.create(WebArchive.class).addClasses(Alpha.class, Bravo.class).addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml");
    WebArchive war2 = ShrinkWrap.create(WebArchive.class).addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml");
    return ShrinkWrap.create(EnterpriseArchive.class, Utils.getDeploymentNameAsHash(MultiwarProjectNameValidation2Test.class, Utils.ARCHIVE_TYPE.EAR)).addAsModules(war1, war2);
}
Also used : EnterpriseArchive(org.jboss.shrinkwrap.api.spec.EnterpriseArchive) WebArchive(org.jboss.shrinkwrap.api.spec.WebArchive) ShouldThrowException(org.jboss.arquillian.container.test.api.ShouldThrowException) Deployment(org.jboss.arquillian.container.test.api.Deployment)

Aggregations

Deployment (org.jboss.arquillian.container.test.api.Deployment)5 ShouldThrowException (org.jboss.arquillian.container.test.api.ShouldThrowException)5 BeanArchive (org.jboss.shrinkwrap.api.BeanArchive)2 EnterpriseArchive (org.jboss.shrinkwrap.api.spec.EnterpriseArchive)2 JavaArchive (org.jboss.shrinkwrap.api.spec.JavaArchive)2 WebArchive (org.jboss.shrinkwrap.api.spec.WebArchive)2 BeansXml (org.jboss.shrinkwrap.impl.BeansXml)2 WeldSEClassPath (org.jboss.weld.environment.se.test.arquillian.WeldSEClassPath)2