Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for WFLY-18430 and WFLY-18790 #17153

Merged
merged 5 commits into from
Dec 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 7 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@
<version.asciidoctor.plugin>2.2.4</version.asciidoctor.plugin>
<version.org.jacoco>0.8.11</version.org.jacoco>
<version.org.jboss.galleon>5.2.2.Final</version.org.jboss.galleon>
<version.org.wildfly.glow>1.0.0.Alpha9</version.org.wildfly.glow>
<version.org.wildfly.glow>1.0.0.Alpha11</version.org.wildfly.glow>
<version.org.jboss.wildscribe>2.1.0.Final</version.org.jboss.wildscribe>
<version.org.wildfly.bom-builder-plugin>2.0.6.Final</version.org.wildfly.bom-builder-plugin>
<version.org.wildfly.checkstyle-config>1.0.8.Final</version.org.wildfly.checkstyle-config>
Expand Down Expand Up @@ -1301,6 +1301,11 @@
</attributes>
</configuration>
</plugin>
<plugin>
<groupId>org.wildfly.glow</groupId>
<artifactId>wildfly-glow-arquillian-plugin</artifactId>
<version>${version.org.wildfly.glow}</version>
</plugin>
</plugins>
</pluginManagement>

Expand All @@ -1324,6 +1329,7 @@
</execution>
</executions>
</plugin>

</plugins>
</build>

Expand Down
1,242 changes: 528 additions & 714 deletions testsuite/integration/basic/pom.xml

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public class WSViewEJBInjectionTestCase {

@Deployment
public static Archive createDeployment() {
final JavaArchive jar = ShrinkWrap.create(JavaArchive.class, "multiple-view-ejb-injection");
final JavaArchive jar = ShrinkWrap.create(JavaArchive.class, "multiple-view-ejb-injection.jar");
jar.addPackage(WSViewEJBInjectionTestCase.class.getPackage());
return jar;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
@ServerSetup(JNDIBindingsNoAppNameTestCase.TestLogHandlerSetup.class)
public class JNDIBindingsNoAppNameTestCase {

private static final String JAR_NAME = "ejb-jndi";
private static final String JAR_NAME = "ejb-jndi.jar";
private static String HOST = TestSuiteEnvironment.getServerAddress();
private static int PORT = TestSuiteEnvironment.getHttpPort();
private static final String TEST_HANDLER_NAME = "test-" + JNDIBindingsNoAppNameTestCase.class.getSimpleName();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@
@RunAsClient
public class MapBasedInitialContextEjbClientTestCase {

private static final String ARCHIVE_NAME = "map-based-client-1";
private static final String BASE_NAME = "map-based-client-1";
private static final String ARCHIVE_NAME = BASE_NAME + ".jar";

@Deployment
public static Archive<?> getDeployment() {
Expand All @@ -48,10 +49,10 @@ public static Archive<?> getDeployment() {
public void testScopedEJBClientContexts() throws Exception {
InitialContext ctx = new InitialContext(getEjbClientProperties(System.getProperty("node0", "127.0.0.1"), 8080));
try {
String lookupName = "ejb:/" + ARCHIVE_NAME + "/" + StatelessBean.class.getSimpleName() + "!" + StatelessIface.class.getCanonicalName();
String lookupName = "ejb:/" + BASE_NAME + "/" + StatelessBean.class.getSimpleName() + "!" + StatelessIface.class.getCanonicalName();
StatelessIface beanStateless = (StatelessIface) ctx.lookup(lookupName);
Assert.assertEquals("Unexpected EJB client context used for invoking stateless bean", CustomCallbackHandler.USER_NAME, beanStateless.getCallerPrincipalName());
lookupName = "ejb:/" + ARCHIVE_NAME + "/" + StatefulBean.class.getSimpleName() + "!" + StatefulIface.class.getCanonicalName() + "?stateful";
lookupName = "ejb:/" + BASE_NAME + "/" + StatefulBean.class.getSimpleName() + "!" + StatefulIface.class.getCanonicalName() + "?stateful";
StatefulIface beanStateful = (StatefulIface) ctx.lookup(lookupName);
Assert.assertEquals("Unexpected EJB client context used for invoking stateful bean", CustomCallbackHandler.USER_NAME, beanStateful.getCallerPrincipalName());
ctx.close();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public class NonDefaultRemoteWorkerTestCase {
@ArquillianResource
protected ManagementClient managementClient;

private static final String NAME_DEPLOYMENT = "echo-ejb-candy"; // module
private static final String NAME_DEPLOYMENT = "echo-ejb-candy.jar"; // module
private static final String NAME_WORKER = "puppeteer";
private static final PathAddress ADDRESS_WORKER = PathAddress.pathAddress(PathElement.pathElement(SUBSYSTEM, "io"),
PathElement.pathElement("worker", NAME_WORKER));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import org.jboss.as.test.integration.ejb.security.runasprincipal.transitive.SingletonStartupBean;
import org.jboss.as.test.integration.ejb.security.runasprincipal.transitive.StatelessSingletonUseBean;
import org.jboss.as.test.integration.security.common.AbstractSecurityDomainSetup;
import org.jboss.as.test.shared.GlowUtil;
import org.jboss.as.test.shared.TestLogHandlerSetupTask;
import org.jboss.as.test.shared.integration.ejb.security.Util;
import org.jboss.as.test.shared.util.LoggingUtil;
Expand Down Expand Up @@ -98,18 +99,23 @@ public static Archive<?> runAsDeployment() {
.addClass(RunAsPrincipalTestCase.class)
.addClass(TestLogHandlerSetupTask.class)
.addClass(LoggingUtil.class)
.addClass(GlowUtil.class)
.addClasses(AbstractSecurityDomainSetup.class, EjbSecurityDomainSetup.class)
.addAsWebInfResource(RunAsPrincipalTestCase.class.getPackage(), "jboss-ejb3.xml", "jboss-ejb3.xml")
.addAsManifestResource(new StringAsset("Dependencies: org.jboss.as.controller-client,org.jboss.dmr\n"), "MANIFEST.MF")
// TODO WFLY-15289 The Elytron permissions need to be checked, should a deployment really need these?
.addAsManifestResource(createPermissionsXmlAsset(new ElytronPermission("getSecurityDomain"),
new PropertyPermission("jboss.server.log.dir", "read"),
createFilePermission("read", "standalone", "log", TEST_LOG_FILE_NAME),
new ElytronPermission("authenticate"),
new ElytronPermission("getIdentity"),
new ElytronPermission("createAdHocIdentity"),
new ChangeRoleMapperPermission("ejb"),
new ElytronPermission("setRunAsPrincipal")), "permissions.xml");
.addAsManifestResource(new StringAsset("Dependencies: org.jboss.as.controller-client,org.jboss.dmr\n"), "MANIFEST.MF");
// When WildFly Glow instantiate and scan the deployment, the deployment is not deployed, the following
// code creates error at deployment instantiation time.
if (!GlowUtil.isGlowScan()) {
// TODO WFLY-15289 The Elytron permissions need to be checked, should a deployment really need these?
war.addAsManifestResource(createPermissionsXmlAsset(new ElytronPermission("getSecurityDomain"),
new PropertyPermission("jboss.server.log.dir", "read"),
createFilePermission("read", "standalone", "log", TEST_LOG_FILE_NAME),
new ElytronPermission("authenticate"),
new ElytronPermission("getIdentity"),
new ElytronPermission("createAdHocIdentity"),
new ChangeRoleMapperPermission("ejb"),
new ElytronPermission("setRunAsPrincipal")), "permissions.xml");
}
war.addPackage(CommonCriteria.class.getPackage());
return war;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public static Archive<?> getTestArchive() throws Exception {

@Deployment(name = SessionConstants.DEPLOYMENT_NAME_SESSION, order = 1, managed = false, testable = false)
public static Archive<?> getSessionArchive() {
final JavaArchive jar = ShrinkWrap.create(JavaArchive.class, SessionConstants.DEPLOYMENT_NAME_SESSION);
final JavaArchive jar = ShrinkWrap.create(JavaArchive.class, SessionConstants.DEPLOYMENT_JAR_NAME_SESSION);
jar.addClass(Constants.class);
jar.addClass(CallCounterProxy.class);
jar.addClass(SessionConstants.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public static Archive<?> getTestArchive() throws Exception {

@Deployment(name = SessionConstants.DEPLOYMENT_NAME_SESSION, order = 1, managed = false, testable = false)
public static Archive<?> getSessionArchive() {
final JavaArchive jar = ShrinkWrap.create(JavaArchive.class, SessionConstants.DEPLOYMENT_NAME_SESSION);
final JavaArchive jar = ShrinkWrap.create(JavaArchive.class, SessionConstants.DEPLOYMENT_JAR_NAME_SESSION);
jar.addClass(Constants.class);
jar.addClass(CallCounterProxy.class);
jar.addClass(SessionConstants.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public class SinglePostConstructInvocationTestCase {

@Deployment
public static Archive<?> getDeployment() {
JavaArchive archive = ShrinkWrap.create(JavaArchive.class, "single-postconstruct-invocation-test");
JavaArchive archive = ShrinkWrap.create(JavaArchive.class, "single-postconstruct-invocation-test.jar");
archive.addClasses(Client.class, Controller.class);
return archive;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/*
* JBoss, Home of Professional Open Source.
* Copyright 2023, Red Hat, Inc., and individual contributors
* as indicated by the @author tags. See the copyright.txt file in the
* distribution for a full listing of individual contributors.
* This is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
* You should have received a copy of the GNU Lesser General Public
* License along with this software; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/

package org.jboss.as.test.integration.hibernate.search.v5migrationhelper;

public class V5MigrationHelperMarker {
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.arquillian.junit.Arquillian;
import org.jboss.as.test.integration.hibernate.search.backend.lucene.massindexer.HibernateSearchLuceneEarMassIndexerTestCase;
import org.jboss.as.test.integration.hibernate.search.v5migrationhelper.V5MigrationHelperMarker;
import org.jboss.as.test.shared.util.AssumeTestGroupUtil;
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.asset.Asset;
Expand Down Expand Up @@ -47,7 +48,7 @@ public static void securityManagerNotSupportedInHibernateSearch() {
}

@Deployment
public static WebArchive createArchive() {
public static WebArchive createArchive() throws Exception {

// TODO maybe just use managed=false and deploy in the @BeforeClass / undeploy in an @AfterClass
if (AssumeTestGroupUtil.isSecurityManagerEnabled()) {
Expand All @@ -62,8 +63,9 @@ public static WebArchive createArchive() {
.addAsResource(persistenceXml(), "META-INF/persistence.xml")
.addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml")
// These JARs are copied to target/ using the maven-dependency-plugin; see pom.xml.
.addAsLibraries(new File("target/testlib/hibernate-search-v5migrationhelper-engine.jar"),
new File("target/testlib/hibernate-search-v5migrationhelper-orm.jar"));
.addAsLibraries(
new File(V5MigrationHelperMarker.class.getResource("hibernate-search-v5migrationhelper-engine.jar").toURI()),
new File(V5MigrationHelperMarker.class.getResource("hibernate-search-v5migrationhelper-orm.jar").toURI()));
}

private static Asset warManifest() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.arquillian.junit.Arquillian;
import org.jboss.as.test.integration.hibernate.search.backend.lucene.simple.HibernateSearchLuceneSimpleTestCase;
import org.jboss.as.test.integration.hibernate.search.v5migrationhelper.V5MigrationHelperMarker;
import org.jboss.as.test.shared.util.AssumeTestGroupUtil;
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.asset.Asset;
Expand Down Expand Up @@ -46,7 +47,7 @@ public static void securityManagerNotSupportedInHibernateSearch() {
}

@Deployment
public static WebArchive createArchive() {
public static WebArchive createArchive() throws Exception {

// TODO maybe just use managed=false and deploy in the @BeforeClass / undeploy in an @AfterClass
if (AssumeTestGroupUtil.isSecurityManagerEnabled()) {
Expand All @@ -61,8 +62,9 @@ public static WebArchive createArchive() {
.addAsResource(persistenceXml(), "META-INF/persistence.xml")
.addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml")
// These JARs are copied to target/ using the maven-dependency-plugin; see pom.xml.
.addAsLibraries(new File("target/testlib/hibernate-search-v5migrationhelper-engine.jar"),
new File("target/testlib/hibernate-search-v5migrationhelper-orm.jar"));
.addAsLibraries(
new File(V5MigrationHelperMarker.class.getResource("hibernate-search-v5migrationhelper-engine.jar").toURI()),
new File(V5MigrationHelperMarker.class.getResource("hibernate-search-v5migrationhelper-orm.jar").toURI()));
}

private static Asset warManifest() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.arquillian.container.test.api.RunAsClient;
import org.jboss.arquillian.junit.Arquillian;
import org.jboss.as.test.shared.GlowUtil;
import org.jboss.shrinkwrap.api.Archive;
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.spec.WebArchive;
Expand All @@ -32,7 +33,11 @@ public class DupliciteApplicationPathTestCase {

@Deployment
public static Archive<?> deploy_true() {
initWarningsCount = getWarningCount("WFLYUT0101");
// When WildFly Glow instantiate and scan the deployment, no server is started.
// Can't read the server log.
if (!GlowUtil.isGlowScan()) {
initWarningsCount = getWarningCount("WFLYUT0101");
}
WebArchive war = ShrinkWrap.create(WebArchive.class, DupliciteApplicationPathTestCase.class.getSimpleName() + ".war");
war.addClass(DupliciteApplicationOne.class);
war.addClass(DupliciteApplicationTwo.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
import org.jboss.as.test.integration.jsf.version.ejb.JSFVersionEJB;
import org.jboss.as.test.integration.jsf.version.war.JSFMyFaces;
import org.jboss.as.test.integration.jsf.version.war.JSFVersion;
import org.jboss.as.test.shared.GlowUtil;
import org.jboss.as.test.shared.TestLogHandlerSetupTask;
import org.jboss.as.test.shared.util.LoggingUtil;
import org.jboss.shrinkwrap.api.ShrinkWrap;
Expand Down Expand Up @@ -103,19 +104,22 @@ public static EnterpriseArchive createDeployment1() throws IOException {
war.addAsWebResource(JSFVersion.class.getPackage(), "jsfmyfacesversion.xhtml", "jsfmyfacesversion.xhtml");
war.addAsWebInfResource(JSFVersion.class.getPackage(), WEB_BUNDLED_JSF_WEB_XML, "web.xml");

//add Jakarta Server Faces as webapp lib
final PomEquippedResolveStage resolver = Maven.resolver().loadPomFromFile("pom.xml");
war.addAsLibraries(
resolver.resolve(
"commons-beanutils:commons-beanutils:1.9.3",
"commons-collections:commons-collections:3.2.2",
"commons-digester:commons-digester:1.8",
"org.apache.myfaces.core:myfaces-api:2.0.24",
"org.apache.myfaces.core:myfaces-impl:2.0.24"
)
.withoutTransitivity()
.asFile()
);
// Do not add these libraries that would then be scanned by WildFly Glow when instantiating/scanning the deployment.
if (!GlowUtil.isGlowScan()) {
//add Jakarta Server Faces as webapp lib
final PomEquippedResolveStage resolver = Maven.resolver().loadPomFromFile("pom.xml");
war.addAsLibraries(
resolver.resolve(
"commons-beanutils:commons-beanutils:1.9.3",
"commons-collections:commons-collections:3.2.2",
"commons-digester:commons-digester:1.8",
"org.apache.myfaces.core:myfaces-api:2.0.24",
"org.apache.myfaces.core:myfaces-impl:2.0.24"
)
.withoutTransitivity()
.asFile()
);
}

// add the .war
ear.addAsModule(war);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.arquillian.junit.Arquillian;
import org.jboss.as.test.shared.GlowUtil;
import org.jboss.shrinkwrap.api.Archive;
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.asset.StringAsset;
Expand Down Expand Up @@ -49,11 +50,14 @@ protected static void doSetup() throws Exception {
@Deployment
public static Archive<?> deploy() throws Exception {

doSetup();
// No actual setup when scanning the deployment prior to test execution.
if (!GlowUtil.isGlowScan()) {
doSetup();
}

JavaArchive jar = ShrinkWrap
.create(JavaArchive.class, "test.jar")
.addClasses(Clown.class, ExtensionTestCase.class, AbstractModuleTest.class)
.addClasses(Clown.class, ExtensionTestCase.class, AbstractModuleTest.class, GlowUtil.class)
.addAsManifestResource(new StringAsset("<beans bean-discovery-mode=\"all\"></beans>"), "beans.xml")
.addAsManifestResource(new StringAsset("Dependencies: cidExtensionModule services\n"),
"MANIFEST.MF");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.arquillian.junit.Arquillian;
import org.jboss.as.test.module.util.TestModule;
import org.jboss.as.test.shared.GlowUtil;
import org.jboss.shrinkwrap.api.Archive;
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.asset.EmptyAsset;
Expand Down Expand Up @@ -79,10 +80,14 @@ public static void tearDown() throws Exception {

@Deployment
public static Archive<?> getDeployment() throws Exception {
doSetup();
// No actual setup when scanning the deployment prior to test execution.
if (!GlowUtil.isGlowScan()) {
doSetup();
}
WebArchive war = ShrinkWrap.create(WebArchive.class, "CrossModuleAccessibilityTestCase.war")
.addClass(CrossModuleAccessibilityTestCase.class)
.addClass(TestModule.class)
.addClass(GlowUtil.class)
.addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml")
.addAsManifestResource(new StringAsset("Dependencies: test.alpha meta-inf, test.bravo meta-inf, test.charlie meta-inf, test.delta meta-inf\n"), "MANIFEST.MF");
return ShrinkWrap.create(EnterpriseArchive.class, "CrossModuleAccessibilityTestCase.ear").addAsModule(war);
Expand Down