/** Make a StoreConnection based on any StoreParams at the location or the system defaults. */ public static StoreConnection make(Location location) { return make(location, null) ; }
public DatasetGraphTransaction(Location location) { this(StoreConnection.make(location)) ; }
@Override protected StoreConnection getStoreConnection() { return StoreConnection.make(DIR) ; } }
@Override protected StoreConnection getStoreConnection() { return StoreConnection.make(DIR) ; } }
/** Obtain a StoreConnection for a particular location */ public static StoreConnection make(String location) { return make(Location.create(location)); }
protected StoreConnection getStoreConnection() { return StoreConnection.make(DIR) ; }
@Override protected StoreConnection getStoreConnection() { return StoreConnection.make(Location.mem()) ; } }
@Override protected StoreConnection getStoreConnection() { return StoreConnection.make(Location.mem()) ; } }
public static void backup(Location location, OutputStream backupfile) { Dataset ds = TDBFactory.createDataset(location) ; StoreConnection sConn = StoreConnection.make(location) ; DatasetGraphTxn dsg = sConn.begin(TxnType.READ, "backup") ; RDFDataMgr.write(backupfile, dsg, Lang.NQUADS) ; dsg.end(); } }
@Test public void params_create_01() { StoreConnection.make(loc, null) ; // Check. Default setup, no params. assertTrue("DB directory", Files.exists(db)) ; assertFalse("Config file unexpectedly found", Files.exists(cfg)) ; }
@Test public void params_create_01() { StoreConnection.make(loc, null) ; // Check. Default setup, no params. assertTrue("DB directory", Files.exists(db)) ; assertFalse("Config file unexpectedly found", Files.exists(cfg)) ; }
@Test public void params_create_02() { StoreConnection.make(loc, pApp) ; // Check. Custom setup. assertTrue("DB directory", Files.exists(db)) ; assertTrue("Config file not found", Files.exists(cfg)) ; StoreParams pLoc = StoreParamsCodec.read(loc) ; assertTrue(StoreParams.sameValues(pLoc, pApp)) ; }
@Test public void params_create_02() { StoreConnection.make(loc, pApp) ; // Check. Custom setup. assertTrue("DB directory", Files.exists(db)) ; assertTrue("Config file not found", Files.exists(cfg)) ; StoreParams pLoc = StoreParamsCodec.read(loc) ; assertTrue(StoreParams.sameValues(pLoc, pApp)) ; }
@Test public void params_reconnect_01() { // Create. StoreConnection.make(loc, null) ; // Drop. StoreConnection.expel(loc, true) ; // Reconnect StoreConnection.make(loc, null) ; StoreParams pLoc = StoreParamsCodec.read(loc) ; assertNull(pLoc) ; StoreParams pDB = StoreConnection.getExisting(loc).getBaseDataset().getConfig().params ; assertNotNull(pDB) ; // Should be the default setup. assertTrue(StoreParams.sameValues(pDft, pDB)) ; }
private void setupTxn() { StoreConnection.release(location) ; FileOps.clearDirectory(path); StoreConnection sc = StoreConnection.make(location) ; DatasetGraphTxn dsg = sc.begin(TxnType.WRITE); dsg.add(quad1) ; dsg.commit() ; dsg.end() ; sc.flush(); StoreConnection.release(location) ; }
private void setupTxn() { StoreConnection.release(location) ; FileOps.clearDirectory(path); StoreConnection sc = StoreConnection.make(location) ; DatasetGraphTxn dsg = sc.begin(TxnType.WRITE); dsg.add(quad1) ; dsg.commit() ; dsg.end() ; sc.flush(); StoreConnection.release(location) ; }
@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)) ; }
@Test public void testTxn() { assertEquals (3, countRDFNodes()) ; StoreConnection sc = StoreConnection.make(location) ; DatasetGraphTxn dsg = sc.begin(TxnType.WRITE) ; assertTrue(dsg.contains(quad1)) ; dsg.add(quad2) ; dsg.commit() ; dsg.end() ; StoreConnection.release(location) ; assertEquals (4, countRDFNodes()) ; }
@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)) ; }
@Test public void testTxn() { assertEquals (3, countRDFNodes()) ; StoreConnection sc = StoreConnection.make(location) ; DatasetGraphTxn dsg = sc.begin(TxnType.WRITE) ; assertTrue(dsg.contains(quad1)) ; dsg.add(quad2) ; dsg.commit() ; dsg.end() ; StoreConnection.release(location) ; assertEquals (4, countRDFNodes()) ; }