Package org.apache.sling.testing.resourceresolver

# Class MockResourceProvider

java.lang.Object
org.apache.sling.spi.resource.provider.ResourceProvider<Void>
org.apache.sling.testing.resourceresolver.MockResourceProvider

public final class MockResourceProvider extends org.apache.sling.spi.resource.provider.ResourceProvider<Void>
This is a wrapper around `MockResourceResolver` to act as resource provider. All resources returned by this provider return the resolver from the resolve context instead of the `MockResourceResolver`.

## Field Summary

### Fields inherited from class org.apache.sling.spi.resource.provider.ResourceProvider

`AUTH_ADMIN, AUTH_CLONE, AUTH_SERVICE_BUNDLE, AUTHENTICATE_LAZY, AUTHENTICATE_NO, AUTHENTICATE_REQUIRED, MODE_OVERLAY, MODE_PASSTHROUGH, PROPERTY_ADAPTABLE, PROPERTY_ATTRIBUTABLE, PROPERTY_AUTHENTICATE, PROPERTY_MODE, PROPERTY_MODIFIABLE, PROPERTY_NAME, PROPERTY_REFRESHABLE, PROPERTY_ROOT, PROPERTY_USE_RESOURCE_ACCESS_SECURITY, RESOURCE_TYPE_SYNTHETIC`

## Constructor Summary

Constructors
Constructor
Description
`MockResourceProvider()`

## Method Summary

Modifier and Type
Method
Description
`<AdapterType>
AdapterType`
`adaptTo(@NotNull org.apache.sling.spi.resource.provider.ResolveContext<Void> ctx, @NotNull Class<AdapterType> type)`
`void`
`commit(@NotNull org.apache.sling.spi.resource.provider.ResolveContext<Void> ctx)`
`@NotNull org.apache.sling.api.resource.Resource`
`create(@NotNull org.apache.sling.spi.resource.provider.ResolveContext<Void> ctx, String path, Map<String,Object> properties)`
`void`
`delete(@NotNull org.apache.sling.spi.resource.provider.ResolveContext<Void> ctx, @NotNull org.apache.sling.api.resource.Resource resource)`
`@Nullable org.apache.sling.spi.resource.provider.QueryLanguageProvider<Void>`
`getQueryLanguageProvider()`
`@Nullable org.apache.sling.api.resource.Resource`
`getResource(@NotNull org.apache.sling.spi.resource.provider.ResolveContext<Void> ctx, @NotNull String path, @NotNull org.apache.sling.spi.resource.provider.ResourceContext resourceContext, @Nullable org.apache.sling.api.resource.Resource parent)`
`boolean`
`hasChanges(@NotNull org.apache.sling.spi.resource.provider.ResolveContext<Void> ctx)`
`@Nullable Iterator<org.apache.sling.api.resource.Resource>`
`listChildren(@NotNull org.apache.sling.spi.resource.provider.ResolveContext<Void> ctx, @NotNull org.apache.sling.api.resource.Resource parent)`
`void`
`revert(@NotNull org.apache.sling.spi.resource.provider.ResolveContext<Void> ctx)`

### Methods inherited from class org.apache.sling.spi.resource.provider.ResourceProvider

`authenticate, copy, getAttribute, getAttributeNames, getParent, getProviderContext, isLive, logout, move, orderBefore, refresh, start, stop, update`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### MockResourceProvider

public MockResourceProvider()

## Method Details

### getResource

@Nullable public @Nullable org.apache.sling.api.resource.Resource getResource(@NotNull @NotNull org.apache.sling.spi.resource.provider.ResolveContext<Void> ctx, @NotNull @NotNull String path, @NotNull @NotNull org.apache.sling.spi.resource.provider.ResourceContext resourceContext, @Nullable @Nullable org.apache.sling.api.resource.Resource parent)

Specified by:
  `getResource` in class `org.apache.sling.spi.resource.provider.ResourceProvider<Void>`

### listChildren

@Nullable public @Nullable Iterator<org.apache.sling.api.resource.Resource> listChildren(@NotNull @NotNull org.apache.sling.spi.resource.provider.ResolveContext<Void> ctx, @NotNull @NotNull org.apache.sling.api.resource.Resource parent)

Specified by:
  `listChildren` in class `org.apache.sling.spi.resource.provider.ResourceProvider<Void>`

### create

@NotNull public @NotNull org.apache.sling.api.resource.Resource create(@NotNull @NotNull org.apache.sling.spi.resource.provider.ResolveContext<Void> ctx, String path, Map<String,Object> properties) throws org.apache.sling.api.resource.PersistenceException

Overrides:
  `create` in class `org.apache.sling.spi.resource.provider.ResourceProvider<Void>`
Throws:
  `org.apache.sling.api.resource.PersistenceException`

### delete

public void delete(@NotNull @NotNull org.apache.sling.spi.resource.provider.ResolveContext<Void> ctx, @NotNull @NotNull org.apache.sling.api.resource.Resource resource) throws org.apache.sling.api.resource.PersistenceException

Overrides:
  `delete` in class `org.apache.sling.spi.resource.provider.ResourceProvider<Void>`
Throws:
  `org.apache.sling.api.resource.PersistenceException`

### revert

public void revert(@NotNull @NotNull org.apache.sling.spi.resource.provider.ResolveContext<Void> ctx)

Overrides:
  `revert` in class `org.apache.sling.spi.resource.provider.ResourceProvider<Void>`

### commit

public void commit(@NotNull @NotNull org.apache.sling.spi.resource.provider.ResolveContext<Void> ctx) throws org.apache.sling.api.resource.PersistenceException

Overrides:
  `commit` in class `org.apache.sling.spi.resource.provider.ResourceProvider<Void>`
Throws:
  `org.apache.sling.api.resource.PersistenceException`

### hasChanges

public boolean hasChanges(@NotNull @NotNull org.apache.sling.spi.resource.provider.ResolveContext<Void> ctx)

Overrides:
  `hasChanges` in class `org.apache.sling.spi.resource.provider.ResourceProvider<Void>`

### getQueryLanguageProvider

@Nullable public @Nullable org.apache.sling.spi.resource.provider.QueryLanguageProvider<Void> getQueryLanguageProvider()

Overrides:
  `getQueryLanguageProvider` in class `org.apache.sling.spi.resource.provider.ResourceProvider<Void>`

### adaptTo

@Nullable public <AdapterType> AdapterType adaptTo(@NotNull @NotNull org.apache.sling.spi.resource.provider.ResolveContext<Void> ctx, @NotNull @NotNull Class<AdapterType> type)

Overrides:
  `adaptTo` in class `org.apache.sling.spi.resource.provider.ResourceProvider<Void>`