Class TestLicensor

  • All Implemented Interfaces:
    Licensor

    @Component
    @Singleton
    public class TestLicensor
    extends Object
    implements Licensor
    Licensor implementation used when running the functional tests.
    Since:
    1.21
    Version:
    $Id$
    • Constructor Summary

      Constructors 
      Constructor Description
      TestLicensor()  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      com.xwiki.licensing.License addLicense​(org.xwiki.extension.ExtensionId extensionId, com.xwiki.licensing.LicenseType licenseType)  
      com.xwiki.licensing.License addLicense​(org.xwiki.extension.ExtensionId extensionId, com.xwiki.licensing.LicenseType licenseType, int expirationDays, long maxUserCount)  
      com.xwiki.licensing.License addLicense​(org.xwiki.model.reference.EntityReference entityReference, com.xwiki.licensing.LicenseType licenseType)  
      com.xwiki.licensing.License addLicense​(org.xwiki.model.reference.EntityReference entityReference, com.xwiki.licensing.LicenseType licenseType, int expirationDays, long maxUserCount)  
      static void clearCustomLicenses()  
      com.xwiki.licensing.License getLicense()
      Retrieve the currently applicable license for the current context document if any.
      com.xwiki.licensing.License getLicense​(org.xwiki.extension.ExtensionId extensionId)
      Retrieve the currently applicable license for the given installed extension.
      com.xwiki.licensing.License getLicense​(org.xwiki.model.reference.EntityReference reference)
      Get the license applicable to the given reference.
      boolean hasLicensure()  
      boolean hasLicensure​(org.xwiki.extension.ExtensionId extensionId)
      Check if the given extension is covered by a valid license.
      boolean hasLicensure​(org.xwiki.model.reference.EntityReference reference)
      Check if the given entity is covered by a valid license.
    • Constructor Detail

      • TestLicensor

        public TestLicensor()
    • Method Detail

      • hasLicensure

        public boolean hasLicensure​(org.xwiki.model.reference.EntityReference reference)
        Description copied from interface: Licensor
        Check if the given entity is covered by a valid license.
        Specified by:
        hasLicensure in interface Licensor
        Parameters:
        reference - the reference of the entity for which licensure should be checked.
        Returns:
        true if the given reference has a valid license or is not subject to licensing.
      • hasLicensure

        public boolean hasLicensure​(org.xwiki.extension.ExtensionId extensionId)
        Description copied from interface: Licensor
        Check if the given extension is covered by a valid license.
        Specified by:
        hasLicensure in interface Licensor
        Parameters:
        extensionId - the identifier of the extension for which licensure should be checked.
        Returns:
        true if the given extension has a valid license or is not subject to licensing.
      • hasLicensure

        public boolean hasLicensure()
        Specified by:
        hasLicensure in interface Licensor
        Returns:
        true if the current document has a valid license or is not subject to licensing.
      • getLicense

        public com.xwiki.licensing.License getLicense()
        Description copied from interface: Licensor
        Retrieve the currently applicable license for the current context document if any.
        Specified by:
        getLicense in interface Licensor
        Returns:
        a license, or null if there is no current document, or the current document is not subject to licensing.
      • getLicense

        public com.xwiki.licensing.License getLicense​(org.xwiki.extension.ExtensionId extensionId)
        Description copied from interface: Licensor
        Retrieve the currently applicable license for the given installed extension.
        Specified by:
        getLicense in interface Licensor
        Parameters:
        extensionId - identifier of an installed extension
        Returns:
        a license, or null if the given installed extension is not subject to licensing.
      • getLicense

        public com.xwiki.licensing.License getLicense​(org.xwiki.model.reference.EntityReference reference)
        Description copied from interface: Licensor
        Get the license applicable to the given reference.
        Specified by:
        getLicense in interface Licensor
        Parameters:
        reference - the reference to get the license from.
        Returns:
        a license, or null if the given reference is not subject to licensing.
      • clearCustomLicenses

        public static void clearCustomLicenses()
      • addLicense

        public com.xwiki.licensing.License addLicense​(org.xwiki.extension.ExtensionId extensionId,
                                                      com.xwiki.licensing.LicenseType licenseType)
        Specified by:
        addLicense in interface Licensor
        Parameters:
        extensionId - identifier of an installed extension
        licenseType - the type of License to add (FREE, TRIAL, PAID)
        Returns:
        the newly created License
      • addLicense

        public com.xwiki.licensing.License addLicense​(org.xwiki.extension.ExtensionId extensionId,
                                                      com.xwiki.licensing.LicenseType licenseType,
                                                      int expirationDays,
                                                      long maxUserCount)
        Specified by:
        addLicense in interface Licensor
        Parameters:
        extensionId - identifier of an installed extension
        licenseType - the type of License to add (FREE, TRIAL, PAID)
        expirationDays - the number of days until the license expires
        maxUserCount - the maximum number of users allowed under this license
        Returns:
        the newly created License
      • addLicense

        public com.xwiki.licensing.License addLicense​(org.xwiki.model.reference.EntityReference entityReference,
                                                      com.xwiki.licensing.LicenseType licenseType)
        Specified by:
        addLicense in interface Licensor
        Parameters:
        entityReference - the reference of the entity for which the license applies
        licenseType - the type of License to add (FREE, TRIAL, PAID)
        Returns:
        the newly created License
      • addLicense

        public com.xwiki.licensing.License addLicense​(org.xwiki.model.reference.EntityReference entityReference,
                                                      com.xwiki.licensing.LicenseType licenseType,
                                                      int expirationDays,
                                                      long maxUserCount)
        Specified by:
        addLicense in interface Licensor
        Parameters:
        entityReference - the reference of the entity for which the license applies
        licenseType - the type of License to add (FREE, TRIAL, PAID)
        expirationDays - the number of days until the license expires
        maxUserCount - the maximum number of users allowed under this license
        Returns:
        the newly created License