Klasse ContentBuilder

java.lang.Object
org.apache.sling.testing.mock.sling.builder.ContentBuilder

public class ContentBuilder extends Object
Helper class for building test content in the resource hierarchy with as less boilerplate code as possible.
  • Feldübersicht

    Felder
    Modifizierer und Typ
    Feld
    Beschreibung
    protected final org.apache.sling.api.resource.ResourceResolver
    Resource resolver
  • Konstruktorübersicht

    Konstruktoren
    Konstruktor
    Beschreibung
    ContentBuilder(@NotNull org.apache.sling.api.resource.ResourceResolver resourceResolver)
     
  • Methodenübersicht

    Modifizierer und Typ
    Methode
    Beschreibung
    protected final @NotNull org.apache.sling.api.resource.Resource
    Ensure that a resource exists at the given path.
    final @NotNull org.apache.sling.api.resource.Resource
    resource(@NotNull String path)
    Create resource.
    final @NotNull org.apache.sling.api.resource.Resource
    resource(@NotNull String path, @NotNull Object @NotNull ... properties)
    Create resource.
    final @NotNull org.apache.sling.api.resource.Resource
    resource(@NotNull String path, @NotNull Map<String,Object> properties)
    Create resource.
    final @NotNull org.apache.sling.api.resource.Resource
    resource(@NotNull org.apache.sling.api.resource.Resource resource, @NotNull String name)
    Create child resource below the given parent resource.
    final @NotNull org.apache.sling.api.resource.Resource
    resource(@NotNull org.apache.sling.api.resource.Resource resource, @NotNull String name, @NotNull Object @NotNull ... properties)
    Create child resource below the given parent resource.
    final @NotNull org.apache.sling.api.resource.Resource
    resource(@NotNull org.apache.sling.api.resource.Resource resource, @NotNull String name, @NotNull Map<String,Object> properties)
    Create child resource below the given parent resource.

    Von Klasse geerbte Methoden java.lang.Object

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

    • resourceResolver

      protected final org.apache.sling.api.resource.ResourceResolver resourceResolver
      Resource resolver
  • Konstruktordetails

    • ContentBuilder

      public ContentBuilder(@NotNull @NotNull org.apache.sling.api.resource.ResourceResolver resourceResolver)
      Parameter:
      resourceResolver - Resource resolver
  • Methodendetails

    • resource

      @NotNull public final @NotNull org.apache.sling.api.resource.Resource resource(@NotNull @NotNull String path)
      Create resource. If parent resource(s) do not exist they are created automatically using nt:unstructured nodes.
      Parameter:
      path - Page path
      Gibt zurück:
      Resource object
    • resource

      @NotNull public final @NotNull org.apache.sling.api.resource.Resource resource(@NotNull @NotNull String path, @NotNull @NotNull Map<String,Object> properties)
      Create resource. If parent resource(s) do not exist they are created automatically using nt:unstructured nodes.
      Parameter:
      path - Page path
      properties - Properties for resource.
      Gibt zurück:
      Resource object
    • resource

      @NotNull public final @NotNull org.apache.sling.api.resource.Resource resource(@NotNull @NotNull String path, @NotNull @NotNull Object @NotNull ... properties)
      Create resource. If parent resource(s) do not exist they are created automatically using nt:unstructured nodes.
      Parameter:
      path - Page path
      properties - Properties for resource.
      Gibt zurück:
      Resource object
    • resource

      @NotNull public final @NotNull org.apache.sling.api.resource.Resource resource(@NotNull @NotNull org.apache.sling.api.resource.Resource resource, @NotNull @NotNull String name)
      Create child resource below the given parent resource.
      Parameter:
      resource - Parent resource
      name - Child resource name
      Gibt zurück:
      Resource object
    • resource

      @NotNull public final @NotNull org.apache.sling.api.resource.Resource resource(@NotNull @NotNull org.apache.sling.api.resource.Resource resource, @NotNull @NotNull String name, @NotNull @NotNull Map<String,Object> properties)
      Create child resource below the given parent resource.
      Parameter:
      resource - Parent resource
      name - Child resource name
      properties - Properties for resource.
      Gibt zurück:
      Resource object
    • resource

      @NotNull public final @NotNull org.apache.sling.api.resource.Resource resource(@NotNull @NotNull org.apache.sling.api.resource.Resource resource, @NotNull @NotNull String name, @NotNull @NotNull Object @NotNull ... properties)
      Create child resource below the given parent resource.
      Parameter:
      resource - Parent resource
      name - Child resource name
      properties - Properties for resource.
      Gibt zurück:
      Resource object
    • ensureResourceExists

      @NotNull protected final @NotNull org.apache.sling.api.resource.Resource ensureResourceExists(@NotNull @NotNull String path)
      Ensure that a resource exists at the given path. If not, it is created using nt:unstructured node type.
      Parameter:
      path - Resource path
      Gibt zurück:
      Resource at path (existing or newly created)