org.apache.sling.testing.resourceresolver
Class MockResourceResolver

java.lang.Object
  extended by org.apache.sling.testing.resourceresolver.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(MockResourceResolverFactoryOptions options, Map<String,Map<String,Object>> resources)
           
 
Method Summary
<AdapterType>
AdapterType
adaptTo(Class<AdapterType> type)
           
 void addChanged(String path, Map<String,Object> props)
           
 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 parent, String name, Map<String,Object> properties)
           
 void delete(org.apache.sling.api.resource.Resource resource)
           
 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 parent)
           
 String getParentResourceType(org.apache.sling.api.resource.Resource resource)
           
 String getParentResourceType(String resourceType)
           
 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 hasChildren(org.apache.sling.api.resource.Resource resource)
           
 boolean isLive()
           
 boolean isResourceType(org.apache.sling.api.resource.Resource resource, String resourceType)
           
 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)
          Deprecated. 
 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()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MockResourceResolver

public MockResourceResolver(MockResourceResolverFactoryOptions options,
                            Map<String,Map<String,Object>> resources)
Method Detail

adaptTo

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

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

resolve

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

resolve

@Deprecated
public org.apache.sling.api.resource.Resource resolve(javax.servlet.http.HttpServletRequest request)
Deprecated. 

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

map

public String map(javax.servlet.http.HttpServletRequest request,
                  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

getChildren

public Iterable<org.apache.sling.api.resource.Resource> getChildren(org.apache.sling.api.resource.Resource parent)
Specified by:
getChildren 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

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

isLive

public boolean isLive()
Specified by:
isLive 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

getAttributeNames

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

getAttribute

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

delete

public void delete(org.apache.sling.api.resource.Resource resource)
            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

create

public org.apache.sling.api.resource.Resource create(org.apache.sling.api.resource.Resource parent,
                                                     String name,
                                                     Map<String,Object> properties)
                                              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

revert

public void revert()
Specified by:
revert 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

hasChanges

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

getParentResourceType

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

getParentResourceType

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

isResourceType

public boolean isResourceType(org.apache.sling.api.resource.Resource resource,
                              String resourceType)
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

addChanged

public void addChanged(String path,
                       Map<String,Object> props)

hasChildren

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


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