org.apache.sling.testing.resourceresolver
Class MockHelper

java.lang.Object
  extended by org.apache.sling.testing.resourceresolver.MockHelper

public class MockHelper
extends Object

Helper class to create resources: MockHelper.create(resolver).resource("/libs").p("prop", "value") .resource("sub").p("sub", "hello") .resource(".sameLevel") .resource("/apps").p("foo", "baa").commit()


Method Summary
 void add()
          Finish building and add all resources to the resource tree.
 void commit()
          Finish building, add all resources to the resource tree and commit changes.
static MockHelper create(org.apache.sling.api.resource.ResourceResolver resolver)
          Create a new helper
 MockHelper p(String name, Object value)
          Add a property to the current resource
 MockHelper resource(String path)
          Add a new resource If the path is relative, this resource is added as a child to the previous resource.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

create

public static MockHelper create(org.apache.sling.api.resource.ResourceResolver resolver)
Create a new helper


resource

public MockHelper resource(String path)
Add a new resource If the path is relative, this resource is added as a child to the previous resource. If the path is relative and starts with a dot, this resource is added as a peer to the previous resource.


p

public MockHelper p(String name,
                    Object value)
Add a property to the current resource


add

public void add()
         throws org.apache.sling.api.resource.PersistenceException
Finish building and add all resources to the resource tree.

Throws:
org.apache.sling.api.resource.PersistenceException

commit

public void commit()
            throws org.apache.sling.api.resource.PersistenceException
Finish building, add all resources to the resource tree and commit changes.

Throws:
org.apache.sling.api.resource.PersistenceException


Copyright © 2007-2014 The Apache Software Foundation. All Rights Reserved.