Search in sources :

Example 96 with DatasetGraph

use of org.apache.jena.sparql.core.DatasetGraph in project jena by apache.

the class TestTDBInternal method exclusive_3.

@Test
public void exclusive_3() {
    DatasetGraph dsg = TDBFactory.createDatasetGraph();
    TransactionManager txnmgr = TDBInternal.getTransactionManager(dsg);
    ReentrantReadWriteLock rwx = (ReentrantReadWriteLock) txnmgr.getExclusivityLock$();
    checkLock(rwx, 0, 0);
    txnmgr.startExclusiveMode();
    checkLock(rwx, 0, 1);
    txnmgr.finishExclusiveMode();
    checkLock(rwx, 0, 0);
}
Also used : ReentrantReadWriteLock(java.util.concurrent.locks.ReentrantReadWriteLock) DatasetGraph(org.apache.jena.sparql.core.DatasetGraph) Test(org.junit.Test)

Example 97 with DatasetGraph

use of org.apache.jena.sparql.core.DatasetGraph in project jena by apache.

the class TestTDBInternal method basics_1.

@Test
public void basics_1() {
    DatasetGraph dsg = TDBFactory.createDatasetGraph();
    StoreConnection sConn = TDBInternal.getStoreConnection(dsg);
    Assert.assertNotNull(sConn);
}
Also used : StoreConnection(org.apache.jena.tdb.StoreConnection) DatasetGraph(org.apache.jena.sparql.core.DatasetGraph) Test(org.junit.Test)

Example 98 with DatasetGraph

use of org.apache.jena.sparql.core.DatasetGraph in project jena by apache.

the class TestTransControl method journalThresholdSize_02.

// Flush on journal size / small setting.
@Test
public void journalThresholdSize_02() {
    TransactionManager.QueueBatchSize = 100;
    TransactionManager.MaxQueueThreshold = -1;
    // Less than commit size. 
    TransactionManager.JournalThresholdSize = 10;
    DatasetGraph dsg = create();
    TransactionManager tMgr = TDBInternal.getTransactionManager(dsg);
    txnAddData(dsg);
    assertEquals(0, tMgr.getQueueLength());
}
Also used : DatasetGraph(org.apache.jena.sparql.core.DatasetGraph)

Example 99 with DatasetGraph

use of org.apache.jena.sparql.core.DatasetGraph in project jena by apache.

the class TestTransControl method maxQueueThreshold_01.

// ---- MaxQueueThreshold
@Test
public void maxQueueThreshold_01() {
    TransactionManager.MaxQueueThreshold = 1;
    DatasetGraph dsg = create();
    TransactionManager tMgr = TDBInternal.getTransactionManager(dsg);
    Txn.executeWrite(dsg, () -> {
    });
    assertEquals(1, tMgr.getQueueLength());
    Txn.executeWrite(dsg, () -> {
    });
    assertEquals(0, tMgr.getQueueLength());
}
Also used : DatasetGraph(org.apache.jena.sparql.core.DatasetGraph)

Example 100 with DatasetGraph

use of org.apache.jena.sparql.core.DatasetGraph in project jena by apache.

the class TestTransControl method queueBatchSize_01.

// ---- QueueBatchSize
@Test
public void queueBatchSize_01() {
    // Immediate.
    TransactionManager.QueueBatchSize = 0;
    DatasetGraph dsg = create();
    TransactionManager tMgr = TDBInternal.getTransactionManager(dsg);
    Txn.executeWrite(dsg, () -> {
    });
    assertEquals(0, tMgr.getQueueLength());
    Txn.executeWrite(dsg, () -> {
    });
    assertEquals(0, tMgr.getQueueLength());
}
Also used : DatasetGraph(org.apache.jena.sparql.core.DatasetGraph)

Aggregations

DatasetGraph (org.apache.jena.sparql.core.DatasetGraph)222 Test (org.junit.Test)132 BaseTest (org.apache.jena.atlas.junit.BaseTest)59 Quad (org.apache.jena.sparql.core.Quad)47 Node (org.apache.jena.graph.Node)29 Graph (org.apache.jena.graph.Graph)18 StoreConnection (org.apache.jena.tdb.StoreConnection)17 DatasetGraphTxn (org.apache.jena.tdb.transaction.DatasetGraphTxn)15 Model (org.apache.jena.rdf.model.Model)10 IOException (java.io.IOException)7 Triple (org.apache.jena.graph.Triple)7 Dataset (org.apache.jena.query.Dataset)7 StreamRDF (org.apache.jena.riot.system.StreamRDF)7 ReentrantReadWriteLock (java.util.concurrent.locks.ReentrantReadWriteLock)5 ResultSet (org.apache.jena.query.ResultSet)5 JsonLDWriteContext (org.apache.jena.riot.JsonLDWriteContext)5 Element (org.apache.jena.sparql.syntax.Element)5 ByteArrayOutputStream (java.io.ByteArrayOutputStream)4 RiotException (org.apache.jena.riot.RiotException)4 QueryIterator (org.apache.jena.sparql.engine.QueryIterator)4