Examples of Poller


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

        project.createOrUpdateFile(Path.fromPortableString("jcr_root/test/hello.txt"), new ByteArrayInputStream(
                "hello, world".getBytes()));

        // verifications
        final RepositoryAccessor repo = new RepositoryAccessor(config);
        Poller poller = new Poller();
        assertThatNode(repo, poller, "/test", allOf(hasPath("/test"), hasPrimaryType("nt:folder"), hasChildrenCount(1)));

        // change node type to sling:Folder
        InputStream contentXml = getClass().getResourceAsStream("sling-folder-nodetype.xml");
        project.createOrUpdateFile(Path.fromPortableString("jcr_root/test/.content.xml"), contentXml);
View Full Code Here

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

        project.createOrUpdateFile(Path.fromPortableString("jcr_root/test/hello.esp"), new ByteArrayInputStream(
                "// not really javascript".getBytes()));

        // verify that file is created
        final RepositoryAccessor repo = new RepositoryAccessor(config);
        Poller poller = new Poller();
        assertThatNode(repo, poller, "/test/hello.esp", hasPrimaryType("nt:file"));

        InputStream contentXml = getClass().getResourceAsStream("file-custom-mimetype.xml");
        project.createOrUpdateFile(Path.fromPortableString("jcr_root/test/hello.esp.dir/.content.xml"), contentXml);
View Full Code Here

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

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

        // verify that file is created
        final RepositoryAccessor repo = new RepositoryAccessor(config);
        Poller poller = new Poller();
        poller.pollUntil(new Callable<Node>() {
            @Override
            public Node call() throws RepositoryException {
                return repo.getNode("/test/hello.txt");
            }
        }, hasFileContent("hello, world"));
View Full Code Here

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

        project.createOrUpdateFile(Path.fromPortableString("jcr_root/test/demo/nested/structure/hello.txt"),
                new ByteArrayInputStream("hello, world".getBytes()));

        // verify that file is created
        final RepositoryAccessor repo = new RepositoryAccessor(config);
        Poller poller = new Poller();
        poller.pollUntil(new Callable<Node>() {
            @Override
            public Node call() throws RepositoryException {
                return repo.getNode("/test/demo/nested/structure/hello.txt");
            }
        }, hasFileContent("hello, world"));
View Full Code Here

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

        project.createOrUpdateFile(Path.fromPortableString("jcr_root/test/folder/config.xml"), getClass()
                .getResourceAsStream("com.example.some.Component.xml"));

        // verify that config node is created
        final RepositoryAccessor repo = new RepositoryAccessor(config);
        Poller poller = new Poller();

        assertThatNode(repo, poller, "/test/folder/config", hasPrimaryType("sling:OsgiConfig"));

        // update file at /test/folder/hello.esp
        project.createOrUpdateFile(Path.fromPortableString("jcr_root/test/folder/hello.esp"), new ByteArrayInputStream(
View Full Code Here

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

        Matcher<Node> postConditions = allOf(hasPath("/content/test-root"), hasPrimaryType("sling:Folder"),
                hasChildrenCount(1));

        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");

            }
        }, postConditions);

        // update jcr:title for /content/test-root
        InputStream updatedContentXml = getClass().getResourceAsStream("sling-folder-nodetype-with-title.xml");
        project.createOrUpdateFile(Path.fromPortableString("jcr_root/content/test-root/.content.xml"),
                updatedContentXml);

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

            }
View Full Code Here

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

        Matcher<Node> postConditions = allOf(hasPath("/content/test-root/nested"), hasPrimaryType("nt:unstructured"),
                hasChildrenCount(1));

        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/nested");

            }
        }, postConditions);

        // update jcr:title for /content/test-root
        project.createOrUpdateFile(Path.fromPortableString("jcr_root/content/test-root/nested/.content.xml"),
                getClass().getResourceAsStream("nt-unstructured-nodetype-with-title.xml"));

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

            }
View Full Code Here

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

        Matcher<Node> postConditions = allOf(hasPath("/content/test-root"), hasPrimaryType("sling:OrderedFolder"),
                hasChildrenNames("folder", "jcr:content"));

        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");

            }
        }, postConditions);

        // reorder the children of the /content/test-root node
        project.createOrUpdateFile(Path.fromPortableString("jcr_root/content/test-root/.content.xml"), getClass()
                .getResourceAsStream("sling-ordered-folder-with-children-reordered.xml"));

        postConditions = allOf(hasPath("/content/test-root"), hasPrimaryType("sling:OrderedFolder"),
                hasChildrenNames("jcr:content", "folder"));

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

            }
View Full Code Here

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

        // first create the local structure where the content is completely serialized inside the .content.xml file
        project.createOrUpdateFile(Path.fromPortableString("jcr_root/content/test-root/mapping/.content.xml"),
                getClass().getResourceAsStream("sling-mapping-with-folder-child.xml"));

        final RepositoryAccessor repo = new RepositoryAccessor(config);
        Poller poller = new Poller();

        // wait until the structure is published
        poller.pollUntil(new Callable<Node>() {
            @Override
            public Node call() throws RepositoryException {
                return repo.getNode("/content/test-root/mapping/jcr:content/par");

            }
        }, hasPrimaryType("nt:unstructured"));

        // now create the folder and its associated .content.xml file ; this will cause
        // intermediate folders to be created whose serialization data is present in the
        // parent's .content.xml file
        project.createOrUpdateFile(
                Path.fromPortableString("jcr_root/content/test-root/mapping/_jcr_content/par/folder/.content.xml"),
                getClass().getResourceAsStream("sling-folder-nodetype.xml"));

        // first wait until the sling:Folder child node is created, to ensure that all changes are processed
        poller.pollUntil(new Callable<Node>() {
            @Override
            public Node call() throws RepositoryException {
                return repo.getNode("/content/test-root/mapping/jcr:content/par/folder");

            }
        }, hasPrimaryType("sling:Folder"));

        // then, verify that the nt:unstructured node is correctly written
        poller.pollUntil(new Callable<Node>() {
            @Override
            public Node call() throws RepositoryException {
                return repo.getNode("/content/test-root/mapping/jcr:content/par");

            }
View Full Code Here

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

        project.createOrUpdateFile(
                Path.fromPortableString("jcr_root/content/test-root/mapping/_jcr_content/par/folder/.content.xml"),
                getClass().getResourceAsStream("sling-folder-nodetype.xml"));       

        final RepositoryAccessor repo = new RepositoryAccessor(config);
        Poller poller = new Poller();

        // wait until the structure is published
        poller.pollUntil(new Callable<Node>() {
            @Override
            public Node call() throws RepositoryException {
                return repo.getNode("/content/test-root/mapping/jcr:content/par/folder");

            }
        }, hasPrimaryType("sling:Folder"));

        // change the folder's node type to nt:unstructured and make sure it's covered by the parent
        project.createOrUpdateFile(Path.fromPortableString("jcr_root/content/test-root/mapping/.content.xml"),
                getClass().getResourceAsStream("sling-mapping-with-unstructured-child.xml"));
        // delete the sling folder node type since the serialization is now completely covered by
        // the parent node
        project.deleteMember(Path.fromPortableString("jcr_root/content/test-root/mapping/_jcr_content"));

        // first wait until the sling:Folder child node is created, to ensure that all changes are processed
        poller.pollUntil(new Callable<Node>() {
            @Override
            public Node call() throws RepositoryException {
                return repo.getNode("/content/test-root/mapping/jcr:content/par/folder");

            }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.