Search in sources :

Example 6 with ChildResourceInjector

use of org.apache.sling.models.impl.injectors.ChildResourceInjector in project sling by apache.

the class ResourceModelClassesTest method setup.

@Before
public void setup() {
    when(componentCtx.getBundleContext()).thenReturn(bundleContext);
    when(componentCtx.getProperties()).thenReturn(new Hashtable<String, Object>());
    factory = new ModelAdapterFactory();
    factory.activate(componentCtx);
    ValueMapInjector valueMapInjector = new ValueMapInjector();
    factory.bindInjector(valueMapInjector, new ServicePropertiesMap(2, 2));
    factory.bindInjector(new ChildResourceInjector(), new ServicePropertiesMap(1, 1));
    factory.bindInjectAnnotationProcessorFactory(valueMapInjector, Collections.<String, Object>singletonMap(Constants.SERVICE_ID, 2L));
    factory.adapterImplementations.addClassesAsAdapterAndImplementation(SimplePropertyModel.class, ArrayWrappersModel.class, ResourceModelWithRequiredField.class, ChildValueMapModel.class, ArrayPrimitivesModel.class, ChildResourceModel.class, ResourceModelWithRequiredFieldOptionalStrategy.class, ParentModel.class, ChildModel.class, ListModel.class);
}
Also used : ValueMapInjector(org.apache.sling.models.impl.injectors.ValueMapInjector) ChildResourceInjector(org.apache.sling.models.impl.injectors.ChildResourceInjector) Before(org.junit.Before)

Aggregations

ChildResourceInjector (org.apache.sling.models.impl.injectors.ChildResourceInjector)6 ValueMapInjector (org.apache.sling.models.impl.injectors.ValueMapInjector)6 Before (org.junit.Before)6 SlingBindings (org.apache.sling.api.scripting.SlingBindings)1 BindingsInjector (org.apache.sling.models.impl.injectors.BindingsInjector)1 OSGiServiceInjector (org.apache.sling.models.impl.injectors.OSGiServiceInjector)1 RequestAttributeInjector (org.apache.sling.models.impl.injectors.RequestAttributeInjector)1 BeanPropertyViaProvider (org.apache.sling.models.impl.via.BeanPropertyViaProvider)1