use of org.apache.sling.caconfig.resource.spi.ConfigurationResourceResolvingStrategy in project sling by apache.
the class DefaultConfigurationResourceResolvingStrategyTest method testGetResourceCollection_PropsParent.
/**
* Resource inheritance with enabling list merging on a parent context level.
* => no inheritance takes place
*/
@Test
public void testGetResourceCollection_PropsParent() {
ConfigurationResourceResolvingStrategy underTest = context.registerInjectActivateService(new DefaultConfigurationResourceResolvingStrategy());
// build config resources
context.build().resource("/conf/site1/sling:test/feature/c").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", PROPERTY_CONFIG_COLLECTION_INHERIT, true).resource("b");
assertThat(underTest.getResourceCollection(site1Page1, BUCKETS, "feature"), ResourceCollectionMatchers.paths("/conf/site1/sling:test/feature/c"));
assertThat(underTest.getResourceCollection(site2Page1, BUCKETS, "feature"), ResourceCollectionMatchers.paths("/conf/site2/sling:test/feature/c", "/conf/site2/sling:test/feature/d"));
}
use of org.apache.sling.caconfig.resource.spi.ConfigurationResourceResolvingStrategy in project sling by apache.
the class DefaultConfigurationResourceResolvingStrategyTest method testDisabled.
@Test
public void testDisabled() {
ConfigurationResourceResolvingStrategy underTest = context.registerInjectActivateService(new DefaultConfigurationResourceResolvingStrategy(), "enabled", false);
assertNull(underTest.getResource(site1Page1, BUCKETS, "test"));
assertNull(underTest.getResourceCollection(site1Page1, BUCKETS, "feature"));
assertNull(underTest.getResourcePath(site1Page1, BUCKET, "test"));
assertNull(underTest.getResourceCollectionParentPath(site1Page1, BUCKET, "feature"));
}
use of org.apache.sling.caconfig.resource.spi.ConfigurationResourceResolvingStrategy in project sling by apache.
the class DefaultConfigurationResourceResolvingStrategyTest method testGetResourceCollection_NoInheritProps.
/**
* Default resource inheritance without customizing inheritance.
* => no resource list merging.
*/
@Test
public void testGetResourceCollection_NoInheritProps() {
ConfigurationResourceResolvingStrategy underTest = context.registerInjectActivateService(new DefaultConfigurationResourceResolvingStrategy());
// build config resources
context.build().resource("/conf/site1/sling:test/feature/c").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"));
assertThat(underTest.getResourceCollection(site2Page1, BUCKETS, "feature"), ResourceCollectionMatchers.paths("/conf/site2/sling:test/feature/c", "/conf/site2/sling:test/feature/d"));
}
use of org.apache.sling.caconfig.resource.spi.ConfigurationResourceResolvingStrategy in project sling by apache.
the class DefaultConfigurationResourceResolvingStrategyTest method testGetResource.
@Test
public void testGetResource() {
ConfigurationResourceResolvingStrategy underTest = context.registerInjectActivateService(new DefaultConfigurationResourceResolvingStrategy());
// build config resources
context.build().resource("/conf/site1/sling:test/test").resource("/libs/conf/sling:test/test");
assertEquals("/conf/site1/sling:test/test", underTest.getResource(site1Page1, BUCKETS, "test").getPath());
assertEquals("/libs/conf/sling:test/test", underTest.getResource(site2Page1, BUCKETS, "test").getPath());
}
use of org.apache.sling.caconfig.resource.spi.ConfigurationResourceResolvingStrategy in project sling by apache.
the class DefaultConfigurationResourceResolvingStrategyTest method testGetResourceCollection_InheritMultipleLevels.
/**
* Resource inheritance with enabling list merging on all levels.
* => merge resource lists from all levels
*/
@Test
public void testGetResourceCollection_InheritMultipleLevels() {
ConfigurationResourceResolvingStrategy underTest = context.registerInjectActivateService(new DefaultConfigurationResourceResolvingStrategy());
// build config resources
context.build().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/feature").resource("b");
assertThat(underTest.getResourceCollection(site1Page1, BUCKETS, "feature"), ResourceCollectionMatchers.paths("/conf/site1/sling:test/feature/c", "/apps/conf/sling:test/feature/a", "/libs/conf/sling:test/feature/b"));
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", "/libs/conf/sling:test/feature/b"));
}
Aggregations