use of org.apache.sling.caconfig.it.example.SimpleConfig in project sling by apache.
the class ConfigurationManagerIT method testWriteConfig.
@Test
public void testWriteConfig() throws Exception {
// write configuration data via configuration manager
Map<String, Object> values = new HashMap<>();
values.put("stringParam", "valueA");
values.put("stringParamDefault", "valueB");
values.put("intParam", 55);
values.put("boolParam", true);
configManager.persistConfiguration(resourcePage1, CONFIG_NAME, new ConfigurationPersistData(values));
resourceResolver.commit();
// read config via configuration resolver
SimpleConfig config = configResolver.get(resourcePage1).as(SimpleConfig.class);
assertNotNull(config);
assertEquals("valueA", config.stringParam());
assertEquals("valueB", config.stringParamDefault());
assertEquals(55, (int) config.intParam());
assertEquals(true, config.boolParam());
}
Aggregations