KEYCLOAK-7518 DeploymentArchiveProcessor assumes that every archive contains jboss-deployment-structure.xml file
This commit is contained in:
parent
1b4d9a6147
commit
dffe70e40a
1 changed files with 10 additions and 4 deletions
|
@ -229,17 +229,23 @@ public class DeploymentArchiveProcessor implements ApplicationArchiveProcessor {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addFilterDependencies(Archive<?> archive, TestClass testClass) {
|
public void addFilterDependencies(Archive<?> archive, TestClass testClass) {
|
||||||
log.info("Adding filter dependencies to " + archive.getName());
|
|
||||||
|
|
||||||
TestContext testContext = testContextProducer.get();
|
TestContext testContext = testContextProducer.get();
|
||||||
if (testContext.getAppServerInfo().isUndertow()) {
|
if (testContext.getAppServerInfo().isUndertow()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Node jbossDeploymentStructureXml = archive.get(JBOSS_DEPLOYMENT_XML_PATH);
|
||||||
|
if (jbossDeploymentStructureXml == null) {
|
||||||
|
log.debug("Archive doesn't contain " + JBOSS_DEPLOYMENT_XML_PATH);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
log.info("Adding filter dependencies to " + archive.getName());
|
||||||
|
|
||||||
String dependency = testClass.getAnnotation(UseServletFilter.class).filterDependency();
|
String dependency = testClass.getAnnotation(UseServletFilter.class).filterDependency();
|
||||||
((WebArchive) archive).addAsLibraries(KeycloakDependenciesResolver.resolveDependencies((dependency + ":" + System.getProperty("project.version"))));
|
((WebArchive) archive).addAsLibraries(KeycloakDependenciesResolver.resolveDependencies((dependency + ":" + System.getProperty("project.version"))));
|
||||||
|
|
||||||
Document jbossXmlDoc = loadXML(archive.get(JBOSS_DEPLOYMENT_XML_PATH).getAsset().openStream());
|
Document jbossXmlDoc = loadXML(jbossDeploymentStructureXml.getAsset().openStream());
|
||||||
removeNodeByAttributeValue(jbossXmlDoc, "dependencies", "module", "name", "org.keycloak.keycloak-saml-core");
|
removeNodeByAttributeValue(jbossXmlDoc, "dependencies", "module", "name", "org.keycloak.keycloak-saml-core");
|
||||||
removeNodeByAttributeValue(jbossXmlDoc, "dependencies", "module", "name", "org.keycloak.keycloak-adapter-spi");
|
removeNodeByAttributeValue(jbossXmlDoc, "dependencies", "module", "name", "org.keycloak.keycloak-adapter-spi");
|
||||||
archive.add(new StringAsset((documentToString(jbossXmlDoc))), JBOSS_DEPLOYMENT_XML_PATH);
|
archive.add(new StringAsset((documentToString(jbossXmlDoc))), JBOSS_DEPLOYMENT_XML_PATH);
|
||||||
|
|
Loading…
Reference in a new issue