Skip to content

Commit

Permalink
Merge pull request wildfly#18229 from scottmarlow/access_earLibClassF…
Browse files Browse the repository at this point in the history
…romAppMain

[WFLY-19769] Prove that appclient main can access ear/lib jar classes
  • Loading branch information
bstansberry authored Sep 26, 2024
2 parents 34c0a52 + b205264 commit bce5759
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ public class AppClientMain {

public static void main(final String[] params) {
logger.trace("Main method invoked");

Status status = new Status();
logger.info("Status class accessed via classloader = " + status.getClass().getClassLoader());
if(!appclient) {
logger.error("InAppClientContainer was not true");
throw new RuntimeException("InAppClientContainer was not true");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@ public static Archive<?> deploy() {
lib.addClasses(Employee.class);
lib.addAsManifestResource(PersistenceUnitPackagingTestCase.class.getPackage(), "persistence.xml", "persistence.xml");
ear.addAsLibrary(lib);

final JavaArchive otherLib = ShrinkWrap.create(JavaArchive.class, "otherlib.jar");
otherLib.addClass(Status.class);
ear.addAsLibrary(otherLib);

final JavaArchive ejb = ShrinkWrap.create(JavaArchive.class, MODULE_NAME + ".jar");
ejb.addClasses(SimpleApplicationClientTestCase.class, AppClientStateSingleton.class);
ear.addAsModule(ejb);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@ public static Archive<?> deploy() {
lib.addClasses(Employee.class);
lib.addAsManifestResource(PersistenceUnitPackagingTestCase.class.getPackage(), "persistence.xml", "persistence.xml");
ear.addAsLibrary(lib);

final JavaArchive otherLib = ShrinkWrap.create(JavaArchive.class, "otherlib.jar");
otherLib.addClass(Status.class);
ear.addAsLibrary(otherLib);

final JavaArchive ejb = ShrinkWrap.create(JavaArchive.class, MODULE_NAME + ".jar");
ejb.addClasses(SimpleApplicationClientTestCase2.class, AppClientStateSingleton.class);
ear.addAsModule(ejb);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/*
* Copyright The WildFly Authors
* SPDX-License-Identifier: Apache-2.0
*/

package org.jboss.as.test.integration.ee.appclient.basic;

/**
* Status
*
* @author Scott Marlow
*/
public class Status {
public String getStatus() {
return "there were no test failures accessing the Status class!";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,11 @@ public static Archive<?> deploy() {
lib.addClasses(Employee.class);
lib.addAsManifestResource(PersistenceUnitPackagingTestCase.class.getPackage(), "persistence.xml", "persistence.xml");
ear.addAsLibrary(lib);

final JavaArchive otherLib = ShrinkWrap.create(JavaArchive.class, "otherlib.jar");
otherLib.addClass(Status.class);
ear.addAsLibrary(otherLib);

final JavaArchive ejb = ShrinkWrap.create(JavaArchive.class, MODULE_NAME + ".jar");
ejb.addClasses(SimpleApplicationClientTestCase.class, AppClientStateSingleton.class);
ear.addAsModule(ejb);
Expand Down

0 comments on commit bce5759

Please sign in to comment.