jackrabbit-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Juergen Melzer (JIRA)" <j...@apache.org>
Subject [jira] Created: (JCR-2078) InvalidItemState after some rollbacks with XA Resource
Date Sat, 18 Apr 2009 13:01:16 GMT
InvalidItemState after some rollbacks with XA Resource
------------------------------------------------------

                 Key: JCR-2078
                 URL: https://issues.apache.org/jira/browse/JCR-2078
             Project: Jackrabbit Content Repository
          Issue Type: Bug
    Affects Versions: 1.5.4, 1.4
            Reporter: Juergen Melzer
            Priority: Critical


I modified a versionable node and do a rollback, after 3 to 10 iterations the test will fail.


Here is a simple testcase to demonstrate the situation.


import junit.framework.TestCase;
import org.apache.jackrabbit.core.RepositoryImpl;
import org.apache.jackrabbit.core.config.RepositoryConfig;
import org.springframework.core.io.ClassPathResource;
import org.springmodules.jcr.jackrabbit.support.JackRabbitUserTransaction;
import org.xml.sax.InputSource;

import javax.jcr.*;
import java.io.File;

public class NoSuchItemStateExceptionTest extends TestCase {

    private static final File TARGET = new File("target");
    private static final String REPO_HOME = "repository-lock-test";

    public void testIt2() throws Exception {

        RepositoryConfig config =
                RepositoryConfig.create(new InputSource(new ClassPathResource("repository.xml").getInputStream()),
                                        REPO_HOME);

        final Repository repository = RepositoryImpl.create(config);
        SimpleCredentials credentials = new SimpleCredentials("1", "1".toCharArray());
        Session sess = repository.login(credentials);


        for (int i = 0; i < 100; i++) {
            JackRabbitUserTransaction tx = new JackRabbitUserTransaction(sess);
            tx.begin();
            System.out.println("i=" + i);

            Node root = sess.getRootNode();
            createNode(sess, root);
            tx.rollback();
        }
    }

    void createNode(Session sess, Node root) throws RepositoryException {

        Node nodeType = root.addNode("first");
        Node n = nodeType.addNode("second");
        n.addMixin("mix:versionable");

        Node n2 = nodeType.addNode("second2");
        n2.addMixin("mix:versionable");
        sess.save();
    }
}



-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message