use of org.apache.jena.tdb.base.file.Location in project jena by apache.
the class TestTDBFactory method testTDBFresh23.
@Test
public void testTDBFresh23() {
Location loc = Location.mem("FOO");
boolean b = TDBFactory.inUseLocation(loc);
TDBFactory.createDataset(loc);
b = TDBFactory.inUseLocation(loc);
assertTrue("Expected true for a named memory location", b);
}
use of org.apache.jena.tdb.base.file.Location in project jena by apache.
the class TestTDBFactory method testTDBFresh22.
@Test
public void testTDBFresh22() {
Location loc = Location.mem();
boolean b = TDBFactory.inUseLocation(loc);
TDBFactory.createDataset(loc);
b = TDBFactory.inUseLocation(loc);
assertFalse("Expected false for a unique memory location", b);
}
use of org.apache.jena.tdb.base.file.Location in project jena by apache.
the class JournalControl method findJournal.
private static Journal findJournal(DatasetGraphTDB dsg) {
Location loc = dsg.getLocation();
String journalFilename = loc.absolute(Names.journalFile);
File f = new File(journalFilename);
if (f.exists() && f.isFile() && f.length() > 0)
return Journal.create(loc);
else
return null;
}
use of org.apache.jena.tdb.base.file.Location in project jena by apache.
the class DebugTDB method dumpNodeIndex.
// public static RangeIndex makeRangeIndex(Location location, String indexName,
// int dftKeyLength, int dftValueLength,
// int readCacheSize,int writeCacheSize)
public static void dumpNodeIndex(String dir) {
Location location = Location.create(dir);
Index nodeToId = SetupTDB.makeIndex(location, Names.indexNode2Id, SystemTDB.BlockSize, SystemTDB.LenNodeHash, SystemTDB.SizeOfNodeId, -1, -1);
for (Record aNodeToId : nodeToId) {
System.out.println(aNodeToId);
}
}
use of org.apache.jena.tdb.base.file.Location in project jena by apache.
the class TestLocationLock method location_lock_dir_02.
@Test
public void location_lock_dir_02() throws IOException {
Assume.assumeTrue(negativePidsTreatedAsAlive);
Location dir = Location.create(tempDir.getRoot().getAbsolutePath());
LocationLock lock = dir.getLock();
Assert.assertTrue(lock.canLock());
Assert.assertFalse(lock.isLocked());
Assert.assertFalse(lock.isOwned());
Assert.assertTrue(lock.canObtain());
// Write a fake PID to the lock file
try (BufferedWriter writer = new BufferedWriter(new FileWriter(dir.getPath("tdb.lock")))) {
// Fake PID that would never be valid
writer.write(Integer.toString(-1234));
}
Assert.assertTrue(lock.isLocked());
Assert.assertFalse(lock.isOwned());
Assert.assertFalse(lock.canObtain());
}
Aggregations