Search in sources :

Example 6 with StoreConnection

use of org.apache.jena.tdb.StoreConnection in project jena by apache.

the class AbstractStoreConnections method store_3.

@Test(expected = TDBTransactionException.class)
public void store_3() {
    // Expel.
    StoreConnection sConn = getStoreConnection();
    DatasetGraphTxn dsgR1 = sConn.begin(ReadWrite.WRITE);
    StoreConnection.release(sConn.getLocation());
}
Also used : StoreConnection(org.apache.jena.tdb.StoreConnection) DatasetGraphTxn(org.apache.jena.tdb.transaction.DatasetGraphTxn) Test(org.junit.Test) ConfigTest(org.apache.jena.tdb.ConfigTest) BaseTest(org.apache.jena.atlas.junit.BaseTest)

Example 7 with StoreConnection

use of org.apache.jena.tdb.StoreConnection in project jena by apache.

the class AbstractStoreConnections method store_5.

@Test
public void store_5() {
    // No transaction. Make sure StoreConnection.release cleans up OK.
    StoreConnection sConn = getStoreConnection();
    Location loc = sConn.getLocation();
    DatasetGraph dsg = sConn.getBaseDataset();
    dsg.add(q);
    assertTrue(dsg.contains(q));
    StoreConnection.release(loc);
    sConn = StoreConnection.make(loc);
    dsg = sConn.getBaseDataset();
    assertTrue(dsg.contains(q));
}
Also used : StoreConnection(org.apache.jena.tdb.StoreConnection) Location(org.apache.jena.tdb.base.file.Location) DatasetGraph(org.apache.jena.sparql.core.DatasetGraph) Test(org.junit.Test) ConfigTest(org.apache.jena.tdb.ConfigTest) BaseTest(org.apache.jena.atlas.junit.BaseTest)

Example 8 with StoreConnection

use of org.apache.jena.tdb.StoreConnection in project jena by apache.

the class AbstractStoreConnections method store_1.

@Test
public void store_1() {
    // Expel.
    StoreConnection sConn = getStoreConnection();
    DatasetGraphTxn dsgR1 = sConn.begin(ReadWrite.READ);
    DatasetGraphTxn dsgW1 = sConn.begin(ReadWrite.WRITE);
    dsgW1.add(q1);
    dsgW1.commit();
    dsgW1.end();
    dsgR1.end();
    assertTrue(sConn.isValid());
    StoreConnection.release(sConn.getLocation());
    assertFalse(sConn.isValid());
    sConn = null;
    StoreConnection sConn2 = getStoreConnection();
    assertTrue(sConn2.isValid());
}
Also used : StoreConnection(org.apache.jena.tdb.StoreConnection) DatasetGraphTxn(org.apache.jena.tdb.transaction.DatasetGraphTxn) Test(org.junit.Test) ConfigTest(org.apache.jena.tdb.ConfigTest) BaseTest(org.apache.jena.atlas.junit.BaseTest)

Example 9 with StoreConnection

use of org.apache.jena.tdb.StoreConnection in project jena by apache.

the class TestTransRestart method setupTxn.

private void setupTxn() {
    StoreConnection.release(location);
    FileOps.clearDirectory(path);
    StoreConnection sc = StoreConnection.make(location);
    DatasetGraphTxn dsg = sc.begin(ReadWrite.WRITE);
    dsg.add(quad1);
    dsg.commit();
    dsg.end();
    sc.flush();
    StoreConnection.release(location);
}
Also used : StoreConnection(org.apache.jena.tdb.StoreConnection) DatasetGraphTxn(org.apache.jena.tdb.transaction.DatasetGraphTxn)

Example 10 with StoreConnection

use of org.apache.jena.tdb.StoreConnection in project jena by apache.

the class AbstractTestTransSeq method trans_01.

// Basics.
@Test
public void trans_01() {
    StoreConnection sConn = getStoreConnection();
    DatasetGraphTxn dsg = sConn.begin(ReadWrite.READ);
    dsg.end();
}
Also used : StoreConnection(org.apache.jena.tdb.StoreConnection) DatasetGraphTxn(org.apache.jena.tdb.transaction.DatasetGraphTxn) Test(org.junit.Test) BaseTest(org.apache.jena.atlas.junit.BaseTest)

Aggregations

StoreConnection (org.apache.jena.tdb.StoreConnection)39 DatasetGraphTxn (org.apache.jena.tdb.transaction.DatasetGraphTxn)32 Test (org.junit.Test)29 BaseTest (org.apache.jena.atlas.junit.BaseTest)28 DatasetGraph (org.apache.jena.sparql.core.DatasetGraph)17 ConfigTest (org.apache.jena.tdb.ConfigTest)9 Location (org.apache.jena.tdb.base.file.Location)4 DatasetGraphTDB (org.apache.jena.tdb.store.DatasetGraphTDB)3 Quad (org.apache.jena.sparql.core.Quad)2 File (java.io.File)1 FileFilter (java.io.FileFilter)1 CountDownLatch (java.util.concurrent.CountDownLatch)1 ExecutorService (java.util.concurrent.ExecutorService)1 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)1 Dataset (org.apache.jena.query.Dataset)1 Model (org.apache.jena.rdf.model.Model)1 NodeTable (org.apache.jena.tdb.store.nodetable.NodeTable)1 BeforeClass (org.junit.BeforeClass)1 ModLocation (tdb.cmdline.ModLocation)1