Package org.modeshape.jcr.api

Examples of org.modeshape.jcr.api.JcrTools.uploadFile()


            Node filesNode = root.addNode("files", "nt:folder");
            assert filesNode != null;

            // Update a couple of files ...
            tools.uploadFile(session, "/files/caution.png", getFile("caution.png"));
            tools.uploadFile(session, "/files/sample1.mp3", getFile("sample1.mp3"));
            tools.uploadFile(session, "/files/fixedWidthFile.txt", getFile("fixedWidthFile.txt"));
            tools.uploadFile(session, "/files/JcrRepository.class", getFile("JcrRepository.clazz"));

            // Save the session ...
            session.save();
View Full Code Here


            assert filesNode != null;

            // Update a couple of files ...
            tools.uploadFile(session, "/files/caution.png", getFile("caution.png"));
            tools.uploadFile(session, "/files/sample1.mp3", getFile("sample1.mp3"));
            tools.uploadFile(session, "/files/fixedWidthFile.txt", getFile("fixedWidthFile.txt"));
            tools.uploadFile(session, "/files/JcrRepository.class", getFile("JcrRepository.clazz"));

            // Save the session ...
            session.save();
View Full Code Here

            // Update a couple of files ...
            tools.uploadFile(session, "/files/caution.png", getFile("caution.png"));
            tools.uploadFile(session, "/files/sample1.mp3", getFile("sample1.mp3"));
            tools.uploadFile(session, "/files/fixedWidthFile.txt", getFile("fixedWidthFile.txt"));
            tools.uploadFile(session, "/files/JcrRepository.class", getFile("JcrRepository.clazz"));

            // Save the session ...
            session.save();

            // Now look for the output. Note that sequencing may take a bit, so we'll cheat by just trying
View Full Code Here

        File binaryFile = new File("src/test/resources/io/binary.pdf");
        assert (binaryFile.exists() && binaryFile.isFile());

        File outputFile = File.createTempFile("modeshape_import_export_" + System.currentTimeMillis(), "_test");
        outputFile.deleteOnExit();
        tools.uploadFile(session, "file", binaryFile);
        session.save();
        session.exportDocumentView("/file", new FileOutputStream(outputFile), false, false);
        assertTrue(outputFile.length() > 0);

        session.getRootNode().getNode("file").remove();
View Full Code Here

            Node root = session.getRootNode();
            Node filesNode = root.addNode("files", "nt:folder");
            assert filesNode != null;

            // Update a couple of files ...
            tools.uploadFile(session, "/files/caution.png", getFile("caution.png"));
            tools.uploadFile(session, "/files/sample1.mp3", getFile("sample1.mp3"));
            tools.uploadFile(session, "/files/fixedWidthFile.txt", getFile("fixedWidthFile.txt"));
            tools.uploadFile(session, "/files/JcrRepository.class", getFile("JcrRepository.clazz"));

            // Save the session ...
View Full Code Here

                // Add some content ...
                session.getRootNode().addNode("testNode");
                for (File testFile : testFiles) {
                    String name = testFile.getName();
                    Node fileNode = tools.uploadFile(session, "/testNode/" + name, testFile);
                    Binary binary = fileNode.getNode("jcr:content").getProperty("jcr:data").getBinary();
                    assertThat(binary.getSize(), is(testFileSizesInBytes.get(name)));
                }

                session.save();
View Full Code Here

        Node node1 = session.getRootNode().addNode("node1");
        session.save();

        // Upload a file
        JcrTools tools = new JcrTools();
        tools.uploadFile(session, "/node1/simple.json", getResourceFile("data/simple.json"));
        Node fileNode = node1.getNode("simple.json");
        Node contentNode = fileNode.getNode("jcr:content");
        assertThat(contentNode.getPrimaryNodeType().getName(), is("nt:resource"));
        assertThat(contentNode.hasProperty("jcr:mimeType"), is(false));
        assertThat(contentNode.hasProperty("jcr:data"), is(true));
View Full Code Here

        Node node1 = session.getRootNode().addNode("node1");
        session.save();

        // Upload a file
        JcrTools tools = new JcrTools();
        tools.uploadFile(session, "/node1/simple.json", getResourceFile("data/simple.json"));
        Node fileNode = node1.getNode("simple.json");
        Node contentNode = fileNode.getNode("jcr:content");
        contentNode.setPrimaryType(ntResourceSubtype.getName());
        assertThat(contentNode.getPrimaryNodeType().getName(), is(ntResourceSubtype.getName()));
        assertThat(contentNode.hasProperty("jcr:mimeType"), is(false));
View Full Code Here

        Node node1 = session.getRootNode().addNode("node1");
        session.save();

        // Upload a file
        JcrTools tools = new JcrTools();
        tools.uploadFile(session, "/node1/simple.json", getResourceFile("data/simple.json"));
        Node fileNode = node1.getNode("simple.json");
        Node contentNode = fileNode.getNode("jcr:content");
        contentNode.setProperty("jcr:mimeType", "bogus");
        assertThat(contentNode.getPrimaryNodeType().getName(), is("nt:resource"));
        assertThat(contentNode.getProperty("jcr:mimeType").getString(), is("bogus"));
View Full Code Here

        Node node1 = session.getRootNode().addNode("node1");
        session.save();

        // Upload a file
        JcrTools tools = new JcrTools();
        tools.uploadFile(session, "/node1/simple.json", getResourceFile("data/simple.json"));
        Node fileNode = node1.getNode("simple.json");
        Node contentNode = fileNode.getNode("jcr:content");
        assertThat(contentNode.getPrimaryNodeType().getName(), is("nt:resource"));
        contentNode.setPrimaryType("nt:unstructured");
        assertThat(contentNode.hasProperty("jcr:mimeType"), is(false));
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.