use of org.apache.jena.jdbc.postprocessing.ResultsEcho in project jena by apache.
the class AbstractJenaConnectionTests method connection_post_processors_04.
/**
* Tests post-processor management operations
*
* @throws SQLException
*/
@Test
public void connection_post_processors_04() throws SQLException {
JenaConnection conn = this.getConnection();
Assert.assertFalse(conn.getPostProcessors().hasNext());
// Add a post-processor
ResultsEcho echo = new ResultsEcho();
conn.addPostProcessor(echo);
Assert.assertTrue(conn.getPostProcessors().hasNext());
// Remove it
conn.removePostProcessor(0);
Assert.assertFalse(conn.getPostProcessors().hasNext());
conn.close();
}
use of org.apache.jena.jdbc.postprocessing.ResultsEcho in project jena by apache.
the class AbstractJenaConnectionTests method connection_post_processors_05.
/**
* Tests post-processor management operations
*
* @throws SQLException
*/
@Test
public void connection_post_processors_05() throws SQLException {
JenaConnection conn = this.getConnection();
Assert.assertFalse(conn.getPostProcessors().hasNext());
// Add a post-processor
ResultsEcho echo = new ResultsEcho();
conn.addPostProcessor(echo);
Assert.assertTrue(conn.getPostProcessors().hasNext());
// Remove all
conn.clearPostProcessors();
Assert.assertFalse(conn.getPostProcessors().hasNext());
conn.close();
}
use of org.apache.jena.jdbc.postprocessing.ResultsEcho in project jena by apache.
the class AbstractJenaConnectionTests method connection_post_processors_02.
/**
* Tests post-processor management operations
*
* @throws SQLException
*/
@Test(expected = IndexOutOfBoundsException.class)
public void connection_post_processors_02() throws SQLException {
JenaConnection conn = this.getConnection();
Assert.assertFalse(conn.getPostProcessors().hasNext());
ResultsEcho echo = new ResultsEcho();
// Inserting at zero index should be safe
conn.insertPostProcessor(0, echo);
Assert.assertTrue(conn.getPostProcessors().hasNext());
// Inserting at some random index will cause an error
try {
conn.insertPostProcessor(50, echo);
} finally {
conn.close();
}
}
use of org.apache.jena.jdbc.postprocessing.ResultsEcho in project jena by apache.
the class AbstractJenaDriverTests method driver_connect_08.
/**
* Tests using a driver to create a connection with its own URLs plus the
* standard pre-processor and post-processor parameter
*
* @throws SQLException
*/
@Test
public void driver_connect_08() throws SQLException {
String url = this.getConnectionUrl();
Assume.assumeNotNull(url);
url = url + "&" + JenaDriver.PARAM_PRE_PROCESSOR + "=" + Echo.class.getCanonicalName();
url = url + "&" + JenaDriver.PARAM_POST_PROCESSOR + "=" + ResultsEcho.class.getCanonicalName();
JenaDriver driver = this.getDriver();
JenaConnection conn = (JenaConnection) driver.connect(url, null);
Assert.assertFalse(conn.isClosed());
Iterator<CommandPreProcessor> iter = conn.getPreProcessors();
Assert.assertTrue(iter.hasNext());
Assert.assertTrue(iter.next() instanceof Echo);
Assert.assertFalse(iter.hasNext());
Iterator<ResultsPostProcessor> iter2 = conn.getPostProcessors();
Assert.assertTrue(iter2.hasNext());
Assert.assertTrue(iter2.next() instanceof ResultsEcho);
Assert.assertFalse(iter2.hasNext());
conn.close();
Assert.assertTrue(conn.isClosed());
}
use of org.apache.jena.jdbc.postprocessing.ResultsEcho in project jena by apache.
the class AbstractJenaConnectionTests method connection_post_processors_03.
/**
* Tests post-processor management operations
*
* @throws SQLException
*/
@Test
public void connection_post_processors_03() throws SQLException {
JenaConnection conn = this.getConnection();
Assert.assertFalse(conn.getPostProcessors().hasNext());
// Add a post-processor
ResultsEcho echo = new ResultsEcho();
conn.addPostProcessor(echo);
Assert.assertTrue(conn.getPostProcessors().hasNext());
// Remove it
conn.removePostProcessor(echo);
Assert.assertFalse(conn.getPostProcessors().hasNext());
conn.close();
}
Aggregations