Search in sources :

Example 11 with ConfigurationResourceResolvingStrategy

use of org.apache.sling.caconfig.resource.spi.ConfigurationResourceResolvingStrategy in project sling by apache.

the class DefaultConfigurationResourceResolvingStrategyTest method testGetResourceCollection_SkipJcrContent.

/**
     * Ensure jcr:content nodes are not included in resource collection.
     */
@Test
public void testGetResourceCollection_SkipJcrContent() {
    ConfigurationResourceResolvingStrategy underTest = context.registerInjectActivateService(new DefaultConfigurationResourceResolvingStrategy());
    // build config resources
    context.build().resource("/conf/site1/sling:test/feature/a").resource("/conf/site1/sling:test/feature/b").resource("/conf/site2/sling:test/feature/jcr:content");
    assertThat(underTest.getResourceCollection(site1Page1, BUCKETS, "feature"), ResourceCollectionMatchers.paths("/conf/site1/sling:test/feature/a", "/conf/site1/sling:test/feature/b"));
}
Also used : ConfigurationResourceResolvingStrategy(org.apache.sling.caconfig.resource.spi.ConfigurationResourceResolvingStrategy) Test(org.junit.Test)

Example 12 with ConfigurationResourceResolvingStrategy

use of org.apache.sling.caconfig.resource.spi.ConfigurationResourceResolvingStrategy in project sling by apache.

the class DefaultConfigurationResourceResolvingStrategyTest method testGetResourceCollection_Inherit1Level.

/**
     * Resource inheritance with enabling list merging on inner-most context level.
     * => merge resource lists from next level
     */
@Test
public void testGetResourceCollection_Inherit1Level() {
    ConfigurationResourceResolvingStrategy underTest = context.registerInjectActivateService(new DefaultConfigurationResourceResolvingStrategy());
    // build config resources
    context.build().resource("/conf/site1/sling:test/feature", PROPERTY_CONFIG_COLLECTION_INHERIT, true).resource("/conf/site1/sling:test/feature/c").resource("/conf/site2/sling:test/feature", PROPERTY_CONFIG_COLLECTION_INHERIT, true).resource("/conf/site2/sling:test/feature/c").resource("/conf/site2/sling:test/feature/d").resource("/apps/conf/sling:test/feature/a").resource("/libs/conf/sling:test/feature/b");
    assertThat(underTest.getResourceCollection(site1Page1, BUCKETS, "feature"), ResourceCollectionMatchers.paths("/conf/site1/sling:test/feature/c", "/apps/conf/sling:test/feature/a"));
    assertThat(underTest.getResourceCollection(site2Page1, BUCKETS, "feature"), ResourceCollectionMatchers.paths("/conf/site2/sling:test/feature/c", "/conf/site2/sling:test/feature/d", "/apps/conf/sling:test/feature/a"));
}
Also used : ConfigurationResourceResolvingStrategy(org.apache.sling.caconfig.resource.spi.ConfigurationResourceResolvingStrategy) Test(org.junit.Test)

Aggregations

ConfigurationResourceResolvingStrategy (org.apache.sling.caconfig.resource.spi.ConfigurationResourceResolvingStrategy)12 Test (org.junit.Test)12 Function (com.google.common.base.Function)1 Collection (java.util.Collection)1 Iterator (java.util.Iterator)1 Resource (org.apache.sling.api.resource.Resource)1 DefaultConfigurationResourceResolvingStrategy (org.apache.sling.caconfig.resource.impl.def.DefaultConfigurationResourceResolvingStrategy)1