use of com.adobe.acs.commons.cloudconfig.CloudConfigurationList 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());
}
use of com.adobe.acs.commons.cloudconfig.CloudConfigurationList in project acs-aem-commons by Adobe-Consulting-Services.
the class CloudConfigurationListImplTest method invalid.
@Test
public void invalid() {
MockRequestPathInfo requestPathInfo = (MockRequestPathInfo) context.request().getRequestPathInfo();
requestPathInfo.setSuffix("");
CloudConfigurationList list = new CloudConfigurationListImpl(context.request());
assertNotNull(list);
assertNotNull(list.getCloudConfigurations());
assertEquals(0, list.getCloudConfigurations().size());
}
Aggregations