Search in sources :

Example 1 with DefaultConfigurationPersistenceStrategy

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");
}
Also used : DefaultConfigurationPersistenceStrategy(org.apache.sling.caconfig.impl.def.DefaultConfigurationPersistenceStrategy)

Example 2 with DefaultConfigurationPersistenceStrategy

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"));
}
Also used : ConfigurationPersistData(org.apache.sling.caconfig.spi.ConfigurationPersistData) ConfigurationCollectionPersistData(org.apache.sling.caconfig.spi.ConfigurationCollectionPersistData) DefaultConfigurationPersistenceStrategy(org.apache.sling.caconfig.impl.def.DefaultConfigurationPersistenceStrategy) Test(org.junit.Test)

Example 3 with DefaultConfigurationPersistenceStrategy

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);
}
Also used : PropertyMetadata(org.apache.sling.caconfig.spi.metadata.PropertyMetadata) ConfigurationMetadata(org.apache.sling.caconfig.spi.metadata.ConfigurationMetadata) DefaultConfigurationPersistenceStrategy(org.apache.sling.caconfig.impl.def.DefaultConfigurationPersistenceStrategy) Before(org.junit.Before)

Example 4 with DefaultConfigurationPersistenceStrategy

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());
}
Also used : ConfigurationManagementSettingsImpl(org.apache.sling.caconfig.management.impl.ConfigurationManagementSettingsImpl) ConfigurationPersistenceStrategyMultiplexerImpl(org.apache.sling.caconfig.management.impl.ConfigurationPersistenceStrategyMultiplexerImpl) DefaultConfigurationPersistenceStrategy(org.apache.sling.caconfig.impl.def.DefaultConfigurationPersistenceStrategy) Before(org.junit.Before)

Example 5 with DefaultConfigurationPersistenceStrategy

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);
}
Also used : ConfigurationOverrideMultiplexerImpl(org.apache.sling.caconfig.impl.override.ConfigurationOverrideMultiplexerImpl) ConfigurationMetadataProviderMultiplexerImpl(org.apache.sling.caconfig.impl.metadata.ConfigurationMetadataProviderMultiplexerImpl) ConfigurationManagementSettingsImpl(org.apache.sling.caconfig.management.impl.ConfigurationManagementSettingsImpl) DefaultConfigurationInheritanceStrategy(org.apache.sling.caconfig.impl.def.DefaultConfigurationInheritanceStrategy) DefaultConfigurationPersistenceStrategy(org.apache.sling.caconfig.impl.def.DefaultConfigurationPersistenceStrategy) ConfigurationPersistenceStrategyMultiplexerImpl(org.apache.sling.caconfig.management.impl.ConfigurationPersistenceStrategyMultiplexerImpl)

Aggregations

DefaultConfigurationPersistenceStrategy (org.apache.sling.caconfig.impl.def.DefaultConfigurationPersistenceStrategy)5 ConfigurationManagementSettingsImpl (org.apache.sling.caconfig.management.impl.ConfigurationManagementSettingsImpl)2 ConfigurationPersistenceStrategyMultiplexerImpl (org.apache.sling.caconfig.management.impl.ConfigurationPersistenceStrategyMultiplexerImpl)2 Before (org.junit.Before)2 DefaultConfigurationInheritanceStrategy (org.apache.sling.caconfig.impl.def.DefaultConfigurationInheritanceStrategy)1 ConfigurationMetadataProviderMultiplexerImpl (org.apache.sling.caconfig.impl.metadata.ConfigurationMetadataProviderMultiplexerImpl)1 ConfigurationOverrideMultiplexerImpl (org.apache.sling.caconfig.impl.override.ConfigurationOverrideMultiplexerImpl)1 ConfigurationCollectionPersistData (org.apache.sling.caconfig.spi.ConfigurationCollectionPersistData)1 ConfigurationPersistData (org.apache.sling.caconfig.spi.ConfigurationPersistData)1 ConfigurationMetadata (org.apache.sling.caconfig.spi.metadata.ConfigurationMetadata)1 PropertyMetadata (org.apache.sling.caconfig.spi.metadata.PropertyMetadata)1 Test (org.junit.Test)1