Search in sources :

Example 1 with ChildResourceViaProvider

use of org.apache.sling.models.impl.via.ChildResourceViaProvider in project sling by apache.

the class ViaTest method setup.

@Before
public void setup() {
    when(componentCtx.getBundleContext()).thenReturn(bundleContext);
    when(componentCtx.getProperties()).thenReturn(new Hashtable<String, Object>());
    when(request.getResource()).thenReturn(resource);
    when(resource.getChild("jcr:content")).thenReturn(childResource);
    factory = new ModelAdapterFactory();
    factory.activate(componentCtx);
    factory.bindInjector(new ValueMapInjector(), new ServicePropertiesMap(1, 1));
    factory.bindViaProvider(new BeanPropertyViaProvider(), null);
    factory.bindViaProvider(new ChildResourceViaProvider(), null);
    factory.adapterImplementations.addClassesAsAdapterAndImplementation(ViaModel.class);
    factory.adapterImplementations.addClassesAsAdapterAndImplementation(ChildResourceViaModel.class);
}
Also used : ValueMapInjector(org.apache.sling.models.impl.injectors.ValueMapInjector) ChildResourceViaProvider(org.apache.sling.models.impl.via.ChildResourceViaProvider) BeanPropertyViaProvider(org.apache.sling.models.impl.via.BeanPropertyViaProvider) Before(org.junit.Before)

Aggregations

ValueMapInjector (org.apache.sling.models.impl.injectors.ValueMapInjector)1 BeanPropertyViaProvider (org.apache.sling.models.impl.via.BeanPropertyViaProvider)1 ChildResourceViaProvider (org.apache.sling.models.impl.via.ChildResourceViaProvider)1 Before (org.junit.Before)1