Package org.apache.jackrabbit.api

Examples of org.apache.jackrabbit.api.XASession


  public void testTransactionCommit() throws Exception {
    MockControl sfControl = MockControl.createControl(SessionFactory.class);
    final SessionFactory sf = (SessionFactory) sfControl.getMock();
    MockControl sessionControl = MockControl.createControl(XASession.class);
    final XASession session = (XASession) sessionControl.getMock();
    // create nice mock
    MockControl xaResControl = MockControl.createControl(XAResource.class);
    XAResource xaRes = (XAResource) xaResControl.getMock();

    sfControl.expectAndReturn(sf.getSession(), session);
    sessionControl.expectAndReturn(session.getXAResource(), xaRes);

    session.save();
    session.logout();

    /*
     * MockControl repositoryControl =
     * MockControl.createNiceControl(Repository.class); Repository
     * repository = (Repository) repositoryControl.getMock();
View Full Code Here


  public void testTransactionRollback() throws Exception {
    MockControl sfControl = MockControl.createControl(SessionFactory.class);
    final SessionFactory sf = (SessionFactory) sfControl.getMock();
    MockControl sessionControl = MockControl.createControl(XASession.class);
    final XASession session = (XASession) sessionControl.getMock();
    // create nice mock
    MockControl xaResControl = MockControl.createControl(XAResource.class);
    XAResource xaRes = (XAResource) xaResControl.getMock();

    sfControl.expectAndReturn(sf.getSession(), session);

    sessionControl.expectAndReturn(session.getXAResource(), xaRes);
    session.save();
    session.logout();
    /*
     * // used for ServiceProvider MockControl repositoryControl =
     * MockControl.createNiceControl(Repository.class); Repository
     * repository = (Repository) repositoryControl.getMock();
     * repositoryControl.replay();
 
View Full Code Here

  public void testTransactionRollbackOnly() throws Exception {
    MockControl sfControl = MockControl.createControl(SessionFactory.class);
    final SessionFactory sf = (SessionFactory) sfControl.getMock();
    MockControl sessionControl = MockControl.createControl(XASession.class);
    final XASession session = (XASession) sessionControl.getMock();
    // create nice mock
    MockControl xaResControl = MockControl.createControl(XAResource.class);
    XAResource xaRes = (XAResource) xaResControl.getMock();

    sfControl.expectAndReturn(sf.getSession(), session);

    sessionControl.expectAndReturn(session.getXAResource(), xaRes);
    session.save();
    session.logout();

    Xid xidMock = new XidMock();

    xaRes.start(xidMock, XAResource.TMNOFLAGS);
    xaResControl.setMatcher(MockControl.ALWAYS_MATCHER);
View Full Code Here

  public void testTransactionCommitWithPrebound() throws Exception {
    MockControl sfControl = MockControl.createControl(SessionFactory.class);
    final SessionFactory sf = (SessionFactory) sfControl.getMock();
    MockControl sessionControl = MockControl.createControl(XASession.class);
    final XASession session = (XASession) sessionControl.getMock();

    MockControl xaResControl = MockControl.createControl(XAResource.class);
    XAResource xaRes = (XAResource) xaResControl.getMock();

    sessionControl.expectAndReturn(session.getXAResource(), xaRes);
    session.save();

    sfControl.replay();
    sessionControl.replay();
    xaResControl.replay();
    final SessionHolderProviderManager providerManager = new ListSessionHolderProviderManager();
View Full Code Here

  public void testTransactionRollbackOnlyWithPrebound() throws Exception {
    MockControl sfControl = MockControl.createControl(SessionFactory.class);
    final SessionFactory sf = (SessionFactory) sfControl.getMock();
    MockControl sessionControl = MockControl.createControl(XASession.class);
    final XASession session = (XASession) sessionControl.getMock();

    MockControl xaResControl = MockControl.createControl(XAResource.class);
    XAResource xaRes = (XAResource) xaResControl.getMock();

    sessionControl.expectAndReturn(session.getXAResource(), xaRes);
    session.save();

    sfControl.replay();
    sessionControl.replay();
    xaResControl.replay();
View Full Code Here

    protected void doBegin(Object transaction, TransactionDefinition transactionDefinition) throws TransactionException {
        if (transactionDefinition.getIsolationLevel() != TransactionDefinition.ISOLATION_DEFAULT) {
            throw new InvalidIsolationLevelException("JCR does not support an isolation level concept");
        }

        XASession session = null;

        try {
            JcrTransactionObject txObject = (JcrTransactionObject) transaction;
            if (txObject.getSessionHolder() == null) {
                // get the new session
View Full Code Here

      MockControl sfCtrl = MockControl.createControl(SessionFactory.class);
      SessionFactory sf = (SessionFactory) sfCtrl.getMock();
        MockControl sessionControl = MockControl.createControl(Session.class);

        MockControl xaSessionControl = MockControl.createControl(XASession.class);
        XASession xaSession = (XASession)xaSessionControl.getMock();

        MockControl xaResCtrl = MockControl.createControl(XAResource.class);
        XAResource xaRes = (XAResource)xaResCtrl.getMock();
       
        xaSessionControl.expectAndReturn(xaSession.getXAResource(), xaRes);
        xaSessionControl.replay();
       
       
       
        sfCtrl.replay();
View Full Code Here

     * Create a new session.
     */
    @SuppressWarnings("deprecation")
    private XASession openSession() throws ResourceException {
        try {
            XASession session = (XASession) mcf.getRepository().login(
                    cri.getCredentials(), cri.getWorkspace());
            log("Created session (" + session + ")");
            return session;
        } catch (RepositoryException e) {
            log("Failed to create session", e);
View Full Code Here

     * Create a new session.
     */
    @SuppressWarnings("deprecation")
    private XASession openSession() throws ResourceException {
        try {
            XASession session = (XASession) mcf.getRepository().login(
                    cri.getCredentials(), cri.getWorkspace());
            log("Created session (" + session + ")");
            return session;
        } catch (RepositoryException e) {
            log("Failed to create session", e);
View Full Code Here

        createRepository();
        Credentials creds = cri.getCredentials();
        String workspace = cri.getWorkspace();

        try {
            XASession session = (XASession) getRepository().login(creds, workspace);
            log("Created session (" + session + ")");
            return session;
        } catch (RepositoryException e) {
            log("Failed to create session", e);
            ResourceException exception = new ResourceException(
View Full Code Here

TOP

Related Classes of org.apache.jackrabbit.api.XASession

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.