use of org.apache.sling.models.impl.injectors.ValueMapInjector 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);
}
use of org.apache.sling.models.impl.injectors.ValueMapInjector in project sling by apache.
the class InterfaceInheritanceTest 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(1, 2));
factory.bindInjectAnnotationProcessorFactory(valueMapInjector, Collections.<String, Object>singletonMap(Constants.SERVICE_ID, 2L));
factory.adapterImplementations.addClassesAsAdapterAndImplementation(SuperClassModel.class, SubClassModel.class);
}
Aggregations