org.apache.sling.commons.testing.sling
Class MockResourceResolver

java.lang.Object
  extended by org.apache.sling.commons.testing.sling.MockResourceResolver
All Implemented Interfaces:
org.apache.sling.api.adapter.Adaptable, org.apache.sling.api.resource.ResourceResolver

public class MockResourceResolver
extends Object
implements org.apache.sling.api.resource.ResourceResolver


Field Summary
 
Fields inherited from interface org.apache.sling.api.resource.ResourceResolver
PROPERTY_RESOURCE_TYPE, REQUEST_ATTR_WORKSPACE_INFO, USER_IMPERSONATOR
 
Constructor Summary
MockResourceResolver()
           
 
Method Summary
<AdapterType>
AdapterType
adaptTo(Class<AdapterType> type)
           
 void addChildren(org.apache.sling.api.resource.Resource parent, Collection<org.apache.sling.api.resource.Resource> children)
           
 void addResource(org.apache.sling.api.resource.Resource resource)
           
 org.apache.sling.api.resource.ResourceResolver clone(Map<String,Object> authenticationInfo)
           
 void close()
           
 void commit()
           
 org.apache.sling.api.resource.Resource create(org.apache.sling.api.resource.Resource arg0, String arg1, Map<String,Object> arg2)
           
 void delete(org.apache.sling.api.resource.Resource arg0)
           
 Iterator<org.apache.sling.api.resource.Resource> findResources(String query, String language)
           
 Object getAttribute(String name)
           
 Iterator<String> getAttributeNames()
           
 Iterable<org.apache.sling.api.resource.Resource> getChildren(org.apache.sling.api.resource.Resource arg0)
           
 String getParentResourceType(org.apache.sling.api.resource.Resource arg0)
           
 String getParentResourceType(String arg0)
           
 org.apache.sling.api.resource.Resource getResource(org.apache.sling.api.resource.Resource base, String path)
           
 org.apache.sling.api.resource.Resource getResource(String path)
           
 String[] getSearchPath()
           
 String getUserID()
           
 boolean hasChanges()
           
 boolean isLive()
           
 boolean isResourceType(org.apache.sling.api.resource.Resource arg0, String arg1)
           
 Iterator<org.apache.sling.api.resource.Resource> listChildren(org.apache.sling.api.resource.Resource parent)
           
 String map(javax.servlet.http.HttpServletRequest request, String resourcePath)
           
 String map(String resourcePath)
           
 Iterator<Map<String,Object>> queryResources(String query, String language)
           
 void refresh()
           
 org.apache.sling.api.resource.Resource resolve(javax.servlet.http.HttpServletRequest request)
           
 org.apache.sling.api.resource.Resource resolve(javax.servlet.http.HttpServletRequest request, String absPath)
           
 org.apache.sling.api.resource.Resource resolve(String absPath)
           
 void revert()
           
 void setSearchPath(String... searchPath)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MockResourceResolver

public MockResourceResolver()
Method Detail

addResource

public void addResource(org.apache.sling.api.resource.Resource resource)

addChildren

public void addChildren(org.apache.sling.api.resource.Resource parent,
                        Collection<org.apache.sling.api.resource.Resource> children)

resolve

public org.apache.sling.api.resource.Resource resolve(javax.servlet.http.HttpServletRequest request)
Specified by:
resolve in interface org.apache.sling.api.resource.ResourceResolver

resolve

public org.apache.sling.api.resource.Resource resolve(String absPath)
Specified by:
resolve in interface org.apache.sling.api.resource.ResourceResolver

map

public String map(String resourcePath)
Specified by:
map in interface org.apache.sling.api.resource.ResourceResolver

getResource

public org.apache.sling.api.resource.Resource getResource(String path)
Specified by:
getResource in interface org.apache.sling.api.resource.ResourceResolver

getResource

public org.apache.sling.api.resource.Resource getResource(org.apache.sling.api.resource.Resource base,
                                                          String path)
Specified by:
getResource in interface org.apache.sling.api.resource.ResourceResolver

getSearchPath

public String[] getSearchPath()
Specified by:
getSearchPath in interface org.apache.sling.api.resource.ResourceResolver

listChildren

public Iterator<org.apache.sling.api.resource.Resource> listChildren(org.apache.sling.api.resource.Resource parent)
Specified by:
listChildren in interface org.apache.sling.api.resource.ResourceResolver

findResources

public Iterator<org.apache.sling.api.resource.Resource> findResources(String query,
                                                                      String language)
Specified by:
findResources in interface org.apache.sling.api.resource.ResourceResolver

queryResources

public Iterator<Map<String,Object>> queryResources(String query,
                                                   String language)
Specified by:
queryResources in interface org.apache.sling.api.resource.ResourceResolver

adaptTo

public <AdapterType> AdapterType adaptTo(Class<AdapterType> type)
Specified by:
adaptTo in interface org.apache.sling.api.adapter.Adaptable

setSearchPath

public void setSearchPath(String... searchPath)

map

public String map(javax.servlet.http.HttpServletRequest request,
                  String resourcePath)
Specified by:
map in interface org.apache.sling.api.resource.ResourceResolver

resolve

public org.apache.sling.api.resource.Resource resolve(javax.servlet.http.HttpServletRequest request,
                                                      String absPath)
Specified by:
resolve in interface org.apache.sling.api.resource.ResourceResolver

close

public void close()
Specified by:
close in interface org.apache.sling.api.resource.ResourceResolver

getUserID

public String getUserID()
Specified by:
getUserID in interface org.apache.sling.api.resource.ResourceResolver

isLive

public boolean isLive()
Specified by:
isLive in interface org.apache.sling.api.resource.ResourceResolver

clone

public org.apache.sling.api.resource.ResourceResolver clone(Map<String,Object> authenticationInfo)
                                                     throws org.apache.sling.api.resource.LoginException
Specified by:
clone in interface org.apache.sling.api.resource.ResourceResolver
Throws:
org.apache.sling.api.resource.LoginException

getAttribute

public Object getAttribute(String name)
Specified by:
getAttribute in interface org.apache.sling.api.resource.ResourceResolver

getAttributeNames

public Iterator<String> getAttributeNames()
Specified by:
getAttributeNames in interface org.apache.sling.api.resource.ResourceResolver

commit

public void commit()
            throws org.apache.sling.api.resource.PersistenceException
Specified by:
commit in interface org.apache.sling.api.resource.ResourceResolver
Throws:
org.apache.sling.api.resource.PersistenceException

create

public org.apache.sling.api.resource.Resource create(org.apache.sling.api.resource.Resource arg0,
                                                     String arg1,
                                                     Map<String,Object> arg2)
                                              throws org.apache.sling.api.resource.PersistenceException
Specified by:
create in interface org.apache.sling.api.resource.ResourceResolver
Throws:
org.apache.sling.api.resource.PersistenceException

delete

public void delete(org.apache.sling.api.resource.Resource arg0)
            throws org.apache.sling.api.resource.PersistenceException
Specified by:
delete in interface org.apache.sling.api.resource.ResourceResolver
Throws:
org.apache.sling.api.resource.PersistenceException

getChildren

public Iterable<org.apache.sling.api.resource.Resource> getChildren(org.apache.sling.api.resource.Resource arg0)
Specified by:
getChildren in interface org.apache.sling.api.resource.ResourceResolver

getParentResourceType

public String getParentResourceType(org.apache.sling.api.resource.Resource arg0)
Specified by:
getParentResourceType in interface org.apache.sling.api.resource.ResourceResolver

getParentResourceType

public String getParentResourceType(String arg0)
Specified by:
getParentResourceType in interface org.apache.sling.api.resource.ResourceResolver

hasChanges

public boolean hasChanges()
Specified by:
hasChanges in interface org.apache.sling.api.resource.ResourceResolver

isResourceType

public boolean isResourceType(org.apache.sling.api.resource.Resource arg0,
                              String arg1)
Specified by:
isResourceType in interface org.apache.sling.api.resource.ResourceResolver

refresh

public void refresh()
Specified by:
refresh in interface org.apache.sling.api.resource.ResourceResolver

revert

public void revert()
Specified by:
revert in interface org.apache.sling.api.resource.ResourceResolver


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