use of org.apache.sling.testing.mock.sling.loader.ContentLoader in project sling by apache.
the class AbstractSlingContextImplTest method setUp.
@Before
public void setUp() throws Exception {
// make sure ResourceResolverFactory is available immediately and not lazily
assertEquals(1, context.getServices(ResourceResolverFactory.class, null).length);
context.addModelsForPackage("org.apache.sling.testing.mock.sling.context.models");
ContentLoader contentLoader = this.context.load();
contentLoader.json("/json-import-samples/content.json", "/content/sample/en");
}
use of org.apache.sling.testing.mock.sling.loader.ContentLoader in project sling by apache.
the class AbstractJcrNamespaceTest method testSling4362.
@Test
public void testSling4362() throws RepositoryException {
BundleContext bundleContext = MockOsgi.newBundleContext();
ResourceResolver resolver = MockSling.newResourceResolver(getResourceResolverType(), bundleContext);
ContentLoader contentLoader = new ContentLoader(resolver);
contentLoader.json("/json-import-samples/SLING-4362.json", context.uniqueRoot().content() + "/foo");
Resource resource = resolver.getResource(context.uniqueRoot().content() + "/foo");
ValueMap props = ResourceUtil.getValueMap(resource);
assertEquals("fooType", props.get("sling:resourceType"));
assertEquals("fooType", resource.getResourceType());
MockOsgi.shutdown(bundleContext);
}
use of org.apache.sling.testing.mock.sling.loader.ContentLoader in project sling by apache.
the class AbstractJcrNamespaceTest method testSling4362_ViaContextRule.
@Test
public void testSling4362_ViaContextRule() throws RepositoryException {
ResourceResolver resolver = context.resourceResolver();
ContentLoader contentLoader = new ContentLoader(resolver);
contentLoader.json("/json-import-samples/SLING-4362.json", context.uniqueRoot().content() + "/foo");
Resource resource = resolver.getResource(context.uniqueRoot().content() + "/foo");
ValueMap props = ResourceUtil.getValueMap(resource);
assertEquals("fooType", props.get("sling:resourceType"));
assertEquals("fooType", resource.getResourceType());
}
Aggregations