use of org.apache.sling.caconfig.impl.def.DefaultConfigurationPersistenceStrategy in project sling by apache.
the class ContextPlugins method registerConfigurationResolverDefaultImpl.
/**
* Register default implementations for for ConfigurationResolver.
* @param context Sling context
*/
private static void registerConfigurationResolverDefaultImpl(SlingContextImpl context) {
context.registerInjectActivateService(new DefaultConfigurationPersistenceStrategy());
// only required for impl 1.2+
registerByClassName(context, "org.apache.sling.caconfig.impl.def.DefaultConfigurationInheritanceStrategy");
}
use of org.apache.sling.caconfig.impl.def.DefaultConfigurationPersistenceStrategy in project sling by apache.
the class ConfigurationPersistenceStrategyMultiplexerImplTest method testWithDefaultStrategy.
@Test
public void testWithDefaultStrategy() {
context.registerInjectActivateService(new DefaultConfigurationPersistenceStrategy());
assertSame(resource1, underTest.getResource(resource1));
assertEquals(resource1.getPath(), underTest.getResourcePath(resource1.getPath()));
assertTrue(underTest.persistConfiguration(context.resourceResolver(), "/conf/test1", new ConfigurationPersistData(resource1.getValueMap())));
assertTrue(underTest.persistConfigurationCollection(context.resourceResolver(), "/conf/testCol", new ConfigurationCollectionPersistData(ImmutableList.of(new ConfigurationPersistData(resource1.getValueMap()).collectionItemName(resource1.getName()), new ConfigurationPersistData(resource2.getValueMap()).collectionItemName(resource2.getName())))));
assertTrue(underTest.deleteConfiguration(context.resourceResolver(), "/conf/test1"));
}
use of org.apache.sling.caconfig.impl.def.DefaultConfigurationPersistenceStrategy in project sling by apache.
the class ConfigurationDataImplTest method setUp.
@Before
public void setUp() {
configurationManagementSettings = context.registerInjectActivateService(new ConfigurationManagementSettingsImpl());
configurationPersistenceStrategy = context.registerInjectActivateService(new DefaultConfigurationPersistenceStrategy());
configResource = context.create().resource("/conf/test", "prop1", "value1", "prop4", true);
configMetadata = new ConfigurationMetadata("testName", ImmutableList.<PropertyMetadata<?>>of(new PropertyMetadata<>("prop1", "defValue"), new PropertyMetadata<>("prop2", String.class), new PropertyMetadata<>("prop3", 5), new PropertyMetadata<>("propIntArray", new Integer[] { 1, 2, 3 })), false);
}
use of org.apache.sling.caconfig.impl.def.DefaultConfigurationPersistenceStrategy in project sling by apache.
the class ConfigurationMetadataProviderMultiplexerImplTest method setUp.
@Before
public void setUp() {
context.registerInjectActivateService(new ConfigurationManagementSettingsImpl());
context.registerInjectActivateService(new ConfigurationPersistenceStrategyMultiplexerImpl());
context.registerInjectActivateService(new DefaultConfigurationPersistenceStrategy());
underTest = context.registerInjectActivateService(new ConfigurationMetadataProviderMultiplexerImpl());
}
use of org.apache.sling.caconfig.impl.def.DefaultConfigurationPersistenceStrategy in project sling by apache.
the class ConfigurationTestUtils method registerConfigurationResolver.
/**
* Register all services for {@link ConfigurationResolver}.
* @param context Sling context
*/
public static ConfigurationResolver registerConfigurationResolver(SlingContext context, Object... properties) {
ConfigurationResourceTestUtils.registerConfigurationResourceResolver(context);
context.registerInjectActivateService(new ConfigurationManagementSettingsImpl());
context.registerInjectActivateService(new DefaultConfigurationPersistenceStrategy());
context.registerInjectActivateService(new ConfigurationPersistenceStrategyMultiplexerImpl());
context.registerInjectActivateService(new DefaultConfigurationInheritanceStrategy());
context.registerInjectActivateService(new ConfigurationInheritanceStrategyMultiplexerImpl());
context.registerInjectActivateService(new ConfigurationOverrideMultiplexerImpl());
context.registerInjectActivateService(new ConfigurationMetadataProviderMultiplexerImpl());
return context.registerInjectActivateService(new ConfigurationResolverImpl(), properties);
}
Aggregations