TDBStorage extends Storage { @Override void initialize() { this.dataset = TDBFactory.createDataset(location); } TDBStorage(DriverConfiguration configuration);   }
@Test public void initializeLoadsExistingTDBDataset() throws Exception { this.storageDir = Files.createTempDirectory("tdb-test").toFile(); storageDir.deleteOnExit(); final Dataset dataset = TDBFactory.createDataset(storageDir.getAbsolutePath()); dataset.begin(ReadWrite.WRITE); generateTestData(dataset); dataset.commit(); TDB.sync(dataset); dataset.close(); this.storage = new TDBStorage(createConfiguration(storageDir.getAbsolutePath())); storage.initialize(); storage.begin(ReadWrite.READ); assertTrue(storage.getDataset().getDefaultModel().contains(RESOURCE, RDF.type, createResource(TYPE_ONE))); storage.commit(); }
@Test public void initializeCreatesNewTDBStorageWhenTargetDirectoryDoesNotExist() throws Exception { this.storageDir = Files.createTempDirectory("tdb-test").toFile(); storageDir.deleteOnExit(); storageDir.delete(); assertFalse(storageDir.exists()); this.storage = new TDBStorage(createConfiguration(storageDir.getAbsolutePath())); storage.initialize(); assertTrue(storageDir.exists()); }