KEYCLOAK-8637 Add support for OIDC multitenancy adapter test for jboss based containers

This commit is contained in:
vramik 2018-10-23 14:19:26 +02:00 committed by Pavel Drozd
parent 9ef4c7fffd
commit f449b8b454
3 changed files with 20 additions and 3 deletions

View file

@ -43,7 +43,7 @@ public class MultiTenantResolver implements KeycloakConfigResolver {
realm = realm.split("\\?")[0];
}
InputStream is = getClass().getResourceAsStream("/adapter-test/multi-tenant/WEB-INF/" + realm + "-keycloak.json");
InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream("/" + realm + "-keycloak.json");
if (is == null) {
throw new IllegalStateException("Not able to find the file /" + realm + "-keycloak.json");

View file

@ -41,9 +41,21 @@ public abstract class AbstractServletsAdapterTest extends AbstractAdapterTest {
protected static WebArchive servletDeploymentMultiTenant(String name, Class... servletClasses) {
WebArchive servletDeployment = servletDeployment(name, null, servletClasses);
return servletDeployment;
String webInfPath = "/adapter-test/" + name + "/WEB-INF/";
String config1 = "tenant1-keycloak.json";
String config2 = "tenant2-keycloak.json";
URL config1Url = AbstractServletsAdapterTest.class.getResource(webInfPath + config1);
Assert.assertNotNull("config1Url should be in " + webInfPath + config1, config1Url);
URL config2Url = AbstractServletsAdapterTest.class.getResource(webInfPath + config2);
Assert.assertNotNull("config2Url should be in " + webInfPath + config2, config2Url);
return servletDeployment
.add(new UrlAsset(config1Url), "/WEB-INF/classes/" + config1)
.add(new UrlAsset(config2Url), "/WEB-INF/classes/" + config2);
}
protected static WebArchive servletDeployment(String name, Class... servletClasses) {
return servletDeployment(name, "keycloak.json", servletClasses);
}

View file

@ -42,6 +42,11 @@ import static org.keycloak.testsuite.utils.io.IOUtil.loadRealm;
* @author Juraci Paixão Kröhling <juraci at kroehling.de>
*/
@AppServerContainer(ContainerConstants.APP_SERVER_UNDERTOW)
@AppServerContainer(ContainerConstants.APP_SERVER_WILDFLY)
@AppServerContainer(ContainerConstants.APP_SERVER_WILDFLY_DEPRECATED)
@AppServerContainer(ContainerConstants.APP_SERVER_EAP)
@AppServerContainer(ContainerConstants.APP_SERVER_EAP6)
@AppServerContainer(ContainerConstants.APP_SERVER_EAP71)
public class MultiTenancyTest extends AbstractServletsAdapterTest {
@Page