Package org.apache.sling.ide.test.impl.helpers

Examples of org.apache.sling.ide.test.impl.helpers.RepositoryAccessor


        project.createOrUpdateFile(Path.fromPortableString("jcr_root/content/test-root/en.xml"), contentXml);

        Matcher<Node> postConditions = allOf(hasPath("/content/test-root/en"), hasPrimaryType("sling:Folder"),
                hasMixinTypes("mix:language"), hasChildrenCount(3));

        final RepositoryAccessor repo = new RepositoryAccessor(config);
        Poller poller = new Poller();
        poller.pollUntil(new Callable<Node>() {
            @Override
            public Node call() throws RepositoryException {
                return repo.getNode("/content/test-root/en");

            }
        }, postConditions);

        // update .content.xml structure
        InputStream updatedContentXml = getClass()
                .getResourceAsStream("content-nested-structure-deleted-all-nodes.xml");
        project.createOrUpdateFile(Path.fromPortableString("jcr_root/content/test-root/en.xml"), updatedContentXml);

        // poll until we only have no child nodes left
        postConditions = allOf(hasPath("/content/test-root/en"), hasPrimaryType("sling:Folder"),
                hasMixinTypes("mix:language"), hasChildrenCount(0));
        poller.pollUntil(new Callable<Node>() {
            @Override
            public Node call() throws RepositoryException {
                return repo.getNode("/content/test-root/en");

            }
        }, postConditions);
    }
View Full Code Here


        project.createOrUpdateFile(Path.fromPortableString("jcr_root/content/test-root/en.xml"), contentXml);

        Matcher<Node> postConditions = allOf(hasPath("/content/test-root/en"), hasPrimaryType("sling:Folder"),
                hasMixinTypes("mix:language"), hasChildrenNames("message", "error", "warning"));

        final RepositoryAccessor repo = new RepositoryAccessor(config);
        Poller poller = new Poller();
        poller.pollUntil(new Callable<Node>() {
            @Override
            public Node call() throws RepositoryException {
                return repo.getNode("/content/test-root/en");

            }
        }, postConditions);

        // update .content.xml structure
        InputStream updatedContentXml = getClass().getResourceAsStream("content-nested-structure-reordered-nodes.xml");
        project.createOrUpdateFile(Path.fromPortableString("jcr_root/content/test-root/en.xml"), updatedContentXml);

        // poll until we have the child nodes reordered
        postConditions = allOf(hasPath("/content/test-root/en"), hasPrimaryType("sling:OrderedFolder"),
                hasMixinTypes("mix:language"), hasChildrenNames("message", "warning", "error"));

        poller.pollUntil(new Callable<Node>() {
            @Override
            public Node call() throws RepositoryException {
                return repo.getNode("/content/test-root/en");

            }
        }, postConditions);

    }
View Full Code Here

        ServerAdapter server = new ServerAdapter(wstServer.getServer());
        server.installModule(contentProject);

        // create prerequisite data
        final RepositoryAccessor repo = new RepositoryAccessor(config);
        repo.createNode("/content", "sling:Folder");
        repo.createNode("/content/test-root", "sling:Folder");

        project.createVltFilterWithRoots("/content/test-root/en");

        // create .content.xml structure
        InputStream contentXml = getClass().getResourceAsStream("content-nested-structure.xml");
        project.createOrUpdateFile(Path.fromPortableString("jcr_root/content/test-root/en.xml"), contentXml);

        Matcher<Node> postConditions = allOf(hasPath("/content/test-root/en"), hasPrimaryType("sling:Folder"),
                hasMixinTypes("mix:language"), hasChildrenCount(3));

        Poller poller = new Poller();
        poller.pollUntil(new Callable<Node>() {
            @Override
            public Node call() throws RepositoryException {
                return repo.getNode("/content/test-root/en");

            }
        }, postConditions);
    }
View Full Code Here

        assertThat(projectRule.getProject(), hasFile("/jcr_root/content/test-root/_sling_stuff/.content.xml"));
    }

    @After
    public void cleanup() throws Exception {
        new RepositoryAccessor(config).tryDeleteResource("/content/test-root");
    }
View Full Code Here

TOP

Related Classes of org.apache.sling.ide.test.impl.helpers.RepositoryAccessor

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.