Package org.wildfly.testing.tools.deployment
package org.wildfly.testing.tools.deployment
Utilities for creating deployment descriptors and configuring deployments for WildFly testing.
This package provides helper methods to generate common WildFly deployment descriptors programmatically, making it easier to configure test deployments with ShrinkWrap or other archive builders.
Key Classes
DeploymentDescriptors- Factory methods for creating deployment descriptor XML filesDeployments- Utility methods for working with ShrinkWrap deployments
Supported Deployment Descriptors
jboss-deployment-structure.xml- Control deployment dependencies and module exclusionsjboss-web.xml- Configure web deployment settings like context root and security domainpermissions.xml- Define Jakarta EE security permissions for the deployment
Example: Adding Module Dependencies
WebArchive war = ShrinkWrap.create(WebArchive.class, "test.war")
.addClass(MyService.class);
// Add jboss-deployment-structure.xml to include additional modules
Asset deploymentStructure = DeploymentDescriptors.createJBossDeploymentStructureAsset(
Set.of("org.jboss.logging"), // modules to add
Set.of() // modules to exclude
);
war.addAsManifestResource(deploymentStructure, "jboss-deployment-structure.xml");
Example: Setting Context Root
WebArchive war = ShrinkWrap.create(WebArchive.class, "myapp.war")
.addClass(MyServlet.class);
// Set custom context root
Asset jbossWeb = DeploymentDescriptors.createJBossWebContextRoot("/api");
war.addAsWebInfResource(jbossWeb, "jboss-web.xml");
Example: Adding Security Permissions
JavaArchive jar = ShrinkWrap.create(JavaArchive.class, "test.jar")
.addClass(MyClass.class);
// Add permissions for file system access
Collection<Permission> permissions = DeploymentDescriptors.createTempDirPermission("read,write");
Asset permissionsXml = DeploymentDescriptors.createPermissionsXmlAsset(permissions);
jar.addAsManifestResource(permissionsXml, "permissions.xml");
Framework Compatibility
This package has no dependencies on JUnit or any specific testing framework. It can be used with:
- WildFly JUnit Extension
- Arquillian
- TestNG
- Any framework that uses ShrinkWrap for deployment creation
- Author:
- James R. Perkins
- See Also:
-
ClassesClassDescriptionA utility to generate various deployment descriptors.Utility class for creating ShrinkWrap archives with conventional naming.