use of com.adobe.cq.commerce.common.ValueMapDecorator in project acs-aem-commons by Adobe-Consulting-Services.
the class AssetsFolderPropertiesSupportTest method doGet.
@Test
public void doGet() throws Exception {
final ValueMap graniteUiFormValues = new ValueMapDecorator(new HashMap<>());
graniteUiFormValues.put("ootb", "ootb value");
slingContext.create().resource("/content/dam/do-get/folder", ImmutableMap.<String, Object>builder().put("resource", "resource value").build());
MockSlingHttpServletRequest request = new MockSlingHttpServletRequest(slingContext.resourceResolver(), osgiContext.bundleContext());
MockRequestPathInfo requestPathInfo = (MockRequestPathInfo) request.getRequestPathInfo();
requestPathInfo.setResourcePath("wizard.html");
requestPathInfo.setSuffix("/content/dam/do-get/folder");
request.setAttribute("granite.ui.form.values", graniteUiFormValues);
assetsFolderPropertiesSupport.doGet(request, response);
ValueMap actual = (ValueMap) request.getAttribute("granite.ui.form.values");
assertEquals("ootb value", actual.get("ootb", String.class));
assertEquals("resource value", actual.get("resource", String.class));
}
use of com.adobe.cq.commerce.common.ValueMapDecorator 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.adobe.cq.commerce.common.ValueMapDecorator in project acs-aem-commons by Adobe-Consulting-Services.
the class TwitterAdapterFactoryTest method setup.
@Before
public void setup() {
Map<String, Object> validOAuthConfig = new HashMap<>();
validOAuthConfig.put("oauth.client.id", VALID_OAUTH_CLIENT_ID);
validOAuthConfig.put("oauth.client.secret", VALID_OAUTH_SECRET);
this.validOauthValueMap = new ValueMapDecorator(validOAuthConfig);
}
Aggregations