org.jboss.weld.environment.deployment.discovery.BeanArchiveHandler Java Examples

The following examples show how to use org.jboss.weld.environment.deployment.discovery.BeanArchiveHandler. 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: SmallRyeHealthArchiveProcessor.java    From smallrye-health with Apache License 2.0 6 votes vote down vote up
@Override
public void process(Archive<?> applicationArchive, TestClass testClass) {
    if (applicationArchive instanceof WebArchive) {
        WebArchive testDeployment = (WebArchive) applicationArchive;
        // Register SmallRyeBeanArchiveHandler using the ServiceLoader mechanism
        testDeployment.addClass(SmallRyeBeanArchiveHandler.class);
        testDeployment.addAsServiceProvider(BeanArchiveHandler.class, SmallRyeBeanArchiveHandler.class);

        String[] deps = {
                "io.smallrye:smallrye-health",
                "io.smallrye.config:smallrye-config",
                "io.smallrye:smallrye-health-tck",
                "org.eclipse.microprofile.health:microprofile-health-tck",
                "org.jboss.weld.servlet:weld-servlet-core" };

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

        testDeployment.addAsLibraries(dependencies);
    }
}
 
Example #3
Source File: SmallRyeHealthArchiveProcessor.java    From smallrye-health with Apache License 2.0 6 votes vote down vote up
@Override
public void process(Archive<?> applicationArchive, TestClass testClass) {
    if (applicationArchive instanceof WebArchive) {
        WebArchive testDeployment = (WebArchive) applicationArchive;
        // Register SmallRyeBeanArchiveHandler using the ServiceLoader mechanism
        testDeployment.addClass(SmallRyeBeanArchiveHandler.class);
        testDeployment.addAsServiceProvider(BeanArchiveHandler.class, SmallRyeBeanArchiveHandler.class);

        String[] deps = {
                "io.smallrye:smallrye-health",
                "io.smallrye.config:smallrye-config",
                "io.smallrye:smallrye-health-tck",
                "org.eclipse.microprofile.health:microprofile-health-tck",
                "org.jboss.weld.servlet:weld-servlet-core" };

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

        testDeployment.addAsLibraries(dependencies);
    }
}