use of org.eclipse.rdf4j.repository.Repository in project rdf4j by eclipse.
the class LocalRepositoryManagerTest method testRestartManagerWithoutTransaction.
@Test
public void testRestartManagerWithoutTransaction() throws Exception {
Repository rep = manager.getRepository(TEST_REPO);
assertNotNull("Expected repository to exist.", rep);
assertTrue("Expected repository to be initialized.", rep.isInitialized());
RepositoryConnection conn = rep.getConnection();
try {
conn.add(conn.getValueFactory().createIRI("urn:sesame:test:subject"), RDF.TYPE, OWL.ONTOLOGY);
assertEquals(1, conn.size());
} finally {
conn.close();
rep.shutDown();
manager.shutDown();
}
manager = new LocalRepositoryManager(datadir);
manager.initialize();
Repository rep2 = manager.getRepository(TEST_REPO);
assertNotNull("Expected repository to exist.", rep2);
assertTrue("Expected repository to be initialized.", rep2.isInitialized());
RepositoryConnection conn2 = rep2.getConnection();
try {
assertEquals(1, conn2.size());
} finally {
conn2.close();
rep2.shutDown();
manager.shutDown();
}
}
use of org.eclipse.rdf4j.repository.Repository in project rdf4j by eclipse.
the class LocalRepositoryManagerTest method testGetRepository.
/**
* Test method for
* {@link org.eclipse.rdf4j.repository.manager.LocalRepositoryManager#getRepository(java.lang.String)} .
*
* @throws RepositoryException
* if a problem occurs accessing the repository
* @throws RepositoryConfigException
* if a problem occurs accessing the repository
*/
@Test
public void testGetRepository() throws RepositoryConfigException, RepositoryException {
Repository rep = manager.getRepository(TEST_REPO);
assertNotNull("Expected repository to exist.", rep);
assertTrue("Expected repository to be initialized.", rep.isInitialized());
rep.shutDown();
rep = manager.getRepository(TEST_REPO);
assertNotNull("Expected repository to exist.", rep);
assertTrue("Expected repository to be initialized.", rep.isInitialized());
}
Aggregations