Search in sources :

Example 11 with JenaTransactionException

use of org.apache.jena.sparql.JenaTransactionException in project jena by apache.

the class AbstractTestTransactionLifecycle method testAbortCommit.

private void testAbortCommit(TxnType txnType) {
    assumeTrue(supportsAbort());
    Dataset ds = create();
    ds.begin(txnType);
    ds.abort();
    try {
        ds.commit();
        fail("Expected transaction exception - abort-commit(" + txnType + ")");
    } catch (JenaTransactionException ex) {
        safeEnd(ds);
    }
}
Also used : Dataset(org.apache.jena.query.Dataset) JenaTransactionException(org.apache.jena.sparql.JenaTransactionException)

Example 12 with JenaTransactionException

use of org.apache.jena.sparql.JenaTransactionException in project jena by apache.

the class AbstractTestTransactionLifecycle method testBeginBegin.

// Error conditions that should be detected.
private void testBeginBegin(TxnType txnType1, TxnType txnType2) {
    Dataset ds = create();
    ds.begin(txnType1);
    try {
        ds.begin(txnType2);
        fail("Expected transaction exception - begin-begin (" + txnType1 + ", " + txnType2 + ")");
    } catch (JenaTransactionException ex) {
        safeEnd(ds);
    }
}
Also used : Dataset(org.apache.jena.query.Dataset) JenaTransactionException(org.apache.jena.sparql.JenaTransactionException)

Example 13 with JenaTransactionException

use of org.apache.jena.sparql.JenaTransactionException in project jena by apache.

the class AbstractTestTransactionLifecycle method testCommitAbort.

private void testCommitAbort(TxnType txnType) {
    assumeTrue(supportsAbort());
    Dataset ds = create();
    ds.begin(txnType);
    ds.commit();
    try {
        ds.abort();
        fail("Expected transaction exception - commit-abort(" + txnType + ")");
    } catch (JenaTransactionException ex) {
        safeEnd(ds);
    }
}
Also used : Dataset(org.apache.jena.query.Dataset) JenaTransactionException(org.apache.jena.sparql.JenaTransactionException)

Example 14 with JenaTransactionException

use of org.apache.jena.sparql.JenaTransactionException in project jena by apache.

the class AbstractTestTransactionLifecycle method testCommitCommit.

private void testCommitCommit(TxnType txnType) {
    Dataset ds = create();
    ds.begin(txnType);
    ds.commit();
    try {
        ds.commit();
        fail("Expected transaction exception - commit-commit(" + txnType + ")");
    } catch (JenaTransactionException ex) {
        safeEnd(ds);
    }
}
Also used : Dataset(org.apache.jena.query.Dataset) JenaTransactionException(org.apache.jena.sparql.JenaTransactionException)

Example 15 with JenaTransactionException

use of org.apache.jena.sparql.JenaTransactionException in project jena by apache.

the class AbstractTestTransactionLifecycle method testAbortAbort.

private void testAbortAbort(TxnType txnType) {
    assumeTrue(supportsAbort());
    Dataset ds = create();
    ds.begin(txnType);
    ds.abort();
    try {
        ds.abort();
        fail("Expected transaction exception - abort-abort(" + txnType + ")");
    } catch (JenaTransactionException ex) {
        ds.end();
    }
}
Also used : Dataset(org.apache.jena.query.Dataset) JenaTransactionException(org.apache.jena.sparql.JenaTransactionException)

Aggregations

JenaTransactionException (org.apache.jena.sparql.JenaTransactionException)23 Dataset (org.apache.jena.query.Dataset)10 DatasetGraph (org.apache.jena.sparql.core.DatasetGraph)3 TxnType (org.apache.jena.query.TxnType)2 PrefixMap (org.apache.jena.riot.system.PrefixMap)1 TDBException (org.apache.jena.tdb.TDBException)1 TDBTransactionException (org.apache.jena.tdb.transaction.TDBTransactionException)1 Test (org.junit.Test)1