use of org.apache.sling.testing.mock.osgi.MockBundle in project sling by apache.
the class BundleContentLoaderTest method loadContentWithRootPath.
@Test
public void loadContentWithRootPath() throws Exception {
Bundle mockBundle = newBundleWithInitialContent("SLING-INF/");
contentLoader.registerBundle(context.resourceResolver().adaptTo(Session.class), mockBundle, false);
Resource imported = context.resourceResolver().getResource("/libs/app");
assertThat("Resource was not imported", imported, notNullValue());
assertThat("sling:resourceType was not properly set", imported.getResourceType(), equalTo("sling:Folder"));
}
use of org.apache.sling.testing.mock.osgi.MockBundle in project sling by apache.
the class BundleContentLoaderTest method newBundleWithInitialContent.
private MockBundle newBundleWithInitialContent(String initialContentHeader) {
MockBundle mockBundle = new MockBundle(context.bundleContext());
mockBundle.setHeaders(singletonMap("Sling-Initial-Content", initialContentHeader));
return mockBundle;
}
use of org.apache.sling.testing.mock.osgi.MockBundle in project sling by apache.
the class BundleContentLoaderTest method loadContentWithSpecificPath.
@Test
public void loadContentWithSpecificPath() throws Exception {
Bundle mockBundle = newBundleWithInitialContent("SLING-INF/libs/app;path:=/libs/app");
contentLoader.registerBundle(context.resourceResolver().adaptTo(Session.class), mockBundle, false);
Resource imported = context.resourceResolver().getResource("/libs/app");
assertThat("Resource was not imported", imported, notNullValue());
assertThat("sling:resourceType was not properly set", imported.getResourceType(), equalTo("sling:Folder"));
}
Aggregations