Class DeploymentDescriptors

java.lang.Object
org.wildfly.testing.tools.deployments.DeploymentDescriptors

public class DeploymentDescriptors extends Object
A utility to generate various deployment descriptors.
Author:
James R. Perkins
  • Method Details

    • addJBossDeploymentStructure

      public static <T extends org.jboss.shrinkwrap.api.container.WebContainer<T> & org.jboss.shrinkwrap.api.Archive<T>> T addJBossDeploymentStructure(T archive, Set<String> addedModules, Set<String> excludedModules)
      Adds a jboss-deployment-structure.xml file to a deployment with optional dependency additions or exclusions.
      Type Parameters:
      T - the archive type
      Parameters:
      archive - the archive to add the jboss-deployment-structure.xml to
      addedModules - the modules to add to an archive or an empty set
      excludedModules - the modules to exclude from an archive or an empty set
      Returns:
      the archive
    • createJBossDeploymentStructureAsset

      public static org.jboss.shrinkwrap.api.asset.Asset createJBossDeploymentStructureAsset(Set<String> addedModules, Set<String> excludedModules)
      Creates a jboss-deployment-structure.xml file with the optional dependency additions or exclusions.
      Parameters:
      addedModules - the modules to add or an empty set
      excludedModules - the modules to exclude or an empty set
      Returns:
      a jboss-deployment-structure.xml asset
    • createJBossDeploymentStructure

      public static byte[] createJBossDeploymentStructure(Set<String> addedModules, Set<String> excludedModules)
      Creates a jboss-deployment-structure.xml file with the optional dependency additions or exclusions.
      Parameters:
      addedModules - the modules to add or an empty set
      excludedModules - the modules to exclude or an empty set
      Returns:
      a jboss-deployment-structure.xml in a byte array
    • createJBossWebContextRoot

      public static org.jboss.shrinkwrap.api.asset.Asset createJBossWebContextRoot(String contextRoot)
      Creates a jboss-web.xml with the context root provided.
      Parameters:
      contextRoot - the context root to use for the deployment
      Returns:
      a jboss-web.xml
    • createJBossWebSecurityDomain

      public static org.jboss.shrinkwrap.api.asset.Asset createJBossWebSecurityDomain(String securityDomain)
      Creates a jboss-web.xml with the security domain for the deployment.
      Parameters:
      securityDomain - the security domain to use for the deployment
      Returns:
      a jboss-web.xml
    • createJBossWebXmlAsset

      public static org.jboss.shrinkwrap.api.asset.Asset createJBossWebXmlAsset(Map<String,String> elements)
      Creates a jboss-web.xml with simple attributes.
      Parameters:
      elements - the elements to add where the key is the element name and the value is the elements value
      Returns:
      a jboss-web.xml
    • createJBossWebXml

      public static byte[] createJBossWebXml(Map<String,String> elements)
      Creates a jboss-web.xml with simple attributes.
      Parameters:
      elements - the elements to add where the key is the element name and the value is the elements value
      Returns:
      a jboss-web.xml
    • createPermissionsXmlAsset

      public static org.jboss.shrinkwrap.api.asset.Asset createPermissionsXmlAsset(Permission... permissions)
      Creates a new asset with the given contents for a permissions.xml file.
      Parameters:
      permissions - the permissions to add to the file
      Returns:
      an asset with the given contents for a permissions.xml file
    • createPermissionsXmlAsset

      public static org.jboss.shrinkwrap.api.asset.Asset createPermissionsXmlAsset(Iterable<? extends Permission> permissions, Permission... additionalPermissions)
      Creates a new asset with the given contents for a permissions.xml file.
      Parameters:
      permissions - the permissions to add to the file
      additionalPermissions - any additional permissions to add to the file
      Returns:
      an asset with the given contents for a permissions.xml file
    • createPermissionsXmlAsset

      public static org.jboss.shrinkwrap.api.asset.Asset createPermissionsXmlAsset(Iterable<? extends Permission> permissions)
      Creates a new asset with the given contents for a permissions.xml file.
      Parameters:
      permissions - the permissions to add to the file
      Returns:
      an asset with the given contents for a permissions.xml file
    • createPermissionsXml

      public static byte[] createPermissionsXml(Permission... permissions)
      Creates a new asset with the given contents for a permissions.xml file.
      Parameters:
      permissions - the permissions to add to the file
      Returns:
      an asset with the given contents for a permissions.xml file
    • createPermissionsXml

      public static byte[] createPermissionsXml(Iterable<? extends Permission> permissions, Permission... additionalPermissions)
      Creates a new asset with the given contents for a permissions.xml file.
      Parameters:
      permissions - the permissions to add to the file
      additionalPermissions - any additional permissions to add to the file
      Returns:
      an asset with the given contents for a permissions.xml file
    • appendPermissions

      public static org.jboss.shrinkwrap.api.asset.Asset appendPermissions(org.jboss.shrinkwrap.api.asset.Asset currentPermissions, Permission... permissions)
      Creates a new asset with the new permissions appended to the current permissions. Note that duplicates will not be added. A duplicates is considered a Permission with the same class name, same name and same actions.
      Parameters:
      currentPermissions - the current permissions, must be valid XML content
      permissions - the permissions to add
      Returns:
      a new asset to replace the current permissions.xml file
    • appendPermissions

      public static org.jboss.shrinkwrap.api.asset.Asset appendPermissions(org.jboss.shrinkwrap.api.asset.Asset currentPermissions, Iterable<? extends Permission> permissions)
      Creates a new asset with the new permissions appended to the current permissions. Note that duplicates will not be added. A duplicates is considered a Permission with the same class name, same name and same actions.
      Parameters:
      currentPermissions - the current permissions, must be valid XML content
      permissions - the permissions to add
      Returns:
      a new asset to replace the current permissions.xml file
    • addModuleFilePermission

      public static Collection<Permission> addModuleFilePermission(String... moduleNames)
      This should only be used as a workaround for issues with API's where something like a ServiceLoader needs access to an implementation.

      Adds file permissions for every JAR in the modules directory. The module.jar.path system property must be set.

      Parameters:
      moduleNames - the module names to add file permissions for
      Returns:
      a collection of permissions required
    • createTempDirPermission

      public static Collection<FilePermission> createTempDirPermission(String actions)
      Creates the permissions required for the java.io.tmpdir. This adds permissions to read the directory, then adds permissions for all files and subdirectories of the temporary directory. The actions are used for the latter permission.
      Parameters:
      actions - the actions required for the temporary directory
      Returns:
      the permissions required