Java Code Examples for org.jboss.shrinkwrap.api.spec.WebArchive#addAsServiceProvider()

The following examples show how to use org.jboss.shrinkwrap.api.spec.WebArchive#addAsServiceProvider() . These examples are extracted from open source projects. 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
@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
@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
@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 4
Source Project: quarkus   File: DeploymentProcessor.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public void process(Archive<?> archive, TestClass testClass) {
    if (archive instanceof WebArchive) {
        WebArchive war = WebArchive.class.cast(archive);

        // enable tracing on the client side
        war.addAsServiceProvider(ClientTracingRegistrarProvider.class,
                ResteasyClientTracingRegistrarProvider.class);
        war.addClasses(ResteasyClientTracingRegistrarProvider.class);

        // override the default TracerProducer
        war.addClass(MockTracerProducer.class);

        // workaround for RESTEASY-1758
        war.addClass(ExceptionMapper.class);
    }

}
 
Example 5
@Override
public void process(Archive<?> applicationArchive, TestClass testClass) {
    if (applicationArchive instanceof WebArchive) {
        WebArchive war = (WebArchive) applicationArchive;
        war.addClass(OptionalAwareSmallRyeJWTAuthCDIExtension.class);
        war.addClass(SmallRyeJWTAuthJaxRsFeature.class);
        war.addAsServiceProvider(Extension.class, OptionalAwareSmallRyeJWTAuthCDIExtension.class);

        if (!war.contains("META-INF/microprofile-config.properties")) {
            war.addAsManifestResource("microprofile-config-local.properties", "microprofile-config.properties");
        }

        // A few tests require the apps to be deployed in the root. Check PublicKeyAsJWKLocationURLTest and PublicKeyAsPEMLocationURLTest
        // Both tests set the public key location url to be in root.
        war.addAsWebInfResource("jboss-web.xml");

        String[] deps = {
                "io.smallrye:smallrye-jwt",
                "io.smallrye.config:smallrye-config",
                "org.jboss.resteasy:resteasy-servlet-initializer",
                "org.jboss.resteasy:resteasy-jaxrs",
                "org.jboss.resteasy:resteasy-client",
                "org.jboss.resteasy:resteasy-cdi",
                "org.jboss.resteasy:resteasy-json-binding-provider",
                "org.jboss.weld.servlet:weld-servlet-core"
        };
        File[] dependencies = Maven.resolver()
                .loadPomFromFile(new File("pom.xml"))
                .resolve(deps)
                .withTransitivity()
                .asFile();

        war.addAsLibraries(dependencies);
    }
}
 
Example 6
@Override
public void process(TestDeployment testDeployment, Archive<?> archive) {
    WebArchive war = (WebArchive) archive;

    String[] deps = {
            "io.smallrye:smallrye-config",
            "io.smallrye:smallrye-metrics",
            "io.smallrye:smallrye-metrics-testsuite-common",
            "org.eclipse.microprofile.metrics:microprofile-metrics-api",
            "org.eclipse.microprofile.config:microprofile-config-api"
    };
    File[] dependencies = Maven.resolver().loadPomFromFile(new File("pom.xml")).resolve(deps).withTransitivity().asFile();
    war.addAsLibraries(dependencies);

    war.addClass(MetricsHttpServlet.class);
    war.addClass(JaxRsMetricsFilter.class);
    war.addClass(JaxRsMetricsServletFilter.class);

    // change application context root to '/' because the TCK assumes that the metrics
    // will be available at '/metrics', and in our case the metrics servlet is located
    // within the application itself, we don't use WildFly's built-in support for metrics
    war.addAsWebInfResource("WEB-INF/jboss-web.xml", "jboss-web.xml");

    // activate the servlet filter
    war.setWebXML("WEB-INF/web.xml");

    // activate the JAX-RS request filter
    war.addAsServiceProvider(Providers.class.getName(), JaxRsMetricsFilter.class.getName());

    // exclude built-in Metrics and Config from WildFly
    war.addAsManifestResource("META-INF/jboss-deployment-structure.xml", "jboss-deployment-structure.xml");
}