use of com.day.cq.wcm.webservicesupport.ConfigurationManager in project acs-aem-commons by Adobe-Consulting-Services.
the class TwitterAdapterFactoryTest method setupPage.
private Page setupPage(ValueMap configData) {
com.day.cq.wcm.webservicesupport.Configuration config = setupConfiguration(configData);
String[] configPath = new String[] { "configpath " };
Page page = mock(Page.class);
Resource contentResource = mock(Resource.class);
when(page.getContentResource()).thenReturn(contentResource);
ResourceResolver resourceResolver = mock(ResourceResolver.class);
when(contentResource.getResourceResolver()).thenReturn(resourceResolver);
ConfigurationManager configurationManager = mock(ConfigurationManager.class);
when(resourceResolver.adaptTo(ConfigurationManager.class)).thenReturn(configurationManager);
when(contentResource.getValueMap()).thenReturn(new ValueMapDecorator(Collections.singletonMap(ConfigurationConstants.PN_CONFIGURATIONS, configPath)));
when(configurationManager.getConfiguration("twitterconnect", configPath)).thenReturn(config);
return page;
}
use of com.day.cq.wcm.webservicesupport.ConfigurationManager in project acs-aem-commons by Adobe-Consulting-Services.
the class TwitterAdapterFactory method findTwitterConfiguration.
private com.day.cq.wcm.webservicesupport.Configuration findTwitterConfiguration(Page page) {
ConfigurationManager configurationManager = page.getContentResource().getResourceResolver().adaptTo(ConfigurationManager.class);
final HierarchyNodeInheritanceValueMap pageProperties = new HierarchyNodeInheritanceValueMap(page.getContentResource());
final String[] services = pageProperties.getInherited(ConfigurationConstants.PN_CONFIGURATIONS, new String[0]);
return configurationManager.getConfiguration(CLOUD_SERVICE_NAME, services);
}
Aggregations