use of com.adobe.acs.commons.cloudconfig.CloudConfiguration in project acs-aem-commons by Adobe-Consulting-Services.
the class CloudConfigurationListImplTest method valid.
@SuppressWarnings("unchecked")
@Test
public void valid() throws IOException, NoSuchFieldException, SecurityException, IllegalArgumentException, IllegalAccessException {
MockRequestPathInfo requestPathInfo = (MockRequestPathInfo) context.request().getRequestPathInfo();
requestPathInfo.setSuffix("/apps/core/wcm/templates/marketocloudconfig");
CloudConfigurationList list = new CloudConfigurationListImpl(context.request());
assertNotNull(list);
Field field = list.getClass().getDeclaredField("configs");
field.setAccessible(true);
assertNotNull(field.get(list));
CloudConfiguration config = new CloudConfigurationImpl(context.resourceResolver().getResource("/conf/test"));
((List<CloudConfiguration>) field.get(list)).add(config);
assertNotNull(list.getCloudConfigurations());
assertEquals(1, list.getCloudConfigurations().size());
config = list.getCloudConfigurations().get(0);
assertNotNull(config);
assertEquals("/conf/test", config.getItemPath());
assertEquals("/", config.getConfigPath());
}
Aggregations