Search in sources :

Example 1 with JCARepositoryHandle

use of org.apache.jackrabbit.jca.JCARepositoryHandle in project jackrabbit by apache.

the class ConnectionFactoryTest method testTransactionSupport.

/**
     * Test if the session supports transactions
     */
public void testTransactionSupport() throws Exception {
    // Create the connection factory
    Object cf = mcf.createConnectionFactory();
    assertTrue(cf instanceof JCARepositoryHandle);
    Repository repository = (Repository) cf;
    // Open a session
    Session session = repository.login(JCR_SUPERUSER);
    assertTrue(session instanceof XAResource);
    session.logout();
}
Also used : Repository(javax.jcr.Repository) XAResource(javax.transaction.xa.XAResource) JCARepositoryHandle(org.apache.jackrabbit.jca.JCARepositoryHandle) Session(javax.jcr.Session)

Example 2 with JCARepositoryHandle

use of org.apache.jackrabbit.jca.JCARepositoryHandle in project jackrabbit by apache.

the class ConnectionFactoryTest method testAllocation.

/**
     * Test the connection factory allocation.
     */
public void testAllocation() throws Exception {
    // Create the connection factory
    Object cf = mcf.createConnectionFactory();
    assertTrue(cf instanceof JCARepositoryHandle);
    Repository repository = (Repository) cf;
    // Open a new session
    Session session = repository.login(JCR_SUPERUSER);
    assertTrue(session != null);
    assertTrue(session instanceof JCASessionHandle);
    // Logout session
    session.logout();
}
Also used : Repository(javax.jcr.Repository) JCARepositoryHandle(org.apache.jackrabbit.jca.JCARepositoryHandle) JCASessionHandle(org.apache.jackrabbit.jca.JCASessionHandle) Session(javax.jcr.Session)

Aggregations

Repository (javax.jcr.Repository)2 Session (javax.jcr.Session)2 JCARepositoryHandle (org.apache.jackrabbit.jca.JCARepositoryHandle)2 XAResource (javax.transaction.xa.XAResource)1 JCASessionHandle (org.apache.jackrabbit.jca.JCASessionHandle)1