Class WarBuilder<T extends WarBuilder<T>>

    • Constructor Detail

      • WarBuilder

        protected WarBuilder​(Class<U> classOfTest)
        Constructs a war builder for the specified test class. It will load all the resources in the same packages of the specified test class.
        Type Parameters:
        U - the type of the test.
        Parameters:
        classOfTest - the class of the test for which a war archive will be build.
    • Method Detail

      • createMavenDependencies

        public WarBuilder<T> createMavenDependencies​(String... mavenDependencies)
        Creates a maven dependencies (when not declared in the pom.xml of the current project). Each of the specified dependencies must be expressed in the canonical form
        <groupId>:<artifactId>[:<version>]
        If the version isn't specified, then it is figured out from the maven.properties file. A property <artifactId>.version is first looked for and if not found, the silverpeas version is then used.
        Parameters:
        mavenDependencies - the canonical maven dependencies to add.
        Returns:
        the instance of the configurator.
      • createMavenDependenciesWithPersistence

        public WarBuilder<T> createMavenDependenciesWithPersistence​(String... mavenDependencies)
        Creates a maven dependencies (when not declared in the pom.xml of the current project). Each of the specified dependencies must be expressed in the canonical form
        <groupId>:<artifactId>[:<version>]
        If the version isn't specified, then it is figured out from the maven.properties file. A property <artifactId>.version is first looked for and if not found, the silverpeas version is then used. The artifacts are then referenced in the persistence descriptor so that the entities and repositories are taken in charge by the persistence layer.
        Parameters:
        mavenDependencies - the canonical maven dependencies to add.
        Returns:
        the instance of the configurator.
        Throws:
        IllegalArgumentException - if no version if found for one of the specified Maven dependencies.
      • addMavenDependencies

        public WarBuilder<T> addMavenDependencies​(String... mavenDependencies)
        Adds the specified maven dependencies with their transitive dependencies that are defined in the pom.xml of the project. Each of the specified dependencies must be expressed in the canonical form
        <groupId>:<artifactId>[:<version>]
        Parameters:
        mavenDependencies - the canonical maven dependencies to add.
        Returns:
        the instance of the configurator.
      • addMavenDependenciesWithPersistence

        public WarBuilder<T> addMavenDependenciesWithPersistence​(String... mavenDependencies)
        Adds the specified maven dependencies with their transitive dependencies that are defined in the pom.xml of the project. Each of the specified dependencies must be expressed in the canonical form
        <groupId>:<artifactId>[:<version>]
        . The artifacts are then referenced in the persistence descriptor so that the entities and repositories are taken in charge by the persistence layer. For doing, in the case the version isn't specified in the canonical form of the dependency, it is figured out from the maven.properties file. A property <artifactId>.version is first looked for and if not found, the silverpeas version is then used.
        Parameters:
        mavenDependencies - the canonical maven dependencies to add.
        Returns:
        the instance of the configurator.
      • addMavenDependenciesWithoutTransitivity

        public WarBuilder<T> addMavenDependenciesWithoutTransitivity​(String... mavenDependencies)
        Adds the specified maven dependencies without their transitive dependencies that are defined in the pom.xml of the project. Each of the specified dependencies must be expressed in the canonical form
        <groupId>:<artifactId>[:<version>]
        Parameters:
        mavenDependencies - the canonical maven dependencies to add.
        Returns:
        the instance of the configurator.
      • addWebListener

        public WarBuilder<T> addWebListener​(Class<? extends EventListener> webListenerClass)
        Adds the specified web servlet listener.
        Parameters:
        webListenerClass - the class of the web listener to add.
        Returns:
        the instance of the configurator.
      • addPackages

        public WarBuilder<T> addPackages​(boolean recursive,
                                         String... packages)
                                  throws IllegalArgumentException
        Description copied from interface: CommonArchive
        Adds all classes in the specified Packages to the Archive.
        Specified by:
        addPackages in interface CommonArchive<T extends WarBuilder<T>>
        Parameters:
        recursive - Should the sub packages be added
        packages - All the packages to add represented by a String ("my/package")
        Returns:
        This virtual archive
        Throws:
        IllegalArgumentException - If no packages were specified
        See Also:
        ClassContainer.addPackages(boolean, Filter, Package...)
      • addAsResource

        public WarBuilder<T> addAsResource​(String resourceName)
                                    throws IllegalArgumentException
        Description copied from interface: CommonArchive
        Adds the resource as a resource to the container, returning the container itself.
        The resource will be placed into the Container Resource path under the same context from which it was retrieved.

        The ClassLoader used to obtain the resource is up to the implementation.
        Specified by:
        addAsResource in interface CommonArchive<T extends WarBuilder<T>>
        Parameters:
        resourceName - resource to add
        Returns:
        This virtual archive
        Throws:
        IllegalArgumentException - If the resourceName is null
        See Also:
        ResourceContainer.addAsResource(Asset, ArchivePath)
      • addAsResource

        public WarBuilder<T> addAsResource​(String resourceName,
                                           String target)
                                    throws IllegalArgumentException
        Description copied from interface: CommonArchive
        Adds the resource as a resource to the container, returning the container itself.

        The ClassLoader used to obtain the resource is up to the implementation.
        Specified by:
        addAsResource in interface CommonArchive<T extends WarBuilder<T>>
        Parameters:
        resourceName - resource to add
        target - The target path within the archive in which to add the resource, relative to the Archives resource path.
        Returns:
        This virtual archive
        Throws:
        IllegalArgumentException - if resourceName is null or if target is null
        See Also:
        ResourceContainer.addAsResource(Asset, ArchivePath)
      • addAsWebInfResource

        public WarBuilder<T> addAsWebInfResource​(org.jboss.shrinkwrap.api.asset.Asset resource,
                                                 String target)
                                          throws IllegalArgumentException
        Description copied from interface: CommonWebArchive
        Adds the Asset as a WEB-INF resource to the container, returning the container itself.
        Specified by:
        addAsWebInfResource in interface CommonWebArchive<T extends WarBuilder<T>>
        Parameters:
        resource - Asset resource to add
        target - The target path within the archive in which to add the resource, relative to the Archives WEB-INF path.
        Returns:
        This Archive
        Throws:
        IllegalArgumentException - If the resource or target is not specified
      • initJcrSchema

        public WarBuilder<T> initJcrSchema()
        The test implied code that uses the JCR. So initialize the JCR schema of Silverpeas.
        Returns:
        itself.
      • build

        public final org.jboss.shrinkwrap.api.spec.WebArchive build()
        Builds the final WAR archive. The following stuffs are automatically added:
        • The beans.xml descriptor in order to activate CDI,
        • The META-INF/services/org.silverpeas.core.util.BeanContainer service file to load the CDI-based bean container,
        Specified by:
        build in interface Builder<T extends WarBuilder<T>>
        Returns:
        the built WAR archive.
      • onLibsToInclude

        protected Predicate<File> onLibsToInclude()
        Gets a predicate on libraries (represented each of them by a file) to indicate if a library is accepted or not to be included among the dependencies of a WAR to build for integration tests ran by Arquillian.
        Returns:
        a predicate on a file (a given library)
      • testFocusedOn

        public final WarBuilder<T> testFocusedOn​(WarBuilder.TestFocus<T> testFocus)
        Applies the configuration that the test is focused on.
        Parameters:
        testFocus - the instance of an anonymous implementation of WarBuilder.TestFocus interface.
        Returns:
        the instance of the war builder.