@Test
public void testGetJcr() throws Exception {

    final File seedDir = new File(testBaseDir, "testGetJcr/seedRepo/segmentstore");
    final File globalDir = new File(testBaseDir, "testGetJcr/globalRepo/segmentstore");
    final String superPath = "/apps/myapp/components/sup1";
    final String resultPath = "/apps/myapp/components/res1";
    TestUtil.prepareRepo(seedDir, session -> {
        final URL slingNodetypes = getClass().getResource("/sling_nodetypes.cnd");
        TestUtil.installCndFromURL(session, slingNodetypes);
        Node sup1 = JcrUtils.getOrCreateByPath(superPath, "sling:Folder", session);
        Node res1 = JcrUtils.getOrCreateByPath(resultPath, "sling:Folder", session);
        res1.addMixin("sling:ResourceSuperType");
        res1.setProperty("sling:resourceSuperType", superPath);
        session.save();
    });
    TestUtil.withReadOnlyFixture(seedDir, session -> {
        QueryManager qm = session.getWorkspace().getQueryManager();
        final String stmt = "select * from [sling:ResourceSuperType] as a OPTION(TRAVERSAL FAIL, INDEX NAME nodetype)";
        final Query query = qm.createQuery(stmt, Query.JCR_SQL2);
        QueryResult result = query.execute();
        final NodeIterator it = result.getNodes();
        assertTrue("Result hasNext()", it.hasNext());
        final Node next = it.nextNode();
        assertFalse("Result has no more", it.hasNext());
        assertEquals("Path is correct", resultPath, next.getPath());
        assertEquals("sling:resourceSuperType value is correct", superPath,
                next.getProperty("sling:resourceSuperType").getString());
    });
}