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

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


        ServerAdapter server = new ServerAdapter(wstServer.getServer());
        server.setAttribute(ISlingLaunchpadServer.PROP_INSTALL_LOCALLY, installBundleLocally);
        server.installModule(bundleProject);

        final RepositoryAccessor repo = new RepositoryAccessor(config);
        Poller poller = new Poller();
        poller.pollUntil(new Callable<Void>() {
            @Override
            public Void call() throws HttpException, IOException {
                repo.assertGetIsSuccessful("simple-servlet", "Version 1");
                return null;
            }
        }, nullValue(Void.class));

        // update DS component class
        InputStream simpleServlet2 = getClass().getResourceAsStream("SimpleServlet.java.v2.txt");
        project.createOrUpdateFile(Path.fromPortableString("src/example/SimpleServlet.java"), simpleServlet2);

        poller.pollUntil(new Callable<Void>() {
            @Override
            public Void call() throws HttpException, IOException {
                repo.assertGetIsSuccessful("simple-servlet", "Version 2");
                return null;
            }
        }, nullValue(Void.class));
    }
View Full Code Here


        project.createOrUpdateFile(Path.fromPortableString("jcr_root/test/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<Void>() {
            @Override
            public Void call() throws HttpException, IOException {
                repo.assertGetIsSuccessful("test/hello.txt", "hello, world");
                return null;
            }
        }, nullValue(Void.class));

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

        // verify that file is updated
        poller.pollUntil(new Callable<Void>() {
            @Override
            public Void call() throws HttpException, IOException {
                repo.assertGetIsSuccessful("test/hello.txt", "goodbye, world");
                return null;
            }
        }, nullValue(Void.class));


        project.deleteMember(Path.fromPortableString("jcr_root/test/hello.txt"));

        // verify that file is deleted
        poller.pollUntil(new Callable<Void>() {
            @Override
            public Void call() throws HttpException, IOException {
                repo.assertGetReturns404("test/hello.txt");
                return null;
            }
        }, nullValue(Void.class));

    }
View Full Code Here

        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");
View Full Code Here

        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

        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

        // create file
        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

        // create sling:OsgiConfig at /test/folder/config.xml
        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
View Full Code Here

    }

    @After
    public void cleanUp() throws Exception {

        new RepositoryAccessor(config).tryDeleteResource("/test");
    }
View Full Code Here

        server.installModule(contentProject);

        deh.clearUnexpectedEventsAfterSettling();

        // create server-side content
        RepositoryAccessor repo = new RepositoryAccessor(config);
        repo.createNode("/content/test-root/en", "nt:folder");
        repo.createNode("/content/test-root/en/files", "nt:folder");
        repo.createFile("/content/test-root/en/files/first.txt", "first file".getBytes());

        runImport(contentProject);

        assertThat(contentProject, hasFolder("jcr_root/content/test-root/en/files"));
        assertThat(contentProject, hasFile("jcr_root/content/test-root/en/files/first.txt", "first file".getBytes()));
View Full Code Here

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

        // create server-side content
        RepositoryAccessor repo = new RepositoryAccessor(config);
        repo.createNode("/content/test-root/de", "nt:folder");
        repo.createNode("/content/test-root/de/files", "nt:folder");
        repo.createFile("/content/test-root/de/files/first.txt", "first file".getBytes());

        deh.clearUnexpectedEventsAfterSettling();

        runImport(contentProject);
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.