javax.enterprise.inject.spi.Extension Java Examples

The following examples show how to use javax.enterprise.inject.spi.Extension. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ArchiveProcessor.java    From smallrye-metrics with Apache License 2.0 7 votes vote down vote up
@Override
public void process(TestDeployment testDeployment, Archive<?> protocolArchive) {
    WebArchive war = (WebArchive) protocolArchive;
    war.addAsWebInfResource("WEB-INF/jboss-web.xml", "jboss-web.xml");
    String[] deps = {
            "io.smallrye:smallrye-config",
            "io.smallrye:smallrye-metrics",
            "io.smallrye:smallrye-metrics-testsuite-common",
            "org.eclipse.microprofile.metrics:microprofile-metrics-api",
            "org.jboss.weld.servlet:weld-servlet-core"
    };

    File[] dependencies = Maven.resolver().loadPomFromFile(new File("pom.xml")).resolve(deps).withTransitivity().asFile();

    war.addAsLibraries(dependencies);

    war.addClass(SmallRyeBeanArchiveHandler.class);
    war.addClass(MetricsHttpServlet.class);
    war.addClass(MetricsInitializer.class);
    war.addAsResource("io/smallrye/metrics/base-metrics.properties", "/io/smallrye/metrics/base-metrics.properties");
    war.addAsServiceProvider(BeanArchiveHandler.class, SmallRyeBeanArchiveHandler.class);
    war.addAsServiceProvider(Extension.class, ConfigExtension.class);
    war.addAsServiceProvider(ConfigProviderResolver.class, SmallRyeConfigProviderResolver.class);
}
 
Example #2
Source File: SimpleCacheTest.java    From deltaspike with Apache License 2.0 6 votes vote down vote up
@Deployment
public static WebArchive war()
{
    String simpleName = SimpleCacheTest.class.getSimpleName();
    String archiveName = simpleName.substring(0, 1).toLowerCase() + simpleName.substring(1);

    // CDI 1.0/Weld 1.x needs EnableInterceptorsInterceptor
    BeansDescriptor beansWithEnablingInterceptor = Descriptors.create(BeansDescriptor.class);
    beansWithEnablingInterceptor.getOrCreateInterceptors().clazz(EnableInterceptorsInterceptor.class.getName());
    
    // war archive needs SimpleCacheInterceptor enabled
    BeansDescriptor beans = Descriptors.create(BeansDescriptor.class);
    beans.getOrCreateInterceptors().clazz(SimpleCacheInterceptor.class.getName());
      
    JavaArchive testJar = ShrinkWrap.create(JavaArchive.class, archiveName + ".jar")
            .addPackage(SimpleCacheTest.class.getPackage())
            .addAsManifestResource(new StringAsset(beansWithEnablingInterceptor.exportAsString()), "beans.xml");

    return ShrinkWrap.create(WebArchive.class, archiveName + ".war")
            .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreAndProxyArchive())
            .addAsLibraries(testJar)
            .addAsServiceProvider(Extension.class, SimpleCacheExtension.class)
            .addAsWebInfResource(new StringAsset(beans.exportAsString()), "beans.xml");
}
 
Example #3
Source File: SmallRyeConfigAuxiliaryArchiveAppender.java    From smallrye-config with Apache License 2.0 6 votes vote down vote up
@Override
public Archive<?> createAuxiliaryArchive() {
    JavaArchive configJar = ShrinkWrap
            .create(JavaArchive.class, "smallrye-config.jar")
            .addPackage(SmallRyeConfig.class.getPackage())
            .addPackage(ConfigExtension.class.getPackage())
            .addAsServiceProvider(Extension.class, ConfigExtension.class)
            .addAsServiceProvider(ConfigProviderResolver.class, SmallRyeConfigProviderResolver.class);
    return configJar;
}
 
Example #4
Source File: ParentExtensionStorage.java    From deltaspike with Apache License 2.0 6 votes vote down vote up
/**
 * @return the Extension from the same type but registered in a hierarchic 'parent' BeanManager
 */
public static synchronized <T extends Extension> T getParentExtension(Extension extension)
{
    if (usingParentExtension())
    {
        ClassLoader parentClassLoader = ClassUtils.getClassLoader(null).getParent();

        Iterator<ExtensionStorageInfo> extIt = extensionStorage.iterator();
        while (extIt.hasNext())
        {
            ExtensionStorageInfo extensionInfo = extIt.next();
            if (!extensionInfo.isAbandoned() && // weak reference case
                extension.getClass().equals(extensionInfo.getExtension().getClass()) &&
                extensionInfo.getClassLoader().equals(parentClassLoader))
            {
                return (T) extensionInfo.getExtension();
            }
        }
    }
    return null;
}
 
Example #5
Source File: MessageTest.java    From deltaspike with Apache License 2.0 6 votes vote down vote up
/**
 * X TODO creating a WebArchive is only a workaround because JavaArchive
 * cannot contain other archives.
 */
@Deployment
public static WebArchive deploy()
{
    JavaArchive testJar = ShrinkWrap
            .create(JavaArchive.class, "messageTest.jar")
            .addPackage(MessageTest.class.getPackage())
            .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml");

    return ShrinkWrap
            .create(WebArchive.class, "messageTest.war")
            .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreArchive())
            .addAsLibraries(testJar)
            .addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml")
            .addAsServiceProvider(Extension.class,
                    MessageBundleExtension.class);
}
 
Example #6
Source File: DynamicGreeterTest.java    From ee8-sandbox with Apache License 2.0 6 votes vote down vote up
@Deployment(name = "test")
public static Archive<?> createDeployment() {

    JavaArchive archive = ShrinkWrap.create(JavaArchive.class)
            .addClasses(
                    Greeter.class,
                    Resources.class,
                    CdiConfig.class
            )
            .addAsServiceProvider(Extension.class, CdiConfig.class)
            .addAsManifestResource("META-INF/test-persistence.xml", "persistence.xml")
            .addAsManifestResource("META-INF/test-beans.xml", "beans.xml");
            
    // System.out.println(archive.toString(true));
    return archive;
}
 
Example #7
Source File: SimpleMessageTest.java    From deltaspike with Apache License 2.0 6 votes vote down vote up
/**
 * X TODO creating a WebArchive is only a workaround because JavaArchive
 * cannot contain other archives.
 */
@Deployment
public static WebArchive deploy()
{
    JavaArchive testJar = ShrinkWrap
            .create(JavaArchive.class, "simpleMessageTest.jar")
            .addPackage(SimpleMessageTest.class.getPackage())
            .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml");

    return ShrinkWrap
            .create(WebArchive.class, "simpleMessageTest.war")
            .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreArchive())
            .addAsLibraries(testJar)
            .addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml")
            .addAsServiceProvider(Extension.class,
                    MessageBundleExtension.class);
}
 
Example #8
Source File: Cxfs.java    From openwebbeans-meecrowave with Apache License 2.0 6 votes vote down vote up
public static Extension mapCdiExtensionIfNeeded(final Extension extension) {
    if ("org.apache.cxf.cdi.JAXRSCdiResourceExtension".equals(extension.getClass().getName())) {
        final Field serviceBeans;
        try {
            serviceBeans = org.apache.cxf.cdi.JAXRSCdiResourceExtension.class
                    .getDeclaredField("serviceBeans");
        } catch (final NoSuchFieldException e) {
            new org.apache.meecrowave.logging.tomcat.LogFacade(Cxfs.class.getName()).warn(e.getMessage(), e);
            return extension;
        }
        if (!serviceBeans.isAccessible()) {
            serviceBeans.setAccessible(true);
        }
        return new ContractFriendlyJAXRSCdiResourceExtension(serviceBeans);
    }
    return extension;
}
 
Example #9
Source File: MessageFormattedMessageTest.java    From deltaspike with Apache License 2.0 6 votes vote down vote up
/**
 * X TODO creating a WebArchive is only a workaround because JavaArchive
 * cannot contain other archives.
 */
@Deployment
public static WebArchive deploy()
{
    Asset beansXml = new StringAsset(
            "<beans><alternatives>" +
                    "<class>" + MessageFormatMessageInterpolator.class.getName() + "</class>" +
                    "</alternatives></beans>"
    );
    JavaArchive testJar = ShrinkWrap
            .create(JavaArchive.class, "messageFormattedMessageTest.jar")
            .addPackage(MessageFormattedMessageTest.class.getPackage())
            .addAsManifestResource(beansXml, "beans.xml");

    return ShrinkWrap
            .create(WebArchive.class, "messageFormattedMessageTest.war")
            .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreArchive())
            .addAsLibraries(testJar)
            .addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml")
            .addAsServiceProvider(Extension.class,
                    MessageBundleExtension.class);
}
 
Example #10
Source File: BrokenMessageBundleOnClassTest.java    From deltaspike with Apache License 2.0 6 votes vote down vote up
/**
 * X TODO creating a WebArchive is only a workaround because JavaArchive
 * cannot contain other archives.
 */
@Deployment
@ShouldThrowException(Exception.class)
public static WebArchive deploy()
{
    JavaArchive testJar = ShrinkWrap
            .create(JavaArchive.class, "invalidMessageBundleTest.jar")
            .addPackage(BrokenMessageBundleClass.class.getPackage())
            .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml");

    return ShrinkWrap
            .create(WebArchive.class, "invalidMessageBundleTest.war")
            .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreArchive())
            .addAsLibraries(testJar)
            .addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml")
            .addAsServiceProvider(Extension.class,
                    MessageBundleExtension.class);
}
 
Example #11
Source File: AbstractContextTest.java    From deltaspike with Apache License 2.0 6 votes vote down vote up
/**
 * X TODO creating a WebArchive is only a workaround because JavaArchive
 * cannot contain other archives.
 */
@Deployment
public static WebArchive deploy()
{
    JavaArchive testJar = ShrinkWrap
            .create(JavaArchive.class, "abstractContextTest.jar")
            .addClass(AbstractContextTest.class)
            .addClass(DummyBean.class)
            .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml")
            .addAsServiceProvider(Extension.class, DummyScopeExtension.class);

    return ShrinkWrap
            .create(WebArchive.class, "abstractContextTest.war")
            .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreArchive())
            .addAsLibraries(testJar)
            .addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml");
}
 
Example #12
Source File: MinimalMessagesTest.java    From deltaspike with Apache License 2.0 6 votes vote down vote up
/**
 * X TODO creating a WebArchive is only a workaround because JavaArchive
 * cannot contain other archives.
 */
@Deployment
public static WebArchive deploy()
{
    JavaArchive testJar = ShrinkWrap
            .create(JavaArchive.class, "minimalMessageTest.jar")
            .addPackages(false, Filters.exclude(MessageContextTest.class),
                    MinimalMessagesTest.class.getPackage())
            .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml");

    return ShrinkWrap
            .create(WebArchive.class, "minimalMessageTest.war")
            .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreArchive())
            .addAsLibraries(testJar)
            .addAsResource("customMinimalMessage_en.properties")
            .addAsResource("org/apache/deltaspike/test/core/api/message/MinimalMessages_en.properties")
            .addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml")
            .addAsServiceProvider(Extension.class,
                    MessageBundleExtension.class);
}
 
Example #13
Source File: ManualTransactionTest.java    From deltaspike with Apache License 2.0 5 votes vote down vote up
@Deployment
public static WebArchive deploy()
{
    JavaArchive testJar = ShrinkWrap.create(JavaArchive.class, "manualTransactionTest.jar")
            .addPackage(ArchiveUtils.SHARED_PACKAGE)
            .addPackage(ManualTransactionTest.class.getPackage().getName())
            .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml");

    return ShrinkWrap.create(WebArchive.class)
            .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreAndJpaArchive())
            .addAsLibraries(testJar)
            .addAsServiceProvider(Extension.class, TransactionContextExtension.class)
            .addAsWebInfResource(ArchiveUtils.getBeansXml(), "beans.xml");
}
 
Example #14
Source File: StereotypeTransactionalTest.java    From deltaspike with Apache License 2.0 5 votes vote down vote up
@Deployment
public static WebArchive deploy()
{
    JavaArchive testJar = ShrinkWrap.create(JavaArchive.class, "stereotypeTransactionalTest.jar")
            .addPackage(ArchiveUtils.SHARED_PACKAGE)
            .addPackage(StereotypeTransactionalTest.class.getPackage().getName())
            .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml");

    return ShrinkWrap.create(WebArchive.class)
            .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreAndJpaArchive())
            .addAsLibraries(testJar)
            .addAsServiceProvider(Extension.class, TransactionContextExtension.class)
            .addAsWebInfResource(ArchiveUtils.getBeansXml(), "beans.xml");
}
 
Example #15
Source File: NestedTransactionWithExceptionTest.java    From deltaspike with Apache License 2.0 5 votes vote down vote up
@Deployment
public static WebArchive deploy()
{
    JavaArchive testJar = ShrinkWrap.create(JavaArchive.class, "nestedTransactionWithExceptionTest.jar")
            .addPackage(ArchiveUtils.SHARED_PACKAGE)
            .addPackage(NestedTransactionWithExceptionTest.class.getPackage().getName())
            .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml");

    return ShrinkWrap.create(WebArchive.class)
            .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreAndJpaArchive())
            .addAsLibraries(testJar)
            .addAsServiceProvider(Extension.class, TransactionContextExtension.class)
            .addAsWebInfResource(ArchiveUtils.getBeansXml(), "beans.xml");
}
 
Example #16
Source File: NestedMultiTransactionCatchedExceptionTest.java    From deltaspike with Apache License 2.0 5 votes vote down vote up
@Deployment
public static WebArchive deploy()
{
    JavaArchive testJar = ShrinkWrap.create(JavaArchive.class, "nestedMultiTransactionCatchedExceptionTest.jar")
            .addPackage(ArchiveUtils.SHARED_PACKAGE)
            .addPackage(NestedMultiTransactionCatchedExceptionTest.class.getPackage().getName())
            .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml");

    return ShrinkWrap.create(WebArchive.class)
            .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreAndJpaArchive())
            .addAsLibraries(testJar)
            .addAsServiceProvider(Extension.class, TransactionContextExtension.class)
            .addAsWebInfResource(ArchiveUtils.getBeansXml(), "beans.xml");
}
 
Example #17
Source File: NestedTransactionCatchedExceptionTest.java    From deltaspike with Apache License 2.0 5 votes vote down vote up
@Deployment
public static WebArchive deploy()
{
    JavaArchive testJar = ShrinkWrap.create(JavaArchive.class, "nestedTransactionCatchedExceptionTest.jar")
            .addPackage(ArchiveUtils.SHARED_PACKAGE)
            .addPackage(NestedTransactionCatchedExceptionTest.class.getPackage().getName())
            .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml");

    return ShrinkWrap.create(WebArchive.class)
            .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreAndJpaArchive())
            .addAsLibraries(testJar)
            .addAsServiceProvider(Extension.class, TransactionContextExtension.class)
            .addAsWebInfResource(ArchiveUtils.getBeansXml(), "beans.xml");
}
 
Example #18
Source File: BeanManagedlTransactionTest.java    From deltaspike with Apache License 2.0 5 votes vote down vote up
@Deployment
public static WebArchive deploy()
{
    JavaArchive testJar = ShrinkWrap.create(JavaArchive.class, "manualTransactionTest.jar")
            .addPackage(ArchiveUtils.SHARED_PACKAGE)
            .addPackage(BeanManagedlTransactionTest.class.getPackage().getName())
            .addAsManifestResource(beansXml, "beans.xml");

    return ShrinkWrap.create(WebArchive.class)
            .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreAndJpaArchive())
            .addAsLibraries(testJar)
            .addAsServiceProvider(Extension.class, TransactionContextExtension.class)
            .addAsWebInfResource(ArchiveUtils.getBeansXml(), "beans.xml");
}
 
Example #19
Source File: TransactionHelperTest.java    From deltaspike with Apache License 2.0 5 votes vote down vote up
@Deployment
public static WebArchive deploy()
{
    JavaArchive testJar = ShrinkWrap.create(JavaArchive.class, "defaultInjectionTest.jar")
            .addPackage(ArchiveUtils.SHARED_PACKAGE)
            .addPackage(TransactionHelperTest.class.getPackage().getName())
            .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml");

    return ShrinkWrap.create(WebArchive.class)
            .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreAndJpaArchive())
            .addAsLibraries(testJar)
            .addAsServiceProvider(Extension.class, TransactionContextExtension.class)
            .addAsWebInfResource(ArchiveUtils.getBeansXml(), "beans.xml");
}
 
Example #20
Source File: AggregatedDefaultEntityManagerInjectionTest.java    From deltaspike with Apache License 2.0 5 votes vote down vote up
@Deployment
public static WebArchive deploy()
{
    JavaArchive testJar = ShrinkWrap.create(JavaArchive.class, "aggregatedDefaultInjectionTest.jar")
            .addPackage(ArchiveUtils.SHARED_PACKAGE)
            .addPackage(AggregatedDefaultEntityManagerInjectionTest.class.getPackage().getName())
            .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml");

    return ShrinkWrap.create(WebArchive.class)
            .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreAndJpaArchive())
            .addAsLibraries(testJar)
            .addAsServiceProvider(Extension.class, TransactionContextExtension.class)
            .addAsWebInfResource(ArchiveUtils.getBeansXml(), "beans.xml");
}
 
Example #21
Source File: NestedMultiTransactionReadOnlyNoRollbackTest.java    From deltaspike with Apache License 2.0 5 votes vote down vote up
@Deployment
public static WebArchive deploy()
{
    JavaArchive testJar = ShrinkWrap.create(JavaArchive.class, "nestedMultiTransactionReadOnlyNoRollbackTest.jar")
            .addPackage(ArchiveUtils.SHARED_PACKAGE)
            .addPackage(NestedMultiTransactionReadOnlyNoRollbackTest.class.getPackage().getName())
            .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml");

    return ShrinkWrap.create(WebArchive.class)
            .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreAndJpaArchive())
            .addAsLibraries(testJar)
            .addAsServiceProvider(Extension.class, TransactionContextExtension.class)
            .addAsWebInfResource(ArchiveUtils.getBeansXml(), "beans.xml");
}
 
Example #22
Source File: NestedMultiTransactionReadOnlyRollbackTest.java    From deltaspike with Apache License 2.0 5 votes vote down vote up
@Deployment
public static WebArchive deploy()
{
    JavaArchive testJar = ShrinkWrap.create(JavaArchive.class, "nestedMultiTransactionReadOnlyRollbackTest.jar")
            .addPackage(ArchiveUtils.SHARED_PACKAGE)
            .addPackage(NestedMultiTransactionReadOnlyRollbackTest.class.getPackage().getName())
            .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml");

    return ShrinkWrap.create(WebArchive.class)
            .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreAndJpaArchive())
            .addAsLibraries(testJar)
            .addAsServiceProvider(Extension.class, TransactionContextExtension.class)
            .addAsWebInfResource(ArchiveUtils.getBeansXml(), "beans.xml");
}
 
Example #23
Source File: MultipleEntityManagerInjectionReadOnlyTest.java    From deltaspike with Apache License 2.0 5 votes vote down vote up
@Deployment
public static WebArchive deploy()
{
    JavaArchive testJar = ShrinkWrap.create(JavaArchive.class, "multipleEntityManagerInjectionReadOnlyTest.jar")
            .addPackage(ArchiveUtils.SHARED_PACKAGE)
            .addPackage(MultipleEntityManagerInjectionReadOnlyTest.class.getPackage().getName())
            .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml");

    return ShrinkWrap.create(WebArchive.class)
            .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreAndJpaArchive())
            .addAsLibraries(testJar)
            .addAsServiceProvider(Extension.class, TransactionContextExtension.class)
            .addAsWebInfResource(ArchiveUtils.getBeansXml(), "beans.xml");
}
 
Example #24
Source File: DefaultTransactionScopedEntityManagerInjectionTest.java    From deltaspike with Apache License 2.0 5 votes vote down vote up
@Deployment
public static WebArchive deploy()
{
    JavaArchive testJar = ShrinkWrap.create(JavaArchive.class, "defaultTransactionScopedInjectionTest.jar")
            .addPackage(ArchiveUtils.SHARED_PACKAGE)
            .addPackage(DefaultTransactionScopedEntityManagerInjectionTest.class.getPackage().getName())
            .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml");

    return ShrinkWrap.create(WebArchive.class)
            .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreAndJpaArchive())
            .addAsLibraries(testJar)
            .addAsServiceProvider(Extension.class, TransactionContextExtension.class)
            .addAsWebInfResource(ArchiveUtils.getBeansXml(), "beans.xml");
}
 
Example #25
Source File: NestedMultiTransactionScopedTransactionTest.java    From deltaspike with Apache License 2.0 5 votes vote down vote up
@Deployment
public static WebArchive deploy()
{
    JavaArchive testJar = ShrinkWrap.create(JavaArchive.class, "nestedMultiTransactionScopedTransactionTest.jar")
            .addPackage(ArchiveUtils.SHARED_PACKAGE)
            .addPackage(NestedMultiTransactionScopedTransactionTest.class.getPackage().getName())
            .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml");

    return ShrinkWrap.create(WebArchive.class)
            .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreAndJpaArchive())
            .addAsLibraries(testJar)
            .addAsServiceProvider(Extension.class, TransactionContextExtension.class)
            .addAsWebInfResource(ArchiveUtils.getBeansXml(), "beans.xml");
}
 
Example #26
Source File: MultipleTransactionScopedEntityManagerInjectionTest.java    From deltaspike with Apache License 2.0 5 votes vote down vote up
@Deployment
public static WebArchive deploy()
{
    JavaArchive testJar = ShrinkWrap.create(JavaArchive.class, "autoTransactionScopedInjectionTest.jar")
            .addPackage(ArchiveUtils.SHARED_PACKAGE)
            .addPackage(MultipleTransactionScopedEntityManagerInjectionTest.class.getPackage().getName())
            .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml");

    return ShrinkWrap.create(WebArchive.class)
            .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreAndJpaArchive())
            .addAsLibraries(testJar)
            .addAsServiceProvider(Extension.class, TransactionContextExtension.class)
            .addAsWebInfResource(ArchiveUtils.getBeansXml(), "beans.xml");
}
 
Example #27
Source File: ManualTransactionScopedTransactionTest.java    From deltaspike with Apache License 2.0 5 votes vote down vote up
@Deployment
public static WebArchive deploy()
{
    JavaArchive testJar = ShrinkWrap.create(JavaArchive.class, "manualTransactionScopedTransactionTest.jar")
            .addPackage(ArchiveUtils.SHARED_PACKAGE)
            .addPackage(ManualTransactionScopedTransactionTest.class.getPackage().getName())
            .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml");

    return ShrinkWrap.create(WebArchive.class)
            .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreAndJpaArchive())
            .addAsLibraries(testJar)
            .addAsServiceProvider(Extension.class, TransactionContextExtension.class)
            .addAsWebInfResource(ArchiveUtils.getBeansXml(), "beans.xml");
}
 
Example #28
Source File: StereotypeTransactionScopedTransactionalTest.java    From deltaspike with Apache License 2.0 5 votes vote down vote up
@Deployment
public static WebArchive deploy()
{
    JavaArchive testJar = ShrinkWrap.create(JavaArchive.class, "stereotypeTransactionScopedTransactionalTest.jar")
            .addPackage(ArchiveUtils.SHARED_PACKAGE)
            .addPackage(StereotypeTransactionScopedTransactionalTest.class.getPackage().getName())
            .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml");

    return ShrinkWrap.create(WebArchive.class)
            .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreAndJpaArchive())
            .addAsLibraries(testJar)
            .addAsServiceProvider(Extension.class, TransactionContextExtension.class)
            .addAsWebInfResource(ArchiveUtils.getBeansXml(), "beans.xml");
}
 
Example #29
Source File: NestedTransactionScopedTransactionTest.java    From deltaspike with Apache License 2.0 5 votes vote down vote up
@Deployment
public static WebArchive deploy()
{
    JavaArchive testJar = ShrinkWrap.create(JavaArchive.class, "nestedTransactionScopedTransaction.jar")
            .addPackage(ArchiveUtils.SHARED_PACKAGE)
            .addPackage(NestedTransactionScopedTransactionTest.class.getPackage().getName())
            .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml");

    return ShrinkWrap.create(WebArchive.class)
            .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreAndJpaArchive())
            .addAsLibraries(testJar)
            .addAsServiceProvider(Extension.class, TransactionContextExtension.class)
            .addAsWebInfResource(ArchiveUtils.getBeansXml(), "beans.xml");
}
 
Example #30
Source File: UncatchedFlushExceptionTest.java    From deltaspike with Apache License 2.0 5 votes vote down vote up
@Deployment
public static WebArchive deploy()
{
    JavaArchive testJar = ShrinkWrap.create(JavaArchive.class, "autoInjectionUncatchedFlushExceptionTest.jar")
            .addPackage(ArchiveUtils.SHARED_PACKAGE)
            .addPackage(UncatchedFlushExceptionTest.class.getPackage().getName())
            .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml");

    return ShrinkWrap.create(WebArchive.class)
            .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreAndJpaArchive())
            .addAsLibraries(testJar)
            .addAsServiceProvider(Extension.class, TransactionContextExtension.class)
            .addAsWebInfResource(ArchiveUtils.getBeansXml(), "beans.xml");
}