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

The following examples show how to use org.jboss.shrinkwrap.api.spec.WebArchive#contains() . 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: SmallRyeJWTArchiveProcessor.java    From smallrye-jwt with Apache License 2.0 5 votes vote down vote up
@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 2
Source File: AbstractExampleAdapterTest.java    From keycloak with Apache License 2.0 5 votes vote down vote up
protected static void modifyOIDCAdapterConfig(WebArchive webArchive) {
    if (webArchive.contains(DeploymentArchiveProcessorUtils.ADAPTER_CONFIG_PATH)) {
        DeploymentArchiveProcessorUtils.modifyOIDCAdapterConfig(webArchive, DeploymentArchiveProcessorUtils.ADAPTER_CONFIG_PATH);
    }

    if (webArchive.contains(DeploymentArchiveProcessorUtils.ADAPTER_CONFIG_PATH_JS)) {
        DeploymentArchiveProcessorUtils.modifyOIDCAdapterConfig(webArchive, DeploymentArchiveProcessorUtils.ADAPTER_CONFIG_PATH_JS);
    }
}
 
Example 3
Source File: UndertowDeployerHelper.java    From keycloak with Apache License 2.0 5 votes vote down vote up
private String getContextPath(WebArchive archive) {
    if (archive.contains("/META-INF/context.xml") && (archive.get("/META-INF/context.xml").getAsset() instanceof StringAsset)) {
        StringAsset asset = (StringAsset) archive.get("/META-INF/context.xml").getAsset();
        return asset.getSource().split("path=\"")[1].split("\"")[0];
    } else {
        return "/".concat(archive.getName().replace(".war", ""));
    }
}