Search in sources :

Example 1 with DefaultContextPathStrategy

use of org.apache.sling.caconfig.resource.impl.def.DefaultContextPathStrategy in project sling by apache.

the class ContextPlugins method registerConfigurationResourceResolverDefaultImpl.

/**
     * Register default implementations for for ConfigurationResourceResolver.
     * @param context Sling context
     */
private static void registerConfigurationResourceResolverDefaultImpl(SlingContextImpl context) {
    context.registerInjectActivateService(new DefaultContextPathStrategy());
    context.registerInjectActivateService(new DefaultConfigurationResourceResolvingStrategy());
}
Also used : DefaultConfigurationResourceResolvingStrategy(org.apache.sling.caconfig.resource.impl.def.DefaultConfigurationResourceResolvingStrategy) DefaultContextPathStrategy(org.apache.sling.caconfig.resource.impl.def.DefaultContextPathStrategy)

Example 2 with DefaultContextPathStrategy

use of org.apache.sling.caconfig.resource.impl.def.DefaultContextPathStrategy in project sling by apache.

the class ContextPathStrategyMultiplexerImplTest method testWithDefaultStrategy.

@Test
public void testWithDefaultStrategy() {
    context.registerInjectActivateService(new DefaultContextPathStrategy());
    assertThat(toResourceIterator(underTest.findContextResources(site1Page1)), ResourceIteratorMatchers.paths("/content/tenant1/region1/site1", "/content/tenant1/region1", "/content/tenant1"));
    assertThat(toResourceIterator(underTest.findContextResources(site2Page1)), ResourceIteratorMatchers.paths("/content/tenant1/region1/site2", "/content/tenant1/region1", "/content/tenant1"));
}
Also used : DefaultContextPathStrategy(org.apache.sling.caconfig.resource.impl.def.DefaultContextPathStrategy) Test(org.junit.Test)

Example 3 with DefaultContextPathStrategy

use of org.apache.sling.caconfig.resource.impl.def.DefaultContextPathStrategy in project sling by apache.

the class ConfigurationResourceResolvingStrategyMultiplexerImplTest method setUp.

@Before
public void setUp() {
    context.registerInjectActivateService(new DefaultContextPathStrategy());
    context.registerInjectActivateService(new ContextPathStrategyMultiplexerImpl());
    underTest = context.registerInjectActivateService(new ConfigurationResourceResolvingStrategyMultiplexerImpl());
    // content resources
    context.build().resource("/content/site1", PROPERTY_CONFIG_REF, "/conf/site1").resource("/content/site2", PROPERTY_CONFIG_REF, "/conf/site2");
    site1Page1 = context.create().resource("/content/site1/page1");
    // configuration
    context.build().resource("/conf/site1/sling:test/test").resource("/conf/site1/sling:test/feature", PROPERTY_CONFIG_COLLECTION_INHERIT, true).resource("c").resource("/conf/site2/sling:test/feature", PROPERTY_CONFIG_COLLECTION_INHERIT, true).siblingsMode().resource("c").resource("d").resource("/apps/conf/sling:test/feature", PROPERTY_CONFIG_COLLECTION_INHERIT, true).resource("a").resource("/libs/conf/sling:test/test").resource("/libs/conf/sling:test/feature").resource("b");
}
Also used : ContextPathStrategyMultiplexerImpl(org.apache.sling.caconfig.management.impl.ContextPathStrategyMultiplexerImpl) DefaultContextPathStrategy(org.apache.sling.caconfig.resource.impl.def.DefaultContextPathStrategy) Before(org.junit.Before)

Example 4 with DefaultContextPathStrategy

use of org.apache.sling.caconfig.resource.impl.def.DefaultContextPathStrategy in project sling by apache.

the class ConfigurationResourceTestUtils method registerConfigurationResourceResolver.

/**
     * Register all services for {@link ConfigurationResourceResolver}.
     * @param context Sling context
     */
public static ConfigurationResourceResolver registerConfigurationResourceResolver(SlingContext context) {
    context.registerInjectActivateService(new DefaultContextPathStrategy());
    context.registerInjectActivateService(new ContextPathStrategyMultiplexerImpl());
    context.registerInjectActivateService(new DefaultConfigurationResourceResolvingStrategy());
    context.registerInjectActivateService(new ConfigurationResourceResolvingStrategyMultiplexerImpl());
    return context.registerInjectActivateService(new ConfigurationResourceResolverImpl());
}
Also used : ContextPathStrategyMultiplexerImpl(org.apache.sling.caconfig.management.impl.ContextPathStrategyMultiplexerImpl) DefaultConfigurationResourceResolvingStrategy(org.apache.sling.caconfig.resource.impl.def.DefaultConfigurationResourceResolvingStrategy) DefaultContextPathStrategy(org.apache.sling.caconfig.resource.impl.def.DefaultContextPathStrategy)

Aggregations

DefaultContextPathStrategy (org.apache.sling.caconfig.resource.impl.def.DefaultContextPathStrategy)4 ContextPathStrategyMultiplexerImpl (org.apache.sling.caconfig.management.impl.ContextPathStrategyMultiplexerImpl)2 DefaultConfigurationResourceResolvingStrategy (org.apache.sling.caconfig.resource.impl.def.DefaultConfigurationResourceResolvingStrategy)2 Before (org.junit.Before)1 Test (org.junit.Test)1