Search in sources :

Example 1 with RestSamlApplicationConfig

use of org.keycloak.testsuite.arquillian.undertow.saml.util.RestSamlApplicationConfig in project keycloak by keycloak.

the class UndertowAppServer method discoverPathAnnotatedClasses.

private ResteasyDeployment discoverPathAnnotatedClasses(WebArchive webArchive) {
    // take all classes from war and add those with @Path annotation to RestSamlApplicationConfig
    Set<Class<?>> classes = webArchive.getContent(archivePath -> archivePath.get().startsWith("/WEB-INF/classes/") && archivePath.get().endsWith(".class")).values().stream().filter(node -> node.getAsset() instanceof ClassAsset).map(node -> ((ClassAsset) node.getAsset()).getSource()).filter(clazz -> clazz.isAnnotationPresent(Path.class)).collect(Collectors.toSet());
    ResteasyDeployment deployment = new ResteasyDeployment();
    deployment.setApplication(new RestSamlApplicationConfig(classes));
    return deployment;
}
Also used : Servlet(org.jboss.arquillian.container.spi.client.protocol.metadata.Servlet) ServletException(javax.servlet.ServletException) ProtocolMetaData(org.jboss.arquillian.container.spi.client.protocol.metadata.ProtocolMetaData) DeployableContainer(org.jboss.arquillian.container.spi.client.container.DeployableContainer) UndertowWarClassLoader(org.keycloak.testsuite.utils.undertow.UndertowWarClassLoader) Logger(org.jboss.logging.Logger) Path(javax.ws.rs.Path) Application(javax.ws.rs.core.Application) Node(org.jboss.shrinkwrap.api.Node) ServletInfo(io.undertow.servlet.api.ServletInfo) Undertow(io.undertow.Undertow) PathHandler(io.undertow.server.handlers.PathHandler) UndertowContainerConfiguration(org.arquillian.undertow.UndertowContainerConfiguration) Charset(java.nio.charset.Charset) HTTPContext(org.jboss.arquillian.container.spi.client.protocol.metadata.HTTPContext) ResteasyDeployment(org.jboss.resteasy.spi.ResteasyDeployment) Map(java.util.Map) UndertowJaxrsServer(org.jboss.resteasy.plugins.server.undertow.UndertowJaxrsServer) UndertowWebArchive(org.jboss.shrinkwrap.undertow.api.UndertowWebArchive) WebArchive(org.jboss.shrinkwrap.api.spec.WebArchive) LifecycleException(org.jboss.arquillian.container.spi.client.container.LifecycleException) ClassAsset(org.jboss.shrinkwrap.api.asset.ClassAsset) Collection(java.util.Collection) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) ProtocolDescription(org.jboss.arquillian.container.spi.client.protocol.ProtocolDescription) Set(java.util.Set) IOException(java.io.IOException) FileUtils(org.apache.commons.io.FileUtils) Archive(org.jboss.shrinkwrap.api.Archive) ServletContainer(io.undertow.servlet.api.ServletContainer) Field(java.lang.reflect.Field) DeploymentManager(io.undertow.servlet.api.DeploymentManager) Collectors(java.util.stream.Collectors) File(java.io.File) RestSamlApplicationConfig(org.keycloak.testsuite.arquillian.undertow.saml.util.RestSamlApplicationConfig) IOUtils(org.apache.commons.io.IOUtils) Descriptor(org.jboss.shrinkwrap.descriptor.api.Descriptor) Optional(java.util.Optional) DeploymentInfo(io.undertow.servlet.api.DeploymentInfo) DeploymentException(org.jboss.arquillian.container.spi.client.container.DeploymentException) Reflections(org.keycloak.common.util.reflections.Reflections) UndertowDeployerHelper(org.keycloak.testsuite.utils.undertow.UndertowDeployerHelper) InputStream(java.io.InputStream) ResteasyDeployment(org.jboss.resteasy.spi.ResteasyDeployment) ClassAsset(org.jboss.shrinkwrap.api.asset.ClassAsset) RestSamlApplicationConfig(org.keycloak.testsuite.arquillian.undertow.saml.util.RestSamlApplicationConfig)

Aggregations

Undertow (io.undertow.Undertow)1 PathHandler (io.undertow.server.handlers.PathHandler)1 DeploymentInfo (io.undertow.servlet.api.DeploymentInfo)1 DeploymentManager (io.undertow.servlet.api.DeploymentManager)1 ServletContainer (io.undertow.servlet.api.ServletContainer)1 ServletInfo (io.undertow.servlet.api.ServletInfo)1 File (java.io.File)1 IOException (java.io.IOException)1 InputStream (java.io.InputStream)1 Field (java.lang.reflect.Field)1 Charset (java.nio.charset.Charset)1 Collection (java.util.Collection)1 Map (java.util.Map)1 Optional (java.util.Optional)1 Set (java.util.Set)1 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)1 Collectors (java.util.stream.Collectors)1 ServletException (javax.servlet.ServletException)1 Path (javax.ws.rs.Path)1 Application (javax.ws.rs.core.Application)1