Klasse UniqueRoot

java.lang.Object
org.apache.sling.testing.mock.sling.context.UniqueRoot

@ConsumerType public class UniqueRoot extends Object
Manages unique root paths in JCR repository. This is important for resource resolver types like JCR_JACKRABBIT where the repository is not cleaned for each test run. This class provides unique root paths for each run, and cleans them up when done.
  • Feldübersicht

    Felder
    Modifizierer und Typ
    Feld
    Beschreibung
    protected final String
    Unique path part
  • Konstruktorübersicht

    Konstruktoren
    Modifizierer
    Konstruktor
    Beschreibung
    protected
    UniqueRoot(@NotNull SlingContextImpl context)
     
  • Methodenübersicht

    Modifizierer und Typ
    Methode
    Beschreibung
    final @NotNull String
    Gets (and creates if required) a unique path at /apps/xxx.
    protected void
    Cleanup is called when the unit test rule completes a unit test run.
    final @NotNull String
    Gets (and creates if required) a unique path at /content/xxx.
    protected final void
    deleteResources(@Nullable org.apache.sling.api.resource.Resource @NotNull ... resources)
    Deletes the given set of resources and commits afterwards.
    protected final org.apache.sling.api.resource.Resource
    getOrCreateResource(@NotNull String path, @NotNull String primaryType)
    Get or create resource with given JCR primary type
    final @NotNull String
    Gets (and creates if required) a unique path at /libs/xxx.

    Von Klasse geerbte Methoden java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Felddetails

    • uniquePathPart

      protected final String uniquePathPart
      Unique path part
  • Konstruktordetails

    • UniqueRoot

      protected UniqueRoot(@NotNull @NotNull SlingContextImpl context)
      Parameter:
      context - Sling context
  • Methodendetails

    • getOrCreateResource

      protected final org.apache.sling.api.resource.Resource getOrCreateResource(@NotNull @NotNull String path, @NotNull @NotNull String primaryType)
      Get or create resource with given JCR primary type
      Parameter:
      path - Path
      primaryType - JCR primary type
      Gibt zurück:
      Resource (never null)
    • content

      @NotNull public final @NotNull String content()
      Gets (and creates if required) a unique path at /content/xxx. The path (incl. all children) is automatically removed when the unit test completes.
      Gibt zurück:
      Unique content path
    • apps

      @NotNull public final @NotNull String apps()
      Gets (and creates if required) a unique path at /apps/xxx. The path (incl. all children) is automatically removed when the unit test completes.
      Gibt zurück:
      Unique content path
    • libs

      @NotNull public final @NotNull String libs()
      Gets (and creates if required) a unique path at /libs/xxx. The path (incl. all children) is automatically removed when the unit test completes.
      Gibt zurück:
      Unique content path
    • cleanUp

      protected void cleanUp()
      Cleanup is called when the unit test rule completes a unit test run. All resources created have to be removed.
    • deleteResources

      protected final void deleteResources(@Nullable @Nullable org.apache.sling.api.resource.Resource @NotNull ... resources)
      Deletes the given set of resources and commits afterwards.
      Parameter:
      resources - Resources to be deleted