Examples of TransientRepository


Examples of org.apache.jackrabbit.core.TransientRepository

    }

    public void testMissingRootVersion() throws Exception {

        // new repository
        TransientRepository rep = new TransientRepository(new File(TEST_DIR));
        Session s = openSession(rep, false);

        String oldVersionRecoveryProp = System
                .getProperty("org.apache.jackrabbit.version.recovery");
View Full Code Here

Examples of org.apache.jackrabbit.core.TransientRepository

    // similar to above, but disconnects version history before damaging the repository
    public void testMissingRootVersion2() throws Exception {

        // new repository
        TransientRepository rep = new TransientRepository(new File(TEST_DIR));
        Session s = openSession(rep, false);

        String oldVersionRecoveryProp = System
                .getProperty("org.apache.jackrabbit.version.recovery");
View Full Code Here

Examples of org.apache.jackrabbit.core.TransientRepository

    // tests recovery from a broken hierarchy in the version store
    public void testBrokenVhrParent() throws Exception {

        // new repository
        TransientRepository rep = new TransientRepository(new File(TEST_DIR));
        Session s = openSession(rep, false);

        try {
            Node root = s.getRootNode();
View Full Code Here

Examples of org.apache.jackrabbit.core.TransientRepository

    }

    public void testAutoFix() throws Exception {

        // new repository
        TransientRepository rep = new TransientRepository(new File(TEST_DIR));
        Session s = openSession(rep, false);
        Node root = s.getRootNode();

        // add nodes /test and /test/missing
        Node test = root.addNode("test");
        Node missing = test.addNode("missing");
        missing.addMixin("mix:referenceable");
        UUID id = UUID.fromString(missing.getIdentifier());
        s.save();
        s.logout();

        destroyBundle(id, "workspaces/default");

        // login and try the operation
        s = openSession(rep, false);
        test = s.getRootNode().getNode("test");

        // try to add a node with the same name
        try {
            test.addNode("missing");
            s.save();
        } catch (RepositoryException e) {
            // expected
        }

        s.logout();

        s = openSession(rep, true);
        test = s.getRootNode().getNode("test");
        // iterate over all child nodes fixes the corruption
        NodeIterator it = test.getNodes();
        while (it.hasNext()) {
            it.nextNode();
        }

        // try to add a node with the same name
        test.addNode("missing");
        s.save();

        // try to delete the parent node
        test.remove();
        s.save();

        s.logout();
        rep.shutdown();

        FileUtils.deleteDirectory(new File("repository"));
    }
View Full Code Here

Examples of org.apache.jackrabbit.core.TransientRepository

        File config = new File(CONFIG_FILE);
        if (!config.exists()) {
            throw new Exception("missing config file: " + config.getPath());
        }
        repository = new TransientRepository(CONFIG_FILE,
                "target/repository_with_auth");

        // set up a user to authenticate
        SessionImpl session = (SessionImpl) repository
                .login(new SimpleCredentials("admin", "admin".toCharArray()));
View Full Code Here

Examples of org.apache.jackrabbit.core.TransientRepository

        this.run = run;
        new File("target/jcr.log").delete();
        FileUtils.deleteQuietly(new File("repository"));

        start();
        repository = new TransientRepository();
        Session session = repository.login(new SimpleCredentials("", "".toCharArray()));
        if (session.getRootNode().hasNode("test")) {
            session.getRootNode().getNode("test").remove();
            session.save();
        }
View Full Code Here

Examples of org.apache.jackrabbit.core.TransientRepository

    private AtomicLong counter = new AtomicLong();

    protected void setUp() throws Exception {
        directory = new File("target", "jackrabbit-sync-test-repo");

        repository = new TransientRepository(directory);

        session = repository.login(
                new SimpleCredentials("admin", "admin".toCharArray()));

        // Add a tree of 100k medium-sized (~10kB) nodes
View Full Code Here

Examples of org.apache.jackrabbit.core.TransientRepository

     *            command line arguments (ignored)
     * @throws Exception
     *             if an error occurs
     */
    public static void main(String[] args) throws Exception {
        Repository repository = new TransientRepository();
        Session session = repository.login();
        try {
            String user = session.getUserID();
            String name = repository.getDescriptor(Repository.REP_NAME_DESC);
            System.out.println("Logged in as " + user + " to a " + name
                    + " repository.");
        } finally {
            session.logout();
        }
View Full Code Here

Examples of org.apache.jackrabbit.core.TransientRepository

     *            command line arguments (ignored)
     * @throws Exception
     *             if an error occurs
     */
    public static void main(String[] args) throws Exception {
        Repository repository = new TransientRepository();
        Session session = repository.login(new SimpleCredentials("username",
                "password".toCharArray()));

        FileInputStream xml = new FileInputStream("src/main/resources/test.xml");
        try {
            Node root = session.getRootNode();
View Full Code Here

Examples of org.apache.jackrabbit.core.TransientRepository

     *            command line arguments (ignored)
     * @throws Exception
     *             if an error occurs
     */
    public static void main(String[] args) throws Exception {
        Repository repository = new TransientRepository();
        Session session = repository.login(new SimpleCredentials("username",
                "password".toCharArray()));
        try {
            Node root = session.getRootNode();

            // Store content
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.