Skip to content

Commit

Permalink
Merge pull request #6115 from jamezp/WFCORE-6933
Browse files Browse the repository at this point in the history
[WFCORE-6933] Add the required permissions for the Log4j2ServiceActiv…
  • Loading branch information
bstansberry authored Jul 24, 2024
2 parents 45aca9a + 6a55195 commit 1734306
Showing 1 changed file with 14 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import org.jboss.logging.Logger;
import org.jboss.shrinkwrap.api.spec.JavaArchive;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
Expand Down Expand Up @@ -57,9 +58,15 @@ public void stopContainer() throws Exception {
container.stop();
}

@Test(expected = ServerDeploymentException.class)
@Test
public void disableLoggingDependencies() throws Exception {
final JavaArchive archive = createDeployment(Log4j2ServiceActivator.class, Log4j2ServiceActivator.DEPENDENCIES);
// Required permissions for log4j2
addPermissions(archive,
new RuntimePermission("getClassLoader"),
new RuntimePermission("accessDeclaredMembers"),
new RuntimePermission("getenv.*")
);
// Ensure the log4j deployment can be deployed
deploy(archive);
undeploy();
Expand All @@ -69,6 +76,11 @@ public void disableLoggingDependencies() throws Exception {
// Restart the container, expect the exception during deployment
container.stop();
container.start();
deploy(archive);
try {
deploy(archive);
Assert.fail("Expected a ServerDeploymentException to be thrown.");
} catch (ServerDeploymentException expected) {

}
}
}

0 comments on commit 1734306

Please sign in to comment.